diff --git a/src/BUILD.gn b/src/BUILD.gn index b54c79fb4a..2a095e79af 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -295,8 +295,6 @@ libtint_source_set("libtint_core_all_src") { sources = [ "ast/access.cc", "ast/access.h", - "ast/access_decoration.cc", - "ast/access_decoration.h", "ast/alias.cc", "ast/alias.h", "ast/array.cc", diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af2200b0b9..1df7ed6130 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,8 +40,6 @@ set(TINT_LIB_SRCS ../include/tint/tint.h ast/access.cc ast/access.h - ast/access_decoration.cc - ast/access_decoration.h ast/alias.cc ast/alias.h ast/array_accessor_expression.cc @@ -513,7 +511,6 @@ endif() if(${TINT_BUILD_TESTS}) set(TINT_TEST_SRCS - ast/access_decoration_test.cc ast/alias_test.cc ast/array_accessor_expression_test.cc ast/array_test.cc diff --git a/src/ast/access_decoration.cc b/src/ast/access_decoration.cc deleted file mode 100644 index 6a3b6f0b5a..0000000000 --- a/src/ast/access_decoration.cc +++ /dev/null @@ -1,51 +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/ast/access_decoration.h" - -#include - -#include "src/program_builder.h" - -TINT_INSTANTIATE_TYPEINFO(tint::ast::AccessDecoration); - -namespace tint { -namespace ast { - -AccessDecoration::AccessDecoration(ProgramID program_id, - const Source& source, - Access val) - : Base(program_id, source), value_(val) {} - -AccessDecoration::~AccessDecoration() = default; - -std::string AccessDecoration::name() const { - return "access"; -} - -void AccessDecoration::to_str(const sem::Info&, - std::ostream& out, - size_t indent) const { - make_indent(out, indent); - out << "AccessDecoration{" << value_ << "}" << std::endl; -} - -AccessDecoration* AccessDecoration::Clone(CloneContext* ctx) const { - // Clone arguments outside of create() call to have deterministic ordering - auto src = ctx->Clone(source()); - return ctx->dst->create(src, value_); -} - -} // namespace ast -} // namespace tint diff --git a/src/ast/access_decoration.h b/src/ast/access_decoration.h deleted file mode 100644 index cee1646de7..0000000000 --- a/src/ast/access_decoration.h +++ /dev/null @@ -1,64 +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. - -#ifndef SRC_AST_ACCESS_DECORATION_H_ -#define SRC_AST_ACCESS_DECORATION_H_ - -#include - -#include "src/ast/access.h" -#include "src/ast/decoration.h" - -namespace tint { -namespace ast { - -/// An access decoration -/// [DEPRECATED]: TODO(crbug.com/tint/846): Remove this class -class AccessDecoration : public Castable { - public: - /// constructor - /// @param program_id the identifier of the program that owns this node - /// @param source the source of this decoration - /// @param value the access value - AccessDecoration(ProgramID program_id, const Source& source, Access value); - ~AccessDecoration() override; - - /// @returns the access control value - Access value() const { return value_; } - - /// @returns the WGSL name for the decoration - std::string name() const override; - - /// Outputs the decoration to the given stream - /// @param sem the semantic info for the program - /// @param out the stream to write to - /// @param indent number of spaces to indent the node when writing - void to_str(const sem::Info& sem, - std::ostream& out, - size_t indent) const override; - - /// Clones this node and all transitive child nodes using the `CloneContext` - /// `ctx`. - /// @param ctx the clone context - /// @return the newly cloned node - AccessDecoration* Clone(CloneContext* ctx) const override; - - private: - Access const value_; -}; - -} // namespace ast -} // namespace tint - -#endif // SRC_AST_ACCESS_DECORATION_H_ diff --git a/src/ast/access_decoration_test.cc b/src/ast/access_decoration_test.cc deleted file mode 100644 index ecb6e0d377..0000000000 --- a/src/ast/access_decoration_test.cc +++ /dev/null @@ -1,38 +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/ast/access_decoration.h" - -#include "src/ast/test_helper.h" - -namespace tint { -namespace ast { -namespace { - -using AccessDecorationTest = TestHelper; - -TEST_F(AccessDecorationTest, Creation) { - auto* d = create(ast::Access::kWrite); - EXPECT_EQ(ast::Access::kWrite, d->value()); -} - -TEST_F(AccessDecorationTest, ToStr) { - auto* d = create(ast::Access::kRead); - EXPECT_EQ(str(d), R"(AccessDecoration{read} -)"); -} - -} // namespace -} // namespace ast -} // namespace tint diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index a84e15c8ac..425b7d5251 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -14,7 +14,6 @@ #include "src/reader/wgsl/parser_impl.h" -#include "src/ast/access_decoration.h" #include "src/ast/array.h" #include "src/ast/assignment_statement.h" #include "src/ast/bitcast_expression.h" @@ -107,14 +106,12 @@ ast::Builtin ident_to_builtin(const std::string& str) { return ast::Builtin::kNone; } -const char kAccessDecoration[] = "access"; const char kBindingDecoration[] = "binding"; const char kBlockDecoration[] = "block"; const char kBuiltinDecoration[] = "builtin"; const char kGroupDecoration[] = "group"; const char kLocationDecoration[] = "location"; const char kOverrideDecoration[] = "override"; -const char kOffsetDecoration[] = "offset"; // DEPRECATED const char kSizeDecoration[] = "size"; const char kAlignDecoration[] = "align"; const char kSetDecoration[] = "set"; @@ -127,11 +124,10 @@ bool is_decoration(Token t) { return false; auto s = t.to_str(); - return s == kAccessDecoration || s == kAlignDecoration || - s == kBindingDecoration || s == kBlockDecoration || - s == kBuiltinDecoration || s == kGroupDecoration || - s == kLocationDecoration || s == kOverrideDecoration || - s == kOffsetDecoration || s == kSetDecoration || + return s == kAlignDecoration || s == kBindingDecoration || + s == kBlockDecoration || s == kBuiltinDecoration || + s == kGroupDecoration || s == kLocationDecoration || + s == kOverrideDecoration || s == kSetDecoration || s == kSizeDecoration || s == kStageDecoration || s == kStrideDecoration || s == kWorkgroupSizeDecoration; } @@ -204,13 +200,9 @@ ParserImpl::TypedIdentifier::TypedIdentifier() = default; ParserImpl::TypedIdentifier::TypedIdentifier(const TypedIdentifier&) = default; ParserImpl::TypedIdentifier::TypedIdentifier(ast::Type* type_in, - ast::Access access_in, std::string name_in, Source source_in) - : type(type_in), - access(access_in), - name(std::move(name_in)), - source(std::move(source_in)) {} + : type(type_in), name(std::move(name_in)), source(std::move(source_in)) {} ParserImpl::TypedIdentifier::~TypedIdentifier() = default; @@ -557,19 +549,7 @@ Maybe ParserImpl::variable_decl(bool allow_inferred) { if (decl.errored) return Failure::kErrored; - auto access = vq.access; - - if (access == ast::Access::kUndefined && - decl->access != ast::Access::kUndefined) { - // TODO(crbug.com/tint/846): Remove this - access = decl->access; - std::stringstream msg; - msg << "declare access with var<" << vq.storage_class << ", " << access - << "> instead of using [[access]] decoration"; - deprecated(source, msg.str()); - } - - return VarDeclInfo{decl->source, decl->name, vq.storage_class, access, + return VarDeclInfo{decl->source, decl->name, vq.storage_class, vq.access, decl->type}; } @@ -580,8 +560,7 @@ Maybe ParserImpl::variable_decl(bool allow_inferred) { // | multisampled_texture_type LESS_THAN type_decl GREATER_THAN // | storage_texture_type LESS_THAN image_storage_type // COMMA access GREATER_THAN -Maybe ParserImpl::texture_sampler_types( - ast::DecorationList& decos) { +Maybe ParserImpl::texture_sampler_types() { auto type = sampler_type(); if (type.matched) return type; @@ -630,21 +609,8 @@ Maybe ParserImpl::texture_sampler_types( return Failure::kErrored; } - if (!match(Token::Type::kComma)) { - // TODO(crbug.com/tint/846): Remove this, along with the decos parameter - auto access_decos = take_decorations(decos); - if (access_decos.size() > 1) { - return add_error(access_decos[1]->source(), - "multiple access decorations not allowed"); - } - if (access_decos.size() == 0) { - return add_error(source_range, "expected access control"); - } - - deprecated( - peek().source(), - "access control is expected as last parameter of storage textures"); - return std::make_pair(format.value, access_decos[0]->value()); + if (!expect("access control", Token::Type::kComma)) { + return Failure::kErrored; } auto access = expect_access("access control"); @@ -926,8 +892,7 @@ Expect ParserImpl::expect_variable_ident_decl( return Failure::kErrored; if (allow_inferred && !peek().Is(Token::Type::kColon)) { - return TypedIdentifier{nullptr, ast::Access::kUndefined, ident.value, - ident.source}; + return TypedIdentifier{nullptr, ident.value, ident.source}; } if (!expect(use, Token::Type::kColon)) @@ -944,18 +909,10 @@ Expect ParserImpl::expect_variable_ident_decl( if (!type.matched) return add_error(t.source(), "invalid type", use); - auto access_decos = take_decorations(decos.value); - if (!expect_decorations_consumed(decos.value)) return Failure::kErrored; - if (access_decos.size() > 1) - return add_error(ident.source, "multiple access decorations not allowed"); - - auto access = - access_decos.empty() ? ast::Access::kUndefined : access_decos[0]->value(); - - return TypedIdentifier{type.value, access, ident.value, ident.source}; + return TypedIdentifier{type.value, ident.value, ident.source}; } Expect ParserImpl::expect_access(const std::string& use) { @@ -1120,7 +1077,7 @@ Maybe ParserImpl::type_decl(ast::DecorationList& decos) { return expect_type_decl_matrix(t); } - auto texture_or_sampler = texture_sampler_types(decos); + auto texture_or_sampler = texture_sampler_types(); if (texture_or_sampler.errored) return Failure::kErrored; if (texture_or_sampler.matched) @@ -2991,16 +2948,6 @@ Maybe ParserImpl::decoration() { } auto s = t.to_str(); - if (s == kAccessDecoration) { - const char* use = "access decoration"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_access("access control"); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } if (s == kLocationDecoration) { const char* use = "location decoration"; @@ -3108,20 +3055,6 @@ Maybe ParserImpl::decoration() { }); } - if (s == kOffsetDecoration) { - deprecated(t.source(), - "[[offset]] has been replaced with [[size]] and [[align]]"); - - const char* use = "offset decoration"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_positive_sint(use); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } - if (s == kSizeDecoration) { const char* use = "size decoration"; return expect_paren_block(use, [&]() -> Result { diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h index 8e6fb0cc8a..adeced48f9 100644 --- a/src/reader/wgsl/parser_impl.h +++ b/src/reader/wgsl/parser_impl.h @@ -208,20 +208,14 @@ class ParserImpl { TypedIdentifier(const TypedIdentifier& other); /// Constructor /// @param type_in parsed type - /// @param access_in parsed access /// @param name_in parsed identifier /// @param source_in source to the identifier - TypedIdentifier(ast::Type* type_in, - ast::Access access_in, - std::string name_in, - Source source_in); + TypedIdentifier(ast::Type* type_in, std::string name_in, Source source_in); /// Destructor ~TypedIdentifier(); /// Parsed type. May be nullptr for inferred types. ast::Type* type = nullptr; - /// The access control. TODO(crbug.com/tint/846): Remove - ast::Access access = ast::Access::kUndefined; /// Parsed identifier. std::string name; /// Source to the identifier. @@ -456,10 +450,8 @@ class ParserImpl { /// @returns the parsed function, nullptr otherwise Maybe function_decl(ast::DecorationList& decos); /// Parses a `texture_sampler_types` grammar element - /// TODO(crbug.com/tint/864): Remove decos parameter - /// @param decos the list of decorations for the type declaration. /// @returns the parsed Type or nullptr if none matched. - Maybe texture_sampler_types(ast::DecorationList& decos); + Maybe texture_sampler_types(); /// Parses a `sampler_type` grammar element /// @returns the parsed Type or nullptr if none matched. Maybe sampler_type(); diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc index d62538e922..6add8ee355 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc @@ -19,74 +19,6 @@ namespace reader { namespace wgsl { namespace { -TEST_F(ParserImplTest, Decoration_Offset) { - auto p = parser("offset(4)"); - auto deco = p->decoration(); - EXPECT_TRUE(deco.matched); - EXPECT_FALSE(deco.errored); - ASSERT_NE(deco.value, nullptr); - ASSERT_FALSE(p->has_error()); - - auto* member_deco = deco.value->As(); - ASSERT_NE(member_deco, nullptr); - ASSERT_TRUE(member_deco->Is()); - - auto* o = member_deco->As(); - EXPECT_EQ(o->offset(), 4u); -} - -TEST_F(ParserImplTest, Decoration_Offset_MissingLeftParen) { - auto p = parser("offset 4)"); - auto deco = p->decoration(); - EXPECT_FALSE(deco.matched); - EXPECT_TRUE(deco.errored); - EXPECT_EQ(deco.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ( - p->error(), - R"(1:1: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] -1:8: expected '(' for offset decoration)"); -} - -TEST_F(ParserImplTest, Decoration_Offset_MissingRightParen) { - auto p = parser("offset(4"); - auto deco = p->decoration(); - EXPECT_FALSE(deco.matched); - EXPECT_TRUE(deco.errored); - EXPECT_EQ(deco.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ( - p->error(), - R"(1:1: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] -1:9: expected ')' for offset decoration)"); -} - -TEST_F(ParserImplTest, Decoration_Offset_MissingValue) { - auto p = parser("offset()"); - auto deco = p->decoration(); - EXPECT_FALSE(deco.matched); - EXPECT_TRUE(deco.errored); - EXPECT_EQ(deco.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ( - p->error(), - R"(1:1: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] -1:8: expected signed integer literal for offset decoration)"); -} - -TEST_F(ParserImplTest, Decoration_Offset_MissingInvalid) { - auto p = parser("offset(nan)"); - auto deco = p->decoration(); - EXPECT_FALSE(deco.matched); - EXPECT_TRUE(deco.errored); - EXPECT_EQ(deco.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ( - p->error(), - R"(1:1: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] -1:8: expected signed integer literal for offset decoration)"); -} - TEST_F(ParserImplTest, Decoration_Size) { auto p = parser("size(4)"); auto deco = p->decoration(); diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc index cfa3555d2c..2ba2260591 100644 --- a/src/reader/wgsl/parser_impl_struct_member_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_test.cc @@ -42,33 +42,6 @@ TEST_F(ParserImplTest, StructMember_Parses) { EXPECT_EQ(m->type()->source().range, (Source::Range{{1u, 5u}, {1u, 8u}})); } -TEST_F(ParserImplTest, StructMember_ParsesWithOffsetDecoration_DEPRECATED) { - auto p = parser("[[offset(2)]] a : i32;"); - - auto& builder = p->builder(); - - auto decos = p->decoration_list(); - EXPECT_FALSE(decos.errored); - EXPECT_TRUE(decos.matched); - EXPECT_EQ(decos.value.size(), 1u); - - auto m = p->expect_struct_member(decos.value); - ASSERT_FALSE(p->has_error()); - ASSERT_FALSE(m.errored); - ASSERT_NE(m.value, nullptr); - - EXPECT_EQ(m->symbol(), builder.Symbols().Get("a")); - EXPECT_TRUE(m->type()->Is()); - EXPECT_EQ(m->decorations().size(), 1u); - EXPECT_TRUE(m->decorations()[0]->Is()); - EXPECT_EQ( - m->decorations()[0]->As()->offset(), - 2u); - - EXPECT_EQ(m->source().range, (Source::Range{{1u, 15u}, {1u, 16u}})); - EXPECT_EQ(m->type()->source().range, (Source::Range{{1u, 19u}, {1u, 22u}})); -} - TEST_F(ParserImplTest, StructMember_ParsesWithAlignDecoration) { auto p = parser("[[align(2)]] a : i32;"); diff --git a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc index fce5b3cf5c..c006882aa7 100644 --- a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc +++ b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/ast/access_decoration.h" #include "src/reader/wgsl/parser_impl_test_helper.h" #include "src/sem/depth_texture_type.h" #include "src/sem/multisampled_texture_type.h" @@ -25,8 +24,7 @@ namespace { TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { auto p = parser("1234"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -35,8 +33,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { auto p = parser("sampler"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -48,8 +45,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { auto p = parser("sampler_comparison"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -61,8 +57,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { auto p = parser("texture_depth_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -75,8 +70,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { auto p = parser("texture_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -90,8 +84,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { auto p = parser("texture_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -105,8 +98,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { auto p = parser("texture_3d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -120,8 +112,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid) { auto p = parser("texture_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -131,8 +122,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { auto p = parser("texture_1d<>"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -142,8 +132,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { auto p = parser("texture_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -153,8 +142,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { auto p = parser("texture_1dtexture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -164,8 +152,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { auto p = parser("texture_multisampled_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -179,8 +166,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_Invalid) { auto p = parser("texture_multisampled_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -190,8 +176,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_Invalid) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { auto p = parser("texture_multisampled_2d<>"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -202,8 +187,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan) { auto p = parser("texture_multisampled_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -213,38 +197,16 @@ TEST_F(ParserImplTest, TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterThan) { auto p = parser("texture_multisampled_2dtexture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); EXPECT_EQ(p->error(), "1:28: expected '>' for multisampled texture type"); } -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm_DEPRECATED) { - auto p = parser("texture_storage_1d"); - ast::DecorationList decos{create(ast::Access::kRead)}; - auto t = p->texture_sampler_types(decos); - ASSERT_FALSE(p->has_error()) << p->error(); - EXPECT_TRUE(t.matched); - EXPECT_FALSE(t.errored); - ASSERT_NE(t.value, nullptr); - - ASSERT_TRUE(t->Is()); - ASSERT_TRUE(t->Is()); - EXPECT_EQ(t->As()->image_format(), - ast::ImageFormat::kR8Unorm); - EXPECT_EQ(t->As()->access(), ast::Access::kRead); - EXPECT_EQ(t->As()->dim(), ast::TextureDimension::k1d); - EXPECT_EQ(t.value->source().range, (Source::Range{{1u, 1u}, {1u, 28u}})); -} - TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) { auto p = parser("texture_storage_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -259,30 +221,9 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) { EXPECT_EQ(t->source().range, (Source::Range{{1u, 1u}, {1u, 34u}})); } -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - TextureSamplerTypes_StorageTexture_Writeonly2dR16Float_DEPRECATED) { - auto p = parser("texture_storage_2d"); - ast::DecorationList decos{create(ast::Access::kWrite)}; - auto t = p->texture_sampler_types(decos); - ASSERT_FALSE(p->has_error()) << p->error(); - EXPECT_TRUE(t.matched); - EXPECT_FALSE(t.errored); - ASSERT_NE(t.value, nullptr); - - ASSERT_TRUE(t->Is()); - ASSERT_TRUE(t->Is()); - EXPECT_EQ(t->As()->image_format(), - ast::ImageFormat::kR16Float); - EXPECT_EQ(t->As()->access(), ast::Access::kWrite); - EXPECT_EQ(t->As()->dim(), ast::TextureDimension::k2d); - EXPECT_EQ(t.value->source().range, (Source::Range{{1u, 1u}, {1u, 29u}})); -} - TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR16Float) { auto p = parser("texture_storage_2d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -299,8 +240,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR16Float) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { auto p = parser("texture_storage_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -309,8 +249,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) { auto p = parser("texture_storage_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -319,8 +258,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { auto p = parser("texture_storage_1d<>"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -329,8 +267,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { auto p = parser("texture_storage_1d"); - ast::DecorationList decos; - auto t = p->texture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -339,8 +276,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan) { auto p = parser("texture_storage_1dtexture_sampler_types(decos); + auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); diff --git a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc index af959b4f54..a063a61219 100644 --- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc +++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc @@ -84,168 +84,6 @@ TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) { ASSERT_EQ(p->error(), "1:10: unknown type 'invalid'"); } -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - VariableIdentDecl_ParsesWithTextureAccessDeco_Read_DEPRECATED) { - auto p = parser("my_var : [[access(read)]] texture_storage_1d"); - - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(decl.errored); - ASSERT_EQ(decl->name, "my_var"); - ASSERT_NE(decl->type, nullptr); - ASSERT_TRUE(decl->type->Is()); - EXPECT_TRUE(decl->type->As()->is_read_only()); - - EXPECT_EQ(p->error(), - "1:54: use of deprecated language feature: access control is " - "expected as last parameter of storage textures"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - VariableIdentDecl_ParsesWithTextureAccessDeco_Write_DEPRECATED) { - auto p = parser("my_var : [[access(write)]] texture_storage_1d"); - - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(decl.errored); - ASSERT_EQ(decl->name, "my_var"); - ASSERT_NE(decl->type, nullptr); - ASSERT_TRUE(decl->type->Is()); - EXPECT_TRUE(decl->type->As()->is_write_only()); - - EXPECT_EQ(p->error(), - "1:55: use of deprecated language feature: access control is " - "expected as last parameter of storage textures"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_Read_DEPRECATED) { - auto p = parser("var my_var : [[access(read)]] S;"); - - auto* mem = Member("a", ty.i32(), ast::DecorationList{}); - ast::StructMemberList members; - members.push_back(mem); - - auto* block_deco = create(); - ast::DecorationList decos; - decos.push_back(block_deco); - - auto* s = Structure(Sym("S"), members, decos); - - p->register_type("S", s); - - auto res = p->expect_global_decl(); - ASSERT_FALSE(res.errored) << p->error(); - ASSERT_NE(p->builder().AST().GlobalVariables().size(), 0u); - auto* decl = p->builder().AST().GlobalVariables()[0]; - ASSERT_NE(decl, nullptr); - ASSERT_EQ(decl->symbol(), p->builder().Symbols().Get("my_var")); - ASSERT_NE(decl->type(), nullptr); - EXPECT_TRUE(decl->type()->Is()); - EXPECT_EQ(decl->declared_access(), ast::Access::kRead); - - EXPECT_EQ(p->error(), - "1:1: use of deprecated language feature: declare access with " - "var instead of using [[access]] decoration"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - VariableIdentDecl_ParsesWithAccessDeco_ReadWrite_DEPRECATED) { - auto p = parser("var my_var : [[access(read_write)]] S;"); - - auto* mem = Member("a", ty.i32(), ast::DecorationList{}); - ast::StructMemberList members; - members.push_back(mem); - - auto* block_deco = create(); - ast::DecorationList decos; - decos.push_back(block_deco); - - auto* s = Structure(Sym("S"), members, decos); - - p->register_type("S", s); - - auto res = p->expect_global_decl(); - ASSERT_FALSE(res.errored) << p->error(); - ASSERT_NE(p->builder().AST().GlobalVariables().size(), 0u); - auto* decl = p->builder().AST().GlobalVariables()[0]; - ASSERT_NE(decl, nullptr); - ASSERT_EQ(decl->symbol(), p->builder().Symbols().Get("my_var")); - ASSERT_NE(decl->type(), nullptr); - EXPECT_TRUE(decl->type()->Is()); - EXPECT_EQ(decl->declared_access(), ast::Access::kReadWrite); - - EXPECT_EQ(p->error(), - "1:1: use of deprecated language feature: declare access with " - "var instead of using [[access]] decoration"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDecoFail_DEPRECATED) { - auto p = parser("my_var : [[access(read), access(read_write)]] S"); - - auto* mem = Member("a", ty.i32(), ast::DecorationList{}); - ast::StructMemberList members; - members.push_back(mem); - - auto* block_deco = create(); - ast::DecorationList decos; - decos.push_back(block_deco); - - auto* s = Structure(Sym("S"), members, decos); - - p->register_type("S", s); - - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:1: multiple access decorations not allowed"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, - VariableIdentDecl_MultipleAccessDeco_MultiBlock_Fail_DEPRECATED) { - auto p = parser("my_var : [[access(read)]][[access(read_write)]] S"); - - auto* mem = Member("a", ty.i32(), ast::DecorationList{}); - ast::StructMemberList members; - members.push_back(mem); - - auto* block_deco = create(); - ast::DecorationList decos; - decos.push_back(block_deco); - - auto* s = Structure(Sym("S"), members, decos); - - p->register_type("S", s); - - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:1: multiple access decorations not allowed"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, VariableIdentDecl_AccessDecoBadValue_DEPRECATED) { - auto p = parser("my_var : [[access(unknown)]] S"); - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:19: invalid value for access control"); -} - -// TODO(crbug.com/tint/846): Remove -TEST_F(ParserImplTest, VariableIdentDecl_AccessDecoIllegalValue_DEPRECATED) { - auto p = parser("my_var : [[access(1)]] S"); - auto decl = p->expect_variable_ident_decl("test"); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:19: expected identifier for access control"); -} - TEST_F(ParserImplTest, VariableIdentDecl_NonAccessDecoFail) { auto p = parser("my_var : [[stride(1)]] S"); diff --git a/src/resolver/decoration_validation_test.cc b/src/resolver/decoration_validation_test.cc index 664bb92eeb..974d1eda4e 100644 --- a/src/resolver/decoration_validation_test.cc +++ b/src/resolver/decoration_validation_test.cc @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/ast/access_decoration.h" #include "src/ast/disable_validation_decoration.h" #include "src/ast/override_decoration.h" #include "src/ast/return_statement.h" diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc index d337fe1aa8..bec3f4bc23 100644 --- a/src/resolver/resolver.cc +++ b/src/resolver/resolver.cc @@ -17,7 +17,6 @@ #include #include -#include "src/ast/access_decoration.h" #include "src/ast/alias.h" #include "src/ast/array.h" #include "src/ast/assignment_statement.h" @@ -243,16 +242,6 @@ bool Resolver::ResolveInternal() { for (auto* node : builder_->ASTNodes().Objects()) { if (marked_.count(node) == 0) { - if (node->IsAnyOf()) { - // TODO(crbug.com/tint/724) - Remove once tint:724 is complete. - // ast::AccessDecorations are generated by the WGSL parser, used to - // build sem::AccessControls and then leaked. - // ast::StrideDecoration are used to build a sem::Arrays, but - // multiple arrays of the same stride, size and element type are - // currently de-duplicated by the type manager, and we leak these - // decorations. - continue; - } TINT_ICE(diagnostics_) << "AST node '" << node->TypeInfo().name << "' was not reached by the resolver\n" << "At: " << node->source() << "\n" diff --git a/test/BUILD.gn b/test/BUILD.gn index 477a0a4969..e2cce2f24d 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -145,7 +145,6 @@ tint_unittests_source_set("tint_unittests_core_sem_src") { tint_unittests_source_set("tint_unittests_core_src") { sources = [ - "../src/ast/access_decoration_test.cc", "../src/ast/alias_test.cc", "../src/ast/array_accessor_expression_test.cc", "../src/ast/array_test.cc", diff --git a/test/bug/tint/294.wgsl b/test/bug/tint/294.wgsl index f60b564505..8a0f450ab3 100644 --- a/test/bug/tint/294.wgsl +++ b/test/bug/tint/294.wgsl @@ -5,4 +5,4 @@ struct Light { [[block]] struct Lights { light : [[stride(32)]] array; }; -[[set(0), binding(1)]] var lights : [[access(read)]] Lights; +[[set(0), binding(1)]] var lights : Lights; diff --git a/test/bug/tint/294.wgsl.expected.hlsl b/test/bug/tint/294.wgsl.expected.hlsl index 52d06e87d1..f4843df71d 100644 --- a/test/bug/tint/294.wgsl.expected.hlsl +++ b/test/bug/tint/294.wgsl.expected.hlsl @@ -1,7 +1,3 @@ -bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[set(0), binding(1)]] var lights : [[access(read)]] Lights; - ^^^ - [numthreads(1, 1, 1)] void unused_entry_point() { return; diff --git a/test/bug/tint/294.wgsl.expected.msl b/test/bug/tint/294.wgsl.expected.msl index 047cfdb16e..224ceadfba 100644 --- a/test/bug/tint/294.wgsl.expected.msl +++ b/test/bug/tint/294.wgsl.expected.msl @@ -1,7 +1,3 @@ -bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[set(0), binding(1)]] var lights : [[access(read)]] Lights; - ^^^ - #include using namespace metal; diff --git a/test/bug/tint/294.wgsl.expected.spvasm b/test/bug/tint/294.wgsl.expected.spvasm index 28f5e64ec0..6450555e71 100644 --- a/test/bug/tint/294.wgsl.expected.spvasm +++ b/test/bug/tint/294.wgsl.expected.spvasm @@ -1,7 +1,3 @@ -bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[set(0), binding(1)]] var lights : [[access(read)]] Lights; - ^^^ - ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 diff --git a/test/bug/tint/294.wgsl.expected.wgsl b/test/bug/tint/294.wgsl.expected.wgsl index d2a86689da..ea5db21c26 100644 --- a/test/bug/tint/294.wgsl.expected.wgsl +++ b/test/bug/tint/294.wgsl.expected.wgsl @@ -1,7 +1,3 @@ -bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[set(0), binding(1)]] var lights : [[access(read)]] Lights; - ^^^ - struct Light { position : vec3; colour : vec3; diff --git a/test/bug/tint/453.wgsl b/test/bug/tint/453.wgsl index c4be66bbbb..0391a803e5 100644 --- a/test/bug/tint/453.wgsl +++ b/test/bug/tint/453.wgsl @@ -1,5 +1,5 @@ -[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; +[[group(0), binding(0)]] var Src : texture_storage_2d; +[[group(0), binding(1)]] var Dst : texture_storage_2d; [[stage(compute)]] fn main() { diff --git a/test/bug/tint/453.wgsl.expected.hlsl b/test/bug/tint/453.wgsl.expected.hlsl index 4e05305e2b..fde2021800 100644 --- a/test/bug/tint/453.wgsl.expected.hlsl +++ b/test/bug/tint/453.wgsl.expected.hlsl @@ -1,11 +1,3 @@ -bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; - ^ - -bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; - ^ - Texture2D Src : register(t0, space0); RWTexture2D Dst : register(u1, space0); diff --git a/test/bug/tint/453.wgsl.expected.spvasm b/test/bug/tint/453.wgsl.expected.spvasm index e22df2b7df..06bba8275d 100644 --- a/test/bug/tint/453.wgsl.expected.spvasm +++ b/test/bug/tint/453.wgsl.expected.spvasm @@ -1,11 +1,3 @@ -bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; - ^ - -bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; - ^ - ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 diff --git a/test/bug/tint/453.wgsl.expected.wgsl b/test/bug/tint/453.wgsl.expected.wgsl index 5a5db6cdf5..f1c4aa31a7 100644 --- a/test/bug/tint/453.wgsl.expected.wgsl +++ b/test/bug/tint/453.wgsl.expected.wgsl @@ -1,11 +1,3 @@ -bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; - ^ - -bug/tint/453.wgsl:2:80 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; - ^ - [[group(0), binding(0)]] var Src : texture_storage_2d; [[group(0), binding(1)]] var Dst : texture_storage_2d; diff --git a/test/bug/tint/757.wgsl b/test/bug/tint/757.wgsl index 68239aabb0..1c458ca872 100644 --- a/test/bug/tint/757.wgsl +++ b/test/bug/tint/757.wgsl @@ -1,13 +1,13 @@ [[block]] struct Constants { - [[offset(0)]] level : i32; + level : i32; }; [[group(0), binding(0)]] var constants : Constants; [[group(0), binding(1)]] var myTexture : texture_2d_array; [[block]] struct Result { - [[offset(0)]] values : [[stride(4)]] array; + values : [[stride(4)]] array; }; [[group(0), binding(3)]] var result : Result; diff --git a/test/bug/tint/757.wgsl.expected.hlsl b/test/bug/tint/757.wgsl.expected.hlsl index 9cbf74fcb9..63d2e80ddf 100644 --- a/test/bug/tint/757.wgsl.expected.hlsl +++ b/test/bug/tint/757.wgsl.expected.hlsl @@ -1,11 +1,3 @@ -bug/tint/757.wgsl:3:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] - [[offset(0)]] level : i32; - ^^^^^^ - -bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] - [[offset(0)]] values : [[stride(4)]] array; - ^^^^^^ - struct Constants { int level; }; diff --git a/test/bug/tint/757.wgsl.expected.wgsl b/test/bug/tint/757.wgsl.expected.wgsl index 3fcd2a0b1c..66512bfe87 100644 --- a/test/bug/tint/757.wgsl.expected.wgsl +++ b/test/bug/tint/757.wgsl.expected.wgsl @@ -1,11 +1,3 @@ -bug/tint/757.wgsl:3:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] - [[offset(0)]] level : i32; - ^^^^^^ - -bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] has been replaced with [[size]] and [[align]] - [[offset(0)]] values : [[stride(4)]] array; - ^^^^^^ - [[block]] struct Constants { level : i32; diff --git a/test/bug/tint/827.wgsl b/test/bug/tint/827.wgsl index f755d8cf74..b884ad9d0d 100644 --- a/test/bug/tint/827.wgsl +++ b/test/bug/tint/827.wgsl @@ -5,7 +5,7 @@ let width : u32 = 128u; [[group(0), binding(0)]] var tex : texture_depth_2d; -[[group(0), binding(1)]] var result : [[access(read_write)]] Result; +[[group(0), binding(1)]] var result : Result; [[stage(compute)]] fn main( [[builtin(global_invocation_id)]] GlobalInvocationId : vec3 diff --git a/test/bug/tint/827.wgsl.expected.hlsl b/test/bug/tint/827.wgsl.expected.hlsl index 506cc6d797..bb53157412 100644 --- a/test/bug/tint/827.wgsl.expected.hlsl +++ b/test/bug/tint/827.wgsl.expected.hlsl @@ -1,7 +1,3 @@ -bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(1)]] var result : [[access(read_write)]] Result; - ^^^ - static const uint width = 128u; Texture2D tex : register(t0, space0); RWByteAddressBuffer result : register(u1, space0); diff --git a/test/bug/tint/827.wgsl.expected.spvasm b/test/bug/tint/827.wgsl.expected.spvasm index 315bbc7706..4bc890f961 100644 --- a/test/bug/tint/827.wgsl.expected.spvasm +++ b/test/bug/tint/827.wgsl.expected.spvasm @@ -1,7 +1,3 @@ -bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(1)]] var result : [[access(read_write)]] Result; - ^^^ - ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 diff --git a/test/bug/tint/827.wgsl.expected.wgsl b/test/bug/tint/827.wgsl.expected.wgsl index 89f72caa82..f3c0e9f5a2 100644 --- a/test/bug/tint/827.wgsl.expected.wgsl +++ b/test/bug/tint/827.wgsl.expected.wgsl @@ -1,7 +1,3 @@ -bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(1)]] var result : [[access(read_write)]] Result; - ^^^ - [[block]] struct Result { values : array; diff --git a/test/deprecated/access_deco/storage_buffer.wgsl b/test/deprecated/access_deco/storage_buffer.wgsl deleted file mode 100644 index 3948107f18..0000000000 --- a/test/deprecated/access_deco/storage_buffer.wgsl +++ /dev/null @@ -1,12 +0,0 @@ - -[[block]] -struct SB { - a : f32; -}; - -[[group(0), binding(0)]] var sb : [[access(read_write)]] SB; - -[[stage(compute)]] -fn main() { - var x : f32 = sb.a; -} diff --git a/test/deprecated/access_deco/storage_buffer.wgsl.expected.hlsl b/test/deprecated/access_deco/storage_buffer.wgsl.expected.hlsl deleted file mode 100644 index d686f810ac..0000000000 --- a/test/deprecated/access_deco/storage_buffer.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(0)]] var sb : [[access(read_write)]] SB; - ^^^ - -RWByteAddressBuffer sb : register(u0, space0); - -[numthreads(1, 1, 1)] -void main() { - float x = asfloat(sb.Load(0u)); - return; -} diff --git a/test/deprecated/access_deco/storage_buffer.wgsl.expected.msl b/test/deprecated/access_deco/storage_buffer.wgsl.expected.msl deleted file mode 100644 index 666ca66e23..0000000000 --- a/test/deprecated/access_deco/storage_buffer.wgsl.expected.msl +++ /dev/null @@ -1,16 +0,0 @@ -deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(0)]] var sb : [[access(read_write)]] SB; - ^^^ - -#include - -using namespace metal; -struct SB { - /* 0x0000 */ float a; -}; - -kernel void tint_symbol(device SB& sb [[buffer(0)]]) { - float x = sb.a; - return; -} - diff --git a/test/deprecated/access_deco/storage_buffer.wgsl.expected.spvasm b/test/deprecated/access_deco/storage_buffer.wgsl.expected.spvasm deleted file mode 100644 index 0736052215..0000000000 --- a/test/deprecated/access_deco/storage_buffer.wgsl.expected.spvasm +++ /dev/null @@ -1,41 +0,0 @@ -deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(0)]] var sb : [[access(read_write)]] SB; - ^^^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 17 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpName %SB "SB" - OpMemberName %SB 0 "a" - OpName %sb "sb" - OpName %main "main" - OpName %x "x" - OpDecorate %SB Block - OpMemberDecorate %SB 0 Offset 0 - OpDecorate %sb DescriptorSet 0 - OpDecorate %sb Binding 0 - %float = OpTypeFloat 32 - %SB = OpTypeStruct %float -%_ptr_StorageBuffer_SB = OpTypePointer StorageBuffer %SB - %sb = OpVariable %_ptr_StorageBuffer_SB StorageBuffer - %void = OpTypeVoid - %5 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float -%_ptr_Function_float = OpTypePointer Function %float - %16 = OpConstantNull %float - %main = OpFunction %void None %5 - %8 = OpLabel - %x = OpVariable %_ptr_Function_float Function %16 - %12 = OpAccessChain %_ptr_StorageBuffer_float %sb %uint_0 - %13 = OpLoad %float %12 - OpStore %x %13 - OpReturn - OpFunctionEnd diff --git a/test/deprecated/access_deco/storage_buffer.wgsl.expected.wgsl b/test/deprecated/access_deco/storage_buffer.wgsl.expected.wgsl deleted file mode 100644 index 4e23308e9f..0000000000 --- a/test/deprecated/access_deco/storage_buffer.wgsl.expected.wgsl +++ /dev/null @@ -1,15 +0,0 @@ -deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var instead of using [[access]] decoration -[[group(0), binding(0)]] var sb : [[access(read_write)]] SB; - ^^^ - -[[block]] -struct SB { - a : f32; -}; - -[[group(0), binding(0)]] var sb : SB; - -[[stage(compute)]] -fn main() { - var x : f32 = sb.a; -} diff --git a/test/deprecated/access_deco/storage_texture.wgsl b/test/deprecated/access_deco/storage_texture.wgsl deleted file mode 100644 index 17cd7fd277..0000000000 --- a/test/deprecated/access_deco/storage_texture.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d; - -[[stage(compute)]] -fn main() { - var x : vec2 = textureDimensions(tex); -} diff --git a/test/deprecated/access_deco/storage_texture.wgsl.expected.hlsl b/test/deprecated/access_deco/storage_texture.wgsl.expected.hlsl deleted file mode 100644 index 24bb410f38..0000000000 --- a/test/deprecated/access_deco/storage_texture.wgsl.expected.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d; - ^ - -RWTexture2D tex : register(u0, space0); - -[numthreads(1, 1, 1)] -void main() { - int2 tint_tmp; - tex.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 x = tint_tmp; - return; -} diff --git a/test/deprecated/access_deco/storage_texture.wgsl.expected.msl b/test/deprecated/access_deco/storage_texture.wgsl.expected.msl deleted file mode 100644 index acf4fbb7fe..0000000000 --- a/test/deprecated/access_deco/storage_texture.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d; - ^ - -#include - -using namespace metal; -kernel void tint_symbol(texture2d tint_symbol_1 [[texture(0)]]) { - int2 x = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); - return; -} - diff --git a/test/deprecated/access_deco/storage_texture.wgsl.expected.spvasm b/test/deprecated/access_deco/storage_texture.wgsl.expected.spvasm deleted file mode 100644 index 03c770ec34..0000000000 --- a/test/deprecated/access_deco/storage_texture.wgsl.expected.spvasm +++ /dev/null @@ -1,38 +0,0 @@ -deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d; - ^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 16 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpName %tex "tex" - OpName %main "main" - OpName %x "x" - OpDecorate %tex NonReadable - OpDecorate %tex DescriptorSet 0 - OpDecorate %tex Binding 0 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 2 Rgba32f -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %tex = OpVariable %_ptr_UniformConstant_3 UniformConstant - %void = OpTypeVoid - %5 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %15 = OpConstantNull %v2int - %main = OpFunction %void None %5 - %8 = OpLabel - %x = OpVariable %_ptr_Function_v2int Function %15 - %12 = OpLoad %3 %tex - %9 = OpImageQuerySize %v2int %12 - OpStore %x %9 - OpReturn - OpFunctionEnd diff --git a/test/deprecated/access_deco/storage_texture.wgsl.expected.wgsl b/test/deprecated/access_deco/storage_texture.wgsl.expected.wgsl deleted file mode 100644 index b7a6aec2d6..0000000000 --- a/test/deprecated/access_deco/storage_texture.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -deprecated/access_deco/storage_texture.wgsl:1:84 warning: use of deprecated language feature: access control is expected as last parameter of storage textures -[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d; - ^ - -[[group(0), binding(0)]] var tex : texture_storage_2d; - -[[stage(compute)]] -fn main() { - var x : vec2 = textureDimensions(tex); -}