Remove deprecated functionality
The following deprecated features are no longer supported: - frag_coord builtin - sample_mask_in and sample_mask_out builtins - void keyword - const keyword Fixed: tint:677 Fixed: tint:699 Fixed: tint:714 Fixed: tint:715 Change-Id: I40ce9711310e70e62465f58f2a7f4d959039e307 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52041 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
cbd3bbc6d7
commit
564000fdd3
|
@ -679,7 +679,6 @@ if(${TINT_BUILD_TESTS})
|
|||
reader/wgsl/parser_impl_function_decoration_list_test.cc
|
||||
reader/wgsl/parser_impl_function_decoration_test.cc
|
||||
reader/wgsl/parser_impl_function_header_test.cc
|
||||
reader/wgsl/parser_impl_function_type_decl_test.cc
|
||||
reader/wgsl/parser_impl_global_constant_decl_test.cc
|
||||
reader/wgsl/parser_impl_global_decl_test.cc
|
||||
reader/wgsl/parser_impl_global_variable_decl_test.cc
|
||||
|
|
|
@ -39,10 +39,6 @@ std::ostream& operator<<(std::ostream& out, Builtin builtin) {
|
|||
out << "front_facing";
|
||||
break;
|
||||
}
|
||||
case Builtin::kFragCoord: {
|
||||
out << "frag_coord";
|
||||
break;
|
||||
}
|
||||
case Builtin::kFragDepth: {
|
||||
out << "frag_depth";
|
||||
break;
|
||||
|
@ -71,14 +67,6 @@ std::ostream& operator<<(std::ostream& out, Builtin builtin) {
|
|||
out << "sample_mask";
|
||||
break;
|
||||
}
|
||||
case Builtin::kSampleMaskIn: {
|
||||
out << "sample_mask_in";
|
||||
break;
|
||||
}
|
||||
case Builtin::kSampleMaskOut: {
|
||||
out << "sample_mask_out";
|
||||
break;
|
||||
}
|
||||
case Builtin::kPointSize: {
|
||||
out << "pointsize";
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ enum class Builtin {
|
|||
kVertexIndex,
|
||||
kInstanceIndex,
|
||||
kFrontFacing,
|
||||
kFragCoord, // TODO(crbug.com/tint/714): Remove this
|
||||
kFragDepth,
|
||||
kLocalInvocationId,
|
||||
kLocalInvocationIndex,
|
||||
|
@ -35,8 +34,6 @@ enum class Builtin {
|
|||
kWorkgroupId,
|
||||
kSampleIndex,
|
||||
kSampleMask,
|
||||
kSampleMaskIn, // TODO(crbug.com/tint/715): Remove this
|
||||
kSampleMaskOut, // TODO(crbug.com/tint/715): Remove this
|
||||
|
||||
// Below are not currently WGSL builtins, but are included in this enum as
|
||||
// they are used by certain backends.
|
||||
|
|
|
@ -478,8 +478,6 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
|||
return {Token::Type::kBreak, source, "break"};
|
||||
if (str == "case")
|
||||
return {Token::Type::kCase, source, "case"};
|
||||
if (str == "const")
|
||||
return {Token::Type::kConst, source, "const"};
|
||||
if (str == "continue")
|
||||
return {Token::Type::kContinue, source, "continue"};
|
||||
if (str == "continuing")
|
||||
|
@ -686,8 +684,6 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
|||
return {Token::Type::kVec3, source, "vec3"};
|
||||
if (str == "vec4")
|
||||
return {Token::Type::kVec4, source, "vec4"};
|
||||
if (str == "void")
|
||||
return {Token::Type::kVoid, source, "void"};
|
||||
if (str == "workgroup")
|
||||
return {Token::Type::kWorkgroup, source, "workgroup"};
|
||||
return {};
|
||||
|
@ -698,6 +694,8 @@ Token Lexer::check_reserved(const Source& source, const std::string& str) {
|
|||
return {Token::Type::kReservedKeyword, source, "asm"};
|
||||
if (str == "bf16")
|
||||
return {Token::Type::kReservedKeyword, source, "bf16"};
|
||||
if (str == "const")
|
||||
return {Token::Type::kReservedKeyword, source, "const"};
|
||||
if (str == "do")
|
||||
return {Token::Type::kReservedKeyword, source, "do"};
|
||||
if (str == "enum")
|
||||
|
@ -728,6 +726,8 @@ Token Lexer::check_reserved(const Source& source, const std::string& str) {
|
|||
return {Token::Type::kReservedKeyword, source, "u64"};
|
||||
if (str == "unless")
|
||||
return {Token::Type::kReservedKeyword, source, "unless"};
|
||||
if (str == "void")
|
||||
return {Token::Type::kReservedKeyword, source, "void"};
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
TokenData{"bool", Token::Type::kBool},
|
||||
TokenData{"break", Token::Type::kBreak},
|
||||
TokenData{"case", Token::Type::kCase},
|
||||
TokenData{"const", Token::Type::kConst},
|
||||
TokenData{"continue", Token::Type::kContinue},
|
||||
TokenData{"continuing", Token::Type::kContinuing},
|
||||
TokenData{"default", Token::Type::kDefault},
|
||||
|
@ -523,7 +522,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
TokenData{"vec2", Token::Type::kVec2},
|
||||
TokenData{"vec3", Token::Type::kVec3},
|
||||
TokenData{"vec4", Token::Type::kVec4},
|
||||
TokenData{"void", Token::Type::kVoid},
|
||||
TokenData{"workgroup", Token::Type::kWorkgroup}));
|
||||
|
||||
using KeywordTest_Reserved = testing::TestWithParam<const char*>;
|
||||
|
@ -540,6 +538,7 @@ INSTANTIATE_TEST_SUITE_P(LexerTest,
|
|||
KeywordTest_Reserved,
|
||||
testing::Values("asm",
|
||||
"bf16",
|
||||
"const",
|
||||
"do",
|
||||
"enum",
|
||||
"f16",
|
||||
|
@ -554,7 +553,8 @@ INSTANTIATE_TEST_SUITE_P(LexerTest,
|
|||
"u16",
|
||||
"u64",
|
||||
"unless",
|
||||
"regardless"));
|
||||
"regardless",
|
||||
"void"));
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
|
|
|
@ -83,9 +83,6 @@ ast::Builtin ident_to_builtin(const std::string& str) {
|
|||
if (str == "front_facing") {
|
||||
return ast::Builtin::kFrontFacing;
|
||||
}
|
||||
if (str == "frag_coord") {
|
||||
return ast::Builtin::kFragCoord;
|
||||
}
|
||||
if (str == "frag_depth") {
|
||||
return ast::Builtin::kFragDepth;
|
||||
}
|
||||
|
@ -107,12 +104,6 @@ ast::Builtin ident_to_builtin(const std::string& str) {
|
|||
if (str == "sample_mask") {
|
||||
return ast::Builtin::kSampleMask;
|
||||
}
|
||||
if (str == "sample_mask_in") {
|
||||
return ast::Builtin::kSampleMaskIn;
|
||||
}
|
||||
if (str == "sample_mask_out") {
|
||||
return ast::Builtin::kSampleMaskOut;
|
||||
}
|
||||
return ast::Builtin::kNone;
|
||||
}
|
||||
|
||||
|
@ -500,13 +491,7 @@ Maybe<ast::Variable*> ParserImpl::global_variable_decl(
|
|||
Maybe<ast::Variable*> ParserImpl::global_constant_decl(
|
||||
ast::DecorationList& decos) {
|
||||
if (!match(Token::Type::kLet)) {
|
||||
Source source;
|
||||
if (match(Token::Type::kConst, &source)) {
|
||||
// crbug.com/tint/699: 'const' renamed to 'let'
|
||||
deprecated(source, "use 'let' instead of 'const'");
|
||||
} else {
|
||||
return Failure::kNoMatch;
|
||||
}
|
||||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
const char* use = "let declaration";
|
||||
|
@ -1327,19 +1312,11 @@ Maybe<ast::Function*> ParserImpl::function_decl(ast::DecorationList& decos) {
|
|||
header->return_type, body.value, decos, header->return_type_decorations);
|
||||
}
|
||||
|
||||
// function_type_decl
|
||||
// : type_decl
|
||||
// | VOID
|
||||
Maybe<ast::Type*> ParserImpl::function_type_decl() {
|
||||
Source source;
|
||||
if (match(Token::Type::kVoid, &source))
|
||||
return builder_.ty.void_(source);
|
||||
|
||||
return type_decl();
|
||||
}
|
||||
|
||||
// function_header
|
||||
// : FN IDENT PAREN_LEFT param_list PAREN_RIGHT ARROW function_type_decl
|
||||
// : FN IDENT PAREN_LEFT param_list PAREN_RIGHT return_type_decl_optional
|
||||
// return_type_decl_optional
|
||||
// :
|
||||
// | ARROW attribute_list* type_decl
|
||||
Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
||||
Source source;
|
||||
if (!match(Token::Type::kFn, &source)) {
|
||||
|
@ -1377,7 +1354,7 @@ Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
|||
|
||||
auto tok = peek();
|
||||
|
||||
auto type = function_type_decl();
|
||||
auto type = type_decl();
|
||||
if (type.errored) {
|
||||
errored = true;
|
||||
} else if (!type.matched) {
|
||||
|
@ -1385,13 +1362,6 @@ Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
|||
} else {
|
||||
return_type = type.value;
|
||||
}
|
||||
|
||||
if (Is<ast::Void>(return_type)) {
|
||||
// crbug.com/tint/677: void has been removed from the language
|
||||
deprecated(tok.source(),
|
||||
"omit '-> void' for functions that do not return a value");
|
||||
}
|
||||
|
||||
} else {
|
||||
return_type = builder_.ty.void_();
|
||||
}
|
||||
|
@ -1489,16 +1459,6 @@ Expect<ast::Builtin> ParserImpl::expect_builtin() {
|
|||
if (builtin == ast::Builtin::kNone)
|
||||
return add_error(ident.source, "invalid value for builtin decoration");
|
||||
|
||||
if (builtin == ast::Builtin::kFragCoord) {
|
||||
deprecated(ident.source, "use 'position' instead of 'frag_coord'");
|
||||
}
|
||||
if (builtin == ast::Builtin::kSampleMaskIn) {
|
||||
deprecated(ident.source, "use 'sample_mask' instead of 'sample_mask_in'");
|
||||
}
|
||||
if (builtin == ast::Builtin::kSampleMaskOut) {
|
||||
deprecated(ident.source, "use 'sample_mask' instead of 'sample_mask_out'");
|
||||
}
|
||||
|
||||
return {builtin, ident.source};
|
||||
}
|
||||
|
||||
|
@ -1695,17 +1655,7 @@ Maybe<ast::ReturnStatement*> ParserImpl::return_stmt() {
|
|||
// | variable_decl EQUAL logical_or_expression
|
||||
// | CONST variable_ident_decl EQUAL logical_or_expression
|
||||
Maybe<ast::VariableDeclStatement*> ParserImpl::variable_stmt() {
|
||||
bool is_const = match(Token::Type::kLet);
|
||||
if (!is_const) {
|
||||
Source source;
|
||||
if (match(Token::Type::kConst, &source)) {
|
||||
// crbug.com/tint/699: 'const' renamed to 'let'
|
||||
deprecated(source, "use 'let' instead of 'const'");
|
||||
is_const = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_const) {
|
||||
if (match(Token::Type::kLet)) {
|
||||
auto decl = expect_variable_ident_decl("let declaration");
|
||||
if (decl.errored)
|
||||
return Failure::kErrored;
|
||||
|
|
|
@ -458,9 +458,6 @@ class ParserImpl {
|
|||
/// @param use a description of what was being parsed if an error was raised
|
||||
/// @returns returns the image format or kNone if none matched.
|
||||
Expect<ast::ImageFormat> expect_image_storage_type(const std::string& use);
|
||||
/// Parses a `function_type_decl` grammar element
|
||||
/// @returns the parsed type or nullptr otherwise
|
||||
Maybe<ast::Type*> function_type_decl();
|
||||
/// Parses a `function_header` grammar element
|
||||
/// @returns the parsed function header
|
||||
Maybe<FunctionHeader> function_header();
|
||||
|
|
|
@ -367,10 +367,10 @@ TEST_F(ParserImplErrorTest, FunctionDeclMissingRParen) {
|
|||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, FunctionDeclMissingArrow) {
|
||||
EXPECT("fn f() void {}",
|
||||
EXPECT("fn f() f32 {}",
|
||||
"test.wgsl:1:8 error: expected '{'\n"
|
||||
"fn f() void {}\n"
|
||||
" ^^^^\n");
|
||||
"fn f() f32 {}\n"
|
||||
" ^^^\n");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplErrorTest, FunctionDeclInvalidReturnType) {
|
||||
|
|
|
@ -124,19 +124,6 @@ TEST_F(ParserImplTest, FunctionHeader_MissingReturnType) {
|
|||
EXPECT_EQ(p->error(), "1:13: unable to determine function return type");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, FunctionHeader_ArrowVoid) {
|
||||
auto p = parser("fn main() -> void");
|
||||
auto f = p->function_header();
|
||||
EXPECT_TRUE(f.matched);
|
||||
EXPECT_FALSE(f.errored);
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:14 warning: use of deprecated language feature: omit '-> void' for functions that do not return a value
|
||||
fn main() -> void
|
||||
^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright 2020 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/reader/wgsl/parser_impl_test_helper.h"
|
||||
|
||||
namespace tint {
|
||||
namespace reader {
|
||||
namespace wgsl {
|
||||
namespace {
|
||||
|
||||
TEST_F(ParserImplTest, FunctionTypeDecl_Void) {
|
||||
auto p = parser("void");
|
||||
|
||||
auto e = p->function_type_decl();
|
||||
EXPECT_TRUE(e.matched);
|
||||
EXPECT_FALSE(e.errored);
|
||||
EXPECT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(e.value->Is<ast::Void>());
|
||||
EXPECT_EQ(e.value->source().range, (Source::Range{{1u, 1u}, {1u, 5u}}));
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, FunctionTypeDecl_Type) {
|
||||
auto p = parser("vec2<f32>");
|
||||
|
||||
auto e = p->function_type_decl();
|
||||
EXPECT_TRUE(e.matched);
|
||||
EXPECT_FALSE(e.errored);
|
||||
EXPECT_FALSE(p->has_error()) << p->error();
|
||||
ASSERT_TRUE(e.value->Is<ast::Vector>());
|
||||
EXPECT_EQ(e.value->As<ast::Vector>()->size(), 2u);
|
||||
EXPECT_TRUE(e.value->As<ast::Vector>()->type()->Is<ast::F32>());
|
||||
EXPECT_EQ(e.value->source().range, (Source::Range{{1u, 1u}, {1u, 10u}}));
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, FunctionTypeDecl_InvalidType) {
|
||||
auto p = parser("vec2<invalid>");
|
||||
auto e = p->function_type_decl();
|
||||
EXPECT_FALSE(e.matched);
|
||||
EXPECT_TRUE(e.errored);
|
||||
EXPECT_TRUE(p->has_error());
|
||||
EXPECT_EQ(e.value, nullptr);
|
||||
EXPECT_EQ(p->error(), "1:6: unknown constructed type 'invalid'");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
} // namespace tint
|
|
@ -181,23 +181,6 @@ TEST_F(ParserImplTest, GlobalConstantDec_Override_InvalidId) {
|
|||
EXPECT_EQ(p->error(), "1:12: override decoration must be positive");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, GlobalConstantDec_Const) {
|
||||
auto p = parser("const a : i32 = 1");
|
||||
auto decos = p->decoration_list();
|
||||
EXPECT_FALSE(decos.errored);
|
||||
EXPECT_FALSE(decos.matched);
|
||||
|
||||
auto e = p->global_constant_decl(decos.value);
|
||||
EXPECT_TRUE(e.matched);
|
||||
EXPECT_FALSE(e.errored);
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:1 warning: use of deprecated language feature: use 'let' instead of 'const'
|
||||
const a : i32 = 1
|
||||
^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -113,7 +113,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
BuiltinData{"instance_idx", ast::Builtin::kInstanceIndex},
|
||||
BuiltinData{"instance_index", ast::Builtin::kInstanceIndex},
|
||||
BuiltinData{"front_facing", ast::Builtin::kFrontFacing},
|
||||
BuiltinData{"frag_coord", ast::Builtin::kFragCoord},
|
||||
BuiltinData{"frag_depth", ast::Builtin::kFragDepth},
|
||||
BuiltinData{"local_invocation_id", ast::Builtin::kLocalInvocationId},
|
||||
BuiltinData{"local_invocation_idx",
|
||||
|
@ -123,9 +122,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId},
|
||||
BuiltinData{"workgroup_id", ast::Builtin::kWorkgroupId},
|
||||
BuiltinData{"sample_index", ast::Builtin::kSampleIndex},
|
||||
BuiltinData{"sample_mask", ast::Builtin::kSampleMask},
|
||||
BuiltinData{"sample_mask_in", ast::Builtin::kSampleMaskIn},
|
||||
BuiltinData{"sample_mask_out", ast::Builtin::kSampleMaskOut}));
|
||||
BuiltinData{"sample_mask", ast::Builtin::kSampleMask}));
|
||||
|
||||
TEST_F(ParserImplTest, Decoration_Builtin_MissingLeftParen) {
|
||||
auto p = parser("builtin position)");
|
||||
|
@ -307,72 +304,6 @@ TEST_F(ParserImplTest, Decoration_Group_MissingInvalid) {
|
|||
"1:7: expected signed integer literal for group decoration");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, Decoration_FragCoord_Deprecated) {
|
||||
auto p = parser("builtin(frag_coord)");
|
||||
auto deco = p->decoration();
|
||||
EXPECT_TRUE(deco.matched);
|
||||
EXPECT_FALSE(deco.errored);
|
||||
ASSERT_NE(deco.value, nullptr);
|
||||
auto* var_deco = deco.value->As<ast::Decoration>();
|
||||
ASSERT_NE(var_deco, nullptr);
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_TRUE(var_deco->Is<ast::BuiltinDecoration>());
|
||||
|
||||
auto* builtin = var_deco->As<ast::BuiltinDecoration>();
|
||||
EXPECT_EQ(builtin->value(), ast::Builtin::kFragCoord);
|
||||
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:9 warning: use of deprecated language feature: use 'position' instead of 'frag_coord'
|
||||
builtin(frag_coord)
|
||||
^^^^^^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, Decoration_SampleMaskIn_Deprecated) {
|
||||
auto p = parser("builtin(sample_mask_in)");
|
||||
auto deco = p->decoration();
|
||||
EXPECT_TRUE(deco.matched);
|
||||
EXPECT_FALSE(deco.errored);
|
||||
ASSERT_NE(deco.value, nullptr);
|
||||
auto* var_deco = deco.value->As<ast::Decoration>();
|
||||
ASSERT_NE(var_deco, nullptr);
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_TRUE(var_deco->Is<ast::BuiltinDecoration>());
|
||||
|
||||
auto* builtin = var_deco->As<ast::BuiltinDecoration>();
|
||||
EXPECT_EQ(builtin->value(), ast::Builtin::kSampleMaskIn);
|
||||
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:9 warning: use of deprecated language feature: use 'sample_mask' instead of 'sample_mask_in'
|
||||
builtin(sample_mask_in)
|
||||
^^^^^^^^^^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, Decoration_SampleMaskOut_Deprecated) {
|
||||
auto p = parser("builtin(sample_mask_out)");
|
||||
auto deco = p->decoration();
|
||||
EXPECT_TRUE(deco.matched);
|
||||
EXPECT_FALSE(deco.errored);
|
||||
ASSERT_NE(deco.value, nullptr);
|
||||
auto* var_deco = deco.value->As<ast::Decoration>();
|
||||
ASSERT_NE(var_deco, nullptr);
|
||||
ASSERT_FALSE(p->has_error());
|
||||
ASSERT_TRUE(var_deco->Is<ast::BuiltinDecoration>());
|
||||
|
||||
auto* builtin = var_deco->As<ast::BuiltinDecoration>();
|
||||
EXPECT_EQ(builtin->value(), ast::Builtin::kSampleMaskOut);
|
||||
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:9 warning: use of deprecated language feature: use 'sample_mask' instead of 'sample_mask_out'
|
||||
builtin(sample_mask_out)
|
||||
^^^^^^^^^^^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -193,19 +193,6 @@ TEST_F(ParserImplTest, VariableStmt_Let_InvalidConstructor) {
|
|||
EXPECT_EQ(p->error(), "1:15: missing constructor for let declaration");
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, VariableStmt_Const) {
|
||||
auto p = parser("const a : i32 = 1");
|
||||
auto e = p->variable_stmt();
|
||||
EXPECT_TRUE(e.matched);
|
||||
EXPECT_FALSE(e.errored);
|
||||
EXPECT_EQ(
|
||||
p->builder().Diagnostics().str(),
|
||||
R"(test.wgsl:1:1 warning: use of deprecated language feature: use 'let' instead of 'const'
|
||||
const a : i32 = 1
|
||||
^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -115,8 +115,6 @@ std::string Token::TypeToName(Type type) {
|
|||
return "break";
|
||||
case Token::Type::kCase:
|
||||
return "case";
|
||||
case Token::Type::kConst:
|
||||
return "const";
|
||||
case Token::Type::kContinue:
|
||||
return "continue";
|
||||
case Token::Type::kContinuing:
|
||||
|
@ -309,8 +307,6 @@ std::string Token::TypeToName(Type type) {
|
|||
return "vec3";
|
||||
case Token::Type::kVec4:
|
||||
return "vec4";
|
||||
case Token::Type::kVoid:
|
||||
return "void";
|
||||
case Token::Type::kWorkgroup:
|
||||
return "workgroup";
|
||||
}
|
||||
|
|
|
@ -123,8 +123,6 @@ class Token {
|
|||
kBreak,
|
||||
/// A 'case'
|
||||
kCase,
|
||||
/// A 'const'
|
||||
kConst,
|
||||
/// A 'continue'
|
||||
kContinue,
|
||||
/// A 'continuing'
|
||||
|
@ -317,8 +315,6 @@ class Token {
|
|||
kVec3,
|
||||
/// A 'vec4'
|
||||
kVec4,
|
||||
/// A 'void'
|
||||
kVoid,
|
||||
/// A 'workgroup'
|
||||
kWorkgroup,
|
||||
};
|
||||
|
@ -464,8 +460,6 @@ class Token {
|
|||
bool IsCase() const { return type_ == Type::kCase; }
|
||||
/// @returns true if token is a 'sampler_comparison'
|
||||
bool IsComparisonSampler() const { return type_ == Type::kComparisonSampler; }
|
||||
/// @returns true if token is a 'const'
|
||||
bool IsConst() const { return type_ == Type::kConst; }
|
||||
/// @returns true if token is a 'continue'
|
||||
bool IsContinue() const { return type_ == Type::kContinue; }
|
||||
/// @returns true if token is a 'continuing'
|
||||
|
@ -676,8 +670,6 @@ class Token {
|
|||
bool IsVec3() const { return type_ == Type::kVec3; }
|
||||
/// @returns true if token is a 'vec4'
|
||||
bool IsVec4() const { return type_ == Type::kVec4; }
|
||||
/// @returns true if token is a 'void'
|
||||
bool IsVoid() const { return type_ == Type::kVoid; }
|
||||
/// @returns true if token is a 'workgroup'
|
||||
bool IsWorkgroup() const { return type_ == Type::kWorkgroup; }
|
||||
|
||||
|
|
|
@ -230,9 +230,7 @@ void Spirv::HandleSampleMaskBuiltins(CloneContext& ctx) const {
|
|||
for (auto* var : ctx.src->AST().GlobalVariables()) {
|
||||
for (auto* deco : var->decorations()) {
|
||||
if (auto* builtin = deco->As<ast::BuiltinDecoration>()) {
|
||||
if (builtin->value() != ast::Builtin::kSampleMask &&
|
||||
builtin->value() != ast::Builtin::kSampleMaskIn &&
|
||||
builtin->value() != ast::Builtin::kSampleMaskOut) {
|
||||
if (builtin->value() != ast::Builtin::kSampleMask) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1957,8 +1957,6 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const {
|
|||
return "SV_InstanceID";
|
||||
case ast::Builtin::kFrontFacing:
|
||||
return "SV_IsFrontFace";
|
||||
case ast::Builtin::kFragCoord:
|
||||
return "SV_Position";
|
||||
case ast::Builtin::kFragDepth:
|
||||
return "SV_Depth";
|
||||
case ast::Builtin::kLocalInvocationId:
|
||||
|
@ -1973,10 +1971,6 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const {
|
|||
return "SV_SampleIndex";
|
||||
case ast::Builtin::kSampleMask:
|
||||
return "SV_Coverage";
|
||||
case ast::Builtin::kSampleMaskIn:
|
||||
return "SV_Coverage";
|
||||
case ast::Builtin::kSampleMaskOut:
|
||||
return "SV_Coverage";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
HlslBuiltinData{ast::Builtin::kVertexIndex, "SV_VertexID"},
|
||||
HlslBuiltinData{ast::Builtin::kInstanceIndex, "SV_InstanceID"},
|
||||
HlslBuiltinData{ast::Builtin::kFrontFacing, "SV_IsFrontFace"},
|
||||
HlslBuiltinData{ast::Builtin::kFragCoord, "SV_Position"},
|
||||
HlslBuiltinData{ast::Builtin::kFragDepth, "SV_Depth"},
|
||||
HlslBuiltinData{ast::Builtin::kLocalInvocationId, "SV_GroupThreadID"},
|
||||
HlslBuiltinData{ast::Builtin::kLocalInvocationIndex, "SV_GroupIndex"},
|
||||
|
@ -84,9 +83,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
"SV_DispatchThreadID"},
|
||||
HlslBuiltinData{ast::Builtin::kWorkgroupId, "SV_GroupID"},
|
||||
HlslBuiltinData{ast::Builtin::kSampleIndex, "SV_SampleIndex"},
|
||||
HlslBuiltinData{ast::Builtin::kSampleMask, "SV_Coverage"},
|
||||
HlslBuiltinData{ast::Builtin::kSampleMaskIn, "SV_Coverage"},
|
||||
HlslBuiltinData{ast::Builtin::kSampleMaskOut, "SV_Coverage"}));
|
||||
HlslBuiltinData{ast::Builtin::kSampleMask, "SV_Coverage"}));
|
||||
|
||||
} // namespace
|
||||
} // namespace hlsl
|
||||
|
|
|
@ -1341,8 +1341,6 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const {
|
|||
return "instance_id";
|
||||
case ast::Builtin::kFrontFacing:
|
||||
return "front_facing";
|
||||
case ast::Builtin::kFragCoord:
|
||||
return "position";
|
||||
case ast::Builtin::kFragDepth:
|
||||
return "depth(any)";
|
||||
case ast::Builtin::kLocalInvocationId:
|
||||
|
@ -1357,10 +1355,6 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const {
|
|||
return "sample_id";
|
||||
case ast::Builtin::kSampleMask:
|
||||
return "sample_mask";
|
||||
case ast::Builtin::kSampleMaskIn:
|
||||
return "sample_mask";
|
||||
case ast::Builtin::kSampleMaskOut:
|
||||
return "sample_mask";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
MslBuiltinData{ast::Builtin::kVertexIndex, "vertex_id"},
|
||||
MslBuiltinData{ast::Builtin::kInstanceIndex, "instance_id"},
|
||||
MslBuiltinData{ast::Builtin::kFrontFacing, "front_facing"},
|
||||
MslBuiltinData{ast::Builtin::kFragCoord, "position"},
|
||||
MslBuiltinData{ast::Builtin::kFragDepth, "depth(any)"},
|
||||
MslBuiltinData{ast::Builtin::kLocalInvocationId,
|
||||
"thread_position_in_threadgroup"},
|
||||
|
@ -76,10 +75,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
MslBuiltinData{ast::Builtin::kWorkgroupId,
|
||||
"threadgroup_position_in_grid"},
|
||||
MslBuiltinData{ast::Builtin::kSampleIndex, "sample_id"},
|
||||
MslBuiltinData{ast::Builtin::kSampleMask, "sample_mask"},
|
||||
MslBuiltinData{ast::Builtin::kSampleMaskIn, "sample_mask"},
|
||||
MslBuiltinData{ast::Builtin::kSampleMaskOut,
|
||||
"sample_mask"}));
|
||||
MslBuiltinData{ast::Builtin::kSampleMask, "sample_mask"}));
|
||||
|
||||
} // namespace
|
||||
} // namespace msl
|
||||
|
|
|
@ -3369,8 +3369,6 @@ SpvBuiltIn Builder::ConvertBuiltin(ast::Builtin builtin,
|
|||
return SpvBuiltInInstanceIndex;
|
||||
case ast::Builtin::kFrontFacing:
|
||||
return SpvBuiltInFrontFacing;
|
||||
case ast::Builtin::kFragCoord:
|
||||
return SpvBuiltInFragCoord;
|
||||
case ast::Builtin::kFragDepth:
|
||||
return SpvBuiltInFragDepth;
|
||||
case ast::Builtin::kLocalInvocationId:
|
||||
|
@ -3388,10 +3386,6 @@ SpvBuiltIn Builder::ConvertBuiltin(ast::Builtin builtin,
|
|||
return SpvBuiltInSampleId;
|
||||
case ast::Builtin::kSampleMask:
|
||||
return SpvBuiltInSampleMask;
|
||||
case ast::Builtin::kSampleMaskIn:
|
||||
return SpvBuiltInSampleMask;
|
||||
case ast::Builtin::kSampleMaskOut:
|
||||
return SpvBuiltInSampleMask;
|
||||
case ast::Builtin::kNone:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -373,8 +373,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
SpvBuiltInInstanceIndex},
|
||||
BuiltinData{ast::Builtin::kFrontFacing, ast::StorageClass::kInput,
|
||||
SpvBuiltInFrontFacing},
|
||||
BuiltinData{ast::Builtin::kFragCoord, ast::StorageClass::kInput,
|
||||
SpvBuiltInFragCoord},
|
||||
BuiltinData{ast::Builtin::kFragDepth, ast::StorageClass::kOutput,
|
||||
SpvBuiltInFragDepth},
|
||||
BuiltinData{ast::Builtin::kLocalInvocationId, ast::StorageClass::kInput,
|
||||
|
@ -390,10 +388,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kInput,
|
||||
SpvBuiltInSampleMask},
|
||||
BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kOutput,
|
||||
SpvBuiltInSampleMask},
|
||||
BuiltinData{ast::Builtin::kSampleMaskIn, ast::StorageClass::kInput,
|
||||
SpvBuiltInSampleMask},
|
||||
BuiltinData{ast::Builtin::kSampleMaskOut, ast::StorageClass::kOutput,
|
||||
SpvBuiltInSampleMask}));
|
||||
|
||||
TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
|
||||
|
|
|
@ -66,7 +66,6 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
WgslBuiltinData{ast::Builtin::kVertexIndex, "vertex_index"},
|
||||
WgslBuiltinData{ast::Builtin::kInstanceIndex, "instance_index"},
|
||||
WgslBuiltinData{ast::Builtin::kFrontFacing, "front_facing"},
|
||||
WgslBuiltinData{ast::Builtin::kFragCoord, "frag_coord"},
|
||||
WgslBuiltinData{ast::Builtin::kFragDepth, "frag_depth"},
|
||||
WgslBuiltinData{ast::Builtin::kLocalInvocationId,
|
||||
"local_invocation_id"},
|
||||
|
@ -75,9 +74,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
WgslBuiltinData{ast::Builtin::kGlobalInvocationId,
|
||||
"global_invocation_id"},
|
||||
WgslBuiltinData{ast::Builtin::kWorkgroupId, "workgroup_id"},
|
||||
WgslBuiltinData{ast::Builtin::kSampleIndex, "sample_index"},
|
||||
WgslBuiltinData{ast::Builtin::kSampleMaskIn, "sample_mask_in"},
|
||||
WgslBuiltinData{ast::Builtin::kSampleMaskOut, "sample_mask_out"}));
|
||||
WgslBuiltinData{ast::Builtin::kSampleIndex, "sample_index"}));
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
|
|
|
@ -439,7 +439,6 @@ tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
|
|||
"../src/reader/wgsl/parser_impl_function_decoration_list_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_function_decoration_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_function_header_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_function_type_decl_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_global_constant_decl_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_global_decl_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_global_variable_decl_test.cc",
|
||||
|
|
Loading…
Reference in New Issue