Move atomic to type/
This CL moves atomic to type/ and updates the namespaces. Bug: tint:1718 Change-Id: I3331bc0dfae2ccede52b5589b7d3cc443366096a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113424 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
0e780da882
commit
d8a084585f
|
@ -415,7 +415,6 @@ libtint_source_set("libtint_core_all_src") {
|
||||||
"scope_stack.h",
|
"scope_stack.h",
|
||||||
"sem/array.h",
|
"sem/array.h",
|
||||||
"sem/array_count.h",
|
"sem/array_count.h",
|
||||||
"sem/atomic.h",
|
|
||||||
"sem/behavior.h",
|
"sem/behavior.h",
|
||||||
"sem/binding_point.h",
|
"sem/binding_point.h",
|
||||||
"sem/break_if_statement.h",
|
"sem/break_if_statement.h",
|
||||||
|
@ -557,6 +556,7 @@ libtint_source_set("libtint_core_all_src") {
|
||||||
"type/abstract_int.h",
|
"type/abstract_int.h",
|
||||||
"type/abstract_numeric.h",
|
"type/abstract_numeric.h",
|
||||||
"type/array_count.h",
|
"type/array_count.h",
|
||||||
|
"type/atomic.h",
|
||||||
"type/bool.h",
|
"type/bool.h",
|
||||||
"type/depth_multisampled_texture.h",
|
"type/depth_multisampled_texture.h",
|
||||||
"type/depth_texture.h",
|
"type/depth_texture.h",
|
||||||
|
@ -636,8 +636,6 @@ libtint_source_set("libtint_sem_src") {
|
||||||
"sem/array.h",
|
"sem/array.h",
|
||||||
"sem/array_count.cc",
|
"sem/array_count.cc",
|
||||||
"sem/array_count.h",
|
"sem/array_count.h",
|
||||||
"sem/atomic.cc",
|
|
||||||
"sem/atomic.h",
|
|
||||||
"sem/behavior.cc",
|
"sem/behavior.cc",
|
||||||
"sem/behavior.h",
|
"sem/behavior.h",
|
||||||
"sem/binding_point.h",
|
"sem/binding_point.h",
|
||||||
|
@ -706,6 +704,8 @@ libtint_source_set("libtint_type_src") {
|
||||||
"type/abstract_numeric.h",
|
"type/abstract_numeric.h",
|
||||||
"type/array_count.cc",
|
"type/array_count.cc",
|
||||||
"type/array_count.h",
|
"type/array_count.h",
|
||||||
|
"type/atomic.cc",
|
||||||
|
"type/atomic.h",
|
||||||
"type/bool.cc",
|
"type/bool.cc",
|
||||||
"type/bool.h",
|
"type/bool.h",
|
||||||
"type/depth_multisampled_texture.cc",
|
"type/depth_multisampled_texture.cc",
|
||||||
|
@ -1204,7 +1204,6 @@ if (tint_build_unittests) {
|
||||||
tint_unittests_source_set("tint_unittests_sem_src") {
|
tint_unittests_source_set("tint_unittests_sem_src") {
|
||||||
sources = [
|
sources = [
|
||||||
"sem/array_test.cc",
|
"sem/array_test.cc",
|
||||||
"sem/atomic_test.cc",
|
|
||||||
"sem/builtin_test.cc",
|
"sem/builtin_test.cc",
|
||||||
"sem/expression_test.cc",
|
"sem/expression_test.cc",
|
||||||
"sem/struct_test.cc",
|
"sem/struct_test.cc",
|
||||||
|
@ -1213,6 +1212,7 @@ if (tint_build_unittests) {
|
||||||
|
|
||||||
tint_unittests_source_set("tint_unittests_type_src") {
|
tint_unittests_source_set("tint_unittests_type_src") {
|
||||||
sources = [
|
sources = [
|
||||||
|
"type/atomic_test.cc",
|
||||||
"type/bool_test.cc",
|
"type/bool_test.cc",
|
||||||
"type/depth_multisampled_texture_test.cc",
|
"type/depth_multisampled_texture_test.cc",
|
||||||
"type/depth_texture_test.cc",
|
"type/depth_texture_test.cc",
|
||||||
|
|
|
@ -295,8 +295,6 @@ list(APPEND TINT_LIB_SRCS
|
||||||
sem/array.h
|
sem/array.h
|
||||||
sem/array_count.cc
|
sem/array_count.cc
|
||||||
sem/array_count.h
|
sem/array_count.h
|
||||||
sem/atomic.cc
|
|
||||||
sem/atomic.h
|
|
||||||
sem/behavior.cc
|
sem/behavior.cc
|
||||||
sem/behavior.h
|
sem/behavior.h
|
||||||
sem/binding_point.h
|
sem/binding_point.h
|
||||||
|
@ -463,6 +461,8 @@ list(APPEND TINT_LIB_SRCS
|
||||||
type/abstract_numeric.h
|
type/abstract_numeric.h
|
||||||
type/array_count.cc
|
type/array_count.cc
|
||||||
type/array_count.h
|
type/array_count.h
|
||||||
|
type/atomic.cc
|
||||||
|
type/atomic.h
|
||||||
type/bool.cc
|
type/bool.cc
|
||||||
type/bool.h
|
type/bool.h
|
||||||
type/depth_multisampled_texture.cc
|
type/depth_multisampled_texture.cc
|
||||||
|
@ -921,7 +921,6 @@ if(TINT_BUILD_TESTS)
|
||||||
resolver/variable_validation_test.cc
|
resolver/variable_validation_test.cc
|
||||||
scope_stack_test.cc
|
scope_stack_test.cc
|
||||||
sem/array_test.cc
|
sem/array_test.cc
|
||||||
sem/atomic.cc
|
|
||||||
sem/builtin_test.cc
|
sem/builtin_test.cc
|
||||||
sem/expression_test.cc
|
sem/expression_test.cc
|
||||||
sem/struct_test.cc
|
sem/struct_test.cc
|
||||||
|
@ -932,6 +931,7 @@ if(TINT_BUILD_TESTS)
|
||||||
text/unicode_test.cc
|
text/unicode_test.cc
|
||||||
traits_test.cc
|
traits_test.cc
|
||||||
transform/transform_test.cc
|
transform/transform_test.cc
|
||||||
|
type/atomic.cc
|
||||||
type/bool_test.cc
|
type/bool_test.cc
|
||||||
type/depth_multisampled_texture_test.cc
|
type/depth_multisampled_texture_test.cc
|
||||||
type/depth_texture_test.cc
|
type/depth_texture_test.cc
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "src/tint/resolver/resolver.h"
|
#include "src/tint/resolver/resolver.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
@ -31,7 +31,7 @@ TEST_F(ResolverAtomicTest, GlobalWorkgroupI32) {
|
||||||
|
|
||||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||||
ASSERT_TRUE(TypeOf(g)->Is<type::Reference>());
|
ASSERT_TRUE(TypeOf(g)->Is<type::Reference>());
|
||||||
auto* atomic = TypeOf(g)->UnwrapRef()->As<sem::Atomic>();
|
auto* atomic = TypeOf(g)->UnwrapRef()->As<type::Atomic>();
|
||||||
ASSERT_NE(atomic, nullptr);
|
ASSERT_NE(atomic, nullptr);
|
||||||
EXPECT_TRUE(atomic->Type()->Is<type::I32>());
|
EXPECT_TRUE(atomic->Type()->Is<type::I32>());
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ TEST_F(ResolverAtomicTest, GlobalWorkgroupU32) {
|
||||||
|
|
||||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||||
ASSERT_TRUE(TypeOf(g)->Is<type::Reference>());
|
ASSERT_TRUE(TypeOf(g)->Is<type::Reference>());
|
||||||
auto* atomic = TypeOf(g)->UnwrapRef()->As<sem::Atomic>();
|
auto* atomic = TypeOf(g)->UnwrapRef()->As<type::Atomic>();
|
||||||
ASSERT_NE(atomic, nullptr);
|
ASSERT_NE(atomic, nullptr);
|
||||||
EXPECT_TRUE(atomic->Type()->Is<type::U32>());
|
EXPECT_TRUE(atomic->Type()->Is<type::U32>());
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ TEST_F(ResolverAtomicTest, GlobalStorageStruct) {
|
||||||
auto* str = TypeOf(g)->UnwrapRef()->As<sem::Struct>();
|
auto* str = TypeOf(g)->UnwrapRef()->As<sem::Struct>();
|
||||||
ASSERT_NE(str, nullptr);
|
ASSERT_NE(str, nullptr);
|
||||||
ASSERT_EQ(str->Members().Length(), 1u);
|
ASSERT_EQ(str->Members().Length(), 1u);
|
||||||
auto* atomic = str->Members()[0]->Type()->As<sem::Atomic>();
|
auto* atomic = str->Members()[0]->Type()->As<type::Atomic>();
|
||||||
ASSERT_NE(atomic, nullptr);
|
ASSERT_NE(atomic, nullptr);
|
||||||
ASSERT_TRUE(atomic->Type()->Is<type::I32>());
|
ASSERT_TRUE(atomic->Type()->Is<type::I32>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "src/tint/resolver/resolver.h"
|
#include "src/tint/resolver/resolver.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "src/tint/ast/binary_expression.h"
|
#include "src/tint/ast/binary_expression.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/evaluation_stage.h"
|
#include "src/tint/sem/evaluation_stage.h"
|
||||||
#include "src/tint/sem/pipeline_stage_set.h"
|
#include "src/tint/sem/pipeline_stage_set.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/type_conversion.h"
|
||||||
|
@ -28,6 +27,7 @@
|
||||||
#include "src/tint/type/abstract_float.h"
|
#include "src/tint/type/abstract_float.h"
|
||||||
#include "src/tint/type/abstract_int.h"
|
#include "src/tint/type/abstract_int.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/external_texture.h"
|
#include "src/tint/type/external_texture.h"
|
||||||
|
@ -569,15 +569,15 @@ bool match_atomic(MatchState&, const type::Type* ty, const type::Type*& T) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto* a = ty->As<sem::Atomic>()) {
|
if (auto* a = ty->As<type::Atomic>()) {
|
||||||
T = a->Type();
|
T = a->Type();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sem::Atomic* build_atomic(MatchState& state, const type::Type* T) {
|
const type::Atomic* build_atomic(MatchState& state, const type::Type* T) {
|
||||||
return state.builder.create<sem::Atomic>(T);
|
return state.builder.create<type::Atomic>(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool match_sampler(MatchState&, const type::Type* ty) {
|
bool match_sampler(MatchState&, const type::Type* ty) {
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/type_conversion.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/type_initializer.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/external_texture.h"
|
#include "src/tint/type/external_texture.h"
|
||||||
|
@ -229,7 +229,7 @@ TEST_F(IntrinsicTableTest, MismatchBool) {
|
||||||
|
|
||||||
TEST_F(IntrinsicTableTest, MatchPointer) {
|
TEST_F(IntrinsicTableTest, MatchPointer) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* atomicI32 = create<sem::Atomic>(i32);
|
auto* atomicI32 = create<type::Atomic>(i32);
|
||||||
auto* ptr =
|
auto* ptr =
|
||||||
create<type::Pointer>(atomicI32, ast::AddressSpace::kWorkgroup, ast::Access::kReadWrite);
|
create<type::Pointer>(atomicI32, ast::AddressSpace::kWorkgroup, ast::Access::kReadWrite);
|
||||||
auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{ptr},
|
auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{ptr},
|
||||||
|
@ -244,7 +244,7 @@ TEST_F(IntrinsicTableTest, MatchPointer) {
|
||||||
|
|
||||||
TEST_F(IntrinsicTableTest, MismatchPointer) {
|
TEST_F(IntrinsicTableTest, MismatchPointer) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* atomicI32 = create<sem::Atomic>(i32);
|
auto* atomicI32 = create<type::Atomic>(i32);
|
||||||
auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{atomicI32},
|
auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{atomicI32},
|
||||||
sem::EvaluationStage::kConstant, Source{});
|
sem::EvaluationStage::kConstant, Source{});
|
||||||
ASSERT_EQ(result.sem, nullptr);
|
ASSERT_EQ(result.sem, nullptr);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -101,8 +101,8 @@ TEST_F(ResolverIsHostShareable, Pointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ResolverIsHostShareable, Atomic) {
|
TEST_F(ResolverIsHostShareable, Atomic) {
|
||||||
EXPECT_TRUE(r()->IsHostShareable(create<sem::Atomic>(create<type::I32>())));
|
EXPECT_TRUE(r()->IsHostShareable(create<type::Atomic>(create<type::I32>())));
|
||||||
EXPECT_TRUE(r()->IsHostShareable(create<sem::Atomic>(create<type::U32>())));
|
EXPECT_TRUE(r()->IsHostShareable(create<type::Atomic>(create<type::U32>())));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ResolverIsHostShareable, ArraySizedOfHostShareable) {
|
TEST_F(ResolverIsHostShareable, ArraySizedOfHostShareable) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -84,8 +84,8 @@ TEST_F(ResolverIsStorableTest, Pointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ResolverIsStorableTest, Atomic) {
|
TEST_F(ResolverIsStorableTest, Atomic) {
|
||||||
EXPECT_TRUE(r()->IsStorable(create<sem::Atomic>(create<type::I32>())));
|
EXPECT_TRUE(r()->IsStorable(create<type::Atomic>(create<type::I32>())));
|
||||||
EXPECT_TRUE(r()->IsStorable(create<sem::Atomic>(create<type::U32>())));
|
EXPECT_TRUE(r()->IsStorable(create<type::Atomic>(create<type::U32>())));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ResolverIsStorableTest, ArraySizedOfStorable) {
|
TEST_F(ResolverIsStorableTest, ArraySizedOfStorable) {
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "src/tint/ast/workgroup_attribute.h"
|
#include "src/tint/ast/workgroup_attribute.h"
|
||||||
#include "src/tint/resolver/uniformity.h"
|
#include "src/tint/resolver/uniformity.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/break_if_statement.h"
|
#include "src/tint/sem/break_if_statement.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/for_loop_statement.h"
|
#include "src/tint/sem/for_loop_statement.h"
|
||||||
|
@ -73,6 +72,7 @@
|
||||||
#include "src/tint/sem/while_statement.h"
|
#include "src/tint/sem/while_statement.h"
|
||||||
#include "src/tint/type/abstract_float.h"
|
#include "src/tint/type/abstract_float.h"
|
||||||
#include "src/tint/type/abstract_int.h"
|
#include "src/tint/type/abstract_int.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
|
@ -247,9 +247,9 @@ type::Type* Resolver::Type(const ast::Type* ty) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
},
|
},
|
||||||
[&](const ast::Array* t) { return Array(t); },
|
[&](const ast::Array* t) { return Array(t); },
|
||||||
[&](const ast::Atomic* t) -> sem::Atomic* {
|
[&](const ast::Atomic* t) -> type::Atomic* {
|
||||||
if (auto* el = Type(t->type)) {
|
if (auto* el = Type(t->type)) {
|
||||||
auto* a = builder_->create<sem::Atomic>(el);
|
auto* a = builder_->create<type::Atomic>(el);
|
||||||
if (!validator_.Atomic(t, a)) {
|
if (!validator_.Atomic(t, a)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -2964,7 +2964,7 @@ sem::Array* Resolver::Array(const ast::Array* arr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el_ty->Is<sem::Atomic>()) {
|
if (el_ty->Is<type::Atomic>()) {
|
||||||
atomic_composite_info_.Add(out, &arr->type->source);
|
atomic_composite_info_.Add(out, &arr->type->source);
|
||||||
} else {
|
} else {
|
||||||
if (auto found = atomic_composite_info_.Get(el_ty)) {
|
if (auto found = atomic_composite_info_.Get(el_ty)) {
|
||||||
|
@ -3309,7 +3309,7 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) {
|
||||||
|
|
||||||
for (size_t i = 0; i < sem_members.Length(); i++) {
|
for (size_t i = 0; i < sem_members.Length(); i++) {
|
||||||
auto* mem_type = sem_members[i]->Type();
|
auto* mem_type = sem_members[i]->Type();
|
||||||
if (mem_type->Is<sem::Atomic>()) {
|
if (mem_type->Is<type::Atomic>()) {
|
||||||
atomic_composite_info_.Add(out, &sem_members[i]->Source());
|
atomic_composite_info_.Add(out, &sem_members[i]->Source());
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,7 +59,6 @@ class WhileStatement;
|
||||||
} // namespace tint::ast
|
} // namespace tint::ast
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Array;
|
class Array;
|
||||||
class Atomic;
|
|
||||||
class BlockStatement;
|
class BlockStatement;
|
||||||
class Builtin;
|
class Builtin;
|
||||||
class CaseStatement;
|
class CaseStatement;
|
||||||
|
@ -72,6 +71,9 @@ class SwitchStatement;
|
||||||
class TypeInitializer;
|
class TypeInitializer;
|
||||||
class WhileStatement;
|
class WhileStatement;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
namespace tint::type {
|
||||||
|
class Atomic;
|
||||||
|
} // namespace tint::type
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "src/tint/ast/vector.h"
|
#include "src/tint/ast/vector.h"
|
||||||
#include "src/tint/ast/workgroup_attribute.h"
|
#include "src/tint/ast/workgroup_attribute.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/break_if_statement.h"
|
#include "src/tint/sem/break_if_statement.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/for_loop_statement.h"
|
#include "src/tint/sem/for_loop_statement.h"
|
||||||
|
@ -65,6 +64,7 @@
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/sem/while_statement.h"
|
#include "src/tint/sem/while_statement.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
|
@ -183,7 +183,7 @@ void Validator::AddNote(const std::string& msg, const Source& source) const {
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl/#plain-types-section
|
// https://gpuweb.github.io/gpuweb/wgsl/#plain-types-section
|
||||||
bool Validator::IsPlain(const type::Type* type) const {
|
bool Validator::IsPlain(const type::Type* type) const {
|
||||||
return type->is_scalar() ||
|
return type->is_scalar() ||
|
||||||
type->IsAnyOf<sem::Atomic, type::Vector, type::Matrix, sem::Array, sem::Struct>();
|
type->IsAnyOf<type::Atomic, type::Vector, type::Matrix, sem::Array, sem::Struct>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl/#fixed-footprint-types
|
// https://gpuweb.github.io/gpuweb/wgsl/#fixed-footprint-types
|
||||||
|
@ -192,7 +192,7 @@ bool Validator::IsFixedFootprint(const type::Type* type) const {
|
||||||
type, //
|
type, //
|
||||||
[&](const type::Vector*) { return true; }, //
|
[&](const type::Vector*) { return true; }, //
|
||||||
[&](const type::Matrix*) { return true; }, //
|
[&](const type::Matrix*) { return true; }, //
|
||||||
[&](const sem::Atomic*) { return true; },
|
[&](const type::Atomic*) { return true; },
|
||||||
[&](const sem::Array* arr) {
|
[&](const sem::Array* arr) {
|
||||||
return !arr->Count()->Is<type::RuntimeArrayCount>() &&
|
return !arr->Count()->Is<type::RuntimeArrayCount>() &&
|
||||||
IsFixedFootprint(arr->ElemType());
|
IsFixedFootprint(arr->ElemType());
|
||||||
|
@ -226,7 +226,7 @@ bool Validator::IsHostShareable(const type::Type* type) const {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](const sem::Atomic* atomic) { return IsHostShareable(atomic->Type()); });
|
[&](const type::Atomic* atomic) { return IsHostShareable(atomic->Type()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
|
// https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
|
||||||
|
@ -260,7 +260,7 @@ const ast::Statement* Validator::ClosestContinuing(bool stop_at_loop,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validator::Atomic(const ast::Atomic* a, const sem::Atomic* s) const {
|
bool Validator::Atomic(const ast::Atomic* a, const type::Atomic* s) const {
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl/#atomic-types
|
// https://gpuweb.github.io/gpuweb/wgsl/#atomic-types
|
||||||
// T must be either u32 or i32.
|
// T must be either u32 or i32.
|
||||||
if (!s->Type()->IsAnyOf<type::U32, type::I32>()) {
|
if (!s->Type()->IsAnyOf<type::U32, type::I32>()) {
|
||||||
|
@ -2466,7 +2466,7 @@ bool Validator::CheckTypeAccessAddressSpace(
|
||||||
|
|
||||||
return Switch(
|
return Switch(
|
||||||
store_ty, //
|
store_ty, //
|
||||||
[&](const sem::Atomic*) {
|
[&](const type::Atomic*) {
|
||||||
if (auto* err = atomic_error()) {
|
if (auto* err = atomic_error()) {
|
||||||
AddError(err, source);
|
AddError(err, source);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -49,7 +49,6 @@ class WhileStatement;
|
||||||
} // namespace tint::ast
|
} // namespace tint::ast
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Array;
|
class Array;
|
||||||
class Atomic;
|
|
||||||
class BlockStatement;
|
class BlockStatement;
|
||||||
class BreakIfStatement;
|
class BreakIfStatement;
|
||||||
class Builtin;
|
class Builtin;
|
||||||
|
@ -64,6 +63,9 @@ class SwitchStatement;
|
||||||
class TypeInitializer;
|
class TypeInitializer;
|
||||||
class WhileStatement;
|
class WhileStatement;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
namespace tint::type {
|
||||||
|
class Atomic;
|
||||||
|
} // namespace tint::type
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
|
|
||||||
|
@ -167,7 +169,7 @@ class Validator {
|
||||||
/// @param a the atomic ast node
|
/// @param a the atomic ast node
|
||||||
/// @param s the atomic sem node
|
/// @param s the atomic sem node
|
||||||
/// @returns true on success, false otherwise.
|
/// @returns true on success, false otherwise.
|
||||||
bool Atomic(const ast::Atomic* a, const sem::Atomic* s) const;
|
bool Atomic(const ast::Atomic* a, const type::Atomic* s) const;
|
||||||
|
|
||||||
/// Validates a pointer type
|
/// Validates a pointer type
|
||||||
/// @param a the pointer ast node
|
/// @param a the pointer ast node
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -84,8 +84,8 @@ TEST_F(ValidatorIsStorableTest, Pointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValidatorIsStorableTest, Atomic) {
|
TEST_F(ValidatorIsStorableTest, Atomic) {
|
||||||
EXPECT_TRUE(v()->IsStorable(create<sem::Atomic>(create<type::I32>())));
|
EXPECT_TRUE(v()->IsStorable(create<type::Atomic>(create<type::I32>())));
|
||||||
EXPECT_TRUE(v()->IsStorable(create<sem::Atomic>(create<type::U32>())));
|
EXPECT_TRUE(v()->IsStorable(create<type::Atomic>(create<type::U32>())));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValidatorIsStorableTest, ArraySizedOfStorable) {
|
TEST_F(ValidatorIsStorableTest, ArraySizedOfStorable) {
|
||||||
|
|
|
@ -27,12 +27,12 @@
|
||||||
#include "src/tint/ast/unary_op.h"
|
#include "src/tint/ast/unary_op.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/member_accessor_expression.h"
|
#include "src/tint/sem/member_accessor_expression.h"
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
#include "src/tint/utils/block_allocator.h"
|
#include "src/tint/utils/block_allocator.h"
|
||||||
#include "src/tint/utils/hash.h"
|
#include "src/tint/utils/hash.h"
|
||||||
|
@ -994,7 +994,7 @@ Transform::ApplyResult DecomposeMemoryAccess::Apply(const Program* src,
|
||||||
auto* buf = access.var->Declaration();
|
auto* buf = access.var->Declaration();
|
||||||
auto* offset = access.offset->Build(ctx);
|
auto* offset = access.offset->Build(ctx);
|
||||||
auto* buf_ty = access.var->Type()->UnwrapRef();
|
auto* buf_ty = access.var->Type()->UnwrapRef();
|
||||||
auto* el_ty = access.type->UnwrapRef()->As<sem::Atomic>()->Type();
|
auto* el_ty = access.type->UnwrapRef()->As<type::Atomic>()->Type();
|
||||||
Symbol func = state.AtomicFunc(buf_ty, el_ty, builtin,
|
Symbol func = state.AtomicFunc(buf_ty, el_ty, builtin,
|
||||||
access.var->As<sem::VariableUser>());
|
access.var->As<sem::VariableUser>());
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/block_statement.h"
|
#include "src/tint/sem/block_statement.h"
|
||||||
#include "src/tint/sem/for_loop_statement.h"
|
#include "src/tint/sem/for_loop_statement.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
#include "src/tint/type/sampler.h"
|
#include "src/tint/type/sampler.h"
|
||||||
|
@ -142,7 +142,7 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type
|
||||||
if (auto* s = ty->As<type::Reference>()) {
|
if (auto* s = ty->As<type::Reference>()) {
|
||||||
return CreateASTTypeFor(ctx, s->StoreType());
|
return CreateASTTypeFor(ctx, s->StoreType());
|
||||||
}
|
}
|
||||||
if (auto* a = ty->As<sem::Atomic>()) {
|
if (auto* a = ty->As<type::Atomic>()) {
|
||||||
return ctx.dst->create<ast::Atomic>(CreateASTTypeFor(ctx, a->Type()));
|
return ctx.dst->create<ast::Atomic>(CreateASTTypeFor(ctx, a->Type()));
|
||||||
}
|
}
|
||||||
if (auto* t = ty->As<type::DepthTexture>()) {
|
if (auto* t = ty->As<type::DepthTexture>()) {
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
#include "src/tint/ast/workgroup_attribute.h"
|
#include "src/tint/ast/workgroup_attribute.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/function.h"
|
#include "src/tint/sem/function.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/utils/map.h"
|
#include "src/tint/utils/map.h"
|
||||||
#include "src/tint/utils/unique_vector.h"
|
#include "src/tint/utils/unique_vector.h"
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ struct ZeroInitWorkgroupMemory::State {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto* atomic = ty->As<sem::Atomic>()) {
|
if (auto* atomic = ty->As<type::Atomic>()) {
|
||||||
auto* zero_init = b.Construct(CreateASTTypeFor(ctx, atomic->Type()));
|
auto* zero_init = b.Construct(CreateASTTypeFor(ctx, atomic->Type()));
|
||||||
auto expr = get_expr(1u);
|
auto expr = get_expr(1u);
|
||||||
if (!expr) {
|
if (!expr) {
|
||||||
|
@ -439,7 +439,7 @@ struct ZeroInitWorkgroupMemory::State {
|
||||||
/// sub-initializations.
|
/// sub-initializations.
|
||||||
/// @param ty the type to inspect
|
/// @param ty the type to inspect
|
||||||
bool CanTriviallyZero(const type::Type* ty) {
|
bool CanTriviallyZero(const type::Type* ty) {
|
||||||
if (ty->Is<sem::Atomic>()) {
|
if (ty->Is<type::Atomic>()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (auto* str = ty->As<sem::Struct>()) {
|
if (auto* str = ty->As<sem::Struct>()) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 The Tint Authors.
|
// Copyright 2022 The Tint Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -12,15 +12,15 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
#include "src/tint/utils/hash.h"
|
#include "src/tint/utils/hash.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::Atomic);
|
TINT_INSTANTIATE_TYPEINFO(tint::type::Atomic);
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::type {
|
||||||
|
|
||||||
Atomic::Atomic(const type::Type* subtype)
|
Atomic::Atomic(const type::Type* subtype)
|
||||||
: Base(type::TypeFlags{
|
: Base(type::TypeFlags{
|
||||||
|
@ -60,4 +60,4 @@ Atomic::Atomic(Atomic&&) = default;
|
||||||
|
|
||||||
Atomic::~Atomic() = default;
|
Atomic::~Atomic() = default;
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::type
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 The Tint Authors.
|
// Copyright 2022 The Tint Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -12,14 +12,14 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#ifndef SRC_TINT_SEM_ATOMIC_H_
|
#ifndef SRC_TINT_TYPE_ATOMIC_H_
|
||||||
#define SRC_TINT_SEM_ATOMIC_H_
|
#define SRC_TINT_TYPE_ATOMIC_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "src/tint/type/type.h"
|
#include "src/tint/type/type.h"
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::type {
|
||||||
|
|
||||||
/// A atomic type.
|
/// A atomic type.
|
||||||
class Atomic final : public Castable<Atomic, type::Type> {
|
class Atomic final : public Castable<Atomic, type::Type> {
|
||||||
|
@ -57,6 +57,6 @@ class Atomic final : public Castable<Atomic, type::Type> {
|
||||||
type::Type const* const subtype_;
|
type::Type const* const subtype_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::type
|
||||||
|
|
||||||
#endif // SRC_TINT_SEM_ATOMIC_H_
|
#endif // SRC_TINT_TYPE_ATOMIC_H_
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 The Tint Authors.
|
// Copyright 2022 The Tint Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -12,11 +12,11 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/sem/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
|
|
||||||
#include "src/tint/sem/test_helper.h"
|
#include "src/tint/type/test_helper.h"
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using AtomicTest = TestHelper;
|
using AtomicTest = TestHelper;
|
||||||
|
@ -53,4 +53,4 @@ TEST_F(AtomicTest, FriendlyName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace tint::sem
|
} // namespace tint::type
|
|
@ -28,7 +28,6 @@
|
||||||
#include "src/tint/ast/variable_decl_statement.h"
|
#include "src/tint/ast/variable_decl_statement.h"
|
||||||
#include "src/tint/debug.h"
|
#include "src/tint/debug.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/block_statement.h"
|
#include "src/tint/sem/block_statement.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/constant.h"
|
#include "src/tint/sem/constant.h"
|
||||||
|
@ -64,6 +63,7 @@
|
||||||
#include "src/tint/transform/std140.h"
|
#include "src/tint/transform/std140.h"
|
||||||
#include "src/tint/transform/unshadow.h"
|
#include "src/tint/transform/unshadow.h"
|
||||||
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
|
@ -2977,7 +2977,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
||||||
}
|
}
|
||||||
out << ", " << width << ">";
|
out << ", " << width << ">";
|
||||||
}
|
}
|
||||||
} else if (auto* atomic = type->As<sem::Atomic>()) {
|
} else if (auto* atomic = type->As<type::Atomic>()) {
|
||||||
if (!EmitType(out, atomic->Type(), address_space, access, name)) {
|
if (!EmitType(out, atomic->Type(), address_space, access, name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "src/tint/ast/variable_decl_statement.h"
|
#include "src/tint/ast/variable_decl_statement.h"
|
||||||
#include "src/tint/debug.h"
|
#include "src/tint/debug.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/block_statement.h"
|
#include "src/tint/sem/block_statement.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/constant.h"
|
#include "src/tint/sem/constant.h"
|
||||||
|
@ -64,6 +63,7 @@
|
||||||
#include "src/tint/transform/unshadow.h"
|
#include "src/tint/transform/unshadow.h"
|
||||||
#include "src/tint/transform/vectorize_scalar_matrix_initializers.h"
|
#include "src/tint/transform/vectorize_scalar_matrix_initializers.h"
|
||||||
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
|
@ -4104,7 +4104,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](const sem::Atomic* atomic) {
|
[&](const type::Atomic* atomic) {
|
||||||
return EmitType(out, atomic->Type(), address_space, access, name);
|
return EmitType(out, atomic->Type(), address_space, access, name);
|
||||||
},
|
},
|
||||||
[&](const type::Void*) {
|
[&](const type::Void*) {
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "src/tint/ast/variable_decl_statement.h"
|
#include "src/tint/ast/variable_decl_statement.h"
|
||||||
#include "src/tint/ast/void.h"
|
#include "src/tint/ast/void.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/constant.h"
|
#include "src/tint/sem/constant.h"
|
||||||
#include "src/tint/sem/function.h"
|
#include "src/tint/sem/function.h"
|
||||||
|
@ -60,6 +59,7 @@
|
||||||
#include "src/tint/transform/unshadow.h"
|
#include "src/tint/transform/unshadow.h"
|
||||||
#include "src/tint/transform/vectorize_scalar_matrix_initializers.h"
|
#include "src/tint/transform/vectorize_scalar_matrix_initializers.h"
|
||||||
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/bool.h"
|
#include "src/tint/type/bool.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
|
@ -2523,7 +2523,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
||||||
|
|
||||||
return Switch(
|
return Switch(
|
||||||
type,
|
type,
|
||||||
[&](const sem::Atomic* atomic) {
|
[&](const type::Atomic* atomic) {
|
||||||
if (atomic->Type()->Is<type::I32>()) {
|
if (atomic->Type()->Is<type::I32>()) {
|
||||||
out << "atomic_int";
|
out << "atomic_int";
|
||||||
return true;
|
return true;
|
||||||
|
@ -3187,7 +3187,7 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(const type:
|
||||||
return SizeAndAlign{str->Size(), str->Align()};
|
return SizeAndAlign{str->Size(), str->Align()};
|
||||||
},
|
},
|
||||||
|
|
||||||
[&](const sem::Atomic* atomic) { return MslPackedTypeSizeAndAlign(atomic->Type()); },
|
[&](const type::Atomic* atomic) { return MslPackedTypeSizeAndAlign(atomic->Type()); },
|
||||||
|
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
TINT_UNREACHABLE(Writer, diagnostics_) << "Unhandled type " << ty->TypeInfo().name;
|
TINT_UNREACHABLE(Writer, diagnostics_) << "Unhandled type " << ty->TypeInfo().name;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "src/tint/ast/internal_attribute.h"
|
#include "src/tint/ast/internal_attribute.h"
|
||||||
#include "src/tint/ast/traverse_expressions.h"
|
#include "src/tint/ast/traverse_expressions.h"
|
||||||
#include "src/tint/sem/array.h"
|
#include "src/tint/sem/array.h"
|
||||||
#include "src/tint/sem/atomic.h"
|
|
||||||
#include "src/tint/sem/builtin.h"
|
#include "src/tint/sem/builtin.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/constant.h"
|
#include "src/tint/sem/constant.h"
|
||||||
|
@ -38,6 +37,7 @@
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/type_initializer.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/transform/add_block_attribute.h"
|
#include "src/tint/transform/add_block_attribute.h"
|
||||||
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
|
@ -3637,7 +3637,7 @@ uint32_t Builder::GenerateTypeIfNeeded(const type::Type* type) {
|
||||||
|
|
||||||
// Atomics are a type in WGSL, but aren't a distinct type in SPIR-V.
|
// Atomics are a type in WGSL, but aren't a distinct type in SPIR-V.
|
||||||
// Just emit the type inside the atomic.
|
// Just emit the type inside the atomic.
|
||||||
if (auto* atomic = type->As<sem::Atomic>()) {
|
if (auto* atomic = type->As<type::Atomic>()) {
|
||||||
return GenerateTypeIfNeeded(atomic->Type());
|
return GenerateTypeIfNeeded(atomic->Type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue