Move type/access to builtin.
This CL moves the type::Access builtin to the builtin:: tree.
Change-Id: I3276d364f7b597671612a23c8823f0afd1914d81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120363
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
index c18f887..c6a2d4d 100644
--- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
@@ -562,7 +562,7 @@
wgpu::BufferBindingType::Storage ||
bgl->GetBindingInfo(bindingIndex).buffer.type == kInternalStorageBufferBinding));
if (forceStorageBufferAsUAV) {
- remappedAccessControls.emplace(srcBindingPoint, tint::type::Access::kReadWrite);
+ remappedAccessControls.emplace(srcBindingPoint, tint::builtin::Access::kReadWrite);
}
}
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index fbed83a..b7022b3 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -693,6 +693,8 @@
libtint_source_set("libtint_builtins_src") {
sources = [
+ "builtin/access.cc",
+ "builtin/access.h",
"builtin/builtin_value.cc",
"builtin/builtin_value.h",
"builtin/extension.cc",
@@ -709,8 +711,6 @@
"type/abstract_int.h",
"type/abstract_numeric.cc",
"type/abstract_numeric.h",
- "type/access.cc",
- "type/access.h",
"type/address_space.cc",
"type/address_space.h",
"type/array.cc",
@@ -776,7 +776,10 @@
"type/void.h",
]
- deps = [ ":libtint_base_src" ]
+ deps = [
+ ":libtint_base_src",
+ ":libtint_builtins_src",
+ ]
}
libtint_source_set("libtint_constant_src") {
@@ -931,6 +934,7 @@
deps = [
":libtint_ast_src",
":libtint_base_src",
+ ":libtint_builtins_src",
":libtint_program_src",
":libtint_reader_src",
":libtint_text_src",
@@ -949,6 +953,7 @@
deps = [
":libtint_ast_src",
":libtint_base_src",
+ ":libtint_builtins_src",
":libtint_program_src",
":libtint_sem_src",
":libtint_type_src",
@@ -1007,6 +1012,7 @@
deps = [
":libtint_ast_src",
":libtint_base_src",
+ ":libtint_builtins_src",
":libtint_constant_src",
":libtint_program_src",
":libtint_sem_src",
@@ -1275,6 +1281,7 @@
deps = [
":libtint_ast_src",
":libtint_base_src",
+ ":libtint_builtins_src",
":libtint_transform_src",
":libtint_unittests_ast_helper",
]
@@ -1287,6 +1294,7 @@
tint_unittests_source_set("tint_unittests_builtins_src") {
sources = [
+ "builtin/access_test.cc",
"builtin/builtin_value_test.cc",
"builtin/extension_test.cc",
]
@@ -1405,7 +1413,6 @@
tint_unittests_source_set("tint_unittests_type_src") {
sources = [
- "type/access_test.cc",
"type/address_space_test.cc",
"type/atomic_test.cc",
"type/bool_test.cc",
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index 4b87d7b..149505d 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -548,6 +548,7 @@
writer/writer.h
)
+tint_generated(builtin/access BENCH TEST)
tint_generated(builtin/builtin_value BENCH TEST)
tint_generated(builtin/extension BENCH TEST)
tint_generated(ast/diagnostic_control BENCH TEST)
@@ -555,7 +556,6 @@
tint_generated(resolver/init_conv_intrinsic)
tint_generated(sem/builtin_type)
tint_generated(sem/parameter_usage)
-tint_generated(type/access BENCH TEST)
tint_generated(type/address_space BENCH TEST)
tint_generated(type/builtin BENCH TEST)
tint_generated(type/texel_format BENCH TEST)
diff --git a/src/tint/ast/alias_test.cc b/src/tint/ast/alias_test.cc
index 6e5d647..d99fb21 100644
--- a/src/tint/ast/alias_test.cc
+++ b/src/tint/ast/alias_test.cc
@@ -14,7 +14,7 @@
#include "src/tint/ast/alias.h"
#include "src/tint/ast/test_helper.h"
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
namespace tint::ast {
namespace {
diff --git a/src/tint/ast/builtin_texture_helper_test.cc b/src/tint/ast/builtin_texture_helper_test.cc
index 4aefbc6..7b55d69 100644
--- a/src/tint/ast/builtin_texture_helper_test.cc
+++ b/src/tint/ast/builtin_texture_helper_test.cc
@@ -55,7 +55,7 @@
args(std::move(a)) {}
TextureOverloadCase::TextureOverloadCase(ValidTextureOverload o,
const char* d,
- type::Access acc,
+ tint::builtin::Access acc,
type::TexelFormat fmt,
type::TextureDimension dims,
TextureDataType datatype,
@@ -404,7 +404,7 @@
{
ValidTextureOverload::kDimensionsStorageWO1d,
"textureDimensions(t : texture_storage_1d<rgba32float>) -> u32",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k1d,
TextureDataType::kF32,
@@ -414,7 +414,7 @@
{
ValidTextureOverload::kDimensionsStorageWO2d,
"textureDimensions(t : texture_storage_2d<rgba32float>) -> vec2<u32>",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k2d,
TextureDataType::kF32,
@@ -424,7 +424,7 @@
{
ValidTextureOverload::kDimensionsStorageWO2dArray,
"textureDimensions(t : texture_storage_2d_array<rgba32float>) -> vec2<u32>",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k2dArray,
TextureDataType::kF32,
@@ -434,7 +434,7 @@
{
ValidTextureOverload::kDimensionsStorageWO3d,
"textureDimensions(t : texture_storage_3d<rgba32float>) -> vec3<u32>",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k3d,
TextureDataType::kF32,
@@ -827,7 +827,7 @@
{
ValidTextureOverload::kNumLayersStorageWO2dArray,
"textureNumLayers(t : texture_storage_2d_array<rgba32float>) -> u32",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k2dArray,
TextureDataType::kF32,
@@ -2327,7 +2327,7 @@
"textureStore(t : texture_storage_1d<rgba32float>,\n"
" coords : i32,\n"
" value : vec4<T>)",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k1d,
TextureDataType::kF32,
@@ -2343,7 +2343,7 @@
"textureStore(t : texture_storage_2d<rgba32float>,\n"
" coords : vec2<i32>,\n"
" value : vec4<T>)",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k2d,
TextureDataType::kF32,
@@ -2360,7 +2360,7 @@
" coords : vec2<u32>,\n"
" array_index : u32,\n"
" value : vec4<T>)",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k2dArray,
TextureDataType::kF32,
@@ -2377,7 +2377,7 @@
"textureStore(t : texture_storage_3d<rgba32float>,\n"
" coords : vec3<u32>,\n"
" value : vec4<T>)",
- type::Access::kWrite,
+ tint::builtin::Access::kWrite,
type::TexelFormat::kRgba32Float,
type::TextureDimension::k3d,
TextureDataType::kF32,
diff --git a/src/tint/ast/builtin_texture_helper_test.h b/src/tint/ast/builtin_texture_helper_test.h
index 6fe0193..46f1442 100644
--- a/src/tint/ast/builtin_texture_helper_test.h
+++ b/src/tint/ast/builtin_texture_helper_test.h
@@ -17,8 +17,8 @@
#include <vector>
+#include "src/tint/builtin/access.h"
#include "src/tint/program_builder.h"
-#include "src/tint/type/access.h"
#include "src/tint/type/storage_texture.h"
#include "src/tint/type/texture_dimension.h"
@@ -207,7 +207,7 @@
/// Constructor for textureLoad() with storage textures
TextureOverloadCase(ValidTextureOverload,
const char*,
- type::Access,
+ tint::builtin::Access,
type::TexelFormat,
type::TextureDimension,
TextureDataType,
@@ -245,7 +245,7 @@
type::SamplerKind const sampler_kind = type::SamplerKind::kSampler;
/// The access control for the storage texture
/// Used only when texture_kind is kStorage
- type::Access const access = type::Access::kReadWrite;
+ tint::builtin::Access const access = tint::builtin::Access::kReadWrite;
/// The image format for the storage texture
/// Used only when texture_kind is kStorage
type::TexelFormat const texel_format = type::TexelFormat::kUndefined;
diff --git a/src/tint/ast/variable.h b/src/tint/ast/variable.h
index 7663e4f..78e3b75 100644
--- a/src/tint/ast/variable.h
+++ b/src/tint/ast/variable.h
@@ -23,7 +23,7 @@
#include "src/tint/ast/expression.h"
#include "src/tint/ast/group_attribute.h"
#include "src/tint/ast/type.h"
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/type/address_space.h"
// Forward declarations
diff --git a/src/tint/type/access.cc b/src/tint/builtin/access.cc
similarity index 92%
rename from src/tint/type/access.cc
rename to src/tint/builtin/access.cc
index 04ccd9d..56b326c 100644
--- a/src/tint/type/access.cc
+++ b/src/tint/builtin/access.cc
@@ -15,14 +15,14 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
-// src/tint/type/access.cc.tmpl
+// src/tint/builtin/access.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
-namespace tint::type {
+namespace tint::builtin {
/// ParseAccess parses a Access from a string.
/// @param str the string to parse
@@ -54,4 +54,4 @@
return out << "<unknown>";
}
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/type/access.cc.tmpl b/src/tint/builtin/access.cc.tmpl
similarity index 86%
rename from src/tint/type/access.cc.tmpl
rename to src/tint/builtin/access.cc.tmpl
index b34ff61..d0f967f 100644
--- a/src/tint/type/access.cc.tmpl
+++ b/src/tint/builtin/access.cc.tmpl
@@ -14,12 +14,12 @@
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "access") -}}
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
-namespace tint::type {
+namespace tint::builtin {
{{ Eval "ParseEnum" $enum}}
{{ Eval "EnumOStream" $enum}}
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/type/access.h b/src/tint/builtin/access.h
similarity index 87%
rename from src/tint/type/access.h
rename to src/tint/builtin/access.h
index 26f24f6..f59f50e 100644
--- a/src/tint/type/access.h
+++ b/src/tint/builtin/access.h
@@ -15,17 +15,17 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
-// src/tint/type/access.h.tmpl
+// src/tint/builtin/access.h.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
-#ifndef SRC_TINT_TYPE_ACCESS_H_
-#define SRC_TINT_TYPE_ACCESS_H_
+#ifndef SRC_TINT_BUILTIN_ACCESS_H_
+#define SRC_TINT_BUILTIN_ACCESS_H_
#include <ostream>
-namespace tint::type {
+namespace tint::builtin {
/// Address space of a given pointer.
enum class Access {
@@ -51,6 +51,6 @@
"write",
};
-} // namespace tint::type
+} // namespace tint::builtin
-#endif // SRC_TINT_TYPE_ACCESS_H_
+#endif // SRC_TINT_BUILTIN_ACCESS_H_
diff --git a/src/tint/type/access.h.tmpl b/src/tint/builtin/access.h.tmpl
similarity index 79%
rename from src/tint/type/access.h.tmpl
rename to src/tint/builtin/access.h.tmpl
index 6d353e5..6e4587a 100644
--- a/src/tint/type/access.h.tmpl
+++ b/src/tint/builtin/access.h.tmpl
@@ -14,16 +14,16 @@
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "access") -}}
-#ifndef SRC_TINT_TYPE_ACCESS_H_
-#define SRC_TINT_TYPE_ACCESS_H_
+#ifndef SRC_TINT_BUILTIN_ACCESS_H_
+#define SRC_TINT_BUILTIN_ACCESS_H_
#include <ostream>
-namespace tint::type {
+namespace tint::builtin {
/// Address space of a given pointer.
{{ Eval "DeclareEnum" $enum}}
-} // namespace tint::type
+} // namespace tint::builtin
-#endif // SRC_TINT_TYPE_ACCESS_H_
+#endif // SRC_TINT_BUILTIN_ACCESS_H_
diff --git a/src/tint/type/access_bench.cc b/src/tint/builtin/access_bench.cc
similarity index 91%
rename from src/tint/type/access_bench.cc
rename to src/tint/builtin/access_bench.cc
index ab578eb..91f808f 100644
--- a/src/tint/type/access_bench.cc
+++ b/src/tint/builtin/access_bench.cc
@@ -15,18 +15,18 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
-// src/tint/type/access_bench.cc.tmpl
+// src/tint/builtin/access_bench.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include <array>
#include "benchmark/benchmark.h"
-namespace tint::type {
+namespace tint::builtin {
namespace {
void AccessParser(::benchmark::State& state) {
@@ -48,4 +48,4 @@
BENCHMARK(AccessParser);
} // namespace
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/type/access_bench.cc.tmpl b/src/tint/builtin/access_bench.cc.tmpl
similarity index 87%
rename from src/tint/type/access_bench.cc.tmpl
rename to src/tint/builtin/access_bench.cc.tmpl
index 420f486..c701ab9 100644
--- a/src/tint/type/access_bench.cc.tmpl
+++ b/src/tint/builtin/access_bench.cc.tmpl
@@ -14,16 +14,16 @@
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "access") -}}
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include <array>
#include "benchmark/benchmark.h"
-namespace tint::type {
+namespace tint::builtin {
namespace {
{{ Eval "BenchmarkParseEnum" $enum }}
} // namespace
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/type/access_test.cc b/src/tint/builtin/access_test.cc
similarity index 93%
rename from src/tint/type/access_test.cc
rename to src/tint/builtin/access_test.cc
index 77968ef..91786ef 100644
--- a/src/tint/type/access_test.cc
+++ b/src/tint/builtin/access_test.cc
@@ -15,19 +15,20 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
-// src/tint/type/access_test.cc.tmpl
+// src/tint/builtin/access_test.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
+
+#include <gtest/gtest.h>
#include <string>
-#include "src/tint/type/test_helper.h"
#include "src/tint/utils/string.h"
-namespace tint::type {
+namespace tint::builtin {
namespace {
namespace parse_print_tests {
@@ -79,4 +80,4 @@
} // namespace parse_print_tests
} // namespace
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/type/access_test.cc.tmpl b/src/tint/builtin/access_test.cc.tmpl
similarity index 84%
rename from src/tint/type/access_test.cc.tmpl
rename to src/tint/builtin/access_test.cc.tmpl
index dd6ed44..0674f4b 100644
--- a/src/tint/type/access_test.cc.tmpl
+++ b/src/tint/builtin/access_test.cc.tmpl
@@ -14,17 +14,18 @@
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "access") -}}
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
+
+#include <gtest/gtest.h>
#include <string>
-#include "src/tint/type/test_helper.h"
#include "src/tint/utils/string.h"
-namespace tint::type {
+namespace tint::builtin {
namespace {
{{ Eval "TestParsePrintEnum" $enum}}
} // namespace
-} // namespace tint::type
+} // namespace tint::builtin
diff --git a/src/tint/fuzzers/transform_builder.h b/src/tint/fuzzers/transform_builder.h
index 90d6af5..73b5b51 100644
--- a/src/tint/fuzzers/transform_builder.h
+++ b/src/tint/fuzzers/transform_builder.h
@@ -131,7 +131,7 @@
uint8_t old_binding;
uint8_t new_group;
uint8_t new_binding;
- type::Access new_access;
+ builtin::Access new_access;
};
std::vector<Config> configs = tb->builder()->vector<Config>();
diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc
index 40658db..396d0e5 100644
--- a/src/tint/inspector/inspector.cc
+++ b/src/tint/inspector/inspector.cc
@@ -719,7 +719,7 @@
auto* var = rsv.first;
auto binding_info = rsv.second;
- if (read_only != (var->Access() == type::Access::kRead)) {
+ if (read_only != (var->Access() == builtin::Access::kRead)) {
continue;
}
diff --git a/src/tint/inspector/inspector_test.cc b/src/tint/inspector/inspector_test.cc
index 743f878..22f1332 100644
--- a/src/tint/inspector/inspector_test.cc
+++ b/src/tint/inspector/inspector_test.cc
@@ -1655,8 +1655,8 @@
TEST_F(InspectorGetStorageSizeTest, Simple_NonStruct) {
AddUniformBuffer("ub_var", ty.i32(), 0, 0);
- AddStorageBuffer("sb_var", ty.i32(), type::Access::kReadWrite, 1, 0);
- AddStorageBuffer("rosb_var", ty.i32(), type::Access::kRead, 1, 1);
+ 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{
Decl(Let("ub", Expr("ub_var"))),
@@ -1687,7 +1687,7 @@
auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("sb_var", sb(), type::Access::kReadWrite, 1, 0);
+ AddStorageBuffer("sb_var", sb(), builtin::Access::kReadWrite, 1, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "sb_var",
utils::Vector{
MemberInfo{0, ty.i32()},
@@ -1696,7 +1696,7 @@
auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("rosb_var", ro_sb(), type::Access::kRead, 1, 1);
+ AddStorageBuffer("rosb_var", ro_sb(), builtin::Access::kRead, 1, 1);
MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var",
utils::Vector{
MemberInfo{0, ty.i32()},
@@ -1774,7 +1774,7 @@
auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("sb_var", sb(), type::Access::kReadWrite, 1, 0);
+ AddStorageBuffer("sb_var", sb(), builtin::Access::kReadWrite, 1, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "sb_var",
utils::Vector{
MemberInfo{0, ty.i32()},
@@ -1783,7 +1783,7 @@
auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("rosb_var", ro_sb(), type::Access::kRead, 1, 1);
+ AddStorageBuffer("rosb_var", ro_sb(), builtin::Access::kRead, 1, 1);
MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var",
utils::Vector{
MemberInfo{0, ty.i32()},
@@ -2140,7 +2140,7 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_NonStruct) {
- AddStorageBuffer("foo_sb", ty.i32(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", ty.i32(), builtin::Access::kReadWrite, 0, 0);
MakePlainGlobalReferenceBodyFunction("sb_func", "foo_sb", ty.i32(), utils::Empty);
MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
@@ -2165,7 +2165,7 @@
auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2196,7 +2196,7 @@
ty.u32(),
ty.f32(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2229,9 +2229,9 @@
ty.u32(),
ty.f32(),
});
- AddStorageBuffer("sb_foo", sb_struct_type(), type::Access::kReadWrite, 0, 0);
- AddStorageBuffer("sb_bar", sb_struct_type(), type::Access::kReadWrite, 0, 1);
- AddStorageBuffer("sb_baz", sb_struct_type(), type::Access::kReadWrite, 2, 0);
+ AddStorageBuffer("sb_foo", sb_struct_type(), builtin::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("sb_bar", sb_struct_type(), builtin::Access::kReadWrite, 0, 1);
+ AddStorageBuffer("sb_baz", sb_struct_type(), builtin::Access::kReadWrite, 2, 0);
auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) {
MakeStructVariableReferenceBodyFunction(func_name, var_name,
@@ -2288,7 +2288,7 @@
ty.i32(),
ty.array<u32, 4>(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2318,7 +2318,7 @@
ty.i32(),
ty.array<u32>(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2347,7 +2347,7 @@
auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
ty.vec3<f32>(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2373,7 +2373,7 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, NonStructVec3) {
- AddStorageBuffer("foo_ub", ty.vec3<f32>(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_ub", ty.vec3<f32>(), builtin::Access::kReadWrite, 0, 0);
MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3<f32>(), utils::Empty);
MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
@@ -2398,7 +2398,7 @@
auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kRead, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2421,7 +2421,7 @@
auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kRead, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2452,9 +2452,9 @@
ty.u32(),
ty.f32(),
});
- AddStorageBuffer("sb_foo", sb_struct_type(), type::Access::kRead, 0, 0);
- AddStorageBuffer("sb_bar", sb_struct_type(), type::Access::kRead, 0, 1);
- AddStorageBuffer("sb_baz", sb_struct_type(), type::Access::kRead, 2, 0);
+ AddStorageBuffer("sb_foo", sb_struct_type(), builtin::Access::kRead, 0, 0);
+ AddStorageBuffer("sb_bar", sb_struct_type(), builtin::Access::kRead, 0, 1);
+ AddStorageBuffer("sb_baz", sb_struct_type(), builtin::Access::kRead, 2, 0);
auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) {
MakeStructVariableReferenceBodyFunction(func_name, var_name,
@@ -2511,7 +2511,7 @@
ty.i32(),
ty.array<u32, 4>(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kRead, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2541,7 +2541,7 @@
ty.i32(),
ty.array<u32>(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kRead, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
@@ -2570,7 +2570,7 @@
auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
ty.i32(),
});
- AddStorageBuffer("foo_sb", foo_struct_type(), type::Access::kReadWrite, 0, 0);
+ AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
utils::Vector{
diff --git a/src/tint/inspector/test_inspector_builder.cc b/src/tint/inspector/test_inspector_builder.cc
index e73c6f5..1de6dd3 100644
--- a/src/tint/inspector/test_inspector_builder.cc
+++ b/src/tint/inspector/test_inspector_builder.cc
@@ -134,7 +134,7 @@
void InspectorBuilder::AddStorageBuffer(const std::string& name,
ast::Type type,
- type::Access access,
+ builtin::Access access,
uint32_t group,
uint32_t binding) {
GlobalVar(name, type, type::AddressSpace::kStorage, access, Binding(AInt(binding)),
@@ -279,7 +279,7 @@
ast::Type InspectorBuilder::MakeStorageTextureTypes(type::TextureDimension dim,
type::TexelFormat format) {
- return ty.storage_texture(dim, format, type::Access::kWrite);
+ return ty.storage_texture(dim, format, builtin::Access::kWrite);
}
void InspectorBuilder::AddStorageTexture(const std::string& name,
diff --git a/src/tint/inspector/test_inspector_builder.h b/src/tint/inspector/test_inspector_builder.h
index 1d99863..7056738 100644
--- a/src/tint/inspector/test_inspector_builder.h
+++ b/src/tint/inspector/test_inspector_builder.h
@@ -182,7 +182,7 @@
/// @param binding the binding number to use for the storage buffer
void AddStorageBuffer(const std::string& name,
ast::Type type,
- type::Access access,
+ builtin::Access access,
uint32_t group,
uint32_t binding);
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h
index f89a30b..4816567 100644
--- a/src/tint/program_builder.h
+++ b/src/tint/program_builder.h
@@ -237,8 +237,8 @@
address_space = b.Expr(addr_space);
}
}
- void Set(ProgramBuilder& b, type::Access ac) {
- if (ac != type::Access::kUndefined) {
+ void Set(ProgramBuilder& b, builtin::Access ac) {
+ if (ac != builtin::Access::kUndefined) {
access = b.Expr(ac);
}
}
@@ -1202,7 +1202,7 @@
/// @return the pointer to `type` with the given type::AddressSpace
ast::Type pointer(ast::Type type,
type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined) const {
+ builtin::Access access = builtin::Access::kUndefined) const {
return pointer(builder->source_, type, address_space, access);
}
@@ -1214,8 +1214,8 @@
ast::Type pointer(const Source& source,
ast::Type type,
type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined) const {
- if (access != type::Access::kUndefined) {
+ builtin::Access access = builtin::Access::kUndefined) const {
+ if (access != builtin::Access::kUndefined) {
return (*this)(source, "ptr", address_space, type, access);
} else {
return (*this)(source, "ptr", address_space, type);
@@ -1227,7 +1227,7 @@
/// @return the pointer to type `T` with the given type::AddressSpace.
template <typename T>
ast::Type pointer(type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined) const {
+ builtin::Access access = builtin::Access::kUndefined) const {
return pointer<T>(builder->source_, address_space, access);
}
@@ -1238,8 +1238,8 @@
template <typename T>
ast::Type pointer(const Source& source,
type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined) const {
- if (access != type::Access::kUndefined) {
+ builtin::Access access = builtin::Access::kUndefined) const {
+ if (access != builtin::Access::kUndefined) {
return (*this)(source, "ptr", address_space, Of<T>(), access);
} else {
return (*this)(source, "ptr", address_space, Of<T>());
@@ -1390,7 +1390,7 @@
/// @returns the storage texture
ast::Type storage_texture(type::TextureDimension dims,
type::TexelFormat format,
- type::Access access) const {
+ builtin::Access access) const {
return storage_texture(builder->source_, dims, format, access);
}
@@ -1402,7 +1402,7 @@
ast::Type storage_texture(const Source& source,
type::TextureDimension dims,
type::TexelFormat format,
- type::Access access) const {
+ builtin::Access access) const {
switch (dims) {
case type::TextureDimension::k1d:
return (*this)(source, "texture_storage_1d", format, access);
@@ -2067,7 +2067,7 @@
/// Can be any of the following, in any order:
/// * ast::Type - specifies the variable's type
/// * type::AddressSpace - specifies the variable's address space
- /// * type::Access - specifies the variable's access control
+ /// * builtin::Access - specifies the variable's access control
/// * ast::Expression* - specifies the variable's initializer expression
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
@@ -2084,7 +2084,7 @@
/// Can be any of the following, in any order:
/// * ast::Type - specifies the variable's type
/// * type::AddressSpace - specifies the variable's address space
- /// * type::Access - specifies the variable's access control
+ /// * builtin::Access - specifies the variable's access control
/// * ast::Expression* - specifies the variable's initializer expression
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
@@ -2186,7 +2186,7 @@
/// Can be any of the following, in any order:
/// * ast::Type - specifies the variable's type
/// * type::AddressSpace - specifies the variable address space
- /// * type::Access - specifies the variable's access control
+ /// * builtin::Access - specifies the variable's access control
/// * ast::Expression* - specifies the variable's initializer expression
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
@@ -2203,7 +2203,7 @@
/// Can be any of the following, in any order:
/// * ast::Type - specifies the variable's type
/// * type::AddressSpace - specifies the variable address space
- /// * type::Access - specifies the variable's access control
+ /// * builtin::Access - specifies the variable's access control
/// * ast::Expression* - specifies the variable's initializer expression
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
diff --git a/src/tint/reader/spirv/function.cc b/src/tint/reader/spirv/function.cc
index 513b7f3..ca35917 100644
--- a/src/tint/reader/spirv/function.cc
+++ b/src/tint/reader/spirv/function.cc
@@ -2522,7 +2522,7 @@
}
}
auto* var = parser_impl_.MakeVar(inst.result_id(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, var_store_type, initializer,
+ builtin::Access::kUndefined, var_store_type, initializer,
AttributeList{});
auto* var_decl_stmt = create<ast::VariableDeclStatement>(Source{}, var);
AddStatement(var_decl_stmt);
@@ -3369,7 +3369,7 @@
auto* store_type = parser_impl_.ConvertType(def_inst->type_id());
AddStatement(create<ast::VariableDeclStatement>(
Source{},
- parser_impl_.MakeVar(id, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ parser_impl_.MakeVar(id, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
store_type, nullptr, AttributeList{})));
auto* type = ty_.Reference(store_type, type::AddressSpace::kUndefined);
identifier_types_.emplace(id, type);
@@ -4842,7 +4842,7 @@
}
// Local variables are always Function storage class, with default
// access mode.
- return DefInfo::Pointer{type::AddressSpace::kFunction, type::Access::kUndefined};
+ return DefInfo::Pointer{type::AddressSpace::kFunction, builtin::Access::kUndefined};
}
case spv::Op::OpFunctionParameter: {
const auto* type = As<Pointer>(parser_impl_.ConvertType(inst.type_id()));
@@ -4855,7 +4855,7 @@
// parameters. In that case we need to do a global analysis to
// determine what the formal argument parameter type should be,
// whether it has read_only or read_write access mode.
- return DefInfo::Pointer{type->address_space, type::Access::kUndefined};
+ return DefInfo::Pointer{type->address_space, builtin::Access::kUndefined};
}
default:
break;
diff --git a/src/tint/reader/spirv/function.h b/src/tint/reader/spirv/function.h
index d035591..5879859 100644
--- a/src/tint/reader/spirv/function.h
+++ b/src/tint/reader/spirv/function.h
@@ -334,7 +334,7 @@
type::AddressSpace address_space = type::AddressSpace::kUndefined;
/// The declared access mode.
- type::Access access = type::Access::kUndefined;
+ builtin::Access access = builtin::Access::kUndefined;
};
/// The expression to use when sinking pointers into their use.
diff --git a/src/tint/reader/spirv/parser_impl.cc b/src/tint/reader/spirv/parser_impl.cc
index 443b28f..282e285 100644
--- a/src/tint/reader/spirv/parser_impl.cc
+++ b/src/tint/reader/spirv/parser_impl.cc
@@ -1576,9 +1576,9 @@
return size->AsIntConstant();
}
-type::Access ParserImpl::VarAccess(const Type* storage_type, type::AddressSpace address_space) {
+builtin::Access ParserImpl::VarAccess(const Type* storage_type, type::AddressSpace address_space) {
if (address_space != type::AddressSpace::kStorage) {
- return type::Access::kUndefined;
+ return builtin::Access::kUndefined;
}
bool read_only = false;
@@ -1587,12 +1587,12 @@
}
// Apply the access(read) or access(read_write) modifier.
- return read_only ? type::Access::kRead : type::Access::kReadWrite;
+ return read_only ? builtin::Access::kRead : builtin::Access::kReadWrite;
}
const ast::Var* ParserImpl::MakeVar(uint32_t id,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const Type* storage_type,
const ast::Expression* initializer,
AttributeList decorations) {
@@ -2526,7 +2526,7 @@
ast_handle_type = ty_.SampledTexture(dim, ast_sampled_component_type);
}
} else {
- const auto access = type::Access::kWrite;
+ const auto access = builtin::Access::kWrite;
const auto format = enum_converter_.ToTexelFormat(image_type->format());
if (format == type::TexelFormat::kUndefined) {
return nullptr;
diff --git a/src/tint/reader/spirv/parser_impl.h b/src/tint/reader/spirv/parser_impl.h
index 0c77a02..7f93497 100644
--- a/src/tint/reader/spirv/parser_impl.h
+++ b/src/tint/reader/spirv/parser_impl.h
@@ -424,7 +424,7 @@
/// @param address_space the 'var' address space
/// @returns the access mode for a 'var' declaration with the given storage type and address
/// space.
- type::Access VarAccess(const Type* storage_type, type::AddressSpace address_space);
+ builtin::Access VarAccess(const Type* storage_type, type::AddressSpace address_space);
/// Creates an AST 'var' node for a SPIR-V ID, including any attached decorations, unless it's
/// an ignorable builtin variable.
@@ -438,7 +438,7 @@
/// in the error case
const ast::Var* MakeVar(uint32_t id,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const Type* storage_type,
const ast::Expression* initializer,
AttributeList decorations);
@@ -674,7 +674,7 @@
/// The address space of the var
type::AddressSpace address_space = type::AddressSpace::kUndefined;
/// The access mode of the var
- type::Access access = type::Access::kUndefined;
+ builtin::Access access = builtin::Access::kUndefined;
};
/// Returns the AST variable for the SPIR-V ID of a module-scope variable,
diff --git a/src/tint/reader/spirv/parser_type.cc b/src/tint/reader/spirv/parser_type.cc
index 9051b78..3164c6e 100644
--- a/src/tint/reader/spirv/parser_type.cc
+++ b/src/tint/reader/spirv/parser_type.cc
@@ -175,7 +175,7 @@
Texture::~Texture() = default;
-Pointer::Pointer(const Type* t, type::AddressSpace s, type::Access a)
+Pointer::Pointer(const Type* t, type::AddressSpace s, builtin::Access a)
: type(t), address_space(s), access(a) {}
Pointer::Pointer(const Pointer&) = default;
@@ -189,7 +189,7 @@
return b.ty.pointer(type->Build(b), address_space, access);
}
-Reference::Reference(const Type* t, type::AddressSpace s, type::Access a)
+Reference::Reference(const Type* t, type::AddressSpace s, builtin::Access a)
: type(t), address_space(s), access(a) {}
Reference::Reference(const Reference&) = default;
@@ -269,7 +269,7 @@
return b.ty.sampled_texture(dims, type->Build(b));
}
-StorageTexture::StorageTexture(type::TextureDimension d, type::TexelFormat f, type::Access a)
+StorageTexture::StorageTexture(type::TextureDimension d, type::TexelFormat f, builtin::Access a)
: Base(d), format(f), access(a) {}
StorageTexture::StorageTexture(const StorageTexture&) = default;
@@ -475,13 +475,13 @@
const spirv::Pointer* TypeManager::Pointer(const Type* el,
type::AddressSpace address_space,
- type::Access access) {
+ builtin::Access access) {
return state->pointers_.Get(el, address_space, access);
}
const spirv::Reference* TypeManager::Reference(const Type* el,
type::AddressSpace address_space,
- type::Access access) {
+ builtin::Access access) {
return state->references_.Get(el, address_space, access);
}
@@ -530,7 +530,7 @@
const spirv::StorageTexture* TypeManager::StorageTexture(type::TextureDimension dims,
type::TexelFormat fmt,
- type::Access access) {
+ builtin::Access access) {
return state->storage_textures_.Get(dims, fmt, access);
}
diff --git a/src/tint/reader/spirv/parser_type.h b/src/tint/reader/spirv/parser_type.h
index 9805607..18f47d3 100644
--- a/src/tint/reader/spirv/parser_type.h
+++ b/src/tint/reader/spirv/parser_type.h
@@ -20,9 +20,9 @@
#include <vector>
#include "src/tint/ast/type.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/castable.h"
#include "src/tint/symbol.h"
-#include "src/tint/type/access.h"
#include "src/tint/type/address_space.h"
#include "src/tint/type/sampler_kind.h"
#include "src/tint/type/texel_format.h"
@@ -162,7 +162,7 @@
/// @param ty the store type
/// @param sc the pointer address space
/// @param access the declared access mode
- Pointer(const Type* ty, type::AddressSpace sc, type::Access access);
+ Pointer(const Type* ty, type::AddressSpace sc, builtin::Access access);
/// Copy constructor
/// @param other the other type to copy
@@ -182,7 +182,7 @@
/// the pointer address space
type::AddressSpace const address_space;
/// the pointer declared access mode
- type::Access const access;
+ builtin::Access const access;
};
/// `ref<SC, T, AM>` type
@@ -193,7 +193,7 @@
/// @param ty the referenced type
/// @param sc the reference address space
/// @param access the reference declared access mode
- Reference(const Type* ty, type::AddressSpace sc, type::Access access);
+ Reference(const Type* ty, type::AddressSpace sc, builtin::Access access);
/// Copy constructor
/// @param other the other type to copy
@@ -213,7 +213,7 @@
/// the pointer address space
type::AddressSpace const address_space;
/// the pointer declared access mode
- type::Access const access;
+ builtin::Access const access;
};
/// `vecN<T>` type
@@ -434,7 +434,7 @@
/// @param d the texture dimensions
/// @param f the storage image format
/// @param a the access control
- StorageTexture(type::TextureDimension d, type::TexelFormat f, type::Access a);
+ StorageTexture(type::TextureDimension d, type::TexelFormat f, builtin::Access a);
/// Copy constructor
/// @param other the other type to copy
@@ -453,7 +453,7 @@
type::TexelFormat const format;
/// the access control
- type::Access const access;
+ builtin::Access const access;
};
/// Base class for named types
@@ -550,7 +550,7 @@
/// the same pointer.
const spirv::Pointer* Pointer(const Type* ty,
type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined);
+ builtin::Access access = builtin::Access::kUndefined);
/// @param ty the referenced type
/// @param address_space the reference address space
/// @param access the declared access mode
@@ -558,7 +558,7 @@
/// return the same pointer.
const spirv::Reference* Reference(const Type* ty,
type::AddressSpace address_space,
- type::Access access = type::Access::kUndefined);
+ builtin::Access access = builtin::Access::kUndefined);
/// @param ty the element type
/// @param sz the number of elements in the vector
/// @return a Vector type. Repeated calls with the same arguments will return
@@ -616,7 +616,7 @@
/// return the same pointer.
const spirv::StorageTexture* StorageTexture(type::TextureDimension d,
type::TexelFormat f,
- type::Access a);
+ builtin::Access a);
private:
struct State;
diff --git a/src/tint/reader/spirv/parser_type_test.cc b/src/tint/reader/spirv/parser_type_test.cc
index af1d090..560b24e 100644
--- a/src/tint/reader/spirv/parser_type_test.cc
+++ b/src/tint/reader/spirv/parser_type_test.cc
@@ -44,9 +44,9 @@
EXPECT_EQ(ty.SampledTexture(type::TextureDimension::k2d, ty.I32()),
ty.SampledTexture(type::TextureDimension::k2d, ty.I32()));
EXPECT_EQ(ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kRead),
+ builtin::Access::kRead),
ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kRead));
+ builtin::Access::kRead));
}
TEST(SpvParserTypeTest, DifferentArgumentsGivesDifferentPointer) {
@@ -81,17 +81,17 @@
EXPECT_NE(ty.SampledTexture(type::TextureDimension::k2d, ty.I32()),
ty.SampledTexture(type::TextureDimension::k2d, ty.U32()));
EXPECT_NE(ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kRead),
+ builtin::Access::kRead),
ty.StorageTexture(type::TextureDimension::k3d, type::TexelFormat::kR32Uint,
- type::Access::kRead));
+ builtin::Access::kRead));
EXPECT_NE(ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kRead),
+ builtin::Access::kRead),
ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Sint,
- type::Access::kRead));
+ builtin::Access::kRead));
EXPECT_NE(ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kRead),
+ builtin::Access::kRead),
ty.StorageTexture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kWrite));
+ builtin::Access::kWrite));
}
} // namespace
diff --git a/src/tint/reader/wgsl/parser_impl.h b/src/tint/reader/wgsl/parser_impl.h
index 64618b3..a034010 100644
--- a/src/tint/reader/wgsl/parser_impl.h
+++ b/src/tint/reader/wgsl/parser_impl.h
@@ -22,6 +22,7 @@
#include <utility>
#include <vector>
+#include "src/tint/builtin/access.h"
#include "src/tint/program_builder.h"
#include "src/tint/reader/wgsl/parser_impl_detail.h"
#include "src/tint/reader/wgsl/token.h"
diff --git a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
index 9a8b936..9708f0d 100644
--- a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc
@@ -21,7 +21,7 @@
struct VariableStorageData {
const char* input;
type::AddressSpace address_space;
- type::Access access;
+ builtin::Access access;
};
inline std::ostream& operator<<(std::ostream& out, VariableStorageData data) {
out << std::string(data.input);
@@ -44,7 +44,7 @@
} else {
EXPECT_EQ(sc->address_space, nullptr);
}
- if (params.access != type::Access::kUndefined) {
+ if (params.access != builtin::Access::kUndefined) {
ast::CheckIdentifier(p->builder().Symbols(), sc->access, utils::ToString(params.access));
} else {
EXPECT_EQ(sc->access, nullptr);
@@ -57,15 +57,17 @@
ParserImplTest,
VariableQualifierTest,
testing::Values(
- VariableStorageData{"uniform", type::AddressSpace::kUniform, type::Access::kUndefined},
- VariableStorageData{"workgroup", type::AddressSpace::kWorkgroup, type::Access::kUndefined},
- VariableStorageData{"storage", type::AddressSpace::kStorage, type::Access::kUndefined},
- VariableStorageData{"private", type::AddressSpace::kPrivate, type::Access::kUndefined},
- VariableStorageData{"function", type::AddressSpace::kFunction, type::Access::kUndefined},
- VariableStorageData{"storage, read", type::AddressSpace::kStorage, type::Access::kRead},
- VariableStorageData{"storage, write", type::AddressSpace::kStorage, type::Access::kWrite},
+ VariableStorageData{"uniform", type::AddressSpace::kUniform, builtin::Access::kUndefined},
+ VariableStorageData{"workgroup", type::AddressSpace::kWorkgroup,
+ builtin::Access::kUndefined},
+ VariableStorageData{"storage", type::AddressSpace::kStorage, builtin::Access::kUndefined},
+ VariableStorageData{"private", type::AddressSpace::kPrivate, builtin::Access::kUndefined},
+ VariableStorageData{"function", type::AddressSpace::kFunction, builtin::Access::kUndefined},
+ VariableStorageData{"storage, read", type::AddressSpace::kStorage, builtin::Access::kRead},
+ VariableStorageData{"storage, write", type::AddressSpace::kStorage,
+ builtin::Access::kWrite},
VariableStorageData{"storage, read_write", type::AddressSpace::kStorage,
- type::Access::kReadWrite}));
+ builtin::Access::kReadWrite}));
TEST_F(ParserImplTest, VariableQualifier_Empty) {
auto p = parser("var<> name");
diff --git a/src/tint/resolver/address_space_validation_test.cc b/src/tint/resolver/address_space_validation_test.cc
index 95301c7..b0c27e7 100644
--- a/src/tint/resolver/address_space_validation_test.cc
+++ b/src/tint/resolver/address_space_validation_test.cc
@@ -325,7 +325,7 @@
// struct S{ a : f32 };
// var<storage, read> g : array<S, 3u>;
Structure("S", utils::Vector{Member("a", ty.f32())});
- GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -347,7 +347,7 @@
Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("a", ty.f16())});
- GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -361,7 +361,7 @@
Structure("S", utils::Vector{Member("a", ty.f16())});
Alias("t",
- ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead));
+ ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -370,7 +370,7 @@
// struct S { x : i32 };
// var<storage, read> g : S;
Structure("S", utils::Vector{Member("x", ty.i32())});
- GlobalVar("g", ty("S"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("g", ty("S"), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -380,7 +380,7 @@
// struct S { x : i32 };
// type t = ptr<storage, read, S>;
Structure("S", utils::Vector{Member("x", ty.i32())});
- Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, type::Access::kRead));
+ Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -392,7 +392,7 @@
Structure("S", utils::Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
- GlobalVar("g", ty("a2"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("g", ty("a2"), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -405,7 +405,7 @@
Structure("S", utils::Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
- Alias("t", ty.pointer(ty("a2"), type::AddressSpace::kStorage, type::Access::kRead));
+ Alias("t", ty.pointer(ty("a2"), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -416,7 +416,7 @@
Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())});
- GlobalVar("g", ty("S"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("g", ty("S"), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -428,7 +428,7 @@
Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())});
- Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, type::Access::kRead));
+ Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -442,7 +442,7 @@
Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
- GlobalVar("g", ty("a2"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("g", ty("a2"), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -457,14 +457,15 @@
Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
- Alias("g", ty.pointer(ty("a2"), type::AddressSpace::kStorage, type::Access::kRead));
+ Alias("g", ty.pointer(ty("a2"), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_NotStorage_AccessMode) {
// var<private, read> g : a;
- GlobalVar(Source{{12, 34}}, "g", ty.i32(), type::AddressSpace::kPrivate, type::Access::kRead);
+ GlobalVar(Source{{12, 34}}, "g", ty.i32(), type::AddressSpace::kPrivate,
+ builtin::Access::kRead);
ASSERT_FALSE(r()->Resolve());
@@ -476,7 +477,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_NotStorage_AccessMode) {
// type t = ptr<private, i32, read>;
Alias("t", ty.pointer(Source{{12, 34}}, ty.i32(), type::AddressSpace::kPrivate,
- type::Access::kRead));
+ builtin::Access::kRead));
ASSERT_FALSE(r()->Resolve());
@@ -487,7 +488,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_ReadAccessMode) {
// @group(0) @binding(0) var<storage, read> a : i32;
- GlobalVar("a", ty.i32(), type::AddressSpace::kStorage, type::Access::kRead, Group(0_a),
+ GlobalVar("a", ty.i32(), type::AddressSpace::kStorage, builtin::Access::kRead, Group(0_a),
Binding(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -495,14 +496,14 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_ReadAccessMode) {
// type t = ptr<storage, read, i32>;
- Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kStorage, type::Access::kRead));
+ Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kStorage, builtin::Access::kRead));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_ReadWriteAccessMode) {
// @group(0) @binding(0) var<storage, read_write> a : i32;
- GlobalVar("a", ty.i32(), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(0_a),
+ GlobalVar("a", ty.i32(), type::AddressSpace::kStorage, builtin::Access::kReadWrite, Group(0_a),
Binding(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -510,15 +511,15 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_ReadWriteAccessMode) {
// type t = ptr<storage, read_write, i32>;
- Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kStorage, type::Access::kReadWrite));
+ Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kStorage, builtin::Access::kReadWrite));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_WriteAccessMode) {
// @group(0) @binding(0) var<storage, read_write> a : i32;
- GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage, type::Access::kWrite,
- Group(0_a), Binding(0_a));
+ GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage,
+ builtin::Access::kWrite, Group(0_a), Binding(0_a));
ASSERT_FALSE(r()->Resolve());
@@ -529,7 +530,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_WriteAccessMode) {
// type t = ptr<storage, read_write, i32>;
Alias("t", ty.pointer(Source{{12, 34}}, ty.i32(), type::AddressSpace::kStorage,
- type::Access::kWrite));
+ builtin::Access::kWrite));
ASSERT_FALSE(r()->Resolve());
diff --git a/src/tint/resolver/assignment_validation_test.cc b/src/tint/resolver/assignment_validation_test.cc
index cf8b505..f8f663b 100644
--- a/src/tint/resolver/assignment_validation_test.cc
+++ b/src/tint/resolver/assignment_validation_test.cc
@@ -33,7 +33,7 @@
auto* s = Structure("S", utils::Vector{
Member("m", ty.i32()),
});
- GlobalVar(Source{{12, 34}}, "a", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{12, 34}}, "a", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("a", "m"), 1_i));
@@ -232,7 +232,7 @@
auto make_type = [&] {
return ty.storage_texture(type::TextureDimension::k1d, type::TexelFormat::kRgba8Unorm,
- type::Access::kWrite);
+ builtin::Access::kWrite);
};
GlobalVar("a", make_type(), Binding(0_a), Group(0_a));
@@ -253,7 +253,7 @@
Member("a", ty.atomic(ty.i32())),
});
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a")));
@@ -270,7 +270,7 @@
Member("a", ty.array(ty.f32())),
});
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a")));
diff --git a/src/tint/resolver/atomics_test.cc b/src/tint/resolver/atomics_test.cc
index ba83fcd..45d56bf 100644
--- a/src/tint/resolver/atomics_test.cc
+++ b/src/tint/resolver/atomics_test.cc
@@ -48,7 +48,7 @@
TEST_F(ResolverAtomicTest, GlobalStorageStruct) {
auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))});
- auto* g = GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ auto* g = GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
EXPECT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/resolver/atomics_validation_test.cc b/src/tint/resolver/atomics_validation_test.cc
index bd0c5cc..919722b 100644
--- a/src/tint/resolver/atomics_validation_test.cc
+++ b/src/tint/resolver/atomics_validation_test.cc
@@ -34,14 +34,14 @@
TEST_F(ResolverAtomicValidationTest, AddressSpace_Storage) {
GlobalVar("g", ty.atomic(Source{{12, 34}}, ty.i32()), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Group(0_a), Binding(0_a));
+ builtin::Access::kReadWrite, Group(0_a), Binding(0_a));
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverAtomicValidationTest, AddressSpace_Storage_Struct) {
auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
- GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(0_a),
+ GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite, Group(0_a),
Binding(0_a));
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -198,7 +198,7 @@
TEST_F(ResolverAtomicValidationTest, Struct_AccessMode_Read) {
auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
- GlobalVar(Source{{56, 78}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{56, 78}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Group(0_a), Binding(0_a));
EXPECT_FALSE(r()->Resolve());
@@ -210,7 +210,7 @@
TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_Struct) {
auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
- GlobalVar(Source{{56, 78}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{56, 78}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Group(0_a), Binding(0_a));
EXPECT_FALSE(r()->Resolve());
@@ -229,7 +229,7 @@
Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), type::AddressSpace::kStorage,
- type::Access::kRead, Group(0_a), Binding(0_a));
+ builtin::Access::kRead, Group(0_a), Binding(0_a));
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
@@ -247,7 +247,7 @@
Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), type::AddressSpace::kStorage,
- type::Access::kRead, Group(0_a), Binding(0_a));
+ builtin::Access::kRead, Group(0_a), Binding(0_a));
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
@@ -287,8 +287,8 @@
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))});
- GlobalVar(Source{{12, 34}}, "g", ty.Of(s0), type::AddressSpace::kStorage, type::Access::kRead,
- Group(0_a), Binding(0_a));
+ GlobalVar(Source{{12, 34}}, "g", ty.Of(s0), type::AddressSpace::kStorage,
+ builtin::Access::kRead, Group(0_a), Binding(0_a));
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
diff --git a/src/tint/resolver/attribute_validation_test.cc b/src/tint/resolver/attribute_validation_test.cc
index 2e4084e..85257f9 100644
--- a/src/tint/resolver/attribute_validation_test.cc
+++ b/src/tint/resolver/attribute_validation_test.cc
@@ -735,7 +735,7 @@
TEST_F(StructMemberAttributeTest, Align_Attribute_Var) {
GlobalVar(Source{{1, 2}}, "val", ty.f32(), type::AddressSpace::kPrivate,
- type::Access::kUndefined, Expr(1.23_f));
+ builtin::Access::kUndefined, Expr(1.23_f));
Structure(Source{{6, 4}}, "mystruct",
utils::Vector{Member(Source{{12, 5}}, "a", ty.f32(),
@@ -809,7 +809,7 @@
TEST_F(StructMemberAttributeTest, Size_Attribute_Var) {
GlobalVar(Source{{1, 2}}, "val", ty.f32(), type::AddressSpace::kPrivate,
- type::Access::kUndefined, Expr(1.23_f));
+ builtin::Access::kUndefined, Expr(1.23_f));
Structure(Source{{6, 4}}, "mystruct",
utils::Vector{Member(Source{{12, 5}}, "a", ty.f32(),
@@ -1270,7 +1270,8 @@
auto* s = Structure("S", utils::Vector{
Member("x", ty.i32()),
});
- GlobalVar(Source{{12, 34}}, "G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead);
+ GlobalVar(Source{{12, 34}}, "G", ty.Of(s), type::AddressSpace::kStorage,
+ builtin::Access::kRead);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
diff --git a/src/tint/resolver/builtin_test.cc b/src/tint/resolver/builtin_test.cc
index e3becab..475fd4d 100644
--- a/src/tint/resolver/builtin_test.cc
+++ b/src/tint/resolver/builtin_test.cc
@@ -215,7 +215,7 @@
TEST_F(ResolverBuiltinArrayTest, ArrayLength_Vector) {
auto ary = ty.array<i32>();
auto* str = Structure("S", utils::Vector{Member("x", ary)});
- GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
auto* call = Call("arrayLength", AddressOf(MemberAccessor("a", "x")));
diff --git a/src/tint/resolver/builtin_validation_test.cc b/src/tint/resolver/builtin_validation_test.cc
index 22e13c2..4158bf1 100644
--- a/src/tint/resolver/builtin_validation_test.cc
+++ b/src/tint/resolver/builtin_validation_test.cc
@@ -581,7 +581,7 @@
// fn foo() {
// workgroupUniformLoad(&v);
// }
- GlobalVar("v", ty.i32(), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("v", ty.i32(), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
utils::Vector{Group(0_a), Binding(0_a)});
WrapInFunction(CallStmt(Call("workgroupUniformLoad", AddressOf(Source{{12, 34}}, "v"))));
diff --git a/src/tint/resolver/compound_assignment_validation_test.cc b/src/tint/resolver/compound_assignment_validation_test.cc
index 64a542c..58f479d 100644
--- a/src/tint/resolver/compound_assignment_validation_test.cc
+++ b/src/tint/resolver/compound_assignment_validation_test.cc
@@ -233,7 +233,7 @@
// {
// a += 1i;
// }
- GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage, builtin::Access::kRead,
Group(0_a), Binding(0_a));
WrapInFunction(CompoundAssign(Source{{56, 78}}, "a", 1_i, ast::BinaryOp::kAdd));
diff --git a/src/tint/resolver/dependency_graph.cc b/src/tint/resolver/dependency_graph.cc
index 75e377f..37a2244 100644
--- a/src/tint/resolver/dependency_graph.cc
+++ b/src/tint/resolver/dependency_graph.cc
@@ -487,7 +487,7 @@
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(fmt));
return;
}
- if (auto access = type::ParseAccess(s); access != type::Access::kUndefined) {
+ if (auto access = builtin::ParseAccess(s); access != builtin::Access::kUndefined) {
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(access));
return;
}
@@ -861,7 +861,7 @@
if (auto builtin_ty = BuiltinType(); builtin_ty != type::Builtin::kUndefined) {
return "builtin type '" + utils::ToString(builtin_ty) + "'";
}
- if (auto access = Access(); access != type::Access::kUndefined) {
+ if (auto access = Access(); access != builtin::Access::kUndefined) {
return "access '" + utils::ToString(access) + "'";
}
if (auto addr = AddressSpace(); addr != type::AddressSpace::kUndefined) {
diff --git a/src/tint/resolver/dependency_graph.h b/src/tint/resolver/dependency_graph.h
index 7819b52..189e7c2 100644
--- a/src/tint/resolver/dependency_graph.h
+++ b/src/tint/resolver/dependency_graph.h
@@ -19,10 +19,10 @@
#include <vector>
#include "src/tint/ast/module.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/diagnostic/diagnostic.h"
#include "src/tint/sem/builtin_type.h"
#include "src/tint/symbol_table.h"
-#include "src/tint/type/access.h"
#include "src/tint/type/builtin.h"
#include "src/tint/type/texel_format.h"
#include "src/tint/utils/hashmap.h"
@@ -35,7 +35,7 @@
/// - const ast::Variable* (as const ast::Node*)
/// - const ast::Function* (as const ast::Node*)
/// - sem::BuiltinType
-/// - type::Access
+/// - builtin::Access
/// - type::AddressSpace
/// - type::Builtin
/// - type::TexelFormat
@@ -68,13 +68,13 @@
return sem::BuiltinType::kNone;
}
- /// @return the access if the ResolvedIdentifier holds type::Access, otherwise
- /// type::Access::kUndefined
- type::Access Access() const {
- if (auto n = std::get_if<type::Access>(&value_)) {
+ /// @return the access if the ResolvedIdentifier holds builtin::Access, otherwise
+ /// builtin::Access::kUndefined
+ builtin::Access Access() const {
+ if (auto n = std::get_if<builtin::Access>(&value_)) {
return *n;
}
- return type::Access::kUndefined;
+ return builtin::Access::kUndefined;
}
/// @return the address space if the ResolvedIdentifier holds type::AddressSpace, otherwise
@@ -130,7 +130,7 @@
std::variant<std::monostate,
const ast::Node*,
sem::BuiltinType,
- type::Access,
+ builtin::Access,
type::AddressSpace,
type::Builtin,
type::TexelFormat>
diff --git a/src/tint/resolver/dependency_graph_test.cc b/src/tint/resolver/dependency_graph_test.cc
index a316ad0..e9ef46b 100644
--- a/src/tint/resolver/dependency_graph_test.cc
+++ b/src/tint/resolver/dependency_graph_test.cc
@@ -1330,7 +1330,7 @@
} // namespace resolve_to_builtin_type
////////////////////////////////////////////////////////////////////////////////
-// Resolve to type::Access tests
+// Resolve to builtin::Access tests
////////////////////////////////////////////////////////////////////////////////
namespace resolve_to_access {
@@ -1348,7 +1348,7 @@
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
- EXPECT_EQ(resolved->Access(), type::ParseAccess(name))
+ EXPECT_EQ(resolved->Access(), builtin::ParseAccess(name))
<< resolved->String(Symbols(), Diagnostics());
}
@@ -1400,17 +1400,17 @@
INSTANTIATE_TEST_SUITE_P(Types,
ResolverDependencyGraphResolveToAccess,
testing::Combine(testing::ValuesIn(kTypeUseKinds),
- testing::ValuesIn(type::kAccessStrings)));
+ testing::ValuesIn(builtin::kAccessStrings)));
INSTANTIATE_TEST_SUITE_P(Values,
ResolverDependencyGraphResolveToAccess,
testing::Combine(testing::ValuesIn(kValueUseKinds),
- testing::ValuesIn(type::kAccessStrings)));
+ testing::ValuesIn(builtin::kAccessStrings)));
INSTANTIATE_TEST_SUITE_P(Functions,
ResolverDependencyGraphResolveToAccess,
testing::Combine(testing::ValuesIn(kFuncUseKinds),
- testing::ValuesIn(type::kAccessStrings)));
+ testing::ValuesIn(builtin::kAccessStrings)));
} // namespace resolve_to_access
@@ -1735,7 +1735,7 @@
GlobalVar(Sym(), ty.external_texture());
GlobalVar(Sym(), ty.multisampled_texture(type::TextureDimension::k2d, T));
GlobalVar(Sym(), ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
- type::Access::kRead));
+ builtin::Access::kRead));
GlobalVar(Sym(), ty.sampler(type::SamplerKind::kSampler));
GlobalVar(Sym(), ty.i32(), utils::Vector{Binding(V), Group(V)});
diff --git a/src/tint/resolver/expression_kind_test.cc b/src/tint/resolver/expression_kind_test.cc
index dc3d8a8..1835971 100644
--- a/src/tint/resolver/expression_kind_test.cc
+++ b/src/tint/resolver/expression_kind_test.cc
@@ -125,9 +125,9 @@
sym = Sym("write");
check_expr = [](const sem::Expression* expr) {
ASSERT_NE(expr, nullptr);
- auto* enum_expr = expr->As<sem::BuiltinEnumExpression<type::Access>>();
+ auto* enum_expr = expr->As<sem::BuiltinEnumExpression<builtin::Access>>();
ASSERT_NE(enum_expr, nullptr);
- EXPECT_EQ(enum_expr->Value(), type::Access::kWrite);
+ EXPECT_EQ(enum_expr->Value(), builtin::Access::kWrite);
};
break;
}
diff --git a/src/tint/resolver/host_shareable_validation_test.cc b/src/tint/resolver/host_shareable_validation_test.cc
index b518b57..059a3e5 100644
--- a/src/tint/resolver/host_shareable_validation_test.cc
+++ b/src/tint/resolver/host_shareable_validation_test.cc
@@ -29,7 +29,7 @@
auto* s =
Structure("S", utils::Vector{Member(Source{{56, 78}}, "x", ty.bool_(Source{{12, 34}}))});
- GlobalVar(Source{{90, 12}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{90, 12}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_FALSE(r()->Resolve());
@@ -45,7 +45,7 @@
auto* s = Structure(
"S", utils::Vector{Member(Source{{56, 78}}, "x", ty.vec3<bool>(Source{{12, 34}}))});
- GlobalVar(Source{{90, 12}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{90, 12}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_FALSE(r()->Resolve());
@@ -62,8 +62,8 @@
auto* s =
Structure("S", utils::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), type::AddressSpace::kStorage, type::Access::kRead,
- Binding(0_a), Group(0_a));
+ GlobalVar(Source{{90, 12}}, "g", ty.Of(a2), type::AddressSpace::kStorage,
+ builtin::Access::kRead, Binding(0_a), Group(0_a));
ASSERT_FALSE(r()->Resolve());
@@ -81,7 +81,7 @@
auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
- GlobalVar(Source{{9, 10}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{9, 10}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_FALSE(r()->Resolve());
@@ -120,7 +120,7 @@
auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
- GlobalVar(Source{{9, 10}}, "g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{9, 10}}, "g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/resolver/increment_decrement_validation_test.cc b/src/tint/resolver/increment_decrement_validation_test.cc
index 7cca736..7848daa 100644
--- a/src/tint/resolver/increment_decrement_validation_test.cc
+++ b/src/tint/resolver/increment_decrement_validation_test.cc
@@ -193,7 +193,7 @@
// {
// a++;
// }
- GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage, type::Access::kRead,
+ GlobalVar(Source{{12, 34}}, "a", ty.i32(), type::AddressSpace::kStorage, builtin::Access::kRead,
Group(0_a), Binding(0_a));
WrapInFunction(Increment(Source{{56, 78}}, "a"));
diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc
index ecaefb2..12d07ac 100644
--- a/src/tint/resolver/intrinsic_table.cc
+++ b/src/tint/resolver/intrinsic_table.cc
@@ -329,7 +329,7 @@
// template
////////////////////////////////////////////////////////////////////////////////
using TexelFormat = type::TexelFormat;
-using Access = type::Access;
+using Access = builtin::Access;
using AddressSpace = type::AddressSpace;
using ParameterUsage = sem::ParameterUsage;
using PipelineStage = ast::PipelineStage;
@@ -561,7 +561,7 @@
const type::Pointer* build_ptr(MatchState& state, Number S, const type::Type* T, Number& A) {
return state.builder.create<type::Pointer>(T, static_cast<type::AddressSpace>(S.Value()),
- static_cast<type::Access>(A.Value()));
+ static_cast<builtin::Access>(A.Value()));
}
bool match_atomic(MatchState&, const type::Type* ty, const type::Type*& T) {
@@ -1276,7 +1276,7 @@
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
nullptr, static_cast<uint32_t>(params.Length()), p.type,
- type::AddressSpace::kUndefined, type::Access::kUndefined, p.usage));
+ type::AddressSpace::kUndefined, builtin::Access::kUndefined, p.usage));
}
sem::PipelineStageSet supported_stages;
if (match.overload->flags.Contains(OverloadFlag::kSupportsVertexPipeline)) {
@@ -1477,7 +1477,7 @@
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
nullptr, static_cast<uint32_t>(params.Length()), p.type,
- type::AddressSpace::kUndefined, type::Access::kUndefined, p.usage));
+ type::AddressSpace::kUndefined, builtin::Access::kUndefined, p.usage));
}
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
@@ -1492,7 +1492,7 @@
auto* target = converters.GetOrCreate(match, [&]() {
auto param = builder.create<sem::Parameter>(
nullptr, 0u, match.parameters[0].type, type::AddressSpace::kUndefined,
- type::Access::kUndefined, match.parameters[0].usage);
+ builtin::Access::kUndefined, match.parameters[0].usage);
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
return builder.create<sem::TypeConversion>(match.return_type, param, eval_stage);
diff --git a/src/tint/resolver/intrinsic_table_test.cc b/src/tint/resolver/intrinsic_table_test.cc
index c649c46..624a208 100644
--- a/src/tint/resolver/intrinsic_table_test.cc
+++ b/src/tint/resolver/intrinsic_table_test.cc
@@ -231,8 +231,8 @@
TEST_F(IntrinsicTableTest, MatchPointer) {
auto* i32 = create<type::I32>();
auto* atomicI32 = create<type::Atomic>(i32);
- auto* ptr =
- create<type::Pointer>(atomicI32, type::AddressSpace::kWorkgroup, type::Access::kReadWrite);
+ auto* ptr = create<type::Pointer>(atomicI32, type::AddressSpace::kWorkgroup,
+ builtin::Access::kReadWrite);
auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{ptr},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
@@ -256,7 +256,7 @@
auto* arr =
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
auto* arr_ptr =
- create<type::Pointer>(arr, type::AddressSpace::kStorage, type::Access::kReadWrite);
+ create<type::Pointer>(arr, type::AddressSpace::kStorage, builtin::Access::kReadWrite);
auto result = table->Lookup(BuiltinType::kArrayLength, utils::Vector{arr_ptr},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
@@ -415,8 +415,9 @@
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* subtype = type::StorageTexture::SubtypeFor(type::TexelFormat::kR32Float, Types());
- auto* tex = create<type::StorageTexture>(
- type::TextureDimension::k2d, type::TexelFormat::kR32Float, type::Access::kWrite, subtype);
+ auto* tex =
+ create<type::StorageTexture>(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
+ builtin::Access::kWrite, subtype);
auto result = table->Lookup(BuiltinType::kTextureStore, utils::Vector{tex, vec2_i32, vec4_f32},
sem::EvaluationStage::kConstant, Source{});
@@ -445,12 +446,12 @@
TEST_F(IntrinsicTableTest, ImplicitLoadOnReference) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(
- BuiltinType::kCos,
- utils::Vector{
- create<type::Reference>(f32, type::AddressSpace::kFunction, type::Access::kReadWrite),
- },
- sem::EvaluationStage::kConstant, Source{});
+ auto result = table->Lookup(BuiltinType::kCos,
+ utils::Vector{
+ create<type::Reference>(f32, type::AddressSpace::kFunction,
+ builtin::Access::kReadWrite),
+ },
+ sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_EQ(result.sem->Type(), BuiltinType::kCos);
@@ -549,7 +550,7 @@
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Builtin_RuntimeEval) {
auto* af = create<type::AbstractFloat>();
auto* bool_ref = create<type::Reference>(create<type::Bool>(), type::AddressSpace::kFunction,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
auto result = table->Lookup(BuiltinType::kSelect, utils::Vector{af, af, bool_ref},
sem::EvaluationStage::kRuntime, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
diff --git a/src/tint/resolver/is_host_shareable_test.cc b/src/tint/resolver/is_host_shareable_test.cc
index 8696900..0d65111 100644
--- a/src/tint/resolver/is_host_shareable_test.cc
+++ b/src/tint/resolver/is_host_shareable_test.cc
@@ -96,7 +96,7 @@
TEST_F(ResolverIsHostShareable, Pointer) {
auto* ptr = create<type::Pointer>(create<type::I32>(), type::AddressSpace::kPrivate,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_FALSE(r()->IsHostShareable(ptr));
}
diff --git a/src/tint/resolver/is_storeable_test.cc b/src/tint/resolver/is_storeable_test.cc
index bfe64c4..af48077 100644
--- a/src/tint/resolver/is_storeable_test.cc
+++ b/src/tint/resolver/is_storeable_test.cc
@@ -79,7 +79,7 @@
TEST_F(ResolverIsStorableTest, Pointer) {
auto* ptr = create<type::Pointer>(create<type::I32>(), type::AddressSpace::kPrivate,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_FALSE(r()->IsStorable(ptr));
}
diff --git a/src/tint/resolver/ptr_ref_test.cc b/src/tint/resolver/ptr_ref_test.cc
index 692bd3b..7f9c957 100644
--- a/src/tint/resolver/ptr_ref_test.cc
+++ b/src/tint/resolver/ptr_ref_test.cc
@@ -101,11 +101,11 @@
ASSERT_TRUE(TypeOf(storage_ptr)->Is<type::Pointer>())
<< "storage_ptr is " << TypeOf(storage_ptr)->TypeInfo().name;
- EXPECT_EQ(TypeOf(function_ptr)->As<type::Pointer>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(private_ptr)->As<type::Pointer>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(workgroup_ptr)->As<type::Pointer>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(uniform_ptr)->As<type::Pointer>()->Access(), type::Access::kRead);
- EXPECT_EQ(TypeOf(storage_ptr)->As<type::Pointer>()->Access(), type::Access::kRead);
+ EXPECT_EQ(TypeOf(function_ptr)->As<type::Pointer>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(private_ptr)->As<type::Pointer>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(workgroup_ptr)->As<type::Pointer>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(uniform_ptr)->As<type::Pointer>()->Access(), builtin::Access::kRead);
+ EXPECT_EQ(TypeOf(storage_ptr)->As<type::Pointer>()->Access(), builtin::Access::kRead);
}
} // namespace
diff --git a/src/tint/resolver/ptr_ref_validation_test.cc b/src/tint/resolver/ptr_ref_validation_test.cc
index 9f6f390..078782c 100644
--- a/src/tint/resolver/ptr_ref_validation_test.cc
+++ b/src/tint/resolver/ptr_ref_validation_test.cc
@@ -144,7 +144,7 @@
auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array<i32, 4>())});
auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))});
auto* storage = GlobalVar("s", ty.Of(buf), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i);
auto* ptr =
diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc
index 8336765..5f4e89d 100644
--- a/src/tint/resolver/resolver.cc
+++ b/src/tint/resolver/resolver.cc
@@ -87,7 +87,7 @@
#include "src/tint/utils/transform.h"
#include "src/tint/utils/vector.h"
-TINT_INSTANTIATE_TYPEINFO(tint::sem::BuiltinEnumExpression<tint::type::Access>);
+TINT_INSTANTIATE_TYPEINFO(tint::sem::BuiltinEnumExpression<tint::builtin::Access>);
TINT_INSTANTIATE_TYPEINFO(tint::sem::BuiltinEnumExpression<tint::type::AddressSpace>);
TINT_INSTANTIATE_TYPEINFO(tint::sem::BuiltinEnumExpression<tint::type::TexelFormat>);
@@ -270,12 +270,12 @@
if (is_global) {
sem = builder_->create<sem::GlobalVariable>(
v, ty, sem::EvaluationStage::kRuntime, type::AddressSpace::kUndefined,
- type::Access::kUndefined,
+ builtin::Access::kUndefined,
/* constant_value */ nullptr, sem::BindingPoint{}, std::nullopt);
} else {
sem = builder_->create<sem::LocalVariable>(v, ty, sem::EvaluationStage::kRuntime,
type::AddressSpace::kUndefined,
- type::Access::kUndefined, current_statement_,
+ builtin::Access::kUndefined, current_statement_,
/* constant_value */ nullptr);
}
@@ -331,7 +331,7 @@
auto* sem = builder_->create<sem::GlobalVariable>(
v, ty, sem::EvaluationStage::kOverride, type::AddressSpace::kUndefined,
- type::Access::kUndefined,
+ builtin::Access::kUndefined,
/* constant_value */ nullptr, sem::BindingPoint{}, std::nullopt);
sem->SetInitializer(rhs);
@@ -427,10 +427,10 @@
auto* sem = is_global
? static_cast<sem::Variable*>(builder_->create<sem::GlobalVariable>(
c, ty, sem::EvaluationStage::kConstant, type::AddressSpace::kUndefined,
- type::Access::kUndefined, value, sem::BindingPoint{}, std::nullopt))
+ builtin::Access::kUndefined, value, sem::BindingPoint{}, std::nullopt))
: static_cast<sem::Variable*>(builder_->create<sem::LocalVariable>(
c, ty, sem::EvaluationStage::kConstant, type::AddressSpace::kUndefined,
- type::Access::kUndefined, current_statement_, value));
+ builtin::Access::kUndefined, current_statement_, value));
sem->SetInitializer(rhs);
builder_->Sem().Add(c, sem);
@@ -500,7 +500,7 @@
return nullptr;
}
- auto access = type::Access::kUndefined;
+ auto access = builtin::Access::kUndefined;
if (var->declared_access) {
auto expr = AccessExpression(var->declared_access);
if (!expr) {
@@ -673,7 +673,7 @@
}
auto* sem = builder_->create<sem::Parameter>(
- param, index, ty, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ param, index, ty, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
sem::ParameterUsage::kNone, binding_point, location);
builder_->Sem().Add(param, sem);
return sem;
@@ -703,17 +703,17 @@
return static_cast<uint32_t>(value);
}
-type::Access Resolver::DefaultAccessForAddressSpace(type::AddressSpace address_space) {
+builtin::Access Resolver::DefaultAccessForAddressSpace(type::AddressSpace address_space) {
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
switch (address_space) {
case type::AddressSpace::kStorage:
case type::AddressSpace::kUniform:
case type::AddressSpace::kHandle:
- return type::Access::kRead;
+ return builtin::Access::kRead;
default:
break;
}
- return type::Access::kReadWrite;
+ return builtin::Access::kReadWrite;
}
bool Resolver::AllocateOverridableConstantIds() {
@@ -1507,7 +1507,8 @@
return sem_.AsTexelFormat(Expression(expr));
}
-sem::BuiltinEnumExpression<type::Access>* Resolver::AccessExpression(const ast::Expression* expr) {
+sem::BuiltinEnumExpression<builtin::Access>* Resolver::AccessExpression(
+ const ast::Expression* expr) {
return sem_.AsAccess(Expression(expr));
}
@@ -2027,7 +2028,7 @@
static_cast<uint32_t>(i), // index
arr->ElemType(), // type
type::AddressSpace::kUndefined, // address_space
- type::Access::kUndefined);
+ builtin::Access::kUndefined);
});
return builder_->create<sem::TypeInitializer>(arr, std::move(params),
args_stage);
@@ -2056,7 +2057,7 @@
static_cast<uint32_t>(i), // index
str->Members()[i]->Type(), // type
type::AddressSpace::kUndefined, // address_space
- type::Access::kUndefined); // access
+ builtin::Access::kUndefined); // access
}
return builder_->create<sem::TypeInitializer>(str, std::move(params),
args_stage);
@@ -2976,9 +2977,9 @@
return nullptr;
}
- if (auto access = resolved->Access(); access != type::Access::kUndefined) {
- return builder_->create<sem::BuiltinEnumExpression<type::Access>>(expr, current_statement_,
- access);
+ if (auto access = resolved->Access(); access != builtin::Access::kUndefined) {
+ return builder_->create<sem::BuiltinEnumExpression<builtin::Access>>(
+ expr, current_statement_, access);
}
if (auto addr = resolved->AddressSpace(); addr != type::AddressSpace::kUndefined) {
diff --git a/src/tint/resolver/resolver.h b/src/tint/resolver/resolver.h
index 003fa3d..4057f73 100644
--- a/src/tint/resolver/resolver.h
+++ b/src/tint/resolver/resolver.h
@@ -150,10 +150,10 @@
sem::BuiltinEnumExpression<type::TexelFormat>* TexelFormatExpression(
const ast::Expression* expr);
- /// @returns the call of Expression() cast to a sem::BuiltinEnumExpression<type::Access>*.
- /// If the sem::Expression is not a sem::BuiltinEnumExpression<type::Access>*, then an error
+ /// @returns the call of Expression() cast to a sem::BuiltinEnumExpression<builtin::Access>*.
+ /// If the sem::Expression is not a sem::BuiltinEnumExpression<builtin::Access>*, then an error
/// diagnostic is raised and nullptr is returned.
- sem::BuiltinEnumExpression<type::Access>* AccessExpression(const ast::Expression* expr);
+ sem::BuiltinEnumExpression<builtin::Access>* AccessExpression(const ast::Expression* expr);
/// Expression traverses the graph of expressions starting at `expr`, building a post-ordered
/// list (leaf-first) of all the expression nodes. Each of the expressions are then resolved by
@@ -405,7 +405,7 @@
/// @param address_space the address space
/// @returns the default access control for the given address space
- type::Access DefaultAccessForAddressSpace(type::AddressSpace address_space);
+ builtin::Access DefaultAccessForAddressSpace(type::AddressSpace address_space);
/// Allocate constant IDs for pipeline-overridable constants.
/// @returns true on success, false on error
diff --git a/src/tint/resolver/resolver_test.cc b/src/tint/resolver/resolver_test.cc
index c926f7a..1d14498 100644
--- a/src/tint/resolver/resolver_test.cc
+++ b/src/tint/resolver/resolver_test.cc
@@ -921,7 +921,7 @@
auto* s = Structure("S", utils::Vector{Member("m", ty.u32())});
auto* sb_var = GlobalVar("sb_var", ty.Of(s), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* wg_var = GlobalVar("wg_var", ty.f32(), type::AddressSpace::kWorkgroup);
auto* priv_var = GlobalVar("priv_var", ty.f32(), type::AddressSpace::kPrivate);
@@ -989,7 +989,7 @@
auto* s = Structure("S", utils::Vector{Member("m", ty.u32())});
auto* sb_var = GlobalVar("sb_var", ty.Of(s), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* wg_var = GlobalVar("wg_var", ty.f32(), type::AddressSpace::kWorkgroup);
auto* priv_var = GlobalVar("priv_var", ty.f32(), type::AddressSpace::kPrivate);
@@ -1913,7 +1913,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_EQ(Sem().Get(var)->Access(), type::Access::kRead);
+ EXPECT_EQ(Sem().Get(var)->Access(), builtin::Access::kRead);
}
TEST_F(ResolverTest, BindingPoint_SetForResources) {
diff --git a/src/tint/resolver/resolver_test_helper.h b/src/tint/resolver/resolver_test_helper.h
index 67d71b8..7f68f25 100644
--- a/src/tint/resolver/resolver_test_helper.h
+++ b/src/tint/resolver/resolver_test_helper.h
@@ -629,13 +629,13 @@
/// @return a new AST alias type
static inline ast::Type AST(ProgramBuilder& b) {
return b.ty.pointer(DataType<T>::AST(b), type::AddressSpace::kPrivate,
- type::Access::kUndefined);
+ builtin::Access::kUndefined);
}
/// @param b the ProgramBuilder
/// @return the semantic aliased type
static inline const type::Type* Sem(ProgramBuilder& b) {
return b.create<type::Pointer>(DataType<T>::Sem(b), type::AddressSpace::kPrivate,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
}
/// @param b the ProgramBuilder
diff --git a/src/tint/resolver/sem_helper.cc b/src/tint/resolver/sem_helper.cc
index 01a737c..1515812 100644
--- a/src/tint/resolver/sem_helper.cc
+++ b/src/tint/resolver/sem_helper.cc
@@ -74,7 +74,7 @@
fn_expr->Declaration()->source);
NoteDeclarationSource(fn);
},
- [&](const sem::BuiltinEnumExpression<type::Access>* access) {
+ [&](const sem::BuiltinEnumExpression<builtin::Access>* access) {
AddError("cannot use access '" + utils::ToString(access->Value()) + "' as " +
std::string(wanted),
access->Declaration()->source);
diff --git a/src/tint/resolver/sem_helper.h b/src/tint/resolver/sem_helper.h
index dd752d3..a1de91b 100644
--- a/src/tint/resolver/sem_helper.h
+++ b/src/tint/resolver/sem_helper.h
@@ -135,11 +135,11 @@
/// @param expr the semantic node
/// @returns nullptr if @p expr is nullptr, or @p expr cast to
- /// sem::BuiltinEnumExpression<type::Access> if the cast is successful, otherwise an error
+ /// sem::BuiltinEnumExpression<builtin::Access> if the cast is successful, otherwise an error
/// diagnostic is raised.
- sem::BuiltinEnumExpression<type::Access>* AsAccess(sem::Expression* expr) const {
+ sem::BuiltinEnumExpression<builtin::Access>* AsAccess(sem::Expression* expr) const {
if (TINT_LIKELY(expr)) {
- auto* enum_expr = expr->As<sem::BuiltinEnumExpression<type::Access>>();
+ auto* enum_expr = expr->As<sem::BuiltinEnumExpression<builtin::Access>>();
if (TINT_LIKELY(enum_expr)) {
return enum_expr;
}
diff --git a/src/tint/resolver/side_effects_test.cc b/src/tint/resolver/side_effects_test.cc
index 456b371..90fcdb9 100644
--- a/src/tint/resolver/side_effects_test.cc
+++ b/src/tint/resolver/side_effects_test.cc
@@ -179,8 +179,8 @@
GlobalVar("storage_arr", ty.array<f32>(), type::AddressSpace::kStorage, Group(0_a),
Binding(AInt(next_binding++)));
GlobalVar("workgroup_arr", ty.array<f32, 4>(), type::AddressSpace::kWorkgroup);
- GlobalVar("a", ty.atomic(ty.i32()), type::AddressSpace::kStorage, type::Access::kReadWrite,
- Group(0_a), Binding(AInt(next_binding++)));
+ GlobalVar("a", ty.atomic(ty.i32()), type::AddressSpace::kStorage,
+ tint::builtin::Access::kReadWrite, Group(0_a), Binding(AInt(next_binding++)));
if (c.pipeline_stage != ast::PipelineStage::kCompute) {
GlobalVar("t2d", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(0_a),
Binding(AInt(next_binding++)));
@@ -192,7 +192,7 @@
Group(0_a), Binding(AInt(next_binding++)));
GlobalVar("tstorage2d",
ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
- type::Access::kWrite),
+ tint::builtin::Access::kWrite),
Group(0_a), Binding(AInt(next_binding++)));
GlobalVar("s2d", ty.sampler(type::SamplerKind::kSampler), Group(0_a),
Binding(AInt(next_binding++)));
diff --git a/src/tint/resolver/struct_address_space_use_test.cc b/src/tint/resolver/struct_address_space_use_test.cc
index ae4e544..1b42e75 100644
--- a/src/tint/resolver/struct_address_space_use_test.cc
+++ b/src/tint/resolver/struct_address_space_use_test.cc
@@ -160,7 +160,7 @@
TEST_F(ResolverAddressSpaceUseTest, StructMultipleAddressSpaceUses) {
auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
GlobalVar("x", ty.Of(s), type::AddressSpace::kUniform, Binding(0_a), Group(0_a));
- GlobalVar("y", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("y", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
WrapInFunction(Var("g", ty.Of(s)));
diff --git a/src/tint/resolver/type_initializer_validation_test.cc b/src/tint/resolver/type_initializer_validation_test.cc
index dde1a2e..f269aa2 100644
--- a/src/tint/resolver/type_initializer_validation_test.cc
+++ b/src/tint/resolver/type_initializer_validation_test.cc
@@ -97,8 +97,9 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
auto* got = TypeOf(a_ident);
- auto* expected = create<type::Reference>(
- params.create_rhs_sem_type(*this), type::AddressSpace::kFunction, type::Access::kReadWrite);
+ auto* expected =
+ create<type::Reference>(params.create_rhs_sem_type(*this), type::AddressSpace::kFunction,
+ builtin::Access::kReadWrite);
ASSERT_EQ(got, expected) << "got: " << FriendlyName(got) << "\n"
<< "expected: " << FriendlyName(expected) << "\n";
}
@@ -151,8 +152,9 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
auto* got = TypeOf(a_ident);
- auto* expected = create<type::Reference>(
- params.create_rhs_sem_type(*this), type::AddressSpace::kFunction, type::Access::kReadWrite);
+ auto* expected =
+ create<type::Reference>(params.create_rhs_sem_type(*this), type::AddressSpace::kFunction,
+ builtin::Access::kReadWrite);
ASSERT_EQ(got, expected) << "got: " << FriendlyName(got) << "\n"
<< "expected: " << FriendlyName(expected) << "\n";
}
@@ -199,8 +201,9 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
auto* got = TypeOf(a_ident);
- auto* expected = create<type::Reference>(
- params.create_rhs_sem_type(*this), type::AddressSpace::kFunction, type::Access::kReadWrite);
+ auto* expected =
+ create<type::Reference>(params.create_rhs_sem_type(*this), type::AddressSpace::kFunction,
+ builtin::Access::kReadWrite);
ASSERT_EQ(got, expected) << "got: " << FriendlyName(got) << "\n"
<< "expected: " << FriendlyName(expected) << "\n";
}
diff --git a/src/tint/resolver/type_validation_test.cc b/src/tint/resolver/type_validation_test.cc
index efc55f0..8559b9a 100644
--- a/src/tint/resolver/type_validation_test.cc
+++ b/src/tint/resolver/type_validation_test.cc
@@ -1066,7 +1066,7 @@
auto& params = GetParam();
auto st = ty(Source{{12, 34}}, params.name, utils::ToString(type::TexelFormat::kR32Uint),
- utils::ToString(type::Access::kWrite));
+ utils::ToString(builtin::Access::kWrite));
GlobalVar("a", st, Group(0_a), Binding(0_a));
@@ -1117,19 +1117,19 @@
// var d : texture_storage_3d<*, write>;
auto st_a = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d, params.format,
- type::Access::kWrite);
+ builtin::Access::kWrite);
GlobalVar("a", st_a, Group(0_a), Binding(0_a));
ast::Type st_b =
- ty.storage_texture(type::TextureDimension::k2d, params.format, type::Access::kWrite);
+ ty.storage_texture(type::TextureDimension::k2d, params.format, builtin::Access::kWrite);
GlobalVar("b", st_b, Group(0_a), Binding(1_a));
- ast::Type st_c =
- ty.storage_texture(type::TextureDimension::k2dArray, params.format, type::Access::kWrite);
+ ast::Type st_c = ty.storage_texture(type::TextureDimension::k2dArray, params.format,
+ builtin::Access::kWrite);
GlobalVar("c", st_c, Group(0_a), Binding(2_a));
ast::Type st_d =
- ty.storage_texture(type::TextureDimension::k3d, params.format, type::Access::kWrite);
+ ty.storage_texture(type::TextureDimension::k3d, params.format, builtin::Access::kWrite);
GlobalVar("d", st_d, Group(0_a), Binding(3_a));
if (params.is_valid) {
@@ -1176,7 +1176,7 @@
// var a : texture_storage_1d<r32uint, read_write>;
auto st = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d,
- type::TexelFormat::kR32Uint, type::Access::kReadWrite);
+ type::TexelFormat::kR32Uint, builtin::Access::kReadWrite);
GlobalVar("a", st, Group(0_a), Binding(0_a));
@@ -1190,7 +1190,7 @@
// var a : texture_storage_1d<r32uint, read>;
auto st = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d,
- type::TexelFormat::kR32Uint, type::Access::kRead);
+ type::TexelFormat::kR32Uint, builtin::Access::kRead);
GlobalVar("a", st, Group(0_a), Binding(0_a));
@@ -1204,7 +1204,7 @@
// var a : texture_storage_1d<r32uint, write>;
auto st = ty.storage_texture(type::TextureDimension::k1d, type::TexelFormat::kR32Uint,
- type::Access::kWrite);
+ builtin::Access::kWrite);
GlobalVar("a", st, Group(0_a), Binding(0_a));
diff --git a/src/tint/resolver/uniformity.cc b/src/tint/resolver/uniformity.cc
index 61e0dad..1fe67c8 100644
--- a/src/tint/resolver/uniformity.cc
+++ b/src/tint/resolver/uniformity.cc
@@ -1211,7 +1211,7 @@
[&](const sem::GlobalVariable* global) {
// Loads from global read-write variables may be non-uniform.
if (global->Declaration()->Is<ast::Var>() &&
- global->Access() != type::Access::kRead && load_rule) {
+ global->Access() != builtin::Access::kRead && load_rule) {
node->AddEdge(current_function_->may_be_non_uniform);
} else {
node->AddEdge(cf);
@@ -1228,7 +1228,7 @@
// We are loading from the pointer, so add an edge to its contents.
auto* root = var_user->RootIdentifier();
if (root->Is<sem::GlobalVariable>()) {
- if (root->Access() != type::Access::kRead) {
+ if (root->Access() != builtin::Access::kRead) {
// The contents of a mutable global variable is always non-uniform.
node->AddEdge(current_function_->may_be_non_uniform);
}
@@ -1473,7 +1473,7 @@
auto* root = sem_arg->RootIdentifier();
if (root->Is<sem::GlobalVariable>()) {
- if (root->Access() != type::Access::kRead) {
+ if (root->Access() != builtin::Access::kRead) {
// The contents of a mutable global variable is always non-uniform.
arg_contents->AddEdge(current_function_->may_be_non_uniform);
}
diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc
index 2935c70..c7f790b 100644
--- a/src/tint/resolver/validator.cc
+++ b/src/tint/resolver/validator.cc
@@ -311,9 +311,9 @@
bool Validator::StorageTexture(const type::StorageTexture* t, const Source& source) const {
switch (t->access()) {
- case type::Access::kWrite:
+ case builtin::Access::kWrite:
break;
- case type::Access::kUndefined:
+ case builtin::Access::kUndefined:
AddError("storage texture missing access control", source);
return false;
default:
@@ -2373,7 +2373,7 @@
AddError("storage type of assignment must be constructible", a->source);
return false;
}
- if (lhs_ref->Access() == type::Access::kRead) {
+ if (lhs_ref->Access() == builtin::Access::kRead) {
AddError("cannot store into a read-only type '" + sem_.RawTypeNameOf(lhs_ty) + "'",
a->source);
return false;
@@ -2414,7 +2414,7 @@
return false;
}
- if (lhs_ref->Access() == type::Access::kRead) {
+ if (lhs_ref->Access() == builtin::Access::kRead) {
AddError("cannot modify read-only type '" + sem_.RawTypeNameOf(lhs_ty) + "'", inc->source);
return false;
}
@@ -2505,7 +2505,7 @@
bool Validator::CheckTypeAccessAddressSpace(
const type::Type* store_ty,
- type::Access access,
+ builtin::Access access,
type::AddressSpace address_space,
utils::VectorRef<const tint::ast::Attribute*> attributes,
const Source& source) const {
@@ -2523,7 +2523,7 @@
return false;
}
- if (address_space == type::AddressSpace::kStorage && access == type::Access::kWrite) {
+ if (address_space == type::AddressSpace::kStorage && access == builtin::Access::kWrite) {
// The access mode for the storage address space can only be 'read' or
// 'read_write'.
AddError("access mode 'write' is not valid for the 'storage' address space", source);
@@ -2535,7 +2535,8 @@
address_space != type::AddressSpace::kWorkgroup) {
return "atomic variables must have <storage> or <workgroup> address space";
}
- if (address_space == type::AddressSpace::kStorage && access != type::Access::kReadWrite) {
+ if (address_space == type::AddressSpace::kStorage &&
+ access != builtin::Access::kReadWrite) {
return "atomic variables in <storage> address space must have read_write access "
"mode";
}
diff --git a/src/tint/resolver/validator.h b/src/tint/resolver/validator.h
index 499dcda..55be986 100644
--- a/src/tint/resolver/validator.h
+++ b/src/tint/resolver/validator.h
@@ -542,7 +542,7 @@
/// @param source the source for the error
/// @returns true on success, false if an error was raised.
bool CheckTypeAccessAddressSpace(const type::Type* store_ty,
- type::Access access,
+ builtin::Access access,
type::AddressSpace address_space,
utils::VectorRef<const tint::ast::Attribute*> attributes,
const Source& source) const;
diff --git a/src/tint/resolver/validator_is_storeable_test.cc b/src/tint/resolver/validator_is_storeable_test.cc
index 6c1fce4..558953e 100644
--- a/src/tint/resolver/validator_is_storeable_test.cc
+++ b/src/tint/resolver/validator_is_storeable_test.cc
@@ -79,7 +79,7 @@
TEST_F(ValidatorIsStorableTest, Pointer) {
auto* ptr = create<type::Pointer>(create<type::I32>(), type::AddressSpace::kPrivate,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_FALSE(v()->IsStorable(ptr));
}
diff --git a/src/tint/resolver/variable_test.cc b/src/tint/resolver/variable_test.cc
index 2239945..dbfc94f 100644
--- a/src/tint/resolver/variable_test.cc
+++ b/src/tint/resolver/variable_test.cc
@@ -149,12 +149,12 @@
ASSERT_TRUE(TypeOf(s)->Is<type::Reference>());
ASSERT_TRUE(TypeOf(a)->Is<type::Reference>());
- EXPECT_EQ(TypeOf(i)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(u)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(f)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(b)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(s)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(a)->As<type::Reference>()->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(i)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(u)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(f)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(b)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(s)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(a)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
EXPECT_TRUE(TypeOf(i)->As<type::Reference>()->StoreType()->Is<type::I32>());
EXPECT_TRUE(TypeOf(u)->As<type::Reference>()->StoreType()->Is<type::U32>());
@@ -473,7 +473,7 @@
auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array<i32, 4>())});
auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))});
auto* storage = GlobalVar("s", ty.Of(buf), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(0_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 3_i);
auto* ptr = Let("p", AddressOf(expr));
@@ -485,8 +485,8 @@
ASSERT_TRUE(TypeOf(expr)->Is<type::Reference>());
ASSERT_TRUE(TypeOf(ptr)->Is<type::Pointer>());
- EXPECT_EQ(TypeOf(expr)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(ptr)->As<type::Pointer>()->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(expr)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(ptr)->As<type::Pointer>()->Access(), builtin::Access::kReadWrite);
}
TEST_F(ResolverVariableTest, LocalLet_ShadowsAlias) {
@@ -1054,11 +1054,11 @@
ASSERT_TRUE(TypeOf(storage)->Is<type::Reference>());
ASSERT_TRUE(TypeOf(handle)->Is<type::Reference>());
- EXPECT_EQ(TypeOf(private_)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(workgroup)->As<type::Reference>()->Access(), type::Access::kReadWrite);
- EXPECT_EQ(TypeOf(uniform)->As<type::Reference>()->Access(), type::Access::kRead);
- EXPECT_EQ(TypeOf(storage)->As<type::Reference>()->Access(), type::Access::kRead);
- EXPECT_EQ(TypeOf(handle)->As<type::Reference>()->Access(), type::Access::kRead);
+ EXPECT_EQ(TypeOf(private_)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(workgroup)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(uniform)->As<type::Reference>()->Access(), builtin::Access::kRead);
+ EXPECT_EQ(TypeOf(storage)->As<type::Reference>()->Access(), builtin::Access::kRead);
+ EXPECT_EQ(TypeOf(handle)->As<type::Reference>()->Access(), builtin::Access::kRead);
}
TEST_F(ResolverVariableTest, GlobalVar_ExplicitAddressSpace) {
@@ -1066,13 +1066,13 @@
auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())});
auto* storage = GlobalVar("sb", ty.Of(buf), type::AddressSpace::kStorage,
- type::Access::kReadWrite, Binding(1_a), Group(0_a));
+ builtin::Access::kReadWrite, Binding(1_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
ASSERT_TRUE(TypeOf(storage)->Is<type::Reference>());
- EXPECT_EQ(TypeOf(storage)->As<type::Reference>()->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(TypeOf(storage)->As<type::Reference>()->Access(), builtin::Access::kReadWrite);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/tint/resolver/variable_validation_test.cc b/src/tint/resolver/variable_validation_test.cc
index 3898d15..1d0837d 100644
--- a/src/tint/resolver/variable_validation_test.cc
+++ b/src/tint/resolver/variable_validation_test.cc
@@ -299,7 +299,7 @@
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i);
auto* ptr = Let(Source{{12, 34}}, "p",
- ty.pointer<i32>(type::AddressSpace::kStorage, type::Access::kReadWrite),
+ ty.pointer<i32>(type::AddressSpace::kStorage, builtin::Access::kReadWrite),
AddressOf(expr));
WrapInFunction(ptr);
diff --git a/src/tint/sem/variable.cc b/src/tint/sem/variable.cc
index 6dc327d..e3f5f75 100644
--- a/src/tint/sem/variable.cc
+++ b/src/tint/sem/variable.cc
@@ -32,7 +32,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const constant::Value* constant_value)
: declaration_(declaration),
type_(type),
@@ -47,7 +47,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const sem::Statement* statement,
const constant::Value* constant_value)
: Base(declaration, type, stage, address_space, access, constant_value),
@@ -59,7 +59,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const constant::Value* constant_value,
sem::BindingPoint binding_point,
std::optional<uint32_t> location)
@@ -73,7 +73,7 @@
uint32_t index,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const ParameterUsage usage /* = ParameterUsage::kNone */,
sem::BindingPoint binding_point /* = {} */,
std::optional<uint32_t> location /* = std::nullopt */)
diff --git a/src/tint/sem/variable.h b/src/tint/sem/variable.h
index afaa0d1..fcaf145 100644
--- a/src/tint/sem/variable.h
+++ b/src/tint/sem/variable.h
@@ -22,10 +22,10 @@
#include "tint/override_id.h"
#include "src/tint/ast/parameter.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/sem/binding_point.h"
#include "src/tint/sem/parameter_usage.h"
#include "src/tint/sem/value_expression.h"
-#include "src/tint/type/access.h"
#include "src/tint/type/address_space.h"
#include "src/tint/type/type.h"
#include "src/tint/utils/unique_vector.h"
@@ -58,7 +58,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const constant::Value* constant_value);
/// Destructor
@@ -77,7 +77,7 @@
type::AddressSpace AddressSpace() const { return address_space_; }
/// @returns the access control for the variable
- type::Access Access() const { return access_; }
+ builtin::Access Access() const { return access_; }
/// @return the constant value of this expression
const constant::Value* ConstantValue() const { return constant_value_; }
@@ -101,7 +101,7 @@
const type::Type* const type_;
const EvaluationStage stage_;
const type::AddressSpace address_space_;
- const type::Access access_;
+ const builtin::Access access_;
const constant::Value* constant_value_;
const ValueExpression* initializer_ = nullptr;
std::vector<const VariableUser*> users_;
@@ -122,7 +122,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const sem::Statement* statement,
const constant::Value* constant_value);
@@ -163,7 +163,7 @@
const type::Type* type,
EvaluationStage stage,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const constant::Value* constant_value,
sem::BindingPoint binding_point = {},
std::optional<uint32_t> location = std::nullopt);
@@ -206,7 +206,7 @@
uint32_t index,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const ParameterUsage usage = ParameterUsage::kNone,
sem::BindingPoint binding_point = {},
std::optional<uint32_t> location = std::nullopt);
diff --git a/src/tint/transform/binding_remapper.cc b/src/tint/transform/binding_remapper.cc
index 192b2c9..e4f2e6e 100644
--- a/src/tint/transform/binding_remapper.cc
+++ b/src/tint/transform/binding_remapper.cc
@@ -122,8 +122,8 @@
// Replace any access controls.
auto ac_it = remappings->access_controls.find(from);
if (ac_it != remappings->access_controls.end()) {
- type::Access access = ac_it->second;
- if (access == type::Access::kUndefined) {
+ builtin::Access access = ac_it->second;
+ if (access == builtin::Access::kUndefined) {
b.Diagnostics().add_error(diag::System::Transform,
"invalid access mode (" +
std::to_string(static_cast<uint32_t>(access)) +
diff --git a/src/tint/transform/binding_remapper.h b/src/tint/transform/binding_remapper.h
index e0f48b3..8fdba2a 100644
--- a/src/tint/transform/binding_remapper.h
+++ b/src/tint/transform/binding_remapper.h
@@ -17,9 +17,9 @@
#include <unordered_map>
+#include "src/tint/builtin/access.h"
#include "src/tint/sem/binding_point.h"
#include "src/tint/transform/transform.h"
-#include "src/tint/type/access.h"
namespace tint::transform {
@@ -34,7 +34,7 @@
using BindingPoints = std::unordered_map<BindingPoint, BindingPoint>;
/// AccessControls is a map of old binding point to new access control
- using AccessControls = std::unordered_map<BindingPoint, type::Access>;
+ using AccessControls = std::unordered_map<BindingPoint, builtin::Access>;
/// Remappings is consumed by the BindingRemapper transform.
/// Data holds information about shader usage and constant buffer offsets.
diff --git a/src/tint/transform/binding_remapper_test.cc b/src/tint/transform/binding_remapper_test.cc
index 5bed528..b4b7b29 100644
--- a/src/tint/transform/binding_remapper_test.cc
+++ b/src/tint/transform/binding_remapper_test.cc
@@ -52,7 +52,7 @@
DataMap data;
data.Add<BindingRemapper::Remappings>(BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{
- {{2, 1}, type::Access::kWrite},
+ {{2, 1}, builtin::Access::kWrite},
});
EXPECT_TRUE(ShouldRun<BindingRemapper>(src, data));
@@ -162,9 +162,9 @@
data.Add<BindingRemapper::Remappings>(
BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{
- {{2, 1}, type::Access::kReadWrite}, // Modify access control
+ {{2, 1}, builtin::Access::kReadWrite}, // Modify access control
// Keep @group(3) @binding(2) as is
- {{4, 3}, type::Access::kRead}, // Add access control
+ {{4, 3}, builtin::Access::kRead}, // Add access control
});
auto got = Run<BindingRemapper>(src, data);
@@ -207,8 +207,8 @@
{{3, 2}, {6, 7}},
},
BindingRemapper::AccessControls{
- {{2, 1}, type::Access::kReadWrite},
- {{3, 2}, type::Access::kReadWrite},
+ {{2, 1}, builtin::Access::kReadWrite},
+ {{3, 2}, builtin::Access::kReadWrite},
});
auto got = Run<BindingRemapper>(src, data);
diff --git a/src/tint/transform/decompose_memory_access.cc b/src/tint/transform/decompose_memory_access.cc
index 072c9c6..47cefcf 100644
--- a/src/tint/transform/decompose_memory_access.cc
+++ b/src/tint/transform/decompose_memory_access.cc
@@ -109,7 +109,7 @@
/// LoadStoreKey is the unordered map key to a load or store intrinsic.
struct LoadStoreKey {
type::AddressSpace const address_space; // buffer address space
- type::Access const access; // buffer access
+ builtin::Access const access; // buffer access
type::Type const* buf_ty = nullptr; // buffer type
type::Type const* el_ty = nullptr; // element type
bool operator==(const LoadStoreKey& rhs) const {
@@ -125,7 +125,7 @@
/// AtomicKey is the unordered map key to an atomic intrinsic.
struct AtomicKey {
- type::Access const access; // buffer access
+ builtin::Access const access; // buffer access
type::Type const* buf_ty = nullptr; // buffer type
type::Type const* el_ty = nullptr; // element type
sem::BuiltinType const op; // atomic op
@@ -466,7 +466,7 @@
auto address_space = var_user->Variable()->AddressSpace();
auto access = var_user->Variable()->Access();
if (address_space != type::AddressSpace::kStorage) {
- access = type::Access::kUndefined;
+ access = builtin::Access::kUndefined;
}
return utils::GetOrCreate(
load_funcs, LoadStoreKey{address_space, access, buf_ty, el_ty}, [&] {
@@ -562,7 +562,7 @@
auto address_space = var_user->Variable()->AddressSpace();
auto access = var_user->Variable()->Access();
if (address_space != type::AddressSpace::kStorage) {
- access = type::Access::kUndefined;
+ access = builtin::Access::kUndefined;
}
return utils::GetOrCreate(
store_funcs, LoadStoreKey{address_space, access, buf_ty, el_ty}, [&] {
@@ -672,7 +672,7 @@
auto address_space = var_user->Variable()->AddressSpace();
auto access = var_user->Variable()->Access();
if (address_space != type::AddressSpace::kStorage) {
- access = type::Access::kUndefined;
+ access = builtin::Access::kUndefined;
}
return utils::GetOrCreate(atomic_funcs, AtomicKey{access, buf_ty, el_ty, op}, [&] {
// The first parameter to all WGSL atomics is the expression to the
diff --git a/src/tint/transform/decompose_strided_array_test.cc b/src/tint/transform/decompose_strided_array_test.cc
index 72bc1b1..bd4b49f 100644
--- a/src/tint/transform/decompose_strided_array_test.cc
+++ b/src/tint/transform/decompose_strided_array_test.cc
@@ -396,7 +396,7 @@
auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
b.Stride(32),
}))});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -458,7 +458,7 @@
b.Stride(4),
})),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -516,7 +516,7 @@
auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
b.Stride(32),
}))});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -582,7 +582,7 @@
b.Stride(32),
}));
auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty("ARR"))});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -658,7 +658,7 @@
b.Stride(128),
}));
auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty("ARR_B"))});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
diff --git a/src/tint/transform/decompose_strided_matrix_test.cc b/src/tint/transform/decompose_strided_matrix_test.cc
index e097acb..0da9e71 100644
--- a/src/tint/transform/decompose_strided_matrix_test.cc
+++ b/src/tint/transform/decompose_strided_matrix_test.cc
@@ -241,7 +241,7 @@
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
}),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -299,7 +299,7 @@
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
}),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func(
"f", utils::Empty, b.ty.void_(),
@@ -354,7 +354,7 @@
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
}),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -413,7 +413,7 @@
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
}),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
@@ -473,7 +473,7 @@
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
}),
});
- b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("s", b.ty.Of(S), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func("f", utils::Empty, b.ty.void_(),
utils::Vector{
diff --git a/src/tint/transform/preserve_padding.cc b/src/tint/transform/preserve_padding.cc
index ba30933..1dbd2af 100644
--- a/src/tint/transform/preserve_padding.cc
+++ b/src/tint/transform/preserve_padding.cc
@@ -121,7 +121,7 @@
utils::Vector<const ast::Parameter*, 2> params = {
b.Param(kDestParamName,
b.ty.pointer(CreateASTTypeFor(ctx, ty), type::AddressSpace::kStorage,
- type::Access::kReadWrite)),
+ builtin::Access::kReadWrite)),
b.Param(kValueParamName, CreateASTTypeFor(ctx, ty)),
};
b.Func(helper_name, params, b.ty.void_(), body());
diff --git a/src/tint/transform/promote_side_effects_to_decl.cc b/src/tint/transform/promote_side_effects_to_decl.cc
index 15f4674..65ec731 100644
--- a/src/tint/transform/promote_side_effects_to_decl.cc
+++ b/src/tint/transform/promote_side_effects_to_decl.cc
@@ -284,7 +284,7 @@
return false;
}
// Don't hoist read-only variables as they cannot receive side-effects.
- if (var_user->Variable()->Access() == type::Access::kRead) {
+ if (var_user->Variable()->Access() == builtin::Access::kRead) {
return false;
}
// Don't hoist textures / samplers as they can't be placed into a let, nor
diff --git a/src/tint/transform/renamer_test.cc b/src/tint/transform/renamer_test.cc
index 2d13436..d4b681c 100644
--- a/src/tint/transform/renamer_test.cc
+++ b/src/tint/transform/renamer_test.cc
@@ -1934,7 +1934,7 @@
for (auto* ident : type::kTexelFormatStrings) {
out.push_back(ident);
}
- for (auto* ident : type::kAccessStrings) {
+ for (auto* ident : builtin::kAccessStrings) {
out.push_back(ident);
}
return out;
diff --git a/src/tint/transform/vertex_pulling.cc b/src/tint/transform/vertex_pulling.cc
index 8d151bf..6a1b5b4 100644
--- a/src/tint/transform/vertex_pulling.cc
+++ b/src/tint/transform/vertex_pulling.cc
@@ -322,7 +322,8 @@
for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) {
// The decorated variable with struct type
b.GlobalVar(GetVertexBufferName(i), b.ty.Of(struct_type), type::AddressSpace::kStorage,
- type::Access::kRead, b.Binding(AInt(i)), b.Group(AInt(cfg.pulling_group)));
+ builtin::Access::kRead, b.Binding(AInt(i)),
+ b.Group(AInt(cfg.pulling_group)));
}
}
diff --git a/src/tint/type/pointer.cc b/src/tint/type/pointer.cc
index 3dcb078..1175961 100644
--- a/src/tint/type/pointer.cc
+++ b/src/tint/type/pointer.cc
@@ -24,14 +24,14 @@
namespace tint::type {
-Pointer::Pointer(const Type* subtype, type::AddressSpace address_space, type::Access access)
+Pointer::Pointer(const Type* subtype, type::AddressSpace address_space, builtin::Access access)
: Base(utils::Hash(TypeInfo::Of<Pointer>().full_hashcode, address_space, subtype, access),
type::Flags{}),
subtype_(subtype),
address_space_(address_space),
access_(access) {
TINT_ASSERT(Type, !subtype->Is<Reference>());
- TINT_ASSERT(Type, access != type::Access::kUndefined);
+ TINT_ASSERT(Type, access != builtin::Access::kUndefined);
}
bool Pointer::Equals(const UniqueNode& other) const {
diff --git a/src/tint/type/pointer.h b/src/tint/type/pointer.h
index 61eab76..8a4d1c9 100644
--- a/src/tint/type/pointer.h
+++ b/src/tint/type/pointer.h
@@ -17,7 +17,7 @@
#include <string>
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/type/address_space.h"
#include "src/tint/type/type.h"
@@ -30,7 +30,7 @@
/// @param subtype the pointee type
/// @param address_space the address space of the pointer
/// @param access the resolved access control of the reference
- Pointer(const Type* subtype, type::AddressSpace address_space, type::Access access);
+ Pointer(const Type* subtype, type::AddressSpace address_space, builtin::Access access);
/// Destructor
~Pointer() override;
@@ -46,7 +46,7 @@
type::AddressSpace AddressSpace() const { return address_space_; }
/// @returns the access control of the reference
- type::Access Access() const { return access_; }
+ builtin::Access Access() const { return access_; }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
@@ -60,7 +60,7 @@
private:
Type const* const subtype_;
type::AddressSpace const address_space_;
- type::Access const access_;
+ builtin::Access const access_;
};
} // namespace tint::type
diff --git a/src/tint/type/pointer_test.cc b/src/tint/type/pointer_test.cc
index a0c8bbb..932548a 100644
--- a/src/tint/type/pointer_test.cc
+++ b/src/tint/type/pointer_test.cc
@@ -21,15 +21,15 @@
using PointerTest = TestHelper;
TEST_F(PointerTest, Creation) {
- auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* c = create<Pointer>(create<F32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* d = create<Pointer>(create<I32>(), AddressSpace::kPrivate, type::Access::kReadWrite);
- auto* e = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kRead);
+ auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* c = create<Pointer>(create<F32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* d = create<Pointer>(create<I32>(), AddressSpace::kPrivate, builtin::Access::kReadWrite);
+ auto* e = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kRead);
EXPECT_TRUE(a->StoreType()->Is<I32>());
EXPECT_EQ(a->AddressSpace(), AddressSpace::kStorage);
- EXPECT_EQ(a->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(a->Access(), builtin::Access::kReadWrite);
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
@@ -38,18 +38,18 @@
}
TEST_F(PointerTest, Hash) {
- auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
+ auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
EXPECT_EQ(a->unique_hash, b->unique_hash);
}
TEST_F(PointerTest, Equals) {
- auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* c = create<Pointer>(create<F32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* d = create<Pointer>(create<I32>(), AddressSpace::kPrivate, type::Access::kReadWrite);
- auto* e = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kRead);
+ auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* c = create<Pointer>(create<F32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* d = create<Pointer>(create<I32>(), AddressSpace::kPrivate, builtin::Access::kReadWrite);
+ auto* e = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kRead);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
@@ -59,17 +59,17 @@
}
TEST_F(PointerTest, FriendlyName) {
- auto* r = create<Pointer>(create<I32>(), AddressSpace::kUndefined, type::Access::kRead);
+ auto* r = create<Pointer>(create<I32>(), AddressSpace::kUndefined, builtin::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<i32, read>");
}
TEST_F(PointerTest, FriendlyNameWithAddressSpace) {
- auto* r = create<Pointer>(create<I32>(), AddressSpace::kWorkgroup, type::Access::kRead);
+ auto* r = create<Pointer>(create<I32>(), AddressSpace::kWorkgroup, builtin::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<workgroup, i32, read>");
}
TEST_F(PointerTest, Clone) {
- auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
+ auto* a = create<Pointer>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
type::Manager mgr;
type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
@@ -77,7 +77,7 @@
auto* ptr = a->Clone(ctx);
EXPECT_TRUE(ptr->StoreType()->Is<I32>());
EXPECT_EQ(ptr->AddressSpace(), AddressSpace::kStorage);
- EXPECT_EQ(ptr->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(ptr->Access(), builtin::Access::kReadWrite);
}
} // namespace
diff --git a/src/tint/type/reference.cc b/src/tint/type/reference.cc
index 6a7e2c6..ca676cc 100644
--- a/src/tint/type/reference.cc
+++ b/src/tint/type/reference.cc
@@ -23,14 +23,14 @@
namespace tint::type {
-Reference::Reference(const Type* subtype, type::AddressSpace address_space, type::Access access)
+Reference::Reference(const Type* subtype, type::AddressSpace address_space, builtin::Access access)
: Base(utils::Hash(TypeInfo::Of<Reference>().full_hashcode, address_space, subtype, access),
type::Flags{}),
subtype_(subtype),
address_space_(address_space),
access_(access) {
TINT_ASSERT(Type, !subtype->Is<Reference>());
- TINT_ASSERT(Type, access != type::Access::kUndefined);
+ TINT_ASSERT(Type, access != builtin::Access::kUndefined);
}
bool Reference::Equals(const UniqueNode& other) const {
diff --git a/src/tint/type/reference.h b/src/tint/type/reference.h
index 1999880..b1981ab 100644
--- a/src/tint/type/reference.h
+++ b/src/tint/type/reference.h
@@ -17,7 +17,7 @@
#include <string>
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/type/address_space.h"
#include "src/tint/type/type.h"
@@ -30,7 +30,7 @@
/// @param subtype the pointee type
/// @param address_space the address space of the reference
/// @param access the resolved access control of the reference
- Reference(const Type* subtype, type::AddressSpace address_space, type::Access access);
+ Reference(const Type* subtype, type::AddressSpace address_space, builtin::Access access);
/// Destructor
~Reference() override;
@@ -46,7 +46,7 @@
type::AddressSpace AddressSpace() const { return address_space_; }
/// @returns the resolved access control of the reference.
- type::Access Access() const { return access_; }
+ builtin::Access Access() const { return access_; }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
@@ -60,7 +60,7 @@
private:
Type const* const subtype_;
type::AddressSpace const address_space_;
- type::Access const access_;
+ builtin::Access const access_;
};
} // namespace tint::type
diff --git a/src/tint/type/reference_test.cc b/src/tint/type/reference_test.cc
index ceee77f..65dde2b 100644
--- a/src/tint/type/reference_test.cc
+++ b/src/tint/type/reference_test.cc
@@ -21,15 +21,15 @@
using ReferenceTest = TestHelper;
TEST_F(ReferenceTest, Creation) {
- auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* c = create<Reference>(create<F32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* d = create<Reference>(create<I32>(), AddressSpace::kPrivate, type::Access::kReadWrite);
- auto* e = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kRead);
+ auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* c = create<Reference>(create<F32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* d = create<Reference>(create<I32>(), AddressSpace::kPrivate, builtin::Access::kReadWrite);
+ auto* e = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kRead);
EXPECT_TRUE(a->StoreType()->Is<I32>());
EXPECT_EQ(a->AddressSpace(), AddressSpace::kStorage);
- EXPECT_EQ(a->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(a->Access(), builtin::Access::kReadWrite);
EXPECT_EQ(a, b);
EXPECT_NE(a, c);
@@ -38,18 +38,18 @@
}
TEST_F(ReferenceTest, Hash) {
- auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
+ auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
EXPECT_EQ(a->unique_hash, b->unique_hash);
}
TEST_F(ReferenceTest, Equals) {
- auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* c = create<Reference>(create<F32>(), AddressSpace::kStorage, type::Access::kReadWrite);
- auto* d = create<Reference>(create<I32>(), AddressSpace::kPrivate, type::Access::kReadWrite);
- auto* e = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kRead);
+ auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* b = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* c = create<Reference>(create<F32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
+ auto* d = create<Reference>(create<I32>(), AddressSpace::kPrivate, builtin::Access::kReadWrite);
+ auto* e = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kRead);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
@@ -59,17 +59,17 @@
}
TEST_F(ReferenceTest, FriendlyName) {
- auto* r = create<Reference>(create<I32>(), AddressSpace::kUndefined, type::Access::kRead);
+ auto* r = create<Reference>(create<I32>(), AddressSpace::kUndefined, builtin::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<i32, read>");
}
TEST_F(ReferenceTest, FriendlyNameWithAddressSpace) {
- auto* r = create<Reference>(create<I32>(), AddressSpace::kWorkgroup, type::Access::kRead);
+ auto* r = create<Reference>(create<I32>(), AddressSpace::kWorkgroup, builtin::Access::kRead);
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<workgroup, i32, read>");
}
TEST_F(ReferenceTest, Clone) {
- auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, type::Access::kReadWrite);
+ auto* a = create<Reference>(create<I32>(), AddressSpace::kStorage, builtin::Access::kReadWrite);
type::Manager mgr;
type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
@@ -77,7 +77,7 @@
auto* ref = a->Clone(ctx);
EXPECT_TRUE(ref->StoreType()->Is<I32>());
EXPECT_EQ(ref->AddressSpace(), AddressSpace::kStorage);
- EXPECT_EQ(ref->Access(), type::Access::kReadWrite);
+ EXPECT_EQ(ref->Access(), builtin::Access::kReadWrite);
}
} // namespace
diff --git a/src/tint/type/storage_texture.cc b/src/tint/type/storage_texture.cc
index 25beb74..c7fede4 100644
--- a/src/tint/type/storage_texture.cc
+++ b/src/tint/type/storage_texture.cc
@@ -26,7 +26,7 @@
StorageTexture::StorageTexture(TextureDimension dim,
type::TexelFormat format,
- type::Access access,
+ builtin::Access access,
Type* subtype)
: Base(utils::Hash(TypeInfo::Of<StorageTexture>().full_hashcode, dim, format, access), dim),
texel_format_(format),
diff --git a/src/tint/type/storage_texture.h b/src/tint/type/storage_texture.h
index 6e96907..62086ee 100644
--- a/src/tint/type/storage_texture.h
+++ b/src/tint/type/storage_texture.h
@@ -17,7 +17,7 @@
#include <string>
-#include "src/tint/type/access.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/type/texel_format.h"
#include "src/tint/type/texture.h"
#include "src/tint/type/texture_dimension.h"
@@ -39,7 +39,7 @@
/// @param subtype the storage subtype. Use SubtypeFor() to calculate this.
StorageTexture(TextureDimension dim,
type::TexelFormat format,
- type::Access access,
+ builtin::Access access,
Type* subtype);
/// Destructor
@@ -56,7 +56,7 @@
type::TexelFormat texel_format() const { return texel_format_; }
/// @returns the access control
- type::Access access() const { return access_; }
+ builtin::Access access() const { return access_; }
/// @param symbols the program's symbol table
/// @returns the name for this type that closely resembles how it would be
@@ -74,7 +74,7 @@
private:
type::TexelFormat const texel_format_;
- type::Access const access_;
+ builtin::Access const access_;
Type* const subtype_;
};
diff --git a/src/tint/type/storage_texture_test.cc b/src/tint/type/storage_texture_test.cc
index 2ffc0b7..9a1b8c6 100644
--- a/src/tint/type/storage_texture_test.cc
+++ b/src/tint/type/storage_texture_test.cc
@@ -24,22 +24,23 @@
namespace {
struct StorageTextureTest : public TestHelper {
- StorageTexture* Create(TextureDimension dims, type::TexelFormat fmt, type::Access access) {
+ StorageTexture* Create(TextureDimension dims, type::TexelFormat fmt, builtin::Access access) {
auto* subtype = StorageTexture::SubtypeFor(fmt, Types());
return create<StorageTexture>(dims, fmt, access, subtype);
}
};
TEST_F(StorageTextureTest, Creation) {
- auto* a =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
- auto* b =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ auto* a = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
+ auto* b = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
auto* c =
- Create(TextureDimension::k2d, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ Create(TextureDimension::k2d, type::TexelFormat::kRgba32Float, builtin::Access::kReadWrite);
auto* d =
- Create(TextureDimension::kCube, type::TexelFormat::kR32Float, type::Access::kReadWrite);
- auto* e = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kRead);
+ Create(TextureDimension::kCube, type::TexelFormat::kR32Float, builtin::Access::kReadWrite);
+ auto* e =
+ Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, builtin::Access::kRead);
EXPECT_TRUE(a->type()->Is<F32>());
EXPECT_EQ(a->dim(), TextureDimension::kCube);
@@ -51,24 +52,25 @@
}
TEST_F(StorageTextureTest, Hash) {
- auto* a =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
- auto* b =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ auto* a = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
+ auto* b = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
EXPECT_EQ(a->unique_hash, b->unique_hash);
}
TEST_F(StorageTextureTest, Equals) {
- auto* a =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
- auto* b =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ auto* a = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
+ auto* b = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
auto* c =
- Create(TextureDimension::k2d, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ Create(TextureDimension::k2d, type::TexelFormat::kRgba32Float, builtin::Access::kReadWrite);
auto* d =
- Create(TextureDimension::kCube, type::TexelFormat::kR32Float, type::Access::kReadWrite);
- auto* e = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kRead);
+ Create(TextureDimension::kCube, type::TexelFormat::kR32Float, builtin::Access::kReadWrite);
+ auto* e =
+ Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, builtin::Access::kRead);
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(*c));
@@ -79,25 +81,25 @@
TEST_F(StorageTextureTest, Dim) {
auto* s = Create(TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_EQ(s->dim(), TextureDimension::k2dArray);
}
TEST_F(StorageTextureTest, Format) {
auto* s = Create(TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_EQ(s->texel_format(), type::TexelFormat::kRgba32Float);
}
TEST_F(StorageTextureTest, FriendlyName) {
auto* s = Create(TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
EXPECT_EQ(s->FriendlyName(Symbols()), "texture_storage_2d_array<rgba32float, read_write>");
}
TEST_F(StorageTextureTest, F32) {
auto* s = Create(TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
auto program = Build();
@@ -110,7 +112,7 @@
TEST_F(StorageTextureTest, U32) {
auto* subtype = StorageTexture::SubtypeFor(type::TexelFormat::kRg32Uint, Types());
auto* s = create<StorageTexture>(TextureDimension::k2dArray, type::TexelFormat::kRg32Uint,
- type::Access::kReadWrite, subtype);
+ builtin::Access::kReadWrite, subtype);
auto program = Build();
@@ -123,7 +125,7 @@
TEST_F(StorageTextureTest, I32) {
auto* subtype = StorageTexture::SubtypeFor(type::TexelFormat::kRgba32Sint, Types());
auto* s = create<StorageTexture>(TextureDimension::k2dArray, type::TexelFormat::kRgba32Sint,
- type::Access::kReadWrite, subtype);
+ builtin::Access::kReadWrite, subtype);
auto program = Build();
@@ -134,8 +136,8 @@
}
TEST_F(StorageTextureTest, Clone) {
- auto* a =
- Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float, type::Access::kReadWrite);
+ auto* a = Create(TextureDimension::kCube, type::TexelFormat::kRgba32Float,
+ builtin::Access::kReadWrite);
type::Manager mgr;
type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
diff --git a/src/tint/type/type_test.cc b/src/tint/type/type_test.cc
index 62ec706..f6adb93 100644
--- a/src/tint/type/type_test.cc
+++ b/src/tint/type/type_test.cc
@@ -44,7 +44,7 @@
const Matrix* mat4x3_f16 = create<Matrix>(vec3_f16, 4u);
const Matrix* mat4x3_af = create<Matrix>(vec3_af, 4u);
const Reference* ref_u32 =
- create<Reference>(u32, AddressSpace::kPrivate, type::Access::kReadWrite);
+ create<Reference>(u32, AddressSpace::kPrivate, builtin::Access::kReadWrite);
const Struct* str_f32 = create<Struct>(Source{},
Sym("str_f32"),
utils::Vector{
diff --git a/src/tint/writer/append_vector.cc b/src/tint/writer/append_vector.cc
index e702c90..53f11db 100644
--- a/src/tint/writer/append_vector.cc
+++ b/src/tint/writer/append_vector.cc
@@ -137,7 +137,7 @@
auto* scalar_cast_target = b->create<sem::TypeConversion>(
packed_el_sem_ty,
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
- type::AddressSpace::kUndefined, type::Access::kUndefined),
+ type::AddressSpace::kUndefined, builtin::Access::kUndefined),
sem::EvaluationStage::kRuntime);
auto* scalar_cast_sem = b->create<sem::Call>(
scalar_cast_ast, scalar_cast_target, sem::EvaluationStage::kRuntime,
@@ -160,7 +160,7 @@
[&](const tint::sem::ValueExpression* arg, size_t i) -> const sem::Parameter* {
return b->create<sem::Parameter>(
nullptr, static_cast<uint32_t>(i), arg->Type()->UnwrapRef(),
- type::AddressSpace::kUndefined, type::Access::kUndefined);
+ type::AddressSpace::kUndefined, builtin::Access::kUndefined);
}),
sem::EvaluationStage::kRuntime);
auto* initializer_sem =
diff --git a/src/tint/writer/flatten_bindings_test.cc b/src/tint/writer/flatten_bindings_test.cc
index 0464742..3b0c7a6 100644
--- a/src/tint/writer/flatten_bindings_test.cc
+++ b/src/tint/writer/flatten_bindings_test.cc
@@ -87,7 +87,7 @@
const size_t num_buffers = 3;
b.GlobalVar("buffer1", b.ty.i32(), type::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
b.GlobalVar("buffer2", b.ty.i32(), type::AddressSpace::kStorage, b.Group(1_a), b.Binding(1_a));
- b.GlobalVar("buffer3", b.ty.i32(), type::AddressSpace::kStorage, type::Access::kRead,
+ b.GlobalVar("buffer3", b.ty.i32(), type::AddressSpace::kStorage, builtin::Access::kRead,
b.Group(2_a), b.Binding(2_a));
const size_t num_samplers = 2;
@@ -103,7 +103,7 @@
b.Group(6_a), b.Binding(6_a));
b.GlobalVar("texture3",
b.ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
- type::Access::kWrite),
+ builtin::Access::kWrite),
b.Group(7_a), b.Binding(7_a));
b.GlobalVar("texture4", b.ty.depth_texture(type::TextureDimension::k2d), b.Group(8_a),
b.Binding(8_a));
diff --git a/src/tint/writer/glsl/generator.h b/src/tint/writer/glsl/generator.h
index 60d5aa1..4d31bdf 100644
--- a/src/tint/writer/glsl/generator.h
+++ b/src/tint/writer/glsl/generator.h
@@ -22,9 +22,9 @@
#include <vector>
#include "src/tint/ast/pipeline_stage.h"
+#include "src/tint/builtin/access.h"
#include "src/tint/sem/binding_point.h"
#include "src/tint/sem/sampler_texture_pair.h"
-#include "src/tint/type/access.h"
#include "src/tint/writer/glsl/version.h"
#include "src/tint/writer/text.h"
@@ -61,7 +61,7 @@
/// A map of old binding point to new access control for the BindingRemapper
/// transform
- std::unordered_map<sem::BindingPoint, type::Access> access_controls;
+ std::unordered_map<sem::BindingPoint, builtin::Access> access_controls;
/// If true, then validation will be disabled for binding point collisions
/// generated by the BindingRemapper transform
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index cd8639a..76a0d18 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -374,7 +374,7 @@
dst_type->is_float_scalar_or_vector()) {
out << "uintBitsToFloat";
} else {
- if (!EmitType(out, dst_type, type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitType(out, dst_type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
return false;
}
@@ -438,12 +438,14 @@
auto* uint_type = BoolTypeToUint(bool_type);
// Cast result to bool scalar or vector type.
- if (!EmitType(out, bool_type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, bool_type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
+ "")) {
return false;
}
ScopedParen outerCastParen(out);
// Cast LHS to uint scalar or vector type.
- if (!EmitType(out, uint_type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, uint_type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
+ "")) {
return false;
}
{
@@ -463,7 +465,8 @@
return false;
}
// Cast RHS to uint scalar or vector type.
- if (!EmitType(out, uint_type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, uint_type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
+ "")) {
return false;
}
{
@@ -491,20 +494,20 @@
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, ret_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, fn_name)) {
+ builtin::Access::kUndefined, fn_name)) {
return "";
}
{
ScopedParen sp(decl);
const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
if (!EmitTypeAndName(decl, ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "lhs")) {
+ builtin::Access::kUndefined, "lhs")) {
return "";
}
decl << ", ";
ty = TypeOf(expr->rhs)->UnwrapRef();
if (!EmitTypeAndName(decl, ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "rhs")) {
+ builtin::Access::kUndefined, "rhs")) {
return "";
}
}
@@ -827,7 +830,7 @@
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
const sem::Call* call,
const sem::TypeConversion* conv) {
- if (!EmitType(out, conv->Target(), type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitType(out, conv->Target(), type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
return false;
}
@@ -851,7 +854,7 @@
return EmitZeroValue(out, type);
}
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false;
}
ScopedParen sp(out);
@@ -922,7 +925,7 @@
{
auto pre = line();
if (!EmitTypeAndName(pre, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, result)) {
+ builtin::Access::kUndefined, result)) {
return false;
}
pre << ";";
@@ -1060,7 +1063,7 @@
// GLSL's bitCount returns an integer type, so cast it to the appropriate
// unsigned type.
if (!EmitType(out, TypeOf(expr)->UnwrapRef(), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "")) {
+ builtin::Access::kReadWrite, "")) {
return false;
}
out << "(bitCount(";
@@ -1132,7 +1135,7 @@
{
std::stringstream s;
if (!EmitType(s, vec_ty->type(), type::AddressSpace::kUndefined,
- type::Access::kRead, "")) {
+ builtin::Access::kRead, "")) {
return "";
}
v = s.str();
@@ -1140,15 +1143,17 @@
{ // (u)int tint_int_dot([i|u]vecN a, [i|u]vecN b) {
auto l = line(&b);
if (!EmitType(l, vec_ty->type(), type::AddressSpace::kUndefined,
- type::Access::kRead, "")) {
+ builtin::Access::kRead, "")) {
return "";
}
l << " " << fn_name << "(";
- if (!EmitType(l, vec_ty, type::AddressSpace::kUndefined, type::Access::kRead, "")) {
+ if (!EmitType(l, vec_ty, type::AddressSpace::kUndefined, builtin::Access::kRead,
+ "")) {
return "";
}
l << " a, ";
- if (!EmitType(l, vec_ty, type::AddressSpace::kUndefined, type::Access::kRead, "")) {
+ if (!EmitType(l, vec_ty, type::AddressSpace::kUndefined, builtin::Access::kRead,
+ "")) {
return "";
}
l << " b) {";
@@ -1200,7 +1205,7 @@
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "")) {
+ builtin::Access::kUndefined, "")) {
return false;
}
l << " result;";
@@ -1226,7 +1231,7 @@
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "")) {
+ builtin::Access::kUndefined, "")) {
return false;
}
l << " result;";
@@ -1884,7 +1889,7 @@
auto out = line();
auto name = builder_.Symbols().NameFor(func->name->symbol);
if (!EmitType(out, sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "")) {
+ builtin::Access::kReadWrite, "")) {
return false;
}
@@ -2261,7 +2266,7 @@
{
auto out = line();
if (!EmitTypeAndName(out, func_sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined,
+ builtin::Access::kUndefined,
builder_.Symbols().NameFor(func->name->symbol))) {
return false;
}
@@ -2341,7 +2346,8 @@
return true;
},
[&](const type::Vector* v) {
- if (!EmitType(out, v, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, v, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
+ "")) {
return false;
}
@@ -2362,7 +2368,8 @@
return true;
},
[&](const type::Matrix* m) {
- if (!EmitType(out, m, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, m, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
+ "")) {
return false;
}
@@ -2379,7 +2386,8 @@
return true;
},
[&](const type::Array* a) {
- if (!EmitType(out, a, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, a, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
+ "")) {
return false;
}
@@ -2471,7 +2479,7 @@
} else if (type->Is<type::U32>()) {
out << "0u";
} else if (auto* vec = type->As<type::Vector>()) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false;
}
ScopedParen sp(out);
@@ -2484,7 +2492,7 @@
}
}
} else if (auto* mat = type->As<type::Matrix>()) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false;
}
ScopedParen sp(out);
@@ -2497,7 +2505,7 @@
}
}
} else if (auto* str = type->As<sem::Struct>()) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined, "")) {
return false;
}
bool first = true;
@@ -2511,7 +2519,7 @@
EmitZeroValue(out, member->Type());
}
} else if (auto* arr = type->As<type::Array>()) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined, "")) {
return false;
}
ScopedParen sp(out);
@@ -2837,7 +2845,7 @@
bool GeneratorImpl::EmitType(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name,
bool* name_printed /* = nullptr */) {
if (name_printed) {
@@ -2934,7 +2942,7 @@
out << "highp ";
- if (storage && storage->access() != type::Access::kRead) {
+ if (storage && storage->access() != builtin::Access::kRead) {
out << "writeonly ";
}
auto* subtype = sampled ? sampled->type()
@@ -3018,7 +3026,7 @@
bool GeneratorImpl::EmitTypeAndName(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name) {
bool printed_name = false;
if (!EmitType(out, type, address_space, access, name, &printed_name)) {
@@ -3054,7 +3062,7 @@
auto out = line(b);
- if (!EmitTypeAndName(out, ty, type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitTypeAndName(out, ty, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
name)) {
return false;
}
@@ -3123,7 +3131,7 @@
auto out = line();
// TODO(senorblanco): handle const
- if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
builder_.Symbols().NameFor(let->name->symbol))) {
return false;
}
@@ -3145,7 +3153,7 @@
auto out = line();
out << "const ";
- if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
builder_.Symbols().NameFor(var->name->symbol))) {
return false;
}
@@ -3173,7 +3181,7 @@
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, fn_name)) {
+ builtin::Access::kUndefined, fn_name)) {
return "";
}
{
@@ -3189,7 +3197,7 @@
ty = ptr->StoreType();
}
if (!EmitTypeAndName(decl, ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, param_name)) {
+ builtin::Access::kUndefined, param_name)) {
return "";
}
parameter_names.emplace_back(std::move(param_name));
diff --git a/src/tint/writer/glsl/generator_impl.h b/src/tint/writer/glsl/generator_impl.h
index 71fb23e..d015000 100644
--- a/src/tint/writer/glsl/generator_impl.h
+++ b/src/tint/writer/glsl/generator_impl.h
@@ -415,7 +415,7 @@
bool EmitType(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name,
bool* name_printed = nullptr);
/// Handles generating type and name
@@ -428,7 +428,7 @@
bool EmitTypeAndName(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name);
/// Handles generating a structure declaration. If the structure has already been emitted, then
/// this function will simply return `true` without emitting anything.
diff --git a/src/tint/writer/glsl/generator_impl_function_test.cc b/src/tint/writer/glsl/generator_impl_function_test.cc
index 2d1ed02..be96c9b 100644
--- a/src/tint/writer/glsl/generator_impl_function_test.cc
+++ b/src/tint/writer/glsl/generator_impl_function_test.cc
@@ -442,7 +442,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -489,7 +489,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -537,7 +537,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("frag_main", utils::Empty, ty.void_(),
@@ -582,7 +582,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("frag_main", utils::Empty, ty.void_(),
@@ -668,7 +668,7 @@
TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) {
auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("sub_func", utils::Vector{Param("param", ty.f32())}, ty.f32(),
@@ -879,7 +879,7 @@
auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
- GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
{
diff --git a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc
index 1023ad0..37005e8 100644
--- a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc
+++ b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc
@@ -91,7 +91,7 @@
auto* s = b.Structure("Data", members);
- b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(1_a), b.Binding(0_a));
}
diff --git a/src/tint/writer/glsl/generator_impl_sanitizer_test.cc b/src/tint/writer/glsl/generator_impl_sanitizer_test.cc
index 051d8e0..cd4d821 100644
--- a/src/tint/writer/glsl/generator_impl_sanitizer_test.cc
+++ b/src/tint/writer/glsl/generator_impl_sanitizer_test.cc
@@ -26,7 +26,7 @@
TEST_F(GlslSanitizerTest, Call_ArrayLength) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -66,7 +66,7 @@
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -105,7 +105,7 @@
TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
diff --git a/src/tint/writer/glsl/generator_impl_type_test.cc b/src/tint/writer/glsl/generator_impl_type_test.cc
index 1f1c8a6..72c5048 100644
--- a/src/tint/writer/glsl/generator_impl_type_test.cc
+++ b/src/tint/writer/glsl/generator_impl_type_test.cc
@@ -40,7 +40,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[4]");
}
@@ -53,7 +53,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[5][4]");
}
@@ -66,7 +66,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[6][5][4]");
}
@@ -79,7 +79,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, ""))
+ builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "bool[4]");
}
@@ -91,7 +91,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, bool_, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, bool_, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "bool");
}
@@ -103,7 +103,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, f32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, f32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float");
}
@@ -117,7 +117,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, f16, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, f16, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float16_t");
}
@@ -129,7 +129,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, i32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, i32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "int");
}
@@ -143,7 +143,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "mat2x3");
}
@@ -159,7 +159,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "f16mat2x3");
}
@@ -196,7 +196,7 @@
auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, sem_s, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sem_s, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "S");
}
@@ -245,7 +245,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, u32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, u32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "uint");
}
@@ -258,7 +258,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, vec3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, vec3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "vec3");
}
@@ -273,7 +273,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, vec3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, vec3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "f16vec3");
}
@@ -285,7 +285,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, void_, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, void_, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "void");
}
@@ -297,7 +297,7 @@
std::stringstream out;
ASSERT_FALSE(
- gen.EmitType(out, sampler, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sampler, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
}
@@ -308,7 +308,7 @@
std::stringstream out;
ASSERT_FALSE(
- gen.EmitType(out, sampler, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sampler, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
}
@@ -514,7 +514,8 @@
GeneratorImpl& gen = Build();
std::stringstream out;
- ASSERT_TRUE(gen.EmitType(out, s, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ ASSERT_TRUE(
+ gen.EmitType(out, s, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "highp sampler2DMS");
}
@@ -531,7 +532,7 @@
TEST_P(GlslStorageTexturesTest, Emit) {
auto params = GetParam();
- auto t = ty.storage_texture(params.dim, params.imgfmt, type::Access::kWrite);
+ auto t = ty.storage_texture(params.dim, params.imgfmt, builtin::Access::kWrite);
GlobalVar("tex", t, Binding(1_a), Group(2_a));
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index df7de5c..f75cf06 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -377,8 +377,8 @@
std::string fn;
{
std::ostringstream ss;
- if (!EmitType(ss, vec, tint::type::AddressSpace::kUndefined, type::Access::kUndefined,
- "")) {
+ if (!EmitType(ss, vec, tint::type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "")) {
return "";
}
fn = UniqueIdentifier("set_" + ss.str());
@@ -386,13 +386,13 @@
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
- if (!EmitTypeAndName(out, vec, type::AddressSpace::kUndefined, type::Access::kUndefined,
- "vec")) {
+ if (!EmitTypeAndName(out, vec, type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "vec")) {
return "";
}
out << ", int idx, ";
if (!EmitTypeAndName(out, vec->type(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "val")) {
+ builtin::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@@ -451,8 +451,8 @@
std::string fn;
{
std::ostringstream ss;
- if (!EmitType(ss, mat, tint::type::AddressSpace::kUndefined, type::Access::kUndefined,
- "")) {
+ if (!EmitType(ss, mat, tint::type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "")) {
return "";
}
fn = UniqueIdentifier("set_vector_" + ss.str());
@@ -460,13 +460,13 @@
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
- if (!EmitTypeAndName(out, mat, type::AddressSpace::kUndefined, type::Access::kUndefined,
- "mat")) {
+ if (!EmitTypeAndName(out, mat, type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "mat")) {
return "";
}
out << ", int col, ";
if (!EmitTypeAndName(out, mat->ColumnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "val")) {
+ builtin::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@@ -520,8 +520,8 @@
std::string fn;
{
std::ostringstream ss;
- if (!EmitType(ss, mat, tint::type::AddressSpace::kUndefined, type::Access::kUndefined,
- "")) {
+ if (!EmitType(ss, mat, tint::type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "")) {
return "";
}
fn = UniqueIdentifier("set_scalar_" + ss.str());
@@ -529,13 +529,13 @@
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
- if (!EmitTypeAndName(out, mat, type::AddressSpace::kUndefined, type::Access::kUndefined,
- "mat")) {
+ if (!EmitTypeAndName(out, mat, type::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "mat")) {
return "";
}
out << ", int col, int row, ";
if (!EmitTypeAndName(out, mat->type(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "val")) {
+ builtin::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@@ -642,7 +642,7 @@
}
out << "as";
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false;
}
out << "(";
@@ -1030,7 +1030,7 @@
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
const sem::Call* call,
const sem::TypeConversion* conv) {
- if (!EmitType(out, conv->Target(), type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitType(out, conv->Target(), type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
return false;
}
@@ -1076,7 +1076,7 @@
if (brackets) {
out << "{";
} else {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false;
}
out << "(";
@@ -1594,12 +1594,12 @@
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, name)) {
+ builtin::Access::kUndefined, name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "value")) {
+ builtin::Access::kUndefined, "value")) {
return false;
}
fn << ") {";
@@ -1615,7 +1615,7 @@
{
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "original_value")) {
+ builtin::Access::kUndefined, "original_value")) {
return false;
}
l << " = 0;";
@@ -1664,7 +1664,7 @@
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, name)) {
+ builtin::Access::kUndefined, name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset) {";
@@ -1680,7 +1680,7 @@
{
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "value")) {
+ builtin::Access::kUndefined, "value")) {
return false;
}
l << " = 0;";
@@ -1698,7 +1698,7 @@
auto fn = line(&buf);
fn << "void " << name << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, value_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "value")) {
+ builtin::Access::kUndefined, "value")) {
return false;
}
fn << ") {";
@@ -1714,7 +1714,7 @@
{
auto l = line(&buf);
if (!EmitTypeAndName(l, value_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "ignored")) {
+ builtin::Access::kUndefined, "ignored")) {
return false;
}
l << ";";
@@ -1729,17 +1729,17 @@
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, name)) {
+ builtin::Access::kUndefined, name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, value_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "compare")) {
+ builtin::Access::kUndefined, "compare")) {
return false;
}
fn << ", ";
if (!EmitTypeAndName(fn, value_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "value")) {
+ builtin::Access::kUndefined, "value")) {
return false;
}
fn << ") {";
@@ -1755,7 +1755,7 @@
{ // T result = {0};
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, "result")) {
+ builtin::Access::kUndefined, "result")) {
return false;
}
l << "=";
@@ -1790,7 +1790,7 @@
if (!builtin->ReturnType()->Is<type::Void>()) {
auto pre = line();
if (!EmitTypeAndName(pre, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, result)) {
+ builtin::Access::kUndefined, result)) {
return false;
}
pre << " = ";
@@ -1854,7 +1854,7 @@
auto pre = line();
auto* value_ty = builtin->Parameters()[1]->Type()->UnwrapRef();
if (!EmitTypeAndName(pre, value_ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, result)) {
+ builtin::Access::kUndefined, result)) {
return false;
}
pre << " = ";
@@ -1892,7 +1892,7 @@
{ // T compare_value = <compare_value>;
auto pre = line();
if (!EmitTypeAndName(pre, TypeOf(compare_value)->UnwrapRef(),
- type::AddressSpace::kUndefined, type::Access::kUndefined,
+ type::AddressSpace::kUndefined, builtin::Access::kUndefined,
compare)) {
return false;
}
@@ -2003,7 +2003,7 @@
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "")) {
+ builtin::Access::kUndefined, "")) {
return false;
}
l << " result;";
@@ -2045,7 +2045,7 @@
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, "")) {
+ builtin::Access::kUndefined, "")) {
return false;
}
l << " result = {fract, int" << width << "(exp)};";
@@ -2082,7 +2082,8 @@
// type after the call to `sign`.
bool GeneratorImpl::EmitSignCall(std::ostream& out, const sem::Call* call, const sem::Builtin*) {
auto* arg = call->Arguments()[0];
- if (!EmitType(out, arg->Type(), type::AddressSpace::kUndefined, type::Access::kReadWrite, "")) {
+ if (!EmitType(out, arg->Type(), type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
+ "")) {
return false;
}
out << "(sign(";
@@ -2885,14 +2886,14 @@
auto pre = line();
pre << "typedef ";
if (!EmitTypeAndName(pre, sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, typedef_name)) {
+ builtin::Access::kReadWrite, typedef_name)) {
return false;
}
pre << ";";
out << typedef_name;
} else {
if (!EmitType(out, sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "")) {
+ builtin::Access::kReadWrite, "")) {
return false;
}
}
@@ -2909,7 +2910,7 @@
auto const* type = v->Type();
auto address_space = type::AddressSpace::kUndefined;
- auto access = type::Access::kUndefined;
+ auto access = builtin::Access::kUndefined;
if (auto* ptr = type->As<type::Pointer>()) {
type = ptr->StoreType();
@@ -2983,7 +2984,7 @@
{
auto out = line();
if (!EmitTypeAndName(out, sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, name)) {
+ builtin::Access::kReadWrite, name)) {
return false;
}
out << ";";
@@ -3068,7 +3069,7 @@
}
auto* global_sem = sem->As<sem::GlobalVariable>();
- out << RegisterAndSpace(sem->Access() == type::Access::kRead ? 't' : 'u',
+ out << RegisterAndSpace(sem->Access() == builtin::Access::kRead ? 't' : 'u',
global_sem->BindingPoint())
<< ";";
@@ -3241,7 +3242,7 @@
}
if (!EmitTypeAndName(out, func_sem->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined,
+ builtin::Access::kUndefined,
builder_.Symbols().NameFor(func->name->symbol))) {
return false;
}
@@ -3336,7 +3337,8 @@
return true;
}
- if (!EmitType(out, v, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, v, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
+ "")) {
return false;
}
@@ -3353,7 +3355,8 @@
return true;
},
[&](const type::Matrix* m) {
- if (!EmitType(out, m, type::AddressSpace::kUndefined, type::Access::kUndefined, "")) {
+ if (!EmitType(out, m, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
+ "")) {
return false;
}
@@ -3372,7 +3375,7 @@
[&](const type::Array* a) {
if (constant->AllZero()) {
out << "(";
- if (!EmitType(out, a, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ if (!EmitType(out, a, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
"")) {
return false;
}
@@ -3513,7 +3516,7 @@
return true;
},
[&](const type::Vector* vec) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
return false;
}
@@ -3529,7 +3532,7 @@
return true;
},
[&](const type::Matrix* mat) {
- if (!EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kReadWrite,
+ if (!EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
return false;
}
@@ -3547,13 +3550,13 @@
[&](const sem::Struct*) {
out << "(";
TINT_DEFER(out << ")" << value);
- return EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ return EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
"");
},
[&](const type::Array*) {
out << "(";
TINT_DEFER(out << ")" << value);
- return EmitType(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ return EmitType(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
"");
},
[&](Default) {
@@ -3929,7 +3932,7 @@
bool GeneratorImpl::EmitType(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name,
bool* name_printed /* = nullptr */) {
if (name_printed) {
@@ -3937,7 +3940,7 @@
}
switch (address_space) {
case type::AddressSpace::kStorage:
- if (access != type::Access::kRead) {
+ if (access != builtin::Access::kRead) {
out << "RW";
}
out << "ByteAddressBuffer";
@@ -4059,7 +4062,7 @@
auto* depth_ms = tex->As<type::DepthMultisampledTexture>();
auto* sampled = tex->As<type::SampledTexture>();
- if (storage && storage->access() != type::Access::kRead) {
+ if (storage && storage->access() != builtin::Access::kRead) {
out << "RW";
}
out << "Texture";
@@ -4156,7 +4159,7 @@
bool GeneratorImpl::EmitTypeAndName(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name) {
bool name_printed = false;
if (!EmitType(out, type, address_space, access, name, &name_printed)) {
@@ -4238,8 +4241,8 @@
}
out << pre;
- if (!EmitTypeAndName(out, ty, type::AddressSpace::kUndefined, type::Access::kReadWrite,
- mem_name)) {
+ if (!EmitTypeAndName(out, ty, type::AddressSpace::kUndefined,
+ builtin::Access::kReadWrite, mem_name)) {
return false;
}
out << post << ";";
@@ -4308,7 +4311,7 @@
auto out = line();
out << "const ";
- if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, type::Access::kUndefined,
+ if (!EmitTypeAndName(out, type, type::AddressSpace::kUndefined, builtin::Access::kUndefined,
builder_.Symbols().NameFor(let->name->symbol))) {
return false;
}
@@ -4336,7 +4339,7 @@
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, builtin->ReturnType(), type::AddressSpace::kUndefined,
- type::Access::kUndefined, fn_name)) {
+ builtin::Access::kUndefined, fn_name)) {
return "";
}
{
@@ -4352,7 +4355,7 @@
ty = ptr->StoreType();
}
if (!EmitTypeAndName(decl, ty, type::AddressSpace::kUndefined,
- type::Access::kUndefined, param_name)) {
+ builtin::Access::kUndefined, param_name)) {
return "";
}
parameter_names.emplace_back(std::move(param_name));
diff --git a/src/tint/writer/hlsl/generator_impl.h b/src/tint/writer/hlsl/generator_impl.h
index b5f53bf..1e2faa1 100644
--- a/src/tint/writer/hlsl/generator_impl.h
+++ b/src/tint/writer/hlsl/generator_impl.h
@@ -414,7 +414,7 @@
bool EmitType(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name,
bool* name_printed = nullptr);
/// Handles generating type and name
@@ -427,7 +427,7 @@
bool EmitTypeAndName(std::ostream& out,
const type::Type* type,
type::AddressSpace address_space,
- type::Access access,
+ builtin::Access access,
const std::string& name);
/// Handles generating a structure declaration. If the structure has already been emitted, then
/// this function will simply return `true` without emitting anything.
diff --git a/src/tint/writer/hlsl/generator_impl_function_test.cc b/src/tint/writer/hlsl/generator_impl_function_test.cc
index afad67c..43e474a 100644
--- a/src/tint/writer/hlsl/generator_impl_function_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_function_test.cc
@@ -436,7 +436,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -469,7 +469,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -502,7 +502,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("frag_main", utils::Empty, ty.void_(),
@@ -533,7 +533,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("frag_main", utils::Empty, ty.void_(),
@@ -602,7 +602,7 @@
TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) {
auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("sub_func",
@@ -830,7 +830,7 @@
auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
- GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
{
diff --git a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc
index f2607c5..2c11fc2 100644
--- a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc
@@ -93,7 +93,7 @@
ProgramBuilder& b = *this;
auto* s = b.Structure("Data", members);
- b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(1_a), b.Binding(0_a));
}
@@ -101,7 +101,7 @@
ProgramBuilder& b = *this;
auto* s = b.Structure("Data", members);
- b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kUniform, type::Access::kUndefined,
+ b.GlobalVar("data", b.ty.Of(s), type::AddressSpace::kUniform, builtin::Access::kUndefined,
b.Group(1_a), b.Binding(1_a));
}
diff --git a/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc b/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc
index 961a27b..8013045 100644
--- a/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc
@@ -26,7 +26,7 @@
TEST_F(HlslSanitizerTest, Call_ArrayLength) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -60,7 +60,7 @@
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -92,7 +92,7 @@
TEST_F(HlslSanitizerTest, Call_ArrayLength_ViaLets) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
@@ -129,9 +129,9 @@
TEST_F(HlslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(2_a),
+ GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
diff --git a/src/tint/writer/hlsl/generator_impl_type_test.cc b/src/tint/writer/hlsl/generator_impl_type_test.cc
index fc347ac..0aa019e 100644
--- a/src/tint/writer/hlsl/generator_impl_type_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_type_test.cc
@@ -40,7 +40,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[4]");
}
@@ -53,7 +53,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[5][4]");
}
@@ -66,7 +66,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, "ary"))
+ builtin::Access::kReadWrite, "ary"))
<< gen.error();
EXPECT_EQ(out.str(), "bool ary[6][5][4]");
}
@@ -79,7 +79,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), type::AddressSpace::kUndefined,
- type::Access::kReadWrite, ""))
+ builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "bool[4]");
}
@@ -91,7 +91,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, bool_, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, bool_, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "bool");
}
@@ -103,7 +103,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, f16, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, f16, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float16_t");
}
@@ -115,7 +115,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, f32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, f32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float");
}
@@ -127,7 +127,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, i32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, i32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "int");
}
@@ -141,7 +141,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "matrix<float16_t, 2, 3>");
}
@@ -155,7 +155,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, mat2x3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float2x3");
}
@@ -184,8 +184,8 @@
Member("a", ty.i32()),
Member("b", ty.f32()),
});
- GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(0_a),
- Group(0_a));
+ GlobalVar("g", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(0_a), Group(0_a));
GeneratorImpl& gen = Build();
@@ -205,7 +205,7 @@
auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, sem_s, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sem_s, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "S");
}
@@ -253,7 +253,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, u32, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, u32, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "uint");
}
@@ -266,7 +266,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, vec3, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, vec3, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "float3");
}
@@ -278,7 +278,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, void_, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, void_, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "void");
}
@@ -290,7 +290,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, sampler, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sampler, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "SamplerState");
}
@@ -302,7 +302,7 @@
std::stringstream out;
ASSERT_TRUE(
- gen.EmitType(out, sampler, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ gen.EmitType(out, sampler, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "SamplerComparisonState");
}
@@ -512,7 +512,8 @@
GeneratorImpl& gen = Build();
std::stringstream out;
- ASSERT_TRUE(gen.EmitType(out, s, type::AddressSpace::kUndefined, type::Access::kReadWrite, ""))
+ ASSERT_TRUE(
+ gen.EmitType(out, s, type::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error();
EXPECT_EQ(out.str(), "Texture2DMS<float4>");
}
@@ -530,7 +531,7 @@
TEST_P(HlslStorageTexturesTest, Emit) {
auto params = GetParam();
- auto t = ty.storage_texture(params.dim, params.imgfmt, type::Access::kWrite);
+ auto t = ty.storage_texture(params.dim, params.imgfmt, builtin::Access::kWrite);
GlobalVar("tex", t,
utils::Vector{
diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc
index 39c3ec7..5fc779a 100644
--- a/src/tint/writer/msl/generator_impl.cc
+++ b/src/tint/writer/msl/generator_impl.cc
@@ -2610,7 +2610,7 @@
return true;
},
[&](const type::Pointer* ptr) {
- if (ptr->Access() == type::Access::kRead) {
+ if (ptr->Access() == builtin::Access::kRead) {
out << "const ";
}
if (!EmitAddressSpace(out, ptr->AddressSpace())) {
@@ -2694,9 +2694,9 @@
}
std::string access_str;
- if (storage->access() == type::Access::kRead) {
+ if (storage->access() == builtin::Access::kRead) {
out << ", access::read";
- } else if (storage->access() == type::Access::kWrite) {
+ } else if (storage->access() == builtin::Access::kWrite) {
out << ", access::write";
} else {
diagnostics_.add_error(diag::System::Writer,
diff --git a/src/tint/writer/msl/generator_impl_function_test.cc b/src/tint/writer/msl/generator_impl_function_test.cc
index de88ecb..05e8531 100644
--- a/src/tint/writer/msl/generator_impl_function_test.cc
+++ b/src/tint/writer/msl/generator_impl_function_test.cc
@@ -341,8 +341,8 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(0_a),
- Binding(0_a));
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Group(0_a), Binding(0_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -380,7 +380,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Group(0_a),
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Group(0_a),
Binding(0_a));
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
@@ -466,8 +466,8 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(0_a),
- Binding(0_a));
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Group(0_a), Binding(0_a));
Func("sub_func",
utils::Vector{
@@ -518,7 +518,7 @@
Member("b", ty.f32()),
});
- GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Group(0_a),
+ GlobalVar("coord", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Group(0_a),
Binding(0_a));
Func("sub_func",
@@ -656,8 +656,8 @@
auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
- GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(0_a),
- Binding(0_a));
+ GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Group(0_a), Binding(0_a));
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
diff --git a/src/tint/writer/msl/generator_impl_sanitizer_test.cc b/src/tint/writer/msl/generator_impl_sanitizer_test.cc
index 3b35e6d..05708dd 100644
--- a/src/tint/writer/msl/generator_impl_sanitizer_test.cc
+++ b/src/tint/writer/msl/generator_impl_sanitizer_test.cc
@@ -28,7 +28,7 @@
TEST_F(MslSanitizerTest, Call_ArrayLength) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -82,7 +82,7 @@
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -135,7 +135,7 @@
TEST_F(MslSanitizerTest, Call_ArrayLength_ViaLets) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
@@ -192,9 +192,9 @@
TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
- GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(2_a),
+ GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(0_a));
Func("a_func", utils::Empty, ty.void_(),
@@ -251,9 +251,9 @@
TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniformMissingBinding) {
auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
- GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(2_a),
+ GlobalVar("c", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(0_a));
Func("a_func", utils::Empty, ty.void_(),
diff --git a/src/tint/writer/msl/generator_impl_type_test.cc b/src/tint/writer/msl/generator_impl_type_test.cc
index 971d2a6..1062fcd 100644
--- a/src/tint/writer/msl/generator_impl_type_test.cc
+++ b/src/tint/writer/msl/generator_impl_type_test.cc
@@ -212,7 +212,8 @@
TEST_F(MslGeneratorImplTest, EmitType_Pointer) {
auto* f32 = create<type::F32>();
- auto* p = create<type::Pointer>(f32, type::AddressSpace::kWorkgroup, type::Access::kReadWrite);
+ auto* p =
+ create<type::Pointer>(f32, type::AddressSpace::kWorkgroup, builtin::Access::kReadWrite);
GeneratorImpl& gen = Build();
@@ -283,7 +284,7 @@
Member("z", ty.f32()),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -392,7 +393,7 @@
Member("e", ty.f32()),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -484,7 +485,7 @@
Member("f", array_z),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -568,7 +569,7 @@
Member("c", ty.i32()),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -630,7 +631,7 @@
Member("tint_pad_21", ty.f32()),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -689,7 +690,7 @@
Member("b", ty.f32()),
});
- ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ ast::Type type = GlobalVar("G", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a))
->type;
@@ -853,7 +854,7 @@
TEST_P(MslStorageTexturesTest, Emit) {
auto params = GetParam();
- auto s = ty.storage_texture(params.dim, type::TexelFormat::kR32Float, type::Access::kWrite);
+ auto s = ty.storage_texture(params.dim, type::TexelFormat::kR32Float, builtin::Access::kWrite);
ast::Type type = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
GeneratorImpl& gen = Build();
diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc
index efee866..33b7cbf 100644
--- a/src/tint/writer/spirv/builder.cc
+++ b/src/tint/writer/spirv/builder.cc
@@ -799,16 +799,16 @@
// type is a sem::Struct or a type::StorageTexture
auto access = st ? st->access() : sem->Access();
switch (access) {
- case type::Access::kWrite:
+ case builtin::Access::kWrite:
push_annot(spv::Op::OpDecorate,
{Operand(var_id), U32Operand(SpvDecorationNonReadable)});
break;
- case type::Access::kRead:
+ case builtin::Access::kRead:
push_annot(spv::Op::OpDecorate,
{Operand(var_id), U32Operand(SpvDecorationNonWritable)});
break;
- case type::Access::kUndefined:
- case type::Access::kReadWrite:
+ case builtin::Access::kUndefined:
+ case builtin::Access::kReadWrite:
break;
}
}
@@ -1900,7 +1900,7 @@
// Create a new vector to splat scalar into
auto splat_vector = result_op();
auto* splat_vector_type = builder_.create<type::Pointer>(
- vec_type, type::AddressSpace::kFunction, type::Access::kReadWrite);
+ vec_type, type::AddressSpace::kFunction, builtin::Access::kReadWrite);
push_function_var({Operand(GenerateTypeIfNeeded(splat_vector_type)), splat_vector,
U32Operand(ConvertAddressSpace(type::AddressSpace::kFunction)),
Operand(GenerateConstantNullIfNeeded(vec_type))});
@@ -3656,10 +3656,10 @@
// fine.
if (auto* ptr = type->As<type::Pointer>()) {
type = builder_.create<type::Pointer>(ptr->StoreType(), ptr->AddressSpace(),
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
} else if (auto* ref = type->As<type::Reference>()) {
type = builder_.create<type::Pointer>(ref->StoreType(), ref->AddressSpace(),
- type::Access::kReadWrite);
+ builtin::Access::kReadWrite);
}
return utils::GetOrCreate(type_to_id_, type, [&]() -> uint32_t {
@@ -3718,11 +3718,12 @@
// SPIR-V, we must output a single type, while the variable is
// annotated with the access type. Doing this ensures we de-dupe.
type_to_id_[builder_.create<type::StorageTexture>(
- tex->dim(), tex->texel_format(), type::Access::kRead, tex->type())] = id;
+ tex->dim(), tex->texel_format(), builtin::Access::kRead, tex->type())] = id;
type_to_id_[builder_.create<type::StorageTexture>(
- tex->dim(), tex->texel_format(), type::Access::kWrite, tex->type())] = id;
+ tex->dim(), tex->texel_format(), builtin::Access::kWrite, tex->type())] = id;
type_to_id_[builder_.create<type::StorageTexture>(
- tex->dim(), tex->texel_format(), type::Access::kReadWrite, tex->type())] = id;
+ tex->dim(), tex->texel_format(), builtin::Access::kReadWrite, tex->type())] =
+ id;
return true;
},
[&](const type::Texture* tex) { return GenerateTextureType(tex, result); },
diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc
index 693fdb1..a895e5f 100644
--- a/src/tint/writer/spirv/builder_builtin_test.cc
+++ b/src/tint/writer/spirv/builder_builtin_test.cc
@@ -278,7 +278,7 @@
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
@@ -322,7 +322,7 @@
Member("z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
@@ -365,7 +365,7 @@
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
@@ -424,7 +424,7 @@
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.array<f32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead, Binding(1_a),
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf(Deref(AddressOf("b"))));
@@ -3513,8 +3513,8 @@
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -3577,8 +3577,8 @@
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -3649,8 +3649,8 @@
auto* s = Structure("S", utils::Vector{
Member("v", ty.atomic<i32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -3722,8 +3722,8 @@
auto* s = Structure("S", utils::Vector{
Member("v", ty.atomic<u32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -3797,8 +3797,8 @@
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
@@ -3873,8 +3873,8 @@
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
- GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite, Binding(1_a),
- Group(2_a));
+ GlobalVar("b", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
+ Binding(1_a), Group(2_a));
Func("a_func", utils::Empty, ty.void_(),
utils::Vector{
diff --git a/src/tint/writer/spirv/builder_function_test.cc b/src/tint/writer/spirv/builder_function_test.cc
index 618a84e..bdfc412 100644
--- a/src/tint/writer/spirv/builder_function_test.cc
+++ b/src/tint/writer/spirv/builder_function_test.cc
@@ -198,7 +198,7 @@
auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
- GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
{
diff --git a/src/tint/writer/spirv/builder_global_variable_test.cc b/src/tint/writer/spirv/builder_global_variable_test.cc
index dae3a50..d412db2 100644
--- a/src/tint/writer/spirv/builder_global_variable_test.cc
+++ b/src/tint/writer/spirv/builder_global_variable_test.cc
@@ -314,7 +314,7 @@
Member("b", ty.i32()),
});
- GlobalVar("b", ty.Of(A), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("b", ty.Of(A), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
spirv::Builder& b = SanitizeAndBuild();
@@ -356,7 +356,7 @@
auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
auto* B = Alias("B", ty.Of(A));
- GlobalVar("b", ty.Of(B), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("b", ty.Of(B), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
spirv::Builder& b = SanitizeAndBuild();
@@ -396,7 +396,7 @@
auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
auto* B = Alias("B", ty.Of(A));
- GlobalVar("b", ty.Of(B), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("b", ty.Of(B), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
spirv::Builder& b = SanitizeAndBuild();
@@ -435,9 +435,9 @@
// var<storage, read_write> c : A
auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
- GlobalVar("b", ty.Of(A), type::AddressSpace::kStorage, type::Access::kRead, Group(0_a),
+ GlobalVar("b", ty.Of(A), type::AddressSpace::kStorage, builtin::Access::kRead, Group(0_a),
Binding(0_a));
- GlobalVar("c", ty.Of(A), type::AddressSpace::kStorage, type::Access::kReadWrite, Group(1_a),
+ GlobalVar("c", ty.Of(A), type::AddressSpace::kStorage, builtin::Access::kReadWrite, Group(1_a),
Binding(0_a));
spirv::Builder& b = SanitizeAndBuild();
@@ -477,7 +477,7 @@
// var<uniform_constant> a : texture_storage_2d<r32uint, write>;
auto type = ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kWrite);
+ builtin::Access::kWrite);
auto* var_a = GlobalVar("a", type, Binding(0_a), Group(0_a));
diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc
index 93831af..a6c7b2b 100644
--- a/src/tint/writer/spirv/builder_type_test.cc
+++ b/src/tint/writer/spirv/builder_type_test.cc
@@ -29,7 +29,7 @@
TEST_F(BuilderTest_Type, GenerateRuntimeArray) {
auto ary = ty.array(ty.i32());
auto* str = Structure("S", utils::Vector{Member("x", ary)});
- GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ast::Type type = str->members[0]->type;
@@ -47,7 +47,7 @@
TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) {
auto ary = ty.array(ty.i32());
auto* str = Structure("S", utils::Vector{Member("x", ary)});
- GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
+ GlobalVar("a", ty.Of(str), type::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
ast::Type type = str->members[0]->type;
@@ -296,7 +296,7 @@
TEST_F(BuilderTest_Type, GeneratePtr) {
auto* i32 = create<type::I32>();
- auto* ptr = create<type::Pointer>(i32, type::AddressSpace::kOut, type::Access::kReadWrite);
+ auto* ptr = create<type::Pointer>(i32, type::AddressSpace::kOut, builtin::Access::kReadWrite);
spirv::Builder& b = Build();
@@ -311,7 +311,7 @@
TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) {
auto* i32 = create<type::I32>();
- auto* ptr = create<type::Pointer>(i32, type::AddressSpace::kOut, type::Access::kReadWrite);
+ auto* ptr = create<type::Pointer>(i32, type::AddressSpace::kOut, builtin::Access::kReadWrite);
spirv::Builder& b = Build();
@@ -863,7 +863,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
auto s = ty.storage_texture(type::TextureDimension::k1d, type::TexelFormat::kR32Float,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -878,7 +878,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
auto s = ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -893,7 +893,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
auto s = ty.storage_texture(type::TextureDimension::k2dArray, type::TexelFormat::kR32Float,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -908,7 +908,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) {
auto s = ty.storage_texture(type::TextureDimension::k3d, type::TexelFormat::kR32Float,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -923,7 +923,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeFloat_Format_r32float) {
auto s = ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -938,7 +938,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeSint_Format_r32sint) {
auto s = ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Sint,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
@@ -953,7 +953,7 @@
TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeUint_Format_r32uint) {
auto s = ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Uint,
- type::Access::kWrite);
+ builtin::Access::kWrite);
ast::Type ty = GlobalVar("test_var", s, Binding(0_a), Group(0_a))->type;
diff --git a/src/tint/writer/wgsl/generator_impl_function_test.cc b/src/tint/writer/wgsl/generator_impl_function_test.cc
index 34e26b4..e29f0f4 100644
--- a/src/tint/writer/wgsl/generator_impl_function_test.cc
+++ b/src/tint/writer/wgsl/generator_impl_function_test.cc
@@ -179,7 +179,7 @@
Member("d", ty.f32()),
});
- GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ GlobalVar("data", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
{
diff --git a/src/tint/writer/wgsl/generator_impl_type_test.cc b/src/tint/writer/wgsl/generator_impl_type_test.cc
index 4f8740c..18fb678 100644
--- a/src/tint/writer/wgsl/generator_impl_type_test.cc
+++ b/src/tint/writer/wgsl/generator_impl_type_test.cc
@@ -143,7 +143,7 @@
TEST_F(WgslGeneratorImplTest, EmitType_PointerAccessMode) {
auto type = Alias("make_type_reachable",
- ty.pointer<f32>(type::AddressSpace::kStorage, type::Access::kReadWrite))
+ ty.pointer<f32>(type::AddressSpace::kStorage, builtin::Access::kReadWrite))
->type;
GeneratorImpl& gen = Build();
@@ -441,7 +441,7 @@
struct StorageTextureData {
type::TexelFormat fmt;
type::TextureDimension dim;
- type::Access access;
+ builtin::Access access;
const char* name;
};
inline std::ostream& operator<<(std::ostream& out, StorageTextureData data) {
@@ -466,13 +466,13 @@
WgslGenerator_StorageTextureTest,
testing::Values(
StorageTextureData{type::TexelFormat::kRgba8Sint, type::TextureDimension::k1d,
- type::Access::kWrite, "texture_storage_1d<rgba8sint, write>"},
+ builtin::Access::kWrite, "texture_storage_1d<rgba8sint, write>"},
StorageTextureData{type::TexelFormat::kRgba8Sint, type::TextureDimension::k2d,
- type::Access::kWrite, "texture_storage_2d<rgba8sint, write>"},
+ builtin::Access::kWrite, "texture_storage_2d<rgba8sint, write>"},
StorageTextureData{type::TexelFormat::kRgba8Sint, type::TextureDimension::k2dArray,
- type::Access::kWrite, "texture_storage_2d_array<rgba8sint, write>"},
+ builtin::Access::kWrite, "texture_storage_2d_array<rgba8sint, write>"},
StorageTextureData{type::TexelFormat::kRgba8Sint, type::TextureDimension::k3d,
- type::Access::kWrite, "texture_storage_3d<rgba8sint, write>"}));
+ builtin::Access::kWrite, "texture_storage_3d<rgba8sint, write>"}));
struct ImageFormatData {
type::TexelFormat fmt;
diff --git a/src/tint/writer/wgsl/generator_impl_variable_test.cc b/src/tint/writer/wgsl/generator_impl_variable_test.cc
index 3d39ce9..33ead1d 100644
--- a/src/tint/writer/wgsl/generator_impl_variable_test.cc
+++ b/src/tint/writer/wgsl/generator_impl_variable_test.cc
@@ -43,7 +43,7 @@
TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Read) {
auto* s = Structure("S", utils::Vector{Member("a", ty.i32())});
- auto* v = GlobalVar("a", ty.Of(s), type::AddressSpace::kStorage, type::Access::kRead,
+ auto* v = GlobalVar("a", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
GeneratorImpl& gen = Build();
@@ -55,7 +55,7 @@
TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) {
auto* s = Structure("S", utils::Vector{Member("a", ty.i32())});
- auto* v = GlobalVar("a", ty.Of(s), type::AddressSpace::kStorage, type::Access::kReadWrite,
+ auto* v = GlobalVar("a", ty.Of(s), type::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
GeneratorImpl& gen = Build();