mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
tint: Remove ast::Void
WGSL does not have a void type. Functions that do not return a value simply omit the return type from the function signature. Change-Id: Id45adc008dce46115552e7dc401a2e27ae10eeb4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118981 Reviewed-by: James Price <jrprice@google.com> Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
@@ -154,7 +154,7 @@ class State {
|
||||
flag = b.Symbols().New("tint_return_flag");
|
||||
new_stmts[0].Push(b.Decl(b.Var(flag, b.ty.bool_())));
|
||||
|
||||
if (!function->return_type->Is<ast::Void>()) {
|
||||
if (function->return_type) {
|
||||
retval = b.Symbols().New("tint_return_value");
|
||||
new_stmts[0].Push(b.Decl(b.Var(retval, ctx.Clone(function->return_type))));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void Transform::RemoveStatement(CloneContext& ctx, const ast::Statement* stmt) {
|
||||
|
||||
const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type* ty) {
|
||||
if (ty->Is<type::Void>()) {
|
||||
return ctx.dst->create<ast::Void>();
|
||||
return nullptr;
|
||||
}
|
||||
if (ty->Is<type::I32>()) {
|
||||
return ctx.dst->create<ast::I32>();
|
||||
|
||||
@@ -45,7 +45,7 @@ TEST_F(CreateASTTypeForTest, Basic) {
|
||||
EXPECT_TRUE(create([](ProgramBuilder& b) { return b.create<type::U32>(); })->Is<ast::U32>());
|
||||
EXPECT_TRUE(create([](ProgramBuilder& b) { return b.create<type::F32>(); })->Is<ast::F32>());
|
||||
EXPECT_TRUE(create([](ProgramBuilder& b) { return b.create<type::Bool>(); })->Is<ast::Bool>());
|
||||
EXPECT_TRUE(create([](ProgramBuilder& b) { return b.create<type::Void>(); })->Is<ast::Void>());
|
||||
EXPECT_EQ(create([](ProgramBuilder& b) { return b.create<type::Void>(); }), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(CreateASTTypeForTest, Matrix) {
|
||||
|
||||
Reference in New Issue
Block a user