wgsl: Remove [[access]] and [[offset]] decorations

These have been deprecated, and their usages in Dawn, CTS and samples have been updated.

Fixed: tint:846
Change-Id: I74b831fd5be2e7ca02e8208835eac8beddcef9af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54325
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-06-16 09:19:36 +00:00 committed by Ben Clayton
parent fe66cbe7bb
commit 7e00263c01
40 changed files with 43 additions and 852 deletions

View File

@ -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",

View File

@ -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

View File

@ -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 <string>
#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<AccessDecoration>(src, value_);
}
} // namespace ast
} // namespace tint

View File

@ -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 <string>
#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<AccessDecoration, Decoration> {
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_

View File

@ -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<AccessDecoration>(ast::Access::kWrite);
EXPECT_EQ(ast::Access::kWrite, d->value());
}
TEST_F(AccessDecorationTest, ToStr) {
auto* d = create<AccessDecoration>(ast::Access::kRead);
EXPECT_EQ(str(d), R"(AccessDecoration{read}
)");
}
} // namespace
} // namespace ast
} // namespace tint

View File

@ -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::VarDeclInfo> 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::VarDeclInfo> 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<ast::Type*> ParserImpl::texture_sampler_types(
ast::DecorationList& decos) {
Maybe<ast::Type*> ParserImpl::texture_sampler_types() {
auto type = sampler_type();
if (type.matched)
return type;
@ -630,21 +609,8 @@ Maybe<ast::Type*> 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<ast::AccessDecoration>(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::TypedIdentifier> 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::TypedIdentifier> ParserImpl::expect_variable_ident_decl(
if (!type.matched)
return add_error(t.source(), "invalid type", use);
auto access_decos = take_decorations<ast::AccessDecoration>(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<ast::Access> ParserImpl::expect_access(const std::string& use) {
@ -1120,7 +1077,7 @@ Maybe<ast::Type*> 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<ast::Decoration*> 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<ast::AccessDecoration>(t.source(), val.value);
});
}
if (s == kLocationDecoration) {
const char* use = "location decoration";
@ -3108,20 +3055,6 @@ Maybe<ast::Decoration*> 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<ast::StructMemberOffsetDecoration>(t.source(), val.value);
});
}
if (s == kSizeDecoration) {
const char* use = "size decoration";
return expect_paren_block(use, [&]() -> Result {

View File

@ -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<ast::Function*> 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<ast::Type*> texture_sampler_types(ast::DecorationList& decos);
Maybe<ast::Type*> texture_sampler_types();
/// Parses a `sampler_type` grammar element
/// @returns the parsed Type or nullptr if none matched.
Maybe<ast::Type*> sampler_type();

View File

@ -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<ast::Decoration>();
ASSERT_NE(member_deco, nullptr);
ASSERT_TRUE(member_deco->Is<ast::StructMemberOffsetDecoration>());
auto* o = member_deco->As<ast::StructMemberOffsetDecoration>();
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();

View File

@ -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<ast::I32>());
EXPECT_EQ(m->decorations().size(), 1u);
EXPECT_TRUE(m->decorations()[0]->Is<ast::StructMemberOffsetDecoration>());
EXPECT_EQ(
m->decorations()[0]->As<ast::StructMemberOffsetDecoration>()->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;");

View File

@ -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<f32>");
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<i32>");
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<u32>");
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<abc>");
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_1d<u32");
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);
@ -164,8 +152,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) {
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) {
auto p = parser("texture_multisampled_2d<i32>");
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<abc>");
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_2d<u32");
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);
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<r8unorm>");
ast::DecorationList decos{create<ast::AccessDecoration>(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<ast::Texture>());
ASSERT_TRUE(t->Is<ast::StorageTexture>());
EXPECT_EQ(t->As<ast::StorageTexture>()->image_format(),
ast::ImageFormat::kR8Unorm);
EXPECT_EQ(t->As<ast::StorageTexture>()->access(), ast::Access::kRead);
EXPECT_EQ(t->As<ast::Texture>()->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<r8unorm, read>");
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<r16float>");
ast::DecorationList decos{create<ast::AccessDecoration>(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<ast::Texture>());
ASSERT_TRUE(t->Is<ast::StorageTexture>());
EXPECT_EQ(t->As<ast::StorageTexture>()->image_format(),
ast::ImageFormat::kR16Float);
EXPECT_EQ(t->As<ast::StorageTexture>()->access(), ast::Access::kWrite);
EXPECT_EQ(t->As<ast::Texture>()->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<r16float, write>");
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<abc, read>");
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<r16float, abc>");
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_1d<r8unorm, read");
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);

View File

@ -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<r32float>");
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<ast::StorageTexture>());
EXPECT_TRUE(decl->type->As<ast::StorageTexture>()->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<r32float>");
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<ast::StorageTexture>());
EXPECT_TRUE(decl->type->As<ast::StorageTexture>()->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::StructBlockDecoration>();
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<ast::TypeName>());
EXPECT_EQ(decl->declared_access(), ast::Access::kRead);
EXPECT_EQ(p->error(),
"1:1: use of deprecated language feature: declare access with "
"var<none, read> 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::StructBlockDecoration>();
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<ast::TypeName>());
EXPECT_EQ(decl->declared_access(), ast::Access::kReadWrite);
EXPECT_EQ(p->error(),
"1:1: use of deprecated language feature: declare access with "
"var<none, read_write> 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::StructBlockDecoration>();
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::StructBlockDecoration>();
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");

View File

@ -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"

View File

@ -17,7 +17,6 @@
#include <algorithm>
#include <utility>
#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<ast::AccessDecoration, ast::StrideDecoration>()) {
// 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"

View File

@ -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",

View File

@ -5,4 +5,4 @@ struct Light {
[[block]] struct Lights {
light : [[stride(32)]] array<Light>;
};
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
[[set(0), binding(1)]] var<storage, read> lights : Lights;

View File

@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;

View File

@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
#include <metal_stdlib>
using namespace metal;

View File

@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@ -1,7 +1,3 @@
bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare access with var<storage, read> instead of using [[access]] decoration
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^
struct Light {
position : vec3<f32>;
colour : vec3<f32>;

View File

@ -1,5 +1,5 @@
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;
[[stage(compute)]]
fn main() {

View File

@ -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<r32uint>;
^
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<r32uint>;
^
Texture2D<uint4> Src : register(t0, space0);
RWTexture2D<uint4> Dst : register(u1, space0);

View File

@ -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<r32uint>;
^
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<r32uint>;
^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@ -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<r32uint>;
^
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<r32uint>;
^
[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;

View File

@ -1,13 +1,13 @@
[[block]] struct Constants {
[[offset(0)]] level : i32;
level : i32;
};
[[group(0), binding(0)]] var<uniform> constants : Constants;
[[group(0), binding(1)]] var myTexture : texture_2d_array<f32>;
[[block]] struct Result {
[[offset(0)]] values : [[stride(4)]] array<f32>;
values : [[stride(4)]] array<f32>;
};
[[group(0), binding(3)]] var<storage, read_write> result : Result;

View File

@ -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<f32>;
^^^^^^
struct Constants {
int level;
};

View File

@ -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<f32>;
^^^^^^
[[block]]
struct Constants {
level : i32;

View File

@ -5,7 +5,7 @@
let width : u32 = 128u;
[[group(0), binding(0)]] var tex : texture_depth_2d;
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
[[group(0), binding(1)]] var<storage, read_write> result : Result;
[[stage(compute)]] fn main(
[[builtin(global_invocation_id)]] GlobalInvocationId : vec3<u32>

View File

@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
static const uint width = 128u;
Texture2D tex : register(t0, space0);
RWByteAddressBuffer result : register(u1, space0);

View File

@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0

View File

@ -1,7 +1,3 @@
bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^
[[block]]
struct Result {
values : array<f32>;

View File

@ -1,12 +0,0 @@
[[block]]
struct SB {
a : f32;
};
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
[[stage(compute)]]
fn main() {
var x : f32 = sb.a;
}

View File

@ -1,11 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
RWByteAddressBuffer sb : register(u0, space0);
[numthreads(1, 1, 1)]
void main() {
float x = asfloat(sb.Load(0u));
return;
}

View File

@ -1,16 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
#include <metal_stdlib>
using namespace metal;
struct SB {
/* 0x0000 */ float a;
};
kernel void tint_symbol(device SB& sb [[buffer(0)]]) {
float x = sb.a;
return;
}

View File

@ -1,41 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> 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

View File

@ -1,15 +0,0 @@
deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated language feature: declare access with var<storage, read_write> instead of using [[access]] decoration
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^
[[block]]
struct SB {
a : f32;
};
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
[[stage(compute)]]
fn main() {
var x : f32 = sb.a;
}

View File

@ -1,6 +0,0 @@
[[group(0), binding(0)]] var tex : [[access(write)]] texture_storage_2d<rgba32float>;
[[stage(compute)]]
fn main() {
var x : vec2<i32> = textureDimensions(tex);
}

View File

@ -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<rgba32float>;
^
RWTexture2D<float4> 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;
}

View File

@ -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<rgba32float>;
^
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol(texture2d<float, access::write> tint_symbol_1 [[texture(0)]]) {
int2 x = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
return;
}

View File

@ -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<rgba32float>;
^
; 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

View File

@ -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<rgba32float>;
^
[[group(0), binding(0)]] var tex : texture_storage_2d<rgba32float, write>;
[[stage(compute)]]
fn main() {
var x : vec2<i32> = textureDimensions(tex);
}