wgsl: Replace [[decoration]] with @decoration
Deprecate the old syntax. Migrate everything to the new syntax.
Bug: tint:1382
Change-Id: Ide12b2e927b17dc93b9714c7049090864cc568d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
diff --git a/src/ast/array.cc b/src/ast/array.cc
index e8339f8..a620dd0 100644
--- a/src/ast/array.cc
+++ b/src/ast/array.cc
@@ -54,7 +54,7 @@
std::ostringstream out;
for (auto* deco : decorations) {
if (auto* stride = deco->As<ast::StrideDecoration>()) {
- out << "[[stride(" << stride->stride << ")]] ";
+ out << "@stride(" << stride->stride << ") ";
}
}
out << "array<" << type->FriendlyName(symbols);
diff --git a/src/ast/array_test.cc b/src/ast/array_test.cc
index 3ada2c7..5a7f02c 100644
--- a/src/ast/array_test.cc
+++ b/src/ast/array_test.cc
@@ -63,7 +63,7 @@
auto* i32 = create<I32>();
auto* arr =
create<Array>(i32, Expr(5), DecorationList{create<StrideDecoration>(32)});
- EXPECT_EQ(arr->FriendlyName(Symbols()), "[[stride(32)]] array<i32, 5>");
+ EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(32) array<i32, 5>");
}
} // namespace
diff --git a/src/ast/disable_validation_decoration.h b/src/ast/disable_validation_decoration.h
index 099a669..5eea9bf 100644
--- a/src/ast/disable_validation_decoration.h
+++ b/src/ast/disable_validation_decoration.h
@@ -65,7 +65,7 @@
~DisableValidationDecoration() override;
/// @return a short description of the internal decoration which will be
- /// displayed in WGSL as `[[internal(<name>)]]` (but is not parsable).
+ /// displayed in WGSL as `@internal(<name>)` (but is not parsable).
std::string InternalName() const override;
/// Performs a deep clone of this object using the CloneContext `ctx`.
diff --git a/src/ast/internal_decoration.h b/src/ast/internal_decoration.h
index eb0b814..50f920c 100644
--- a/src/ast/internal_decoration.h
+++ b/src/ast/internal_decoration.h
@@ -35,7 +35,7 @@
~InternalDecoration() override;
/// @return a short description of the internal decoration which will be
- /// displayed in WGSL as `[[internal(<name>)]]` (but is not parsable).
+ /// displayed in WGSL as `@internal(<name>)` (but is not parsable).
virtual std::string InternalName() const = 0;
/// @returns the WGSL name for the decoration
diff --git a/src/ast/module_clone_test.cc b/src/ast/module_clone_test.cc
index b2415dc..29e9891 100644
--- a/src/ast/module_clone_test.cc
+++ b/src/ast/module_clone_test.cc
@@ -28,13 +28,13 @@
// See also fuzzers/tint_ast_clone_fuzzer.cc for further coverage of cloning.
Source::File file("test.wgsl", R"([[block]]
struct S0 {
- [[size(4)]]
+ @size(4)
m0 : u32;
m1 : array<u32>;
};
[[block]] struct S1 {
- [[size(4)]]
+ @size(4)
m0 : u32;
m1 : array<u32, 6>;
};
@@ -42,21 +42,21 @@
let c0 : i32 = 10;
let c1 : bool = true;
-type t0 = [[stride(16)]] array<vec4<f32>>;
+type t0 = @stride(16) array<vec4<f32>>;
type t1 = array<vec4<f32>>;
var<private> g0 : u32 = 20u;
var<private> g1 : f32 = 123.0;
-[[group(0), binding(0)]] var g2 : texture_2d<f32>;
-[[group(1), binding(0)]] var g3 : texture_depth_2d;
-[[group(2), binding(0)]] var g4 : texture_storage_2d<rg32float, write>;
-[[group(3), binding(0)]] var g5 : texture_depth_cube_array;
-[[group(4), binding(0)]] var g6 : texture_external;
+@group(0) @binding(0) var g2 : texture_2d<f32>;
+@group(1) @binding(0) var g3 : texture_depth_2d;
+@group(2) @binding(0) var g4 : texture_storage_2d<rg32float, write>;
+@group(3) @binding(0) var g5 : texture_depth_cube_array;
+@group(4) @binding(0) var g6 : texture_external;
var<private> g7 : vec3<f32>;
-[[group(0), binding(1)]] var<storage, write> g8 : S0;
-[[group(1), binding(1)]] var<storage, read> g9 : S0;
-[[group(2), binding(1)]] var<storage, read_write> g10 : S0;
+@group(0) @binding(1) var<storage, write> g8 : S0;
+@group(1) @binding(1) var<storage, read> g9 : S0;
+@group(2) @binding(1) var<storage, read_write> g10 : S0;
fn f0(p0 : bool) -> f32 {
if (p0) {
@@ -101,7 +101,7 @@
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f1(1.0, 2);
}
diff --git a/src/ast/struct_member_offset_decoration.h b/src/ast/struct_member_offset_decoration.h
index 8c6f3ac..da1a661 100644
--- a/src/ast/struct_member_offset_decoration.h
+++ b/src/ast/struct_member_offset_decoration.h
@@ -23,14 +23,14 @@
namespace ast {
/// A struct member offset decoration
-/// @note The WGSL spec removed the `[[offset(n)]]` decoration for `[[size(n)]]`
-/// and `[[align(n)]]` in https://github.com/gpuweb/gpuweb/pull/1447. However
+/// @note The WGSL spec removed the `@offset(n)` decoration for `@size(n)`
+/// and `@align(n)` in https://github.com/gpuweb/gpuweb/pull/1447. However
/// this decoration is kept because the SPIR-V reader has to deal with absolute
/// offsets, and transforming these to size / align is complex and can be done
/// in a number of ways. The Resolver is responsible for consuming the size and
/// align decorations and transforming these into absolute offsets. It is
-/// trivial for the Resolver to handle `[[offset(n)]]` or `[[size(n)]]` /
-/// `[[align(n)]]` decorations, so this is what we do, keeping all the layout
+/// trivial for the Resolver to handle `@offset(n)` or `@size(n)` /
+/// `@align(n)` decorations, so this is what we do, keeping all the layout
/// logic in one place.
class StructMemberOffsetDecoration
: public Castable<StructMemberOffsetDecoration, Decoration> {
diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc
index 1d237f8..713887b 100644
--- a/src/inspector/inspector_test.cc
+++ b/src/inspector/inspector_test.cc
@@ -2726,7 +2726,7 @@
TEST_F(InspectorGetSamplerTextureUsesTest, None) {
std::string shader = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
})";
@@ -2739,12 +2739,12 @@
TEST_F(InspectorGetSamplerTextureUsesTest, Simple) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
})";
@@ -2762,12 +2762,12 @@
TEST_F(InspectorGetSamplerTextureUsesTest, UnknownEntryPoint) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
})";
@@ -2778,12 +2778,12 @@
TEST_F(InspectorGetSamplerTextureUsesTest, MultipleCalls) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
})";
@@ -2799,16 +2799,16 @@
TEST_F(InspectorGetSamplerTextureUsesTest, BothIndirect) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, s, uv);
}
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, mySampler, fragUV) * fragPosition;
})";
@@ -2826,16 +2826,16 @@
TEST_F(InspectorGetSamplerTextureUsesTest, SamplerIndirect) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(myTexture, s, uv);
}
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(mySampler, fragUV) * fragPosition;
})";
@@ -2853,16 +2853,16 @@
TEST_F(InspectorGetSamplerTextureUsesTest, TextureIndirect) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(t: texture_2d<f32>, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, mySampler, uv);
}
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, fragUV) * fragPosition;
})";
@@ -2880,16 +2880,16 @@
TEST_F(InspectorGetSamplerTextureUsesTest, NeitherIndirect) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(uv: vec2<f32>) -> vec4<f32> {
return textureSample(myTexture, mySampler, uv);
}
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(fragUV) * fragPosition;
})";
@@ -2907,8 +2907,8 @@
TEST_F(InspectorGetSamplerTextureUsesTest, Complex) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
@@ -2927,21 +2927,21 @@
return X(t, s, uv) + Y(t, s, uv);
}
-[[stage(fragment)]]
-fn via_call([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn via_call(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return Z(myTexture, mySampler, fragUV) * fragPosition;
}
-[[stage(fragment)]]
-fn via_ptr([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn via_ptr(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) + fragPosition;
}
-[[stage(fragment)]]
-fn direct([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn direct(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) + fragPosition;
})";
@@ -3075,16 +3075,16 @@
// ::GetSamplerTextureUses was called.
TEST_F(InspectorRegressionTest, tint967) {
std::string shader = R"(
-[[group(0), binding(1)]] var mySampler: sampler;
-[[group(0), binding(2)]] var myTexture: texture_2d<f32>;
+@group(0) @binding(1) var mySampler: sampler;
+@group(0) @binding(2) var myTexture: texture_2d<f32>;
fn doSample(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, s, uv);
}
-[[stage(fragment)]]
-fn main([[location(0)]] fragUV: vec2<f32>,
- [[location(1)]] fragPosition: vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@location(0) fragUV: vec2<f32>,
+ @location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, mySampler, fragUV) * fragPosition;
})";
diff --git a/src/reader/spirv/function_call_test.cc b/src/reader/spirv/function_call_test.cc
index c3efe3f..1626fc8 100644
--- a/src/reader/spirv/function_call_test.cc
+++ b/src/reader/spirv/function_call_test.cc
@@ -61,7 +61,7 @@
return;
}
-[[stage(fragment)]]
+@stage(fragment)
fn x_100() {
x_100_1();
}
@@ -188,7 +188,7 @@
return;
}
-[[stage(fragment)]]
+@stage(fragment)
fn x_100() {
x_100_1();
}
diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc
index 189fdbe..9526586 100644
--- a/src/reader/spirv/function_memory_test.cc
+++ b/src/reader/spirv/function_memory_test.cc
@@ -858,7 +858,7 @@
return;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
main_1();
}
@@ -899,7 +899,7 @@
return;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
main_1();
}
@@ -950,14 +950,14 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
<< assembly << p->error();
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = [[stride(4)]] array<u32>;
+ EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = @stride(4) array<u32>;
struct S {
field0 : u32;
field1 : RTArr;
}
-[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+@group(0) @binding(0) var<storage, read_write> myvar : S;
)"));
}
diff --git a/src/reader/spirv/function_var_test.cc b/src/reader/spirv/function_var_test.cc
index 9e09f66..eb1d179 100644
--- a/src/reader/spirv/function_var_test.cc
+++ b/src/reader/spirv/function_var_test.cc
@@ -338,9 +338,8 @@
EXPECT_TRUE(fe.EmitFunctionVariables());
auto ast_body = fe.ast_body();
- EXPECT_THAT(
- test::ToString(p->program(), ast_body),
- HasSubstr("var x_200 : array<u32, 2u> = array<u32, 2u>();"));
+ EXPECT_THAT(test::ToString(p->program(), ast_body),
+ HasSubstr("var x_200 : array<u32, 2u> = array<u32, 2u>();"));
}
TEST_F(SpvParserFunctionVarTest,
@@ -368,7 +367,7 @@
auto ast_body = fe.ast_body();
EXPECT_THAT(test::ToString(p->program(), ast_body),
- HasSubstr("var x_200 : Arr = [[stride(16)]] array<u32, 2u>();"));
+ HasSubstr("var x_200 : Arr = @stride(16) array<u32, 2u>();"));
}
TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer) {
diff --git a/src/reader/spirv/parser_impl_function_decl_test.cc b/src/reader/spirv/parser_impl_function_decl_test.cc
index b3eecc1..925883d 100644
--- a/src/reader/spirv/parser_impl_function_decl_test.cc
+++ b/src/reader/spirv/parser_impl_function_decl_test.cc
@@ -124,13 +124,13 @@
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
)")) << program_ast;
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
)"));
}
@@ -148,7 +148,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
)"));
}
@@ -166,7 +166,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(1, 1, 1)]]
+@stage(compute) @workgroup_size(1, 1, 1)
fn main() {
)"));
}
@@ -186,11 +186,11 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(fragment)]]
+@stage(fragment)
fn first_shader() {
)"));
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(fragment)]]
+@stage(fragment)
fn second_shader() {
)"));
}
@@ -213,7 +213,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(2, 4, 8)]]
+@stage(compute) @workgroup_size(2, 4, 8)
fn comp_main() {
)")) << program_ast;
}
@@ -239,7 +239,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(3, 5, 7)]]
+@stage(compute) @workgroup_size(3, 5, 7)
fn comp_main() {
)")) << program_ast;
}
@@ -270,7 +270,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(3, 5, 7)]]
+@stage(compute) @workgroup_size(3, 5, 7)
fn comp_main() {
)")) << program_ast;
}
@@ -300,7 +300,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(3, 5, 7)]]
+@stage(compute) @workgroup_size(3, 5, 7)
fn comp_main() {
)")) << program_ast;
}
@@ -334,7 +334,7 @@
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
-[[stage(compute), workgroup_size(3, 5, 7)]]
+@stage(compute) @workgroup_size(3, 5, 7)
fn comp_main() {
)")) << program_ast;
}
diff --git a/src/reader/spirv/parser_impl_handle_test.cc b/src/reader/spirv/parser_impl_handle_test.cc
index a5f0cba..2e08b30 100644
--- a/src/reader/spirv/parser_impl_handle_test.cc
+++ b/src/reader/spirv/parser_impl_handle_test.cc
@@ -1254,7 +1254,7 @@
%ptr = OpTypePointer UniformConstant %sampler
%10 = OpVariable %ptr UniformConstant
)",
- R"([[group(0), binding(0)]] var x_10 : sampler;)"}));
+ R"(@group(0) @binding(0) var x_10 : sampler;)"}));
INSTANTIATE_TEST_SUITE_P(
Images,
@@ -1265,7 +1265,7 @@
"", R"(
%10 = OpVariable %ptr_f_texture_1d UniformConstant
)",
- R"([[group(0), binding(0)]] var x_10 : texture_1d<f32>;)"},
+ R"(@group(0) @binding(0) var x_10 : texture_1d<f32>;)"},
DeclUnderspecifiedHandleCase{
R"(
OpDecorate %10 NonWritable
@@ -1273,7 +1273,7 @@
R"(
%10 = OpVariable %ptr_f_storage_1d UniformConstant
)",
- R"([[group(0), binding(0)]] var x_10 : texture_1d<f32>;)"},
+ R"(@group(0) @binding(0) var x_10 : texture_1d<f32>;)"},
DeclUnderspecifiedHandleCase{
R"(
OpDecorate %10 NonReadable
@@ -1281,7 +1281,7 @@
R"(
%10 = OpVariable %ptr_f_storage_1d UniformConstant
)",
- R"([[group(0), binding(0)]] var x_10 : texture_storage_1d<rg32float, write>;)"}));
+ R"(@group(0) @binding(0) var x_10 : texture_storage_1d<rg32float, write>;)"}));
// Test handle declaration or error, when there is an image access.
@@ -1405,8 +1405,7 @@
{"%float 1D 0 1 1 1 Unknown", "%result = OpImageQuerySamples %uint %im",
"WGSL arrayed textures must be 2d_array or cube_array: ", ""},
{"%float 2D 0 0 1 1 Unknown", "%result = OpImageQuerySamples %uint %im",
- "",
- "[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;"},
+ "", "@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;"},
{"%float 2D 0 1 1 1 Unknown", "%result = OpImageQuerySamples %uint %im",
"WGSL multisampled textures must be 2d and non-arrayed: ", ""},
{"%float 3D 0 0 1 1 Unknown", "%result = OpImageQuerySamples %uint %im",
@@ -1560,36 +1559,36 @@
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12)"},
// OpImageGather 2D ConstOffset signed
ImageAccessCase{
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12, vec2<i32>(3, 4))"},
// OpImageGather 2D ConstOffset unsigned
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1 ConstOffset "
"%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureGather(1, x_20, x_10, coords12, "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageGather 2D Array
ImageAccessCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)))"},
// OpImageGather 2D Array ConstOffset signed
@@ -1597,9 +1596,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), vec2<i32>(3, 4))"},
// OpImageGather 2D Array ConstOffset unsigned
@@ -1607,9 +1606,9 @@
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1 ConstOffset "
"%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureGather(1, x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
@@ -1617,53 +1616,53 @@
ImageAccessCase{"%float Cube 0 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_cube<f32>;)",
+@group(2) @binding(1) var x_20 : texture_cube<f32>;)",
"textureGather(1, x_20, x_10, coords123)"},
// OpImageGather Cube Array
ImageAccessCase{"%float Cube 0 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords1234 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_cube_array<f32>;)",
"textureGather(1, x_20, x_10, coords1234.xyz, "
"i32(round(coords1234.w)))"},
// OpImageGather 2DDepth
ImageAccessCase{"%float 2D 1 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGather(x_20, x_10, coords12)"},
// OpImageGather 2DDepth ConstOffset signed
ImageAccessCase{
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGather(x_20, x_10, coords12, vec2<i32>(3, 4))"},
// OpImageGather 2DDepth ConstOffset unsigned
ImageAccessCase{"%float 2D 1 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords12 %int_1 ConstOffset "
"%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGather(x_20, x_10, coords12, "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageGather 2DDepth Array
ImageAccessCase{"%float 2D 1 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGather(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)))"},
// OpImageGather 2DDepth Array ConstOffset signed
@@ -1671,9 +1670,9 @@
"%float 2D 1 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGather(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), vec2<i32>(3, 4))"},
// OpImageGather 2DDepth Array ConstOffset unsigned
@@ -1681,9 +1680,9 @@
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1 ConstOffset "
"%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGather(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
@@ -1691,17 +1690,17 @@
ImageAccessCase{"%float Cube 1 0 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords123 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube;)",
+@group(2) @binding(1) var x_20 : texture_depth_cube;)",
"textureGather(x_20, x_10, coords123)"},
// OpImageGather DepthCube Array
ImageAccessCase{"%float Cube 1 1 0 1 Unknown",
"%result = OpImageGather "
"%v4float %sampled_image %coords1234 %int_1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_cube_array;)",
"textureGather(x_20, x_10, coords1234.xyz, "
"i32(round(coords1234.w)))"}}));
@@ -1714,18 +1713,18 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageDrefGather "
"%v4float %sampled_image %coords12 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGatherCompare(x_20, x_10, coords12, 0.200000003)"},
// OpImageDrefGather 2DDepth ConstOffset signed
ImageAccessCase{
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageDrefGather "
"%v4float %sampled_image %coords12 %depth ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGatherCompare(x_20, x_10, coords12, 0.200000003, "
"vec2<i32>(3, 4))"},
// OpImageDrefGather 2DDepth ConstOffset unsigned
@@ -1734,62 +1733,59 @@
"%result = OpImageDrefGather "
"%v4float %sampled_image %coords12 %depth ConstOffset "
"%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d;)",
"textureGatherCompare(x_20, x_10, coords12, 0.200000003, "
"vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageDrefGather 2DDepth Array
- ImageAccessCase{
- "%float 2D 1 1 0 1 Unknown",
- "%result = OpImageDrefGather "
- "%v4float %sampled_image %coords123 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ ImageAccessCase{"%float 2D 1 1 0 1 Unknown",
+ "%result = OpImageDrefGather "
+ "%v4float %sampled_image %coords123 %depth",
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
- "textureGatherCompare(x_20, x_10, coords123.xy, "
- "i32(round(coords123.z)), 0.200000003)"},
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
+ "textureGatherCompare(x_20, x_10, coords123.xy, "
+ "i32(round(coords123.z)), 0.200000003)"},
// OpImageDrefGather 2DDepth Array ConstOffset signed
ImageAccessCase{
"%float 2D 1 1 0 1 Unknown",
"%result = OpImageDrefGather "
"%v4float %sampled_image %coords123 %depth ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
"textureGatherCompare(x_20, x_10, coords123.xy, "
"i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4))"},
// OpImageDrefGather 2DDepth Array ConstOffset unsigned
- ImageAccessCase{
- "%float 2D 1 1 0 1 Unknown",
- "%result = OpImageDrefGather "
- "%v4float %sampled_image %coords123 %depth ConstOffset "
- "%u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ ImageAccessCase{"%float 2D 1 1 0 1 Unknown",
+ "%result = OpImageDrefGather "
+ "%v4float %sampled_image %coords123 %depth ConstOffset "
+ "%u_offsets2d",
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
- "textureGatherCompare(x_20, x_10, coords123.xy, "
- "i32(round(coords123.z)), 0.200000003, "
- "vec2<i32>(vec2<u32>(3u, 4u)))"},
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
+ "textureGatherCompare(x_20, x_10, coords123.xy, "
+ "i32(round(coords123.z)), 0.200000003, "
+ "vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageDrefGather DepthCube
ImageAccessCase{
"%float Cube 1 0 0 1 Unknown",
"%result = OpImageDrefGather "
"%v4float %sampled_image %coords123 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube;)",
+@group(2) @binding(1) var x_20 : texture_depth_cube;)",
"textureGatherCompare(x_20, x_10, coords123, 0.200000003)"},
// OpImageDrefGather DepthCube Array
- ImageAccessCase{
- "%float Cube 1 1 0 1 Unknown",
- "%result = OpImageDrefGather "
- "%v4float %sampled_image %coords1234 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ ImageAccessCase{"%float Cube 1 1 0 1 Unknown",
+ "%result = OpImageDrefGather "
+ "%v4float %sampled_image %coords1234 %depth",
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;)",
- "textureGatherCompare(x_20, x_10, coords1234.xyz, "
- "i32(round(coords1234.w)), 0.200000003)"}}));
+@group(2) @binding(1) var x_20 : texture_depth_cube_array;)",
+ "textureGatherCompare(x_20, x_10, coords1234.xyz, "
+ "i32(round(coords1234.w)), 0.200000003)"}}));
INSTANTIATE_TEST_SUITE_P(
ImageSampleImplicitLod,
@@ -1800,9 +1796,9 @@
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords12",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureSample(x_20, x_10, coords12)"},
// OpImageSampleImplicitLod arrayed
@@ -1810,9 +1806,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
"textureSample(x_20, x_10, coords123.xy, i32(round(coords123.z)))"},
// OpImageSampleImplicitLod with ConstOffset
@@ -1820,9 +1816,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords12 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureSample(x_20, x_10, coords12, vec2<i32>(3, 4))"},
// OpImageSampleImplicitLod arrayed with ConstOffset
@@ -1830,18 +1826,18 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSample(x_20, x_10, coords123.xy, i32(round(coords123.z)), vec2<i32>(3, 4)))"},
// OpImageSampleImplicitLod with Bias
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords12 Bias %float_7",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
"textureSampleBias(x_20, x_10, coords12, 7.0)"},
// OpImageSampleImplicitLod arrayed with Bias
@@ -1849,9 +1845,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 Bias %float_7",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0))"},
// OpImageSampleImplicitLod with Bias and signed ConstOffset
@@ -1860,9 +1856,9 @@
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords12 Bias|ConstOffset "
"%float_7 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(3, 4))"},
// OpImageSampleImplicitLod with Bias and unsigned ConstOffset
@@ -1872,9 +1868,9 @@
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords12 Bias|ConstOffset "
"%float_7 %u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageSampleImplicitLod arrayed with Bias
ImageAccessCase{
@@ -1882,9 +1878,9 @@
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 Bias|ConstOffset "
"%float_7 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0, vec2<i32>(3, 4))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -1903,11 +1899,11 @@
%200 = OpImageSampleImplicitLod %v4float %sampled_image %coords12
%210 = OpImageSampleDrefImplicitLod %float %sampled_dref_image %coords12 %depth
)",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
-[[group(0), binding(1)]] var x_30 : sampler_comparison;
+@group(0) @binding(1) var x_30 : sampler_comparison;
)",
R"(
let x_200 : vec4<f32> = vec4<f32>(textureSample(x_20, x_10, coords12), 0.0, 0.0, 0.0);
@@ -1923,9 +1919,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod "
"%float %sampled_image %coords12 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003))"},
// ImageSampleDrefImplicitLod - arrayed
@@ -1933,18 +1929,18 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod "
"%float %sampled_image %coords123 %depth",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003))"},
// ImageSampleDrefImplicitLod with ConstOffset
ImageAccessCase{
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod %float "
"%sampled_image %coords12 %depth ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4)))"},
// ImageSampleDrefImplicitLod arrayed with ConstOffset
@@ -1952,9 +1948,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod %float "
"%sampled_image %coords123 %depth ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4)))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -1968,9 +1964,9 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleDrefExplicitLod "
"%float %sampled_image %coords12 %depth Lod %float_0",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003))"},
// 2D array
@@ -1978,9 +1974,9 @@
"%float 2D 1 1 0 1 Unknown",
"%result = OpImageSampleDrefExplicitLod "
"%float %sampled_image %coords123 %depth Lod %float_0",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003))"},
// 2D, ConstOffset
ImageAccessCase{
@@ -1988,9 +1984,9 @@
"%result = OpImageSampleDrefExplicitLod %float "
"%sampled_image %coords12 %depth Lod|ConstOffset "
"%float_0 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4)))"},
// 2D array, ConstOffset
@@ -1999,27 +1995,27 @@
"%result = OpImageSampleDrefExplicitLod %float "
"%sampled_image %coords123 %depth Lod|ConstOffset "
"%float_0 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2<i32>(3, 4)))"},
// Cube
ImageAccessCase{
"%float Cube 1 0 0 1 Unknown",
"%result = OpImageSampleDrefExplicitLod "
"%float %sampled_image %coords123 %depth Lod %float_0",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube;)",
+@group(2) @binding(1) var x_20 : texture_depth_cube;)",
R"(textureSampleCompareLevel(x_20, x_10, coords123, 0.200000003))"},
// Cube array
ImageAccessCase{
"%float Cube 1 1 0 1 Unknown",
"%result = OpImageSampleDrefExplicitLod "
"%float %sampled_image %coords1234 %depth Lod %float_0",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;)",
+@group(2) @binding(1) var x_20 : texture_depth_cube_array;)",
R"(textureSampleCompareLevel(x_20, x_10, coords1234.xyz, i32(round(coords1234.w)), 0.200000003))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2031,9 +2027,9 @@
ImageAccessCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Lod %float_null",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords12, 0.0))"},
// OpImageSampleExplicitLod arrayed - using Lod
@@ -2041,9 +2037,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Lod %float_null",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0))"},
// OpImageSampleExplicitLod - using Lod and ConstOffset
@@ -2052,9 +2048,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Lod|ConstOffset "
"%float_null %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(3, 4)))"},
// OpImageSampleExplicitLod - using Lod and unsigned ConstOffset
@@ -2064,9 +2060,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Lod|ConstOffset "
"%float_null %u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageSampleExplicitLod arrayed - using Lod and ConstOffset
@@ -2075,9 +2071,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Lod|ConstOffset "
"%float_null %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0, vec2<i32>(3, 4)))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2090,9 +2086,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Grad %vf12 %vf21",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords12, vf12, vf21))"},
// OpImageSampleExplicitLod arrayed - using Grad
@@ -2100,9 +2096,9 @@
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Grad %vf12 %vf21",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21))"},
// OpImageSampleExplicitLod - using Grad and ConstOffset
@@ -2111,9 +2107,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Grad|ConstOffset "
"%vf12 %vf21 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(3, 4)))"},
// OpImageSampleExplicitLod - using Grad and unsigned ConstOffset
@@ -2122,9 +2118,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords12 Grad|ConstOffset "
"%vf12 %vf21 %u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(vec2<u32>(3u, 4u)))"},
// OpImageSampleExplicitLod arrayed - using Grad and ConstOffset
@@ -2133,9 +2129,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Grad|ConstOffset "
"%vf12 %vf21 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21, vec2<i32>(3, 4)))"},
// OpImageSampleExplicitLod arrayed - using Grad and unsigned
@@ -2145,9 +2141,9 @@
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Grad|ConstOffset "
"%vf12 %vf21 %u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(textureSampleGrad(x_20, x_10, coords123.xy, i32(round(coords123.z)), vf12, vf21, vec2<i32>(vec2<u32>(3u, 4u))))"}));
// Test crbug.com/378:
@@ -2164,17 +2160,17 @@
{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod %v4float "
"%sampled_image %vf12 Lod %f1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, vf12, f1))"},
// Test a depth case
{"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleExplicitLod %v4float "
"%sampled_image %vf12 Lod %f1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(vec4<f32>(textureSampleLevel(x_20, x_10, vf12, i32(f1)), 0.0, 0.0, 0.0))"}}));
@@ -2213,9 +2209,9 @@
"%float 1D 0 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords12",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_1d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_1d<f32>;)",
R"(textureSample(x_20, x_10, (coords12.x / coords12.y)))"},
// OpImageSampleProjImplicitLod 2D
@@ -2223,9 +2219,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSample(x_20, x_10, (coords123.xy / coords123.z)))"},
// OpImageSampleProjImplicitLod 3D
@@ -2233,9 +2229,9 @@
"%float 3D 0 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords1234",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_3d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_3d<f32>;)",
R"(textureSample(x_20, x_10, (coords1234.xyz / coords1234.w)))"},
// OpImageSampleProjImplicitLod 2D with ConstOffset
@@ -2245,9 +2241,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSample(x_20, x_10, (coords123.xy / coords123.z), vec2<i32>(3, 4)))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2261,9 +2257,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123 Bias %float_7",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0))"},
// OpImageSampleProjImplicitLod with Bias and signed ConstOffset
@@ -2272,9 +2268,9 @@
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123 Bias|ConstOffset "
"%float_7 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2<i32>(3, 4)))"},
// OpImageSampleProjImplicitLod with Bias and unsigned ConstOffset
@@ -2284,9 +2280,9 @@
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123 Bias|ConstOffset "
"%float_7 %u_offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2<i32>(vec2<u32>(3u, 4u))))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2298,9 +2294,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjExplicitLod "
"%v4float %sampled_image %coords123 Lod %f1",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, (coords123.xy / coords123.z), f1))"},
// OpImageSampleProjExplicitLod 2D Lod with ConstOffset
@@ -2308,9 +2304,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjExplicitLod "
"%v4float %sampled_image %coords123 Lod|ConstOffset %f1 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleLevel(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3, 4)))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2322,9 +2318,9 @@
"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleProjExplicitLod "
"%v4float %sampled_image %coords123 Grad %vf12 %vf21",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, (coords123.xy / coords123.z), vf12, vf21))"},
// OpImageSampleProjExplicitLod 2D Lod Grad ConstOffset
@@ -2333,9 +2329,9 @@
"%result = OpImageSampleProjExplicitLod "
"%v4float %sampled_image %coords123 Grad|ConstOffset "
"%vf12 %vf21 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(textureSampleGrad(x_20, x_10, (coords123.xy / coords123.z), vf12, vf21, vec2<i32>(3, 4)))"}));
INSTANTIATE_TEST_SUITE_P(
@@ -2348,9 +2344,9 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords123",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
// Sampling the depth texture yields an f32, but the
// SPIR-V operation yiedls vec4<f32>, so fill out the
@@ -2367,9 +2363,9 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleProjDrefImplicitLod "
"%float %sampled_image %coords123 %f1",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), f1))"},
@@ -2378,9 +2374,9 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleProjDrefImplicitLod "
"%float %sampled_image %coords123 %f1 ConstOffset %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), f1, vec2<i32>(3, 4)))"}));
@@ -2397,9 +2393,9 @@
"%float 2D 1 0 0 1 Unknown",
"%result = OpImageSampleProjDrefExplicitLod "
"%float %sampled_image %coords123 %depth Lod %float_0",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0))"},
@@ -2409,9 +2405,9 @@
"%result = OpImageSampleProjDrefExplicitLod "
"%float %sampled_image %coords123 %depth "
"Lod|ConstOffset %float_0 %offsets2d",
- R"([[group(0), binding(0)]] var x_10 : sampler_comparison;
+ R"(@group(0) @binding(0) var x_10 : sampler_comparison;
-[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+@group(2) @binding(1) var x_20 : texture_depth_2d;
)",
R"(textureSampleCompareLevel(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0, vec2<i32>(3, 4)))"}));
@@ -2492,7 +2488,7 @@
// OpImageWrite with no extra params
{"%float 2D 0 0 0 2 Rgba32f",
"OpImageWrite %im %vi12 %vf1234",
- "[[group(2), binding(1)]] var x_20 : "
+ "@group(2) @binding(1) var x_20 : "
"texture_storage_2d<rgba32float, write>;",
"textureStore(x_20, vi12, vf1234);"}}));
@@ -2507,36 +2503,36 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// Source 1 component
{"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %f1",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32float, write>;)",
"textureStore(x_20, vi12, vec4<f32>(f1, 0.0, 0.0, 0.0));"},
// Source 2 component, dest 1 component
{"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf12",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32float, write>;)",
"textureStore(x_20, vi12, vec4<f32>(vf12, 0.0, 0.0));"},
// Source 3 component, dest 1 component
{"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf123",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32float, write>;)",
"textureStore(x_20, vi12, vec4<f32>(vf123, 0.0));"},
// Source 4 component, dest 1 component
{"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf1234",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32float, write>;)",
"textureStore(x_20, vi12, vf1234);"},
// Source 2 component, dest 2 component
{"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf12",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rg32float, write>;)",
"textureStore(x_20, vi12, vec4<f32>(vf12, 0.0, 0.0));"},
// Source 3 component, dest 2 component
{"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf123",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rg32float, write>;)",
"textureStore(x_20, vi12, vec4<f32>(vf123, 0.0));"},
// Source 4 component, dest 2 component
{"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf1234",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rg32float, write>;)",
"textureStore(x_20, vi12, vf1234);"},
// WGSL does not support 3-component storage textures.
// Source 4 component, dest 4 component
{"%float 2D 0 0 0 2 Rgba32f", "OpImageWrite %im %vi12 %vf1234",
- "[[group(2), binding(1)]] var x_20 : "
+ "@group(2) @binding(1) var x_20 : "
"texture_storage_2d<rgba32float, write>;",
"textureStore(x_20, vi12, vf1234);"}}));
@@ -2617,11 +2613,11 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// Sampled type is unsigned int, texel is unsigned int
{"%uint 2D 0 0 0 2 Rgba32ui", "OpImageWrite %im %vi12 %vu1234",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32uint, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32uint, write>;)",
R"(textureStore(x_20, vi12, vu1234))"},
// Sampled type is signed int, texel is signed int
{"%int 2D 0 0 0 2 Rgba32i", "OpImageWrite %im %vi12 %vi1234",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32sint, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32sint, write>;)",
R"(textureStore(x_20, vi12, vi1234))"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2635,25 +2631,25 @@
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, write>;)"},
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32float, write>;)"},
// Sampled type is float, texel is unsigned int
{"%int 2D 0 0 0 2 Rgba32f", "OpImageWrite %im %vi12 %vu1234",
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, write>;)"},
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32float, write>;)"},
// Sampled type is unsigned int, texel is float
{"%uint 2D 0 0 0 2 Rgba32ui", "OpImageWrite %im %vi12 %vf1234",
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32uint, write>;)"},
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32uint, write>;)"},
// Sampled type is signed int, texel is float
{"%int 2D 0 0 0 2 Rgba32i", "OpImageWrite %im %vi12 %vf1234",
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32sint, write>;
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32sint, write>;
})"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2667,13 +2663,13 @@
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32uint, write>;)"},
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32uint, write>;)"},
// Sampled type is signed int, texel is unsigned int
{"%int 2D 0 0 0 2 Rgba32i", "OpImageWrite %im %vi12 %vu1234",
"invalid texel type for storage texture write: component must be "
"float, signed integer, or unsigned integer to match the texture "
"channel type: OpImageWrite",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32sint, write>;
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<rgba32sint, write>;
})"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2684,11 +2680,11 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// Source unsigned, dest unsigned
{"%uint 2D 0 0 0 2 R32ui", "OpImageWrite %im %vi12 %vu12",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32uint, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32uint, write>;)",
R"(textureStore(x_20, vi12, vec4<u32>(vu12, 0u, 0u)))"},
// Source signed, dest signed
{"%int 2D 0 0 0 2 R32i", "OpImageWrite %im %vi12 %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_storage_2d<r32sint, write>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_storage_2d<r32sint, write>;)",
R"(textureStore(x_20, vi12, vec4<i32>(vi12, 0, 0)))"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2698,22 +2694,22 @@
// OpImageFetch with no extra params, on sampled texture
// Level of detail is injected for sampled texture
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
// OpImageFetch with explicit level, on sampled texture
{"%float 2D 0 0 0 1 Unknown",
"%99 = OpImageFetch %v4float %im %vi12 Lod %int_3",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 3);)"},
// OpImageFetch with no extra params, on depth texture
// Level of detail is injected for depth texture
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);)"},
// OpImageFetch with extra params, on depth texture
{"%float 2D 1 0 0 1 Unknown",
"%99 = OpImageFetch %v4float %im %vi12 Lod %int_3",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 3), 0.0, 0.0, 0.0);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2726,7 +2722,7 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// ImageFetch on depth image.
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 ",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2740,7 +2736,7 @@
// ImageFetch on multisampled depth image.
{"%float 2D 1 0 1 1 Unknown",
"%99 = OpImageFetch %v4float %im %vi12 Sample %i1",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_multisampled_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_multisampled_2d;)",
R"(let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, i1), 0.0, 0.0, 0.0);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2756,7 +2752,7 @@
// ImageFetch non-arrayed
{"%float 2D 0 0 1 1 Unknown",
"%99 = OpImageFetch %v4float %im %vi12 Sample %i1",
- R"([[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, i1);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2765,7 +2761,7 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
{"%float 2D 0 0 1 1 Unknown",
"%99 = OpImageFetch %v4float %im %vi12 Sample %u1",
- R"([[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, i32(u1));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2788,11 +2784,11 @@
// OpImageFetch requires no conversion, float -> v4float
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
// OpImageFetch requires no conversion, uint -> v4uint
{"%uint 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4uint %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<u32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<u32>;)",
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0);)"},
// OpImageFetch requires conversion, uint -> v4int
// is invalid SPIR-V:
@@ -2801,7 +2797,7 @@
// OpImageFetch requires no conversion, int -> v4int
{"%int 2D 0 0 0 1 Unknown", "%99 = OpImageFetch %v4int %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<i32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<i32>;)",
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0);)"},
// OpImageFetch requires conversion, int -> v4uint
// is invalid SPIR-V:
@@ -2814,11 +2810,11 @@
// OpImageRead requires no conversion, float -> v4float
{"%float 2D 0 0 0 2 Rgba32f", "%99 = OpImageRead %v4float %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);)"},
// OpImageRead requires no conversion, uint -> v4uint
{"%uint 2D 0 0 0 2 Rgba32ui", "%99 = OpImageRead %v4uint %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<u32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<u32>;)",
R"(let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0);)"},
// OpImageRead requires conversion, uint -> v4int
@@ -2828,7 +2824,7 @@
// OpImageRead requires no conversion, int -> v4int
{"%int 2D 0 0 0 2 Rgba32i", "%99 = OpImageRead %v4int %im %vi12",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<i32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<i32>;)",
R"(let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0);)"},
// OpImageRead requires conversion, int -> v4uint
@@ -2845,9 +2841,9 @@
// OpImageSampleImplicitLod requires no conversion, float -> v4float
{"%float 2D 0 0 0 1 Unknown",
"%99 = OpImageSampleImplicitLod %v4float %sampled_image %vf12",
- R"([[group(0), binding(0)]] var x_10 : sampler;
+ R"(@group(0) @binding(0) var x_10 : sampler;
-[[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec4<f32> = textureSample(x_20, x_10, vf12);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2862,26 +2858,26 @@
"%99 = OpImageQuerySize %int %im \n"
"%98 = OpImageRead %v4float %im %i1\n", // Implicitly mark as
// NonWritable
- R"([[group(2), binding(1)]] var x_20 : texture_1d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_1d<f32>;)",
R"(let x_99 : i32 = i32(textureDimensions(x_20));)"},
// 2D storage image
{"%float 2D 0 0 0 2 Rgba32f",
"%99 = OpImageQuerySize %v2int %im \n"
"%98 = OpImageRead %v4float %im %vi12\n", // Implicitly mark as
// NonWritable
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20))"},
// 3D storage image
{"%float 3D 0 0 0 2 Rgba32f",
"%99 = OpImageQuerySize %v3int %im \n"
"%98 = OpImageRead %v4float %im %vi123\n", // Implicitly mark as
// NonWritable
- R"([[group(2), binding(1)]] var x_20 : texture_3d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_3d<f32>;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20));)"},
// Multisampled
{"%float 2D 0 0 1 1 Unknown", "%99 = OpImageQuerySize %v2int %im \n",
- R"([[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2897,7 +2893,7 @@
{"%float 2D 0 1 0 2 Rgba32f",
"%99 = OpImageQuerySize %v3int %im \n"
"%98 = OpImageRead %v4float %im %vi123\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20), textureNumLayers(x_20));)"}
// 3D array storage image doesn't exist.
@@ -2914,37 +2910,37 @@
// 1D
{"%float 1D 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_1d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_1d<f32>;)",
R"(let x_99 : i32 = i32(textureDimensions(x_20, i1)))"},
// 2D
{"%float 2D 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v2int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1));)"},
// 3D
{"%float 3D 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v3int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_3d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_3d<f32>;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1));)"},
// Cube
{"%float Cube 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v2int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_cube<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_cube<f32>;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1).xy);)"},
// Depth 2D
{"%float 2D 1 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v2int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1));)"},
// Depth Cube
{"%float Cube 1 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v2int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_cube;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_cube;)",
R"(let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1).xy);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -2960,7 +2956,7 @@
// 2D array
{"%float 2D 0 1 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v3int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1), textureNumLayers(x_20));)"},
// There is no 3D array
@@ -2972,13 +2968,13 @@
// https://github.com/gpuweb/gpuweb/issues/1345
{"%float Cube 0 1 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v3int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_cube_array<f32>;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1).xy, textureNumLayers(x_20));)"},
// Depth 2D array
{"%float 2D 1 1 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v3int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1), textureNumLayers(x_20));)"},
// Depth Cube Array
@@ -2988,7 +2984,7 @@
// https://github.com/gpuweb/gpuweb/issues/1345
{"%float Cube 1 1 0 1 Unknown",
"%99 = OpImageQuerySizeLod %v3int %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_cube_array;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_cube_array;)",
R"(let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1).xy, textureNumLayers(x_20));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -3001,7 +2997,7 @@
{"%float 1D 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %int %im %u1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_1d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_1d<f32>;)",
R"(let x_99 : i32 = i32(textureDimensions(x_20, i32(u1)));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -3015,7 +3011,7 @@
{"%float 1D 0 0 0 1 Unknown",
"%99 = OpImageQuerySizeLod %uint %im %i1\n",
- R"([[group(2), binding(1)]] var x_20 : texture_1d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_1d<f32>;)",
R"(let x_99 : u32 = u32(textureDimensions(x_20, i1));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -3029,47 +3025,47 @@
// 2D
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// 2D array
{"%float 2D 0 1 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d_array<f32>;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// 3D
{"%float 3D 0 0 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_3d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_3d<f32>;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// Cube
{"%float Cube 0 0 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_cube<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_cube<f32>;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// Cube array
{"%float Cube 0 1 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_cube_array<f32>;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// depth 2d
{"%float 2D 1 0 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// depth 2d array
{"%float 2D 1 1 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_2d_array;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_2d_array;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// depth cube
{"%float Cube 1 0 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_cube;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_cube;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"},
// depth cube array
{"%float Cube 1 1 0 1 Unknown", "%99 = OpImageQueryLevels %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_depth_cube_array;)",
+ R"(@group(2) @binding(1) var x_20 : texture_depth_cube_array;)",
R"(let x_99 : i32 = textureNumLevels(x_20);)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -3079,7 +3075,7 @@
SpvParserHandleTest_SampledImageAccessTest,
::testing::ValuesIn(std::vector<ImageAccessCase>{
{"%float 2D 0 0 0 1 Unknown", "%99 = OpImageQueryLevels %uint %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_2d<f32>;)",
R"(let x_99 : u32 = u32(textureNumLevels(x_20));)"}}));
INSTANTIATE_TEST_SUITE_P(
@@ -3088,7 +3084,7 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// Multsample 2D
{"%float 2D 0 0 1 1 Unknown", "%99 = OpImageQuerySamples %int %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;)",
R"(let x_99 : i32 = textureNumSamples(x_20);)"} // namespace
// Multisample 2D array
@@ -3102,7 +3098,7 @@
::testing::ValuesIn(std::vector<ImageAccessCase>{
// Multsample 2D
{"%float 2D 0 0 1 1 Unknown", "%99 = OpImageQuerySamples %uint %im\n",
- R"([[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;)",
+ R"(@group(2) @binding(1) var x_20 : texture_multisampled_2d<f32>;)",
R"(let x_99 : u32 = u32(textureNumSamples(x_20));)"}
// Multisample 2D array
diff --git a/src/reader/spirv/parser_impl_module_var_test.cc b/src/reader/spirv/parser_impl_module_var_test.cc
index 4c7ab3a..31007f3 100644
--- a/src/reader/spirv/parser_impl_module_var_test.cc
+++ b/src/reader/spirv/parser_impl_module_var_test.cc
@@ -471,11 +471,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
gl_Position : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@@ -531,11 +531,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
gl_Position : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@@ -590,11 +590,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
gl_Position : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@@ -649,11 +649,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_2);
@@ -707,11 +707,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_2);
@@ -765,11 +765,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_2);
@@ -801,11 +801,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_2);
@@ -1298,7 +1298,7 @@
const auto module_str = test::ToString(p->program());
EXPECT_THAT(
module_str,
- HasSubstr("[[group(3), binding(9)]] var<storage, read_write> x_1 : S;"))
+ HasSubstr("@group(3) @binding(9) var<storage, read_write> x_1 : S;"))
<< module_str;
}
@@ -1349,7 +1349,7 @@
const auto module_str = test::ToString(p->program());
EXPECT_THAT(
module_str,
- HasSubstr("[[group(0), binding(3)]] var<storage, read_write> x_1 : S;"))
+ HasSubstr("@group(0) @binding(3) var<storage, read_write> x_1 : S;"))
<< module_str;
}
@@ -1399,7 +1399,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"(type Arr = [[stride(4)]] array<u32, 2u>;
+ EXPECT_THAT(module_str, HasSubstr(R"(type Arr = @stride(4) array<u32, 2u>;
struct S {
field0 : u32;
@@ -1407,7 +1407,7 @@
field2 : Arr;
}
-[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+@group(0) @binding(0) var<storage, read_write> x_1 : S;
)")) << module_str;
}
@@ -1437,7 +1437,7 @@
field0 : mat3x2<f32>;
}
-[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+@group(0) @binding(0) var<storage, read_write> myvar : S;
)")) << module_str;
}
@@ -1466,7 +1466,7 @@
field0 : mat3x2<f32>;
}
-[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+@group(0) @binding(0) var<storage, read_write> myvar : S;
)")) << module_str;
}
@@ -1492,11 +1492,11 @@
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
- [[stride(64), internal(disable_validation__ignore_stride)]]
+ @stride(64) @internal(disable_validation__ignore_stride)
field0 : mat3x2<f32>;
}
-[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+@group(0) @binding(0) var<storage, read_write> myvar : S;
)")) << module_str;
}
@@ -1549,7 +1549,7 @@
field1 : f32;
}
-[[group(0), binding(0)]] var<storage, read> x_1 : S;
+@group(0) @binding(0) var<storage, read> x_1 : S;
)")) << module_str;
}
@@ -1578,7 +1578,7 @@
field1 : f32;
}
-[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+@group(0) @binding(0) var<storage, read_write> x_1 : S;
)")) << module_str;
}
@@ -1610,7 +1610,7 @@
field1 : f32;
}
-[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+@group(0) @binding(0) var<storage, read_write> x_1 : S;
)")) << module_str;
}
@@ -1655,8 +1655,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str,
- HasSubstr("[[override(12)]] let myconst : bool = true;"))
+ EXPECT_THAT(module_str, HasSubstr("@override(12) let myconst : bool = true;"))
<< module_str;
}
@@ -1673,7 +1672,7 @@
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str,
- HasSubstr("[[override(12)]] let myconst : bool = false;"))
+ HasSubstr("@override(12) let myconst : bool = false;"))
<< module_str;
}
@@ -1689,8 +1688,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str,
- HasSubstr("[[override(12)]] let myconst : u32 = 42u;"))
+ EXPECT_THAT(module_str, HasSubstr("@override(12) let myconst : u32 = 42u;"))
<< module_str;
}
@@ -1706,7 +1704,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr("[[override(12)]] let myconst : i32 = 42;"))
+ EXPECT_THAT(module_str, HasSubstr("@override(12) let myconst : i32 = 42;"))
<< module_str;
}
@@ -1722,8 +1720,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str,
- HasSubstr("[[override(12)]] let myconst : f32 = 2.5;"))
+ EXPECT_THAT(module_str, HasSubstr("@override(12) let myconst : f32 = 2.5;"))
<< module_str;
}
@@ -1810,8 +1807,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param);
main_1();
}
@@ -1923,8 +1920,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param);
main_1();
}
@@ -1977,8 +1974,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
}
@@ -2007,8 +2004,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
}
@@ -2036,8 +2033,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
}
@@ -2152,8 +2149,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = x_1_param;
main_1();
}
@@ -2184,8 +2181,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = x_1_param;
main_1();
}
@@ -2216,8 +2213,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = x_1_param;
main_1();
}
@@ -2247,8 +2244,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = bitcast<i32>(x_1_param);
main_1();
}
@@ -2279,8 +2276,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = bitcast<i32>(x_1_param);
main_1();
}
@@ -2311,8 +2308,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = bitcast<i32>(x_1_param);
main_1();
}
@@ -2362,11 +2359,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1[0]);
@@ -2399,11 +2396,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1[0]);
@@ -2436,11 +2433,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1[0]);
@@ -2472,11 +2469,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0]));
@@ -2509,11 +2506,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0]));
@@ -2546,11 +2543,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0]));
@@ -2574,13 +2571,13 @@
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- const std::string expected = R"(type Arr = [[stride(4)]] array<u32, 1u>;
+ const std::string expected = R"(type Arr = @stride(4) array<u32, 1u>;
-type Arr_1 = [[stride(4)]] array<u32, 2u>;
+type Arr_1 = @stride(4) array<u32, 2u>;
-type Arr_2 = [[stride(4)]] array<i32, 1u>;
+type Arr_2 = @stride(4) array<i32, 1u>;
-type Arr_3 = [[stride(4)]] array<i32, 2u>;
+type Arr_3 = @stride(4) array<i32, 2u>;
var<private> x_1 : Arr;
@@ -2589,8 +2586,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = x_1_param;
main_1();
}
@@ -2613,13 +2610,13 @@
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- const std::string expected = R"(type Arr = [[stride(4)]] array<u32, 1u>;
+ const std::string expected = R"(type Arr = @stride(4) array<u32, 1u>;
-type Arr_1 = [[stride(4)]] array<u32, 2u>;
+type Arr_1 = @stride(4) array<u32, 2u>;
-type Arr_2 = [[stride(4)]] array<i32, 1u>;
+type Arr_2 = @stride(4) array<i32, 1u>;
-type Arr_3 = [[stride(4)]] array<i32, 2u>;
+type Arr_3 = @stride(4) array<i32, 2u>;
var<private> x_1 : Arr;
@@ -2629,11 +2626,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1[0]);
@@ -2687,12 +2684,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(x_4);
@@ -2725,12 +2722,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(x_4);
@@ -2762,12 +2759,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(x_4);
@@ -2798,12 +2795,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(x_4);
@@ -2836,12 +2833,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(x_4);
@@ -2873,12 +2870,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(x_4);
@@ -2958,12 +2955,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(position);
@@ -2996,12 +2993,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(position);
@@ -3033,12 +3030,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(position);
@@ -3093,12 +3090,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(position);
@@ -3131,12 +3128,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(position);
@@ -3168,12 +3165,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
position_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(position);
@@ -3318,8 +3315,8 @@
return;
}
-[[stage(compute), workgroup_size(1, 1, 1)]]
-fn main([[builtin(${wgsl_builtin})]] x_1_param : ${unsigned_wgsl_type}) {
+@stage(compute) @workgroup_size(1, 1, 1)
+fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
}
@@ -3367,8 +3364,8 @@
return;
}
-[[stage(compute), workgroup_size(1, 1, 1)]]
-fn main([[builtin(${wgsl_builtin})]] x_1_param : ${unsigned_wgsl_type}) {
+@stage(compute) @workgroup_size(1, 1, 1)
+fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
}
@@ -3415,8 +3412,8 @@
return;
}
-[[stage(compute), workgroup_size(1, 1, 1)]]
-fn main([[builtin(${wgsl_builtin})]] x_1_param : ${unsigned_wgsl_type}) {
+@stage(compute) @workgroup_size(1, 1, 1)
+fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
}
@@ -3730,14 +3727,14 @@
}
struct main_out {
- [[location(0)]]
+ @location(0)
x_2_1 : u32;
- [[location(6)]]
+ @location(6)
x_4_1 : u32;
}
-[[stage(fragment)]]
-fn main([[location(0)]] x_1_param : u32, [[location(30)]] x_3_param : u32) -> main_out {
+@stage(fragment)
+fn main(@location(0) x_1_param : u32, @location(30) x_3_param : u32) -> main_out {
x_1 = x_1_param;
x_3 = x_3_param;
main_1();
@@ -3784,12 +3781,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
return main_out(x_4);
@@ -3834,12 +3831,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_4_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+@stage(vertex)
+fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
return main_out(x_4);
@@ -3879,8 +3876,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = x_1_param;
main_1();
}
@@ -3918,8 +3915,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[builtin(sample_mask)]] x_1_param : u32) {
+@stage(fragment)
+fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0] = bitcast<i32>(x_1_param);
main_1();
}
@@ -3960,11 +3957,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1[0]);
@@ -4006,11 +4003,11 @@
}
struct main_out {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
x_1_1 : u32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0]));
@@ -4050,11 +4047,11 @@
}
struct main_out {
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
x_1_1 : f32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1);
@@ -4084,11 +4081,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
gl_Position : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@@ -4154,11 +4151,11 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
gl_Position : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@@ -4211,12 +4208,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(4)]] x_1_param : f32, [[location(5)]] x_1_param_1 : f32, [[location(6)]] x_1_param_2 : f32) -> main_out {
+@stage(vertex)
+fn main(@location(4) x_1_param : f32, @location(5) x_1_param_1 : f32, @location(6) x_1_param_2 : f32) -> main_out {
x_1[0] = x_1_param;
x_1[1] = x_1_param_1;
x_1[2] = x_1_param_2;
@@ -4269,12 +4266,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(9)]] x_1_param : vec4<f32>, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
+@stage(vertex)
+fn main(@location(9) x_1_param : vec4<f32>, @location(10) x_1_param_1 : vec4<f32>) -> main_out {
x_1[0] = x_1_param;
x_1[1] = x_1_param_1;
main_1();
@@ -4336,12 +4333,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(9)]] x_1_param : f32, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
+@stage(vertex)
+fn main(@location(9) x_1_param : f32, @location(10) x_1_param_1 : vec4<f32>) -> main_out {
x_1.alice = x_1_param;
x_1.bob = x_1_param_1;
main_1();
@@ -4395,12 +4392,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(7)]] x_1_param : vec4<f32>, [[location(8)]] x_1_param_1 : vec4<f32>, [[location(9)]] x_1_param_2 : vec4<f32>, [[location(10)]] x_1_param_3 : vec4<f32>) -> main_out {
+@stage(vertex)
+fn main(@location(7) x_1_param : vec4<f32>, @location(8) x_1_param_1 : vec4<f32>, @location(9) x_1_param_2 : vec4<f32>, @location(10) x_1_param_3 : vec4<f32>) -> main_out {
x_1[0][0] = x_1_param;
x_1[0][1] = x_1_param_1;
x_1[1][0] = x_1_param_2;
@@ -4456,17 +4453,17 @@
}
struct main_out {
- [[location(4)]]
+ @location(4)
x_1_1 : f32;
- [[location(5)]]
+ @location(5)
x_1_2 : f32;
- [[location(6)]]
+ @location(6)
x_1_3 : f32;
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_1[0], x_1[1], x_1[2], x_2);
@@ -4517,15 +4514,15 @@
}
struct main_out {
- [[location(9)]]
+ @location(9)
x_1_1 : vec4<f32>;
- [[location(10)]]
+ @location(10)
x_1_2 : vec4<f32>;
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_1[0], x_1[1], x_2);
@@ -4586,15 +4583,15 @@
}
struct main_out {
- [[location(9)]]
+ @location(9)
x_1_1 : f32;
- [[location(10)]]
+ @location(10)
x_1_2 : vec4<f32>;
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_1.alice, x_1.bob, x_2);
@@ -4661,16 +4658,16 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_2_1 : vec4<f32>;
- [[location(9)]]
+ @location(9)
x_3_1 : f32;
- [[location(11)]]
+ @location(11)
x_3_2 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(9)]] x_1_param : f32, [[location(11)]] x_1_param_1 : vec4<f32>) -> main_out {
+@stage(vertex)
+fn main(@location(9) x_1_param : f32, @location(11) x_1_param_1 : vec4<f32>) -> main_out {
x_1.alice = x_1_param;
x_1.bob = x_1_param_1;
main_1();
@@ -4746,12 +4743,12 @@
}
struct main_out {
- [[builtin(position)]]
+ @builtin(position)
x_10_1 : vec4<f32>;
}
-[[stage(vertex)]]
-fn main([[location(1), interpolate(flat)]] x_1_param : u32, [[location(2), interpolate(flat)]] x_2_param : vec2<u32>, [[location(3), interpolate(flat)]] x_3_param : i32, [[location(4), interpolate(flat)]] x_4_param : vec2<i32>, [[location(5), interpolate(flat)]] x_5_param : f32, [[location(6), interpolate(flat)]] x_6_param : vec2<f32>) -> main_out {
+@stage(vertex)
+fn main(@location(1) @interpolate(flat) x_1_param : u32, @location(2) @interpolate(flat) x_2_param : vec2<u32>, @location(3) @interpolate(flat) x_3_param : i32, @location(4) @interpolate(flat) x_4_param : vec2<i32>, @location(5) @interpolate(flat) x_5_param : f32, @location(6) @interpolate(flat) x_6_param : vec2<f32>) -> main_out {
x_1 = x_1_param;
x_2 = x_2_param;
x_3 = x_3_param;
@@ -4831,23 +4828,23 @@
}
struct main_out {
- [[location(1), interpolate(flat)]]
+ @location(1) @interpolate(flat)
x_1_1 : u32;
- [[location(2), interpolate(flat)]]
+ @location(2) @interpolate(flat)
x_2_1 : vec2<u32>;
- [[location(3), interpolate(flat)]]
+ @location(3) @interpolate(flat)
x_3_1 : i32;
- [[location(4), interpolate(flat)]]
+ @location(4) @interpolate(flat)
x_4_1 : vec2<i32>;
- [[location(5), interpolate(flat)]]
+ @location(5) @interpolate(flat)
x_5_1 : f32;
- [[location(6), interpolate(flat)]]
+ @location(6) @interpolate(flat)
x_6_1 : vec2<f32>;
- [[builtin(position)]]
+ @builtin(position)
x_10_1 : vec4<f32>;
}
-[[stage(vertex)]]
+@stage(vertex)
fn main() -> main_out {
main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10);
@@ -4899,8 +4896,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[location(1), interpolate(flat)]] x_1_param : f32, [[location(2), interpolate(flat)]] x_1_param_1 : f32, [[location(5), interpolate(flat)]] x_2_param : f32, [[location(6), interpolate(flat)]] x_2_param_1 : f32) {
+@stage(fragment)
+fn main(@location(1) @interpolate(flat) x_1_param : f32, @location(2) @interpolate(flat) x_1_param_1 : f32, @location(5) @interpolate(flat) x_2_param : f32, @location(6) @interpolate(flat) x_2_param_1 : f32) {
x_1[0] = x_1_param;
x_1[1] = x_1_param_1;
x_2.field0 = x_2_param;
@@ -4975,8 +4972,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[location(1)]] x_1_param : f32, [[location(2), interpolate(perspective, centroid)]] x_2_param : f32, [[location(3), interpolate(perspective, sample)]] x_3_param : f32, [[location(4), interpolate(linear)]] x_4_param : f32, [[location(5), interpolate(linear, centroid)]] x_5_param : f32, [[location(6), interpolate(linear, sample)]] x_6_param : f32) {
+@stage(fragment)
+fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_2_param : f32, @location(3) @interpolate(perspective, sample) x_3_param : f32, @location(4) @interpolate(linear) x_4_param : f32, @location(5) @interpolate(linear, centroid) x_5_param : f32, @location(6) @interpolate(linear, sample) x_6_param : f32) {
x_1 = x_1_param;
x_2 = x_2_param;
x_3 = x_3_param;
@@ -5043,8 +5040,8 @@
return;
}
-[[stage(fragment)]]
-fn main([[location(1)]] x_1_param : f32, [[location(2), interpolate(perspective, centroid)]] x_1_param_1 : f32, [[location(3), interpolate(perspective, sample)]] x_1_param_2 : f32, [[location(4), interpolate(linear)]] x_1_param_3 : f32, [[location(5), interpolate(linear, centroid)]] x_1_param_4 : f32, [[location(6), interpolate(linear, sample)]] x_1_param_5 : f32) {
+@stage(fragment)
+fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_1_param_1 : f32, @location(3) @interpolate(perspective, sample) x_1_param_2 : f32, @location(4) @interpolate(linear) x_1_param_3 : f32, @location(5) @interpolate(linear, centroid) x_1_param_4 : f32, @location(6) @interpolate(linear, sample) x_1_param_5 : f32) {
x_1.field0 = x_1_param;
x_1.field1 = x_1_param_1;
x_1.field2 = x_1_param_2;
@@ -5122,21 +5119,21 @@
}
struct main_out {
- [[location(1)]]
+ @location(1)
x_1_1 : f32;
- [[location(2), interpolate(perspective, centroid)]]
+ @location(2) @interpolate(perspective, centroid)
x_2_1 : f32;
- [[location(3), interpolate(perspective, sample)]]
+ @location(3) @interpolate(perspective, sample)
x_3_1 : f32;
- [[location(4), interpolate(linear)]]
+ @location(4) @interpolate(linear)
x_4_1 : f32;
- [[location(5), interpolate(linear, centroid)]]
+ @location(5) @interpolate(linear, centroid)
x_5_1 : f32;
- [[location(6), interpolate(linear, sample)]]
+ @location(6) @interpolate(linear, sample)
x_6_1 : f32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6);
@@ -5201,21 +5198,21 @@
}
struct main_out {
- [[location(1)]]
+ @location(1)
x_1_1 : f32;
- [[location(2), interpolate(perspective, centroid)]]
+ @location(2) @interpolate(perspective, centroid)
x_1_2 : f32;
- [[location(3), interpolate(perspective, sample)]]
+ @location(3) @interpolate(perspective, sample)
x_1_3 : f32;
- [[location(4), interpolate(linear)]]
+ @location(4) @interpolate(linear)
x_1_4 : f32;
- [[location(5), interpolate(linear, centroid)]]
+ @location(5) @interpolate(linear, centroid)
x_1_5 : f32;
- [[location(6), interpolate(linear, sample)]]
+ @location(6) @interpolate(linear, sample)
x_1_6 : f32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> main_out {
main_1();
return main_out(x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5);
diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc
index f593222..8da9c73 100644
--- a/src/reader/spirv/parser_impl_named_types_test.cc
+++ b/src/reader/spirv/parser_impl_named_types_test.cc
@@ -78,7 +78,7 @@
)"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_THAT(test::ToString(p->program()),
- HasSubstr("RTArr = [[stride(8)]] array<u32>;\n"));
+ HasSubstr("RTArr = @stride(8) array<u32>;\n"));
p->DeliberatelyInvalidSpirv();
}
@@ -93,9 +93,9 @@
)"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_THAT(test::ToString(p->program()),
- HasSubstr(R"(type RTArr = [[stride(8)]] array<u32>;
+ HasSubstr(R"(type RTArr = @stride(8) array<u32>;
-type RTArr_1 = [[stride(8)]] array<u32>;
+type RTArr_1 = @stride(8) array<u32>;
)"));
p->DeliberatelyInvalidSpirv();
@@ -110,7 +110,7 @@
)"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_THAT(test::ToString(p->program()),
- HasSubstr("myrtarr = [[stride(8)]] array<u32>;\n"));
+ HasSubstr("myrtarr = @stride(8) array<u32>;\n"));
p->DeliberatelyInvalidSpirv();
}
@@ -126,7 +126,7 @@
)"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_THAT(test::ToString(p->program()),
- HasSubstr("myarr = [[stride(8)]] array<u32, 5u>;"));
+ HasSubstr("myarr = @stride(8) array<u32, 5u>;"));
p->DeliberatelyInvalidSpirv();
}
@@ -142,9 +142,9 @@
)"));
EXPECT_TRUE(p->BuildAndParseInternalModule());
EXPECT_THAT(test::ToString(p->program()),
- HasSubstr(R"(type Arr = [[stride(8)]] array<u32, 5u>;
+ HasSubstr(R"(type Arr = @stride(8) array<u32, 5u>;
-type Arr_1 = [[stride(8)]] array<u32, 5u>;
+type Arr_1 = @stride(8) array<u32, 5u>;
)"));
p->DeliberatelyInvalidSpirv();
diff --git a/src/reader/wgsl/lexer.cc b/src/reader/wgsl/lexer.cc
index f8c8bfa..31d2546 100644
--- a/src/reader/wgsl/lexer.cc
+++ b/src/reader/wgsl/lexer.cc
@@ -777,7 +777,11 @@
auto source = begin_source();
auto type = Token::Type::kUninitialized;
- if (matches(pos_, "[[")) {
+ if (matches(pos_, "@")) {
+ type = Token::Type::kAttr;
+ pos_ += 1;
+ location_.column += 1;
+ } else if (matches(pos_, "[[")) {
type = Token::Type::kAttrLeft;
pos_ += 2;
location_.column += 2;
diff --git a/src/reader/wgsl/lexer_test.cc b/src/reader/wgsl/lexer_test.cc
index 20b3f18..0ea9b9a 100644
--- a/src/reader/wgsl/lexer_test.cc
+++ b/src/reader/wgsl/lexer_test.cc
@@ -662,6 +662,7 @@
testing::Values(TokenData{"&", Token::Type::kAnd},
TokenData{"&&", Token::Type::kAndAnd},
TokenData{"->", Token::Type::kArrow},
+ TokenData{"@", Token::Type::kAttr},
TokenData{"[[", Token::Type::kAttrLeft},
TokenData{"]]", Token::Type::kAttrRight},
TokenData{"/", Token::Type::kForwardSlash},
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index cdc9b87..9f54309 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -161,9 +161,9 @@
/// @return the current enter-exit depth for the given block token type. If
/// `t` is not a block token type, then 0 is always returned.
int consume(const Token& t) {
- if (t.Is(Token::Type::kAttrLeft))
+ if (t.Is(Token::Type::kAttrLeft)) // [DEPRECATED]
return attrs++;
- if (t.Is(Token::Type::kAttrRight))
+ if (t.Is(Token::Type::kAttrRight)) // [DEPRECATED]
return attrs--;
if (t.Is(Token::Type::kBraceLeft))
return brace++;
@@ -1383,7 +1383,8 @@
while (continue_parsing()) {
// Check for the end of the list.
auto t = peek();
- if (!t.IsIdentifier() && !t.Is(Token::Type::kAttrLeft)) {
+ if (!t.IsIdentifier() && !t.Is(Token::Type::kAttr) &&
+ !t.Is(Token::Type::kAttrLeft)) {
break;
}
@@ -2834,11 +2835,21 @@
ast::DecorationList decos;
while (continue_parsing()) {
- auto list = decoration_bracketed_list(decos);
- if (list.errored)
- errored = true;
- if (!list.matched)
- break;
+ if (match(Token::Type::kAttr)) {
+ if (auto deco = expect_decoration(); deco.errored) {
+ errored = true;
+ } else {
+ decos.emplace_back(deco.value);
+ }
+ } else { // [DEPRECATED] - old [[decoration]] style
+ auto list = decoration_bracketed_list(decos);
+ if (list.errored) {
+ errored = true;
+ }
+ if (!list.matched) {
+ break;
+ }
+ }
matched = true;
}
@@ -2855,11 +2866,15 @@
Maybe<bool> ParserImpl::decoration_bracketed_list(ast::DecorationList& decos) {
const char* use = "decoration list";
- if (!match(Token::Type::kAttrLeft)) {
+ Source source;
+ if (!match(Token::Type::kAttrLeft, &source)) {
return Failure::kNoMatch;
}
- Source source;
+ deprecated(source,
+ "[[decoration]] style decorations have been replaced with "
+ "@decoration style");
+
if (match(Token::Type::kAttrRight, &source))
return add_error(source, "empty decoration list");
@@ -2879,7 +2894,7 @@
if (is_decoration(peek())) {
// We have two decorations in a bracket without a separating comma.
- // e.g. [[location(1) group(2)]]
+ // e.g. @location(1) group(2)
// ^^^ expected comma
expect(use, Token::Type::kComma);
return Failure::kErrored;
@@ -3092,7 +3107,7 @@
const char* use = "override decoration";
if (peek_is(Token::Type::kParenLeft)) {
- // [[override(x)]]
+ // @override(x)
return expect_paren_block(use, [&]() -> Result {
auto val = expect_positive_sint(use);
if (val.errored)
diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h
index 77c97e2..6c202a7 100644
--- a/src/reader/wgsl/parser_impl.h
+++ b/src/reader/wgsl/parser_impl.h
@@ -669,7 +669,7 @@
/// Parses a `assignment_stmt` grammar element
/// @returns the parsed assignment or nullptr
Maybe<const ast::AssignmentStatement*> assignment_stmt();
- /// Parses one or more bracketed decoration lists.
+ /// Parses one or more decoration lists.
/// @return the parsed decoration list, or an empty list on error.
Maybe<ast::DecorationList> decoration_list();
/// Parses a list of decorations between `ATTR_LEFT` and `ATTR_RIGHT`
diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc
index 29f5a7e..417c1eb 100644
--- a/src/reader/wgsl/parser_impl_error_msg_test.cc
+++ b/src/reader/wgsl/parser_impl_error_msg_test.cc
@@ -39,387 +39,491 @@
TEST_F(ParserImplErrorTest, AdditiveInvalidExpr) {
EXPECT("fn f() { return 1.0 + <; }",
- "test.wgsl:1:23 error: unable to parse right side of + expression\n"
- "fn f() { return 1.0 + <; }\n"
- " ^\n");
+ R"(test.wgsl:1:23 error: unable to parse right side of + expression
+fn f() { return 1.0 + <; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AndInvalidExpr) {
EXPECT("fn f() { return 1 & >; }",
- "test.wgsl:1:21 error: unable to parse right side of & expression\n"
- "fn f() { return 1 & >; }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: unable to parse right side of & expression
+fn f() { return 1 & >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AliasDeclInvalidDeco) {
- EXPECT("[[override]]type e=u32;",
- "test.wgsl:1:3 error: unexpected decorations\n"
- "[[override]]type e=u32;\n"
- " ^^^^^^^^\n");
+ EXPECT(
+ "@override type e=u32;",
+ R"(test.wgsl:1:2 error: unexpected decorations
+@override type e=u32;
+ ^^^^^^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_AliasDeclInvalidDeco) {
+ EXPECT(
+ "[[override]]type e=u32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[override]]type e=u32;
+^^
+
+test.wgsl:1:3 error: unexpected decorations
+[[override]]type e=u32;
+ ^^^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, IndexExprInvalidExpr) {
EXPECT("fn f() { x = y[^]; }",
- "test.wgsl:1:16 error: unable to parse expression inside []\n"
- "fn f() { x = y[^]; }\n"
- " ^\n");
+ R"(test.wgsl:1:16 error: unable to parse expression inside []
+fn f() { x = y[^]; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, IndexExprMissingRBracket) {
EXPECT("fn f() { x = y[1; }",
- "test.wgsl:1:17 error: expected ']' for index accessor\n"
- "fn f() { x = y[1; }\n"
- " ^\n");
+ R"(test.wgsl:1:17 error: expected ']' for index accessor
+fn f() { x = y[1; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AssignmentStmtMissingAssignment) {
- EXPECT("fn f() { a; }",
- "test.wgsl:1:11 error: expected '=' for assignment\n"
- "fn f() { a; }\n"
- " ^\n");
+ EXPECT("fn f() { a; }", R"(test.wgsl:1:11 error: expected '=' for assignment
+fn f() { a; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AssignmentStmtMissingAssignment2) {
EXPECT("fn f() { a : i32; }",
- "test.wgsl:1:10 error: expected 'var' for variable declaration\n"
- "fn f() { a : i32; }\n"
- " ^\n");
+ R"(test.wgsl:1:10 error: expected 'var' for variable declaration
+fn f() { a : i32; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AssignmentStmtMissingSemicolon) {
EXPECT("fn f() { a = 1 }",
- "test.wgsl:1:16 error: expected ';' for assignment statement\n"
- "fn f() { a = 1 }\n"
- " ^\n");
+ R"(test.wgsl:1:16 error: expected ';' for assignment statement
+fn f() { a = 1 }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, AssignmentStmtInvalidLHS_IntrinsicFunctionName) {
EXPECT("normalize = 5;",
- "test.wgsl:1:1 error: statement found outside of function body\n"
- "normalize = 5;\n"
- "^^^^^^^^^\n");
+ R"(test.wgsl:1:1 error: statement found outside of function body
+normalize = 5;
+^^^^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, AssignmentStmtInvalidRHS) {
EXPECT("fn f() { a = >; }",
- "test.wgsl:1:14 error: unable to parse right side of assignment\n"
- "fn f() { a = >; }\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: unable to parse right side of assignment
+fn f() { a = >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, BitcastExprMissingLessThan) {
EXPECT("fn f() { x = bitcast(y); }",
- "test.wgsl:1:21 error: expected '<' for bitcast expression\n"
- "fn f() { x = bitcast(y); }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: expected '<' for bitcast expression
+fn f() { x = bitcast(y); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, BitcastExprMissingGreaterThan) {
EXPECT("fn f() { x = bitcast<u32(y); }",
- "test.wgsl:1:25 error: expected '>' for bitcast expression\n"
- "fn f() { x = bitcast<u32(y); }\n"
- " ^\n");
+ R"(test.wgsl:1:25 error: expected '>' for bitcast expression
+fn f() { x = bitcast<u32(y); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, BitcastExprMissingType) {
EXPECT("fn f() { x = bitcast<>(y); }",
- "test.wgsl:1:22 error: invalid type for bitcast expression\n"
- "fn f() { x = bitcast<>(y); }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: invalid type for bitcast expression
+fn f() { x = bitcast<>(y); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, BreakStmtMissingSemicolon) {
EXPECT("fn f() { loop { break } }",
- "test.wgsl:1:23 error: expected ';' for break statement\n"
- "fn f() { loop { break } }\n"
- " ^\n");
+ R"(test.wgsl:1:23 error: expected ';' for break statement
+fn f() { loop { break } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, CallExprMissingRParen) {
EXPECT("fn f() { x = f(1.; }",
- "test.wgsl:1:18 error: expected ')' for function call\n"
- "fn f() { x = f(1.; }\n"
- " ^\n");
+ R"(test.wgsl:1:18 error: expected ')' for function call
+fn f() { x = f(1.; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, CallStmtMissingRParen) {
EXPECT("fn f() { f(1.; }",
- "test.wgsl:1:14 error: expected ')' for function call\n"
- "fn f() { f(1.; }\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: expected ')' for function call
+fn f() { f(1.; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, CallStmtInvalidArgument0) {
EXPECT("fn f() { f(<); }",
- "test.wgsl:1:12 error: expected ')' for function call\n"
- "fn f() { f(<); }\n"
- " ^\n");
+ R"(test.wgsl:1:12 error: expected ')' for function call
+fn f() { f(<); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, CallStmtInvalidArgument1) {
EXPECT("fn f() { f(1.0, <); }",
- "test.wgsl:1:17 error: expected ')' for function call\n"
- "fn f() { f(1.0, <); }\n"
- " ^\n");
+ R"(test.wgsl:1:17 error: expected ')' for function call
+fn f() { f(1.0, <); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, CallStmtMissingSemicolon) {
EXPECT("fn f() { f() }",
- "test.wgsl:1:14 error: expected ';' for function call\n"
- "fn f() { f() }\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: expected ';' for function call
+fn f() { f() }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ConstructorExprMissingLParen) {
EXPECT("fn f() { x = vec2<u32>1,2); }",
- "test.wgsl:1:23 error: expected '(' for type constructor\n"
- "fn f() { x = vec2<u32>1,2); }\n"
- " ^\n");
+ R"(test.wgsl:1:23 error: expected '(' for type constructor
+fn f() { x = vec2<u32>1,2); }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ConstructorExprMissingRParen) {
EXPECT("fn f() { x = vec2<u32>(1,2; }",
- "test.wgsl:1:27 error: expected ')' for type constructor\n"
- "fn f() { x = vec2<u32>(1,2; }\n"
- " ^\n");
+ R"(test.wgsl:1:27 error: expected ')' for type constructor
+fn f() { x = vec2<u32>(1,2; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ConstVarStmtInvalid) {
EXPECT("fn f() { let >; }",
- "test.wgsl:1:14 error: expected identifier for let declaration\n"
- "fn f() { let >; }\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: expected identifier for let declaration
+fn f() { let >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ConstVarStmtMissingAssignment) {
EXPECT("fn f() { let a : i32; }",
- "test.wgsl:1:21 error: expected '=' for let declaration\n"
- "fn f() { let a : i32; }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: expected '=' for let declaration
+fn f() { let a : i32; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ConstVarStmtMissingConstructor) {
EXPECT("fn f() { let a : i32 = >; }",
- "test.wgsl:1:24 error: missing constructor for let declaration\n"
- "fn f() { let a : i32 = >; }\n"
- " ^\n");
+ R"(test.wgsl:1:24 error: missing constructor for let declaration
+fn f() { let a : i32 = >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ContinueStmtMissingSemicolon) {
EXPECT("fn f() { loop { continue } }",
- "test.wgsl:1:26 error: expected ';' for continue statement\n"
- "fn f() { loop { continue } }\n"
- " ^\n");
+ R"(test.wgsl:1:26 error: expected ';' for continue statement
+fn f() { loop { continue } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, DiscardStmtMissingSemicolon) {
EXPECT("fn f() { discard }",
- "test.wgsl:1:18 error: expected ';' for discard statement\n"
- "fn f() { discard }\n"
- " ^\n");
+ R"(test.wgsl:1:18 error: expected ';' for discard statement
+fn f() { discard }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, EqualityInvalidExpr) {
EXPECT("fn f() { return 1 == >; }",
- "test.wgsl:1:22 error: unable to parse right side of == expression\n"
- "fn f() { return 1 == >; }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: unable to parse right side of == expression
+fn f() { return 1 == >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopInitializerMissingSemicolon) {
EXPECT("fn f() { for (var i : i32 = 0 i < 8; i=i+1) {} }",
- "test.wgsl:1:31 error: expected ';' for initializer in for loop\n"
- "fn f() { for (var i : i32 = 0 i < 8; i=i+1) {} }\n"
- " ^\n");
+ R"(test.wgsl:1:31 error: expected ';' for initializer in for loop
+fn f() { for (var i : i32 = 0 i < 8; i=i+1) {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopInitializerMissingVar) {
EXPECT("fn f() { for (i : i32 = 0; i < 8; i=i+1) {} }",
- "test.wgsl:1:15 error: expected 'var' for variable declaration\n"
- "fn f() { for (i : i32 = 0; i < 8; i=i+1) {} }\n"
- " ^\n");
+ R"(test.wgsl:1:15 error: expected 'var' for variable declaration
+fn f() { for (i : i32 = 0; i < 8; i=i+1) {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopConditionMissingSemicolon) {
EXPECT("fn f() { for (var i : i32 = 0; i < 8 i=i+1) {} }",
- "test.wgsl:1:38 error: expected ';' for condition in for loop\n"
- "fn f() { for (var i : i32 = 0; i < 8 i=i+1) {} }\n"
- " ^\n");
+ R"(test.wgsl:1:38 error: expected ';' for condition in for loop
+fn f() { for (var i : i32 = 0; i < 8 i=i+1) {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopMissingLParen) {
EXPECT("fn f() { for var i : i32 = 0; i < 8; i=i+1) {} }",
- "test.wgsl:1:14 error: expected '(' for for loop\n"
- "fn f() { for var i : i32 = 0; i < 8; i=i+1) {} }\n"
- " ^^^\n");
+ R"(test.wgsl:1:14 error: expected '(' for for loop
+fn f() { for var i : i32 = 0; i < 8; i=i+1) {} }
+ ^^^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopMissingRParen) {
EXPECT("fn f() { for (var i : i32 = 0; i < 8; i=i+1 {} }",
- "test.wgsl:1:45 error: expected ')' for for loop\n"
- "fn f() { for (var i : i32 = 0; i < 8; i=i+1 {} }\n"
- " ^\n");
+ R"(test.wgsl:1:45 error: expected ')' for for loop
+fn f() { for (var i : i32 = 0; i < 8; i=i+1 {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopMissingLBrace) {
EXPECT("fn f() { for (var i : i32 = 0; i < 8; i=i+1) }",
- "test.wgsl:1:46 error: expected '{' for for loop\n"
- "fn f() { for (var i : i32 = 0; i < 8; i=i+1) }\n"
- " ^\n");
+ R"(test.wgsl:1:46 error: expected '{' for for loop
+fn f() { for (var i : i32 = 0; i < 8; i=i+1) }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ForLoopMissingRBrace) {
EXPECT("fn f() { for (var i : i32 = 0; i < 8; i=i+1) {",
- "test.wgsl:1:47 error: expected '}' for for loop\n"
- "fn f() { for (var i : i32 = 0; i < 8; i=i+1) {\n"
- " ^\n");
-}
-
-TEST_F(ParserImplErrorTest, FunctionDeclDecoMissingEnd) {
- EXPECT("[[stage(vertex) fn f() {}",
- "test.wgsl:1:17 error: expected ']]' for decoration list\n"
- "[[stage(vertex) fn f() {}\n"
- " ^^\n");
+ R"(test.wgsl:1:47 error: expected '}' for for loop
+fn f() { for (var i : i32 = 0; i < 8; i=i+1) {
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingLParen) {
- EXPECT("[[stage vertex]] fn f() {}",
- "test.wgsl:1:9 error: expected '(' for stage decoration\n"
- "[[stage vertex]] fn f() {}\n"
- " ^^^^^^\n");
+ EXPECT(
+ "@stage vertex) fn f() {}",
+ R"(test.wgsl:1:8 error: expected '(' for stage decoration
+@stage vertex) fn f() {}
+ ^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingRParen) {
- EXPECT("[[stage(vertex]] fn f() {}",
- "test.wgsl:1:15 error: expected ')' for stage decoration\n"
- "[[stage(vertex]] fn f() {}\n"
- " ^^\n");
+ EXPECT(
+ "@stage(vertex fn f() {}",
+ R"(test.wgsl:1:15 error: expected ')' for stage decoration
+@stage(vertex fn f() {}
+ ^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_FunctionDeclDecoStageMissingLParen) {
+ EXPECT(
+ "[[stage vertex]] fn f() {}",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[stage vertex]] fn f() {}
+^^
+
+test.wgsl:1:9 error: expected '(' for stage decoration
+[[stage vertex]] fn f() {}
+ ^^^^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_FunctionDeclDecoStageMissingRParen) {
+ EXPECT(
+ "[[stage(vertex]] fn f() {}",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[stage(vertex]] fn f() {}
+^^
+
+test.wgsl:1:15 error: expected ')' for stage decoration
+[[stage(vertex]] fn f() {}
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageInvalid) {
- EXPECT("[[stage(x)]] fn f() {}",
- "test.wgsl:1:9 error: invalid value for stage decoration\n"
- "[[stage(x)]] fn f() {}\n"
- " ^\n");
+ EXPECT("@stage(x) fn f() {}",
+ R"(test.wgsl:1:8 error: invalid value for stage decoration
+@stage(x) fn f() {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageTypeInvalid) {
- EXPECT("[[shader(vertex)]] fn main() {}",
- "test.wgsl:1:3 error: expected decoration\n"
- "[[shader(vertex)]] fn main() {}\n"
- " ^^^^^^\n");
+ EXPECT("@shader(vertex) fn main() {}",
+ R"(test.wgsl:1:2 error: expected decoration
+@shader(vertex) fn main() {}
+ ^^^^^^
+
+test.wgsl:1:8 error: unexpected token
+@shader(vertex) fn main() {}
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, FunctionDeclDecoWorkgroupSizeMissingLParen) {
- EXPECT("[[workgroup_size 1]] fn f() {}",
- "test.wgsl:1:18 error: expected '(' for workgroup_size decoration\n"
- "[[workgroup_size 1]] fn f() {}\n"
- " ^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_FunctionDeclDecoWorkgroupSizeMissingLParen) {
+ EXPECT(
+ "[[workgroup_size 1]] fn f() {}",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[workgroup_size 1]] fn f() {}
+^^
+
+test.wgsl:1:18 error: expected '(' for workgroup_size decoration
+[[workgroup_size 1]] fn f() {}
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, FunctionDeclDecoWorkgroupSizeMissingRParen) {
- EXPECT("[[workgroup_size(1]] fn f() {}",
- "test.wgsl:1:19 error: expected ')' for workgroup_size decoration\n"
- "[[workgroup_size(1]] fn f() {}\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_FunctionDeclDecoWorkgroupSizeMissingRParen) {
+ EXPECT(
+ "[[workgroup_size(1]] fn f() {}",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[workgroup_size(1]] fn f() {}
+^^
+
+test.wgsl:1:19 error: expected ')' for workgroup_size decoration
+[[workgroup_size(1]] fn f() {}
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoWorkgroupSizeXInvalid) {
- EXPECT("[[workgroup_size()]] fn f() {}",
- "test.wgsl:1:18 error: expected workgroup_size x parameter\n"
- "[[workgroup_size()]] fn f() {}\n"
- " ^\n");
+ EXPECT("@workgroup_size() fn f() {}",
+ R"(test.wgsl:1:17 error: expected workgroup_size x parameter
+@workgroup_size() fn f() {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoWorkgroupSizeYInvalid) {
- EXPECT("[[workgroup_size(1, )]] fn f() {}",
- "test.wgsl:1:21 error: expected workgroup_size y parameter\n"
- "[[workgroup_size(1, )]] fn f() {}\n"
- " ^\n");
+ EXPECT("@workgroup_size(1, ) fn f() {}",
+ R"(test.wgsl:1:20 error: expected workgroup_size y parameter
+@workgroup_size(1, ) fn f() {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclDecoWorkgroupSizeZInvalid) {
- EXPECT("[[workgroup_size(1, 2, )]] fn f() {}",
- "test.wgsl:1:24 error: expected workgroup_size z parameter\n"
- "[[workgroup_size(1, 2, )]] fn f() {}\n"
- " ^\n");
+ EXPECT("@workgroup_size(1, 2, ) fn f() {}",
+ R"(test.wgsl:1:23 error: expected workgroup_size z parameter
+@workgroup_size(1, 2, ) fn f() {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingIdentifier) {
EXPECT("fn () {}",
- "test.wgsl:1:4 error: expected identifier for function declaration\n"
- "fn () {}\n"
- " ^\n");
+ R"(test.wgsl:1:4 error: expected identifier for function declaration
+fn () {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingLParen) {
EXPECT("fn f) {}",
- "test.wgsl:1:5 error: expected '(' for function declaration\n"
- "fn f) {}\n"
- " ^\n");
+ R"(test.wgsl:1:5 error: expected '(' for function declaration
+fn f) {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingRParen) {
EXPECT("fn f( {}",
- "test.wgsl:1:7 error: expected ')' for function declaration\n"
- "fn f( {}\n"
- " ^\n");
+ R"(test.wgsl:1:7 error: expected ')' for function declaration
+fn f( {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingArrow) {
- EXPECT("fn f() f32 {}",
- "test.wgsl:1:8 error: expected '{'\n"
- "fn f() f32 {}\n"
- " ^^^\n");
+ EXPECT("fn f() f32 {}", R"(test.wgsl:1:8 error: expected '{'
+fn f() f32 {}
+ ^^^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclInvalidReturnType) {
EXPECT("fn f() -> 1 {}",
- "test.wgsl:1:11 error: unable to determine function return type\n"
- "fn f() -> 1 {}\n"
- " ^\n");
+ R"(test.wgsl:1:11 error: unable to determine function return type
+fn f() -> 1 {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclParamMissingColon) {
- EXPECT("fn f(x) {}",
- "test.wgsl:1:7 error: expected ':' for parameter\n"
- "fn f(x) {}\n"
- " ^\n");
+ EXPECT("fn f(x) {}", R"(test.wgsl:1:7 error: expected ':' for parameter
+fn f(x) {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclParamInvalidType) {
- EXPECT("fn f(x : 1) {}",
- "test.wgsl:1:10 error: invalid type for parameter\n"
- "fn f(x : 1) {}\n"
- " ^\n");
+ EXPECT("fn f(x : 1) {}", R"(test.wgsl:1:10 error: invalid type for parameter
+fn f(x : 1) {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclParamMissing) {
EXPECT("fn f(x : i32, ,) {}",
- "test.wgsl:1:15 error: expected ')' for function declaration\n"
- "fn f(x : i32, ,) {}\n"
- " ^\n");
+ R"(test.wgsl:1:15 error: expected ')' for function declaration
+fn f(x : i32, ,) {}
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingLBrace) {
- EXPECT("fn f() }",
- "test.wgsl:1:8 error: expected '{'\n"
- "fn f() }\n"
- " ^\n");
+ EXPECT("fn f() }", R"(test.wgsl:1:8 error: expected '{'
+fn f() }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionDeclMissingRBrace) {
- EXPECT("fn f() {",
- "test.wgsl:1:9 error: expected '}'\n"
- "fn f() {\n"
- " ^\n");
+ EXPECT("fn f() {", R"(test.wgsl:1:9 error: expected '}'
+fn f() {
+ ^
+)");
}
TEST_F(ParserImplErrorTest, FunctionScopeUnusedDecl) {
- EXPECT("fn f(a:i32)->i32{return a;[[size(1)]]}",
- "test.wgsl:1:29 error: unexpected decorations\n"
- "fn f(a:i32)->i32{return a;[[size(1)]]}\n"
- " ^^^^\n");
+ EXPECT("fn f(a:i32)->i32{return a;@size(1)}",
+ R"(test.wgsl:1:28 error: unexpected decorations
+fn f(a:i32)->i32{return a;@size(1)}
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, FunctionMissingOpenLine) {
@@ -427,64 +531,72 @@
var a : f32 = bar[0];
return;
})",
- "test.wgsl:2:17 error: unable to parse const_expr\n"
- " var a : f32 = bar[0];\n"
- " ^^^\n"
- "\n"
- "test.wgsl:3:3 error: statement found outside of function body\n"
- " return;\n"
- " ^^^^^^\n");
+ R"(test.wgsl:2:17 error: unable to parse const_expr
+ var a : f32 = bar[0];
+ ^^^
+
+test.wgsl:3:3 error: statement found outside of function body
+ return;
+ ^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstInvalidIdentifier) {
EXPECT("let ^ : i32 = 1;",
- "test.wgsl:1:5 error: expected identifier for let declaration\n"
- "let ^ : i32 = 1;\n"
- " ^\n");
+ R"(test.wgsl:1:5 error: expected identifier for let declaration
+let ^ : i32 = 1;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstMissingSemicolon) {
EXPECT("let i : i32 = 1",
- "test.wgsl:1:16 error: expected ';' for let declaration\n"
- "let i : i32 = 1\n"
- " ^\n");
+ R"(test.wgsl:1:16 error: expected ';' for let declaration
+let i : i32 = 1
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstMissingLParen) {
EXPECT("let i : vec2<i32> = vec2<i32>;",
- "test.wgsl:1:30 error: expected '(' for type constructor\n"
- "let i : vec2<i32> = vec2<i32>;\n"
- " ^\n");
+ R"(test.wgsl:1:30 error: expected '(' for type constructor
+let i : vec2<i32> = vec2<i32>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstMissingRParen) {
EXPECT("let i : vec2<i32> = vec2<i32>(1., 2.;",
- "test.wgsl:1:37 error: expected ')' for type constructor\n"
- "let i : vec2<i32> = vec2<i32>(1., 2.;\n"
- " ^\n");
+ R"(test.wgsl:1:37 error: expected ')' for type constructor
+let i : vec2<i32> = vec2<i32>(1., 2.;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstBadConstLiteral) {
EXPECT("let i : vec2<i32> = vec2<i32>(!);",
- "test.wgsl:1:31 error: unable to parse const_expr\n"
- "let i : vec2<i32> = vec2<i32>(!);\n"
- " ^\n");
+ R"(test.wgsl:1:31 error: unable to parse const_expr
+let i : vec2<i32> = vec2<i32>(!);
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstBadConstLiteralSpaceLessThan) {
EXPECT("let i = 1 < 2;",
- "test.wgsl:1:11 error: expected \';\' for let declaration\n"
- "let i = 1 < 2;\n"
- " ^\n");
+ R"(test.wgsl:1:11 error: expected ';' for let declaration
+let i = 1 < 2;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstNotConstExpr) {
EXPECT(
"let a = 1;\n"
"let b = a;",
- "test.wgsl:2:9 error: unable to parse const_expr\n"
- "let b = a;\n"
- " ^\n");
+ R"(test.wgsl:2:9 error: unable to parse const_expr
+let b = a;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) {
@@ -516,767 +628,1080 @@
TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingLParen) {
EXPECT("let i : vec2<i32> = vec2<i32> 1, 2);",
- "test.wgsl:1:31 error: expected '(' for type constructor\n"
- "let i : vec2<i32> = vec2<i32> 1, 2);\n"
- " ^\n");
+ R"(test.wgsl:1:31 error: expected '(' for type constructor
+let i : vec2<i32> = vec2<i32> 1, 2);
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingRParen) {
EXPECT("let i : vec2<i32> = vec2<i32>(1, 2;",
- "test.wgsl:1:35 error: expected ')' for type constructor\n"
- "let i : vec2<i32> = vec2<i32>(1, 2;\n"
- " ^\n");
+ R"(test.wgsl:1:35 error: expected ')' for type constructor
+let i : vec2<i32> = vec2<i32>(1, 2;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclInvalidDeco) {
- EXPECT("[[stage(vertex)]] x;",
- "test.wgsl:1:19 error: expected declaration after decorations\n"
- "[[stage(vertex)]] x;\n"
- " ^\n");
+ EXPECT("@stage(vertex) x;",
+ R"(test.wgsl:1:16 error: expected declaration after decorations
+@stage(vertex) x;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingLessThan) {
EXPECT("var x : texture_1d;",
- "test.wgsl:1:19 error: expected '<' for sampled texture type\n"
- "var x : texture_1d;\n"
- " ^\n");
+ R"(test.wgsl:1:19 error: expected '<' for sampled texture type
+var x : texture_1d;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingGreaterThan) {
EXPECT("var x : texture_1d<f32;",
- "test.wgsl:1:23 error: expected '>' for sampled texture type\n"
- "var x : texture_1d<f32;\n"
- " ^\n");
+ R"(test.wgsl:1:23 error: expected '>' for sampled texture type
+var x : texture_1d<f32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureInvalidSubtype) {
EXPECT("var x : texture_1d<1>;",
- "test.wgsl:1:20 error: invalid type for sampled texture type\n"
- "var x : texture_1d<1>;\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: invalid type for sampled texture type
+var x : texture_1d<1>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclMultisampledTextureMissingLessThan) {
EXPECT("var x : texture_multisampled_2d;",
- "test.wgsl:1:32 error: expected '<' for multisampled texture type\n"
- "var x : texture_multisampled_2d;\n"
- " ^\n");
+ R"(test.wgsl:1:32 error: expected '<' for multisampled texture type
+var x : texture_multisampled_2d;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclMultisampledTextureMissingGreaterThan) {
EXPECT("var x : texture_multisampled_2d<f32;",
- "test.wgsl:1:36 error: expected '>' for multisampled texture type\n"
- "var x : texture_multisampled_2d<f32;\n"
- " ^\n");
+ R"(test.wgsl:1:36 error: expected '>' for multisampled texture type
+var x : texture_multisampled_2d<f32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclMultisampledTextureInvalidSubtype) {
EXPECT("var x : texture_multisampled_2d<1>;",
- "test.wgsl:1:33 error: invalid type for multisampled texture type\n"
- "var x : texture_multisampled_2d<1>;\n"
- " ^\n");
+ R"(test.wgsl:1:33 error: invalid type for multisampled texture type
+var x : texture_multisampled_2d<1>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan) {
EXPECT("var x : texture_storage_2d;",
- "test.wgsl:1:27 error: expected '<' for storage texture type\n"
- "var x : texture_storage_2d;\n"
- " ^\n");
+ R"(test.wgsl:1:27 error: expected '<' for storage texture type
+var x : texture_storage_2d;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingGreaterThan) {
EXPECT("var x : texture_storage_2d<r32uint, read;",
- "test.wgsl:1:41 error: expected '>' for storage texture type\n"
- "var x : texture_storage_2d<r32uint, read;\n"
- " ^\n");
+ R"(test.wgsl:1:41 error: expected '>' for storage texture type
+var x : texture_storage_2d<r32uint, read;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingSubtype) {
EXPECT("var x : texture_storage_2d<>;",
- "test.wgsl:1:28 error: invalid format for storage texture type\n"
- "var x : texture_storage_2d<>;\n"
- " ^\n");
+ R"(test.wgsl:1:28 error: invalid format for storage texture type
+var x : texture_storage_2d<>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingInvalidSubtype) {
EXPECT("var x : texture_storage_2d<1>;",
- "test.wgsl:1:28 error: invalid format for storage texture type\n"
- "var x : texture_storage_2d<1>;\n"
- " ^\n");
+ R"(test.wgsl:1:28 error: invalid format for storage texture type
+var x : texture_storage_2d<1>;
+ ^
+)");
}
// TODO(crbug.com/tint/1324): DEPRECATED: Remove when [[block]] is removed.
-TEST_F(ParserImplErrorTest, GlobalDeclStructDecoMissingStruct) {
- EXPECT("[[block]];",
- "test.wgsl:1:3 warning: use of deprecated language feature: [[block]] "
- "attributes have been removed from WGSL\n"
- "[[block]];\n"
- " ^^^^^\n\n"
- "test.wgsl:1:10 error: expected declaration after decorations\n"
- "[[block]];\n"
- " ^\n");
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclStructDecoMissingStruct) {
+ EXPECT(
+ "[[block]];",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[block]];
+^^
+
+test.wgsl:1:3 warning: use of deprecated language feature: [[block]] attributes have been removed from WGSL
+[[block]];
+ ^^^^^
+
+test.wgsl:1:10 error: expected declaration after decorations
+[[block]];
+ ^
+)");
}
// TODO(crbug.com/tint/1324): DEPRECATED: Remove when [[block]] is removed.
-TEST_F(ParserImplErrorTest, GlobalDeclStructDecoMissingEnd) {
- EXPECT("[[block struct {};",
- "test.wgsl:1:3 warning: use of deprecated language feature: [[block]] "
- "attributes have been removed from WGSL\n"
- "[[block struct {};\n"
- " ^^^^^\n\n"
- "test.wgsl:1:9 error: expected ']]' for decoration list\n"
- "[[block struct {};\n"
- " ^^^^^^\n");
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclStructDecoMissingEnd) {
+ EXPECT(
+ "[[block struct {};",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[block struct {};
+^^
+
+test.wgsl:1:3 warning: use of deprecated language feature: [[block]] attributes have been removed from WGSL
+[[block struct {};
+ ^^^^^
+
+test.wgsl:1:9 error: expected ']]' for decoration list
+[[block struct {};
+ ^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingIdentifier) {
EXPECT("struct {};",
- "test.wgsl:1:8 error: expected identifier for struct declaration\n"
- "struct {};\n"
- " ^\n");
+ R"(test.wgsl:1:8 error: expected identifier for struct declaration
+struct {};
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingLBrace) {
EXPECT("struct S };",
- "test.wgsl:1:10 error: expected '{' for struct declaration\n"
- "struct S };\n"
- " ^\n");
+ R"(test.wgsl:1:10 error: expected '{' for struct declaration
+struct S };
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingRBrace) {
EXPECT("struct S { i : i32;",
- "test.wgsl:1:20 error: expected '}' for struct declaration\n"
- "struct S { i : i32;\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected '}' for struct declaration
+struct S { i : i32;
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberDecoEmpty) {
- EXPECT("struct S { [[]] i : i32; };",
- "test.wgsl:1:14 error: empty decoration list\n"
- "struct S { [[]] i : i32; };\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclStructMemberDecoEmpty) {
+ EXPECT(
+ "struct S { [[]] i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[]] i : i32; };
+ ^^
+
+test.wgsl:1:14 error: empty decoration list
+struct S { [[]] i : i32; };
+ ^^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberDecoMissingEnd) {
- EXPECT("struct S { [[ i : i32; };",
- "test.wgsl:1:15 error: expected decoration\n"
- "struct S { [[ i : i32; };\n"
- " ^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclStructMemberDecoMissingEnd) {
+ EXPECT(
+ "struct S { [[ i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[ i : i32; };
+ ^^
+
+test.wgsl:1:15 error: expected decoration
+struct S { [[ i : i32; };
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberInvalidIdentifier) {
EXPECT("struct S { 1 : i32; };",
- "test.wgsl:1:12 error: expected identifier for struct member\n"
- "struct S { 1 : i32; };\n"
- " ^\n");
+ R"(test.wgsl:1:12 error: expected identifier for struct member
+struct S { 1 : i32; };
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberMissingSemicolon) {
EXPECT("struct S { i : i32 };",
- "test.wgsl:1:20 error: expected ';' for struct member\n"
- "struct S { i : i32 };\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected ';' for struct member
+struct S { i : i32 };
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignMissingLParen) {
- EXPECT("struct S { [[align 1)]] i : i32; };",
- "test.wgsl:1:20 error: expected '(' for align decoration\n"
- "struct S { [[align 1)]] i : i32; };\n"
- " ^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclStructMemberAlignMissingLParen) {
+ EXPECT(
+ "struct S { [[align 1)]] i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[align 1)]] i : i32; };
+ ^^
+
+test.wgsl:1:20 error: expected '(' for align decoration
+struct S { [[align 1)]] i : i32; };
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignMissingRParen) {
- EXPECT("struct S { [[align(1]] i : i32; };",
- "test.wgsl:1:21 error: expected ')' for align decoration\n"
- "struct S { [[align(1]] i : i32; };\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclStructMemberAlignMissingRParen) {
+ EXPECT(
+ "struct S { [[align(1]] i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[align(1]] i : i32; };
+ ^^
+
+test.wgsl:1:21 error: expected ')' for align decoration
+struct S { [[align(1]] i : i32; };
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignInvaldValue) {
- EXPECT("struct S { [[align(x)]] i : i32; };",
- "test.wgsl:1:20 error: expected signed integer literal for align "
- "decoration\n"
- "struct S { [[align(x)]] i : i32; };\n"
- " ^\n");
+ EXPECT(
+ "struct S { @align(x) i : i32; };",
+ R"(test.wgsl:1:19 error: expected signed integer literal for align decoration
+struct S { @align(x) i : i32; };
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberAlignNegativeValue) {
- EXPECT("struct S { [[align(-2)]] i : i32; };",
- "test.wgsl:1:20 error: align decoration must be positive\n"
- "struct S { [[align(-2)]] i : i32; };\n"
- " ^^\n");
+ EXPECT("struct S { @align(-2) i : i32; };",
+ R"(test.wgsl:1:19 error: align decoration must be positive
+struct S { @align(-2) i : i32; };
+ ^^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeMissingLParen) {
- EXPECT("struct S { [[size 1)]] i : i32; };",
- "test.wgsl:1:19 error: expected '(' for size decoration\n"
- "struct S { [[size 1)]] i : i32; };\n"
- " ^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclStructMemberSizeMissingLParen) {
+ EXPECT(
+ "struct S { [[size 1)]] i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[size 1)]] i : i32; };
+ ^^
+
+test.wgsl:1:19 error: expected '(' for size decoration
+struct S { [[size 1)]] i : i32; };
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeMissingRParen) {
- EXPECT("struct S { [[size(1]] i : i32; };",
- "test.wgsl:1:20 error: expected ')' for size decoration\n"
- "struct S { [[size(1]] i : i32; };\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclStructMemberSizeMissingRParen) {
+ EXPECT(
+ "struct S { [[size(1]] i : i32; };",
+ R"(test.wgsl:1:12 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+struct S { [[size(1]] i : i32; };
+ ^^
+
+test.wgsl:1:20 error: expected ')' for size decoration
+struct S { [[size(1]] i : i32; };
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeInvaldValue) {
- EXPECT("struct S { [[size(x)]] i : i32; };",
- "test.wgsl:1:19 error: expected signed integer literal for size "
- "decoration\n"
- "struct S { [[size(x)]] i : i32; };\n"
- " ^\n");
+ EXPECT(
+ "struct S { @size(x) i : i32; };",
+ R"(test.wgsl:1:18 error: expected signed integer literal for size decoration
+struct S { @size(x) i : i32; };
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructMemberSizeNegativeValue) {
- EXPECT("struct S { [[size(-2)]] i : i32; };",
- "test.wgsl:1:19 error: size decoration must be positive\n"
- "struct S { [[size(-2)]] i : i32; };\n"
- " ^^\n");
+ EXPECT("struct S { @size(-2) i : i32; };",
+ R"(test.wgsl:1:18 error: size decoration must be positive
+struct S { @size(-2) i : i32; };
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclTypeAliasMissingIdentifier) {
EXPECT("type 1 = f32;",
- "test.wgsl:1:6 error: expected identifier for type alias\n"
- "type 1 = f32;\n"
- " ^\n");
+ R"(test.wgsl:1:6 error: expected identifier for type alias
+type 1 = f32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclTypeAliasInvalidType) {
- EXPECT("type meow = 1;",
- "test.wgsl:1:13 error: invalid type alias\n"
- "type meow = 1;\n"
- " ^\n");
+ EXPECT("type meow = 1;", R"(test.wgsl:1:13 error: invalid type alias
+type meow = 1;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclTypeAliasMissingAssignment) {
- EXPECT("type meow f32",
- "test.wgsl:1:11 error: expected '=' for type alias\n"
- "type meow f32\n"
- " ^^^\n");
+ EXPECT("type meow f32", R"(test.wgsl:1:11 error: expected '=' for type alias
+type meow f32
+ ^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclTypeAliasMissingSemicolon) {
- EXPECT("type meow = f32",
- "test.wgsl:1:16 error: expected ';' for type alias\n"
- "type meow = f32\n"
- " ^\n");
+ EXPECT("type meow = f32", R"(test.wgsl:1:16 error: expected ';' for type alias
+type meow = f32
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclTypeDecoInvalid) {
- EXPECT("var x : [[]] i32;",
- "test.wgsl:1:11 error: empty decoration list\n"
- "var x : [[]] i32;\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclTypeDecoInvalid) {
+ EXPECT(
+ "var x : [[]] i32;",
+ R"(test.wgsl:1:9 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+var x : [[]] i32;
+ ^^
+
+test.wgsl:1:11 error: empty decoration list
+var x : [[]] i32;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingLessThan) {
EXPECT("var i : array;",
- "test.wgsl:1:14 error: expected '<' for array declaration\n"
- "var i : array;\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: expected '<' for array declaration
+var i : array;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingGreaterThan) {
EXPECT("var i : array<u32, 3;",
- "test.wgsl:1:21 error: expected '>' for array declaration\n"
- "var i : array<u32, 3;\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: expected '>' for array declaration
+var i : array<u32, 3;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoNotArray) {
- EXPECT("var i : [[stride(1)]] i32;",
- "test.wgsl:1:11 error: unexpected decorations\n"
- "var i : [[stride(1)]] i32;\n"
- " ^^^^^^\n");
+ EXPECT("var i : @stride(1) i32;",
+ R"(test.wgsl:1:10 error: unexpected decorations
+var i : @stride(1) i32;
+ ^^^^^^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoMissingEnd) {
- EXPECT("var i : [[stride(1) array<i32>;",
- "test.wgsl:1:21 error: expected ']]' for decoration list\n"
- "var i : [[stride(1) array<i32>;\n"
- " ^^^^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarArrayDecoMissingEnd) {
+ EXPECT(
+ "var i : [[stride(1) array<i32>;",
+ R"(test.wgsl:1:9 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+var i : [[stride(1) array<i32>;
+ ^^
+
+test.wgsl:1:21 error: expected ']]' for decoration list
+var i : [[stride(1) array<i32>;
+ ^^^^^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoStrideMissingLParen) {
- EXPECT("var i : [[stride 1)]] array<i32>;",
- "test.wgsl:1:18 error: expected '(' for stride decoration\n"
- "var i : [[stride 1)]] array<i32>;\n"
- " ^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclVarArrayDecoStrideMissingLParen) {
+ EXPECT(
+ "var i : [[stride 1)]] array<i32>;",
+ R"(test.wgsl:1:9 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+var i : [[stride 1)]] array<i32>;
+ ^^
+
+test.wgsl:1:18 error: expected '(' for stride decoration
+var i : [[stride 1)]] array<i32>;
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoStrideMissingRParen) {
- EXPECT("var i : [[stride(1]] array<i32>;",
- "test.wgsl:1:19 error: expected ')' for stride decoration\n"
- "var i : [[stride(1]] array<i32>;\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest,
+ DEPRECATED_GlobalDeclVarArrayDecoStrideMissingRParen) {
+ EXPECT(
+ "var i : [[stride(1]] array<i32>;",
+ R"(test.wgsl:1:9 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+var i : [[stride(1]] array<i32>;
+ ^^
+
+test.wgsl:1:19 error: expected ')' for stride decoration
+var i : [[stride(1]] array<i32>;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoStrideInvalid) {
- EXPECT("var i : [[stride(x)]] array<i32>;",
- "test.wgsl:1:18 error: expected signed integer literal for stride "
- "decoration\n"
- "var i : [[stride(x)]] array<i32>;\n"
- " ^\n");
+ EXPECT(
+ "var i : @stride(x) array<i32>;",
+ R"(test.wgsl:1:17 error: expected signed integer literal for stride decoration
+var i : @stride(x) array<i32>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayDecoStrideNegative) {
- EXPECT("var i : [[stride(-1)]] array<i32>;",
- "test.wgsl:1:18 error: stride decoration must be greater than 0\n"
- "var i : [[stride(-1)]] array<i32>;\n"
- " ^^\n");
+ EXPECT("var i : @stride(-1) array<i32>;",
+ R"(test.wgsl:1:17 error: stride decoration must be greater than 0
+var i : @stride(-1) array<i32>;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingType) {
EXPECT("var i : array<1, 3>;",
- "test.wgsl:1:15 error: invalid type for array declaration\n"
- "var i : array<1, 3>;\n"
- " ^\n");
+ R"(test.wgsl:1:15 error: invalid type for array declaration
+var i : array<1, 3>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingSize) {
EXPECT("var i : array<u32, >;",
- "test.wgsl:1:20 error: expected array size expression\n"
- "var i : array<u32, >;\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected array size expression
+var i : array<u32, >;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarArrayInvalidSize) {
EXPECT("var i : array<u32, !>;",
- "test.wgsl:1:20 error: expected array size expression\n"
- "var i : array<u32, !>;\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected array size expression
+var i : array<u32, !>;
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarDecoListEmpty) {
- EXPECT("[[]] var i : i32;",
- "test.wgsl:1:3 error: empty decoration list\n"
- "[[]] var i : i32;\n"
- " ^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoListEmpty) {
+ EXPECT(
+ "[[]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[]] var i : i32;
+^^
+
+test.wgsl:1:3 error: empty decoration list
+[[]] var i : i32;
+ ^^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarDecoListInvalid) {
- EXPECT("[[location(1), meow]] var i : i32;",
- "test.wgsl:1:16 error: expected decoration\n"
- "[[location(1), meow]] var i : i32;\n"
- " ^^^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoListInvalid) {
+ EXPECT(
+ "[[location(1), meow]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[location(1), meow]] var i : i32;
+^^
+
+test.wgsl:1:16 error: expected decoration
+[[location(1), meow]] var i : i32;
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoListMissingComma) {
- EXPECT("[[location(1) group(2)]] var i : i32;",
- "test.wgsl:1:15 error: expected ',' for decoration list\n"
- "[[location(1) group(2)]] var i : i32;\n"
- " ^^^^^\n");
+ EXPECT("@location(1) group(2) var i : i32;",
+ R"(test.wgsl:1:14 error: expected declaration after decorations
+@location(1) group(2) var i : i32;
+ ^^^^^
+
+test.wgsl:1:19 error: unexpected token
+@location(1) group(2) var i : i32;
+ ^
+)");
}
-TEST_F(ParserImplErrorTest, GlobalDeclVarDecoListMissingEnd) {
- EXPECT("[[location(1) meow]] var i : i32;",
- "test.wgsl:1:15 error: expected ']]' for decoration list\n"
- "[[location(1) meow]] var i : i32;\n"
- " ^^^^\n");
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoListMissingEnd) {
+ EXPECT(
+ "[[location(1) meow]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[location(1) meow]] var i : i32;
+^^
+
+test.wgsl:1:15 error: expected ']]' for decoration list
+[[location(1) meow]] var i : i32;
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingLParen) {
- EXPECT("[[location 1]] var i : i32;",
- "test.wgsl:1:12 error: expected '(' for location decoration\n"
- "[[location 1]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@location 1) var i : i32;",
+ R"(test.wgsl:1:11 error: expected '(' for location decoration
+@location 1) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingRParen) {
- EXPECT("[[location (1]] var i : i32;",
- "test.wgsl:1:14 error: expected ')' for location decoration\n"
- "[[location (1]] var i : i32;\n"
- " ^^\n");
+ EXPECT(
+ "@location (1 var i : i32;",
+ R"(test.wgsl:1:14 error: expected ')' for location decoration
+@location (1 var i : i32;
+ ^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoLocationMissingLParen) {
+ EXPECT(
+ "[[location 1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[location 1]] var i : i32;
+^^
+
+test.wgsl:1:12 error: expected '(' for location decoration
+[[location 1]] var i : i32;
+ ^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoLocationMissingRParen) {
+ EXPECT(
+ "[[location (1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[location (1]] var i : i32;
+^^
+
+test.wgsl:1:14 error: expected ')' for location decoration
+[[location (1]] var i : i32;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationInvalidValue) {
- EXPECT("[[location(x)]] var i : i32;",
- "test.wgsl:1:12 error: expected signed integer literal for location "
- "decoration\n"
- "[[location(x)]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@location(x) var i : i32;",
+ R"(test.wgsl:1:11 error: expected signed integer literal for location decoration
+@location(x) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingLParen) {
- EXPECT("[[builtin position]] var i : i32;",
- "test.wgsl:1:11 error: expected '(' for builtin decoration\n"
- "[[builtin position]] var i : i32;\n"
- " ^^^^^^^^\n");
+ EXPECT(
+ "@builtin position) var i : i32;",
+ R"(test.wgsl:1:10 error: expected '(' for builtin decoration
+@builtin position) var i : i32;
+ ^^^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingRParen) {
- EXPECT("[[builtin(position]] var i : i32;",
- "test.wgsl:1:19 error: expected ')' for builtin decoration\n"
- "[[builtin(position]] var i : i32;\n"
- " ^^\n");
+ EXPECT(
+ "@builtin(position var i : i32;",
+ R"(test.wgsl:1:19 error: expected ')' for builtin decoration
+@builtin(position var i : i32;
+ ^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoBuiltinMissingLParen) {
+ EXPECT(
+ "[[builtin position]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[builtin position]] var i : i32;
+^^
+
+test.wgsl:1:11 error: expected '(' for builtin decoration
+[[builtin position]] var i : i32;
+ ^^^^^^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoBuiltinMissingRParen) {
+ EXPECT(
+ "[[builtin(position]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[builtin(position]] var i : i32;
+^^
+
+test.wgsl:1:19 error: expected ')' for builtin decoration
+[[builtin(position]] var i : i32;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinInvalidIdentifer) {
- EXPECT("[[builtin(1)]] var i : i32;",
- "test.wgsl:1:11 error: expected identifier for builtin\n"
- "[[builtin(1)]] var i : i32;\n"
- " ^\n");
+ EXPECT("@builtin(1) var i : i32;",
+ R"(test.wgsl:1:10 error: expected identifier for builtin
+@builtin(1) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinInvalidValue) {
- EXPECT("[[builtin(x)]] var i : i32;",
- "test.wgsl:1:11 error: invalid value for builtin decoration\n"
- "[[builtin(x)]] var i : i32;\n"
- " ^\n");
+ EXPECT("@builtin(x) var i : i32;",
+ R"(test.wgsl:1:10 error: invalid value for builtin decoration
+@builtin(x) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingLParen) {
- EXPECT("[[binding 1]] var i : i32;",
- "test.wgsl:1:11 error: expected '(' for binding decoration\n"
- "[[binding 1]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@binding 1) var i : i32;",
+ R"(test.wgsl:1:10 error: expected '(' for binding decoration
+@binding 1) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingRParen) {
- EXPECT("[[binding(1]] var i : i32;",
- "test.wgsl:1:12 error: expected ')' for binding decoration\n"
- "[[binding(1]] var i : i32;\n"
- " ^^\n");
+ EXPECT(
+ "@binding(1 var i : i32;",
+ R"(test.wgsl:1:12 error: expected ')' for binding decoration
+@binding(1 var i : i32;
+ ^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoBindingMissingLParen) {
+ EXPECT(
+ "[[binding 1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[binding 1]] var i : i32;
+^^
+
+test.wgsl:1:11 error: expected '(' for binding decoration
+[[binding 1]] var i : i32;
+ ^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoBindingMissingRParen) {
+ EXPECT(
+ "[[binding(1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[binding(1]] var i : i32;
+^^
+
+test.wgsl:1:12 error: expected ')' for binding decoration
+[[binding(1]] var i : i32;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingInvalidValue) {
- EXPECT("[[binding(x)]] var i : i32;",
- "test.wgsl:1:11 error: expected signed integer literal for binding "
- "decoration\n"
- "[[binding(x)]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@binding(x) var i : i32;",
+ R"(test.wgsl:1:10 error: expected signed integer literal for binding decoration
+@binding(x) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingLParen) {
- EXPECT("[[group 1]] var i : i32;",
- "test.wgsl:1:9 error: expected '(' for group decoration\n"
- "[[group 1]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@group 1) var i : i32;",
+ R"(test.wgsl:1:8 error: expected '(' for group decoration
+@group 1) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingRParen) {
- EXPECT("[[group(1]] var i : i32;",
- "test.wgsl:1:10 error: expected ')' for group decoration\n"
- "[[group(1]] var i : i32;\n"
- " ^^\n");
+ EXPECT(
+ "@group(1 var i : i32;",
+ R"(test.wgsl:1:10 error: expected ')' for group decoration
+@group(1 var i : i32;
+ ^^^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoGroupMissingLParen) {
+ EXPECT(
+ "[[group 1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[group 1]] var i : i32;
+^^
+
+test.wgsl:1:9 error: expected '(' for group decoration
+[[group 1]] var i : i32;
+ ^
+)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplErrorTest, DEPRECATED_GlobalDeclVarDecoGroupMissingRParen) {
+ EXPECT(
+ "[[group(1]] var i : i32;",
+ R"(test.wgsl:1:1 warning: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+[[group(1]] var i : i32;
+^^
+
+test.wgsl:1:10 error: expected ')' for group decoration
+[[group(1]] var i : i32;
+ ^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingGroupValue) {
- EXPECT("[[group(x)]] var i : i32;",
- "test.wgsl:1:9 error: expected signed integer literal for group "
- "decoration\n"
- "[[group(x)]] var i : i32;\n"
- " ^\n");
+ EXPECT(
+ "@group(x) var i : i32;",
+ R"(test.wgsl:1:8 error: expected signed integer literal for group decoration
+@group(x) var i : i32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarInvalidIdentifier) {
EXPECT("var ^ : mat4x4;",
- "test.wgsl:1:5 error: expected identifier for variable declaration\n"
- "var ^ : mat4x4;\n"
- " ^\n");
+ R"(test.wgsl:1:5 error: expected identifier for variable declaration
+var ^ : mat4x4;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarMatrixMissingGreaterThan) {
- EXPECT("var i : mat4x4<u32;",
- "test.wgsl:1:19 error: expected '>' for matrix\n"
- "var i : mat4x4<u32;\n"
- " ^\n");
+ EXPECT("var i : mat4x4<u32;", R"(test.wgsl:1:19 error: expected '>' for matrix
+var i : mat4x4<u32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarMatrixMissingType) {
- EXPECT("var i : mat4x4<1>;",
- "test.wgsl:1:16 error: invalid type for matrix\n"
- "var i : mat4x4<1>;\n"
- " ^\n");
+ EXPECT("var i : mat4x4<1>;", R"(test.wgsl:1:16 error: invalid type for matrix
+var i : mat4x4<1>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarMissingSemicolon) {
EXPECT("var i : i32",
- "test.wgsl:1:12 error: expected ';' for variable declaration\n"
- "var i : i32\n"
- " ^\n");
+ R"(test.wgsl:1:12 error: expected ';' for variable declaration
+var i : i32
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingLessThan) {
EXPECT("var i : ptr;",
- "test.wgsl:1:12 error: expected '<' for ptr declaration\n"
- "var i : ptr;\n"
- " ^\n");
+ R"(test.wgsl:1:12 error: expected '<' for ptr declaration
+var i : ptr;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingGreaterThan) {
EXPECT("var i : ptr<private, u32;",
- "test.wgsl:1:25 error: expected '>' for ptr declaration\n"
- "var i : ptr<private, u32;\n"
- " ^\n");
+ R"(test.wgsl:1:25 error: expected '>' for ptr declaration
+var i : ptr<private, u32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingComma) {
EXPECT("var i : ptr<private u32>;",
- "test.wgsl:1:21 error: expected ',' for ptr declaration\n"
- "var i : ptr<private u32>;\n"
- " ^^^\n");
+ R"(test.wgsl:1:21 error: expected ',' for ptr declaration
+var i : ptr<private u32>;
+ ^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingStorageClass) {
EXPECT("var i : ptr<meow, u32>;",
- "test.wgsl:1:13 error: invalid storage class for ptr declaration\n"
- "var i : ptr<meow, u32>;\n"
- " ^^^^\n");
+ R"(test.wgsl:1:13 error: invalid storage class for ptr declaration
+var i : ptr<meow, u32>;
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingType) {
EXPECT("var i : ptr<private, 1>;",
- "test.wgsl:1:22 error: invalid type for ptr declaration\n"
- "var i : ptr<private, 1>;\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: invalid type for ptr declaration
+var i : ptr<private, 1>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarAtomicMissingLessThan) {
EXPECT("var i : atomic;",
- "test.wgsl:1:15 error: expected '<' for atomic declaration\n"
- "var i : atomic;\n"
- " ^\n");
+ R"(test.wgsl:1:15 error: expected '<' for atomic declaration
+var i : atomic;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarAtomicMissingGreaterThan) {
EXPECT("var i : atomic<u32 x;",
- "test.wgsl:1:20 error: expected '>' for atomic declaration\n"
- "var i : atomic<u32 x;\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected '>' for atomic declaration
+var i : atomic<u32 x;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarStorageDeclInvalidClass) {
EXPECT("var<fish> i : i32",
- "test.wgsl:1:5 error: invalid storage class for variable declaration\n"
- "var<fish> i : i32\n"
- " ^^^^\n");
+ R"(test.wgsl:1:5 error: invalid storage class for variable declaration
+var<fish> i : i32
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarStorageDeclMissingGThan) {
EXPECT("var<private i : i32",
- "test.wgsl:1:13 error: expected '>' for variable declaration\n"
- "var<private i : i32\n"
- " ^\n");
+ R"(test.wgsl:1:13 error: expected '>' for variable declaration
+var<private i : i32
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarVectorMissingGreaterThan) {
- EXPECT("var i : vec3<u32;",
- "test.wgsl:1:17 error: expected '>' for vector\n"
- "var i : vec3<u32;\n"
- " ^\n");
+ EXPECT("var i : vec3<u32;", R"(test.wgsl:1:17 error: expected '>' for vector
+var i : vec3<u32;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, GlobalDeclVarVectorMissingType) {
- EXPECT("var i : vec3<1>;",
- "test.wgsl:1:14 error: invalid type for vector\n"
- "var i : vec3<1>;\n"
- " ^\n");
+ EXPECT("var i : vec3<1>;", R"(test.wgsl:1:14 error: invalid type for vector
+var i : vec3<1>;
+ ^
+)");
}
TEST_F(ParserImplErrorTest, IfStmtMissingLParen) {
- EXPECT("fn f() { if true) {} }",
- "test.wgsl:1:13 error: expected '('\n"
- "fn f() { if true) {} }\n"
- " ^^^^\n");
+ EXPECT("fn f() { if true) {} }", R"(test.wgsl:1:13 error: expected '('
+fn f() { if true) {} }
+ ^^^^
+)");
}
TEST_F(ParserImplErrorTest, IfStmtMissingRParen) {
- EXPECT("fn f() { if (true {} }",
- "test.wgsl:1:19 error: expected ')'\n"
- "fn f() { if (true {} }\n"
- " ^\n");
+ EXPECT("fn f() { if (true {} }", R"(test.wgsl:1:19 error: expected ')'
+fn f() { if (true {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, IfStmtInvalidCond) {
EXPECT("fn f() { if (>) {} }",
- "test.wgsl:1:14 error: unable to parse expression\n"
- "fn f() { if (>) {} }\n"
- " ^\n");
+ R"(test.wgsl:1:14 error: unable to parse expression
+fn f() { if (>) {} }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, LogicalAndInvalidExpr) {
EXPECT("fn f() { return 1 && >; }",
- "test.wgsl:1:22 error: unable to parse right side of && expression\n"
- "fn f() { return 1 && >; }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: unable to parse right side of && expression
+fn f() { return 1 && >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, LogicalOrInvalidExpr) {
EXPECT("fn f() { return 1 || >; }",
- "test.wgsl:1:22 error: unable to parse right side of || expression\n"
- "fn f() { return 1 || >; }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: unable to parse right side of || expression
+fn f() { return 1 || >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, LoopMissingLBrace) {
- EXPECT("fn f() { loop }",
- "test.wgsl:1:15 error: expected '{' for loop\n"
- "fn f() { loop }\n"
- " ^\n");
+ EXPECT("fn f() { loop }", R"(test.wgsl:1:15 error: expected '{' for loop
+fn f() { loop }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, LoopMissingRBrace) {
- EXPECT("fn f() { loop {",
- "test.wgsl:1:16 error: expected '}' for loop\n"
- "fn f() { loop {\n"
- " ^\n");
+ EXPECT("fn f() { loop {", R"(test.wgsl:1:16 error: expected '}' for loop
+fn f() { loop {
+ ^
+)");
}
TEST_F(ParserImplErrorTest, MaxErrorsReached) {
- EXPECT("x; x; x; x; x; x; x; x;",
- "test.wgsl:1:1 error: unexpected token\n"
- "x; x; x; x; x; x; x; x;\n"
- "^\n\n"
- "test.wgsl:1:4 error: unexpected token\n"
- "x; x; x; x; x; x; x; x;\n"
- " ^\n\n"
- "test.wgsl:1:7 error: unexpected token\n"
- "x; x; x; x; x; x; x; x;\n"
- " ^\n\n"
- "test.wgsl:1:10 error: unexpected token\n"
- "x; x; x; x; x; x; x; x;\n"
- " ^\n\n"
- "test.wgsl:1:13 error: unexpected token\n"
- "x; x; x; x; x; x; x; x;\n"
- " ^\n\n"
- "test.wgsl error: stopping after 5 errors");
+ EXPECT("x; x; x; x; x; x; x; x;", R"(test.wgsl:1:1 error: unexpected token
+x; x; x; x; x; x; x; x;
+^
+
+test.wgsl:1:4 error: unexpected token
+x; x; x; x; x; x; x; x;
+ ^
+
+test.wgsl:1:7 error: unexpected token
+x; x; x; x; x; x; x; x;
+ ^
+
+test.wgsl:1:10 error: unexpected token
+x; x; x; x; x; x; x; x;
+ ^
+
+test.wgsl:1:13 error: unexpected token
+x; x; x; x; x; x; x; x;
+ ^
+
+test.wgsl error: stopping after 5 errors)");
}
TEST_F(ParserImplErrorTest, MemberExprMissingIdentifier) {
EXPECT("fn f() { x = a.; }",
- "test.wgsl:1:16 error: expected identifier for member accessor\n"
- "fn f() { x = a.; }\n"
- " ^\n");
+ R"(test.wgsl:1:16 error: expected identifier for member accessor
+fn f() { x = a.; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, MultiplicativeInvalidExpr) {
EXPECT("fn f() { return 1.0 * <; }",
- "test.wgsl:1:23 error: unable to parse right side of * expression\n"
- "fn f() { return 1.0 * <; }\n"
- " ^\n");
+ R"(test.wgsl:1:23 error: unable to parse right side of * expression
+fn f() { return 1.0 * <; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, OrInvalidExpr) {
EXPECT("fn f() { return 1 | >; }",
- "test.wgsl:1:21 error: unable to parse right side of | expression\n"
- "fn f() { return 1 | >; }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: unable to parse right side of | expression
+fn f() { return 1 | >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, RelationalInvalidExpr) {
EXPECT("fn f() { return 1 < >; }",
- "test.wgsl:1:21 error: unable to parse right side of < expression\n"
- "fn f() { return 1 < >; }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: unable to parse right side of < expression
+fn f() { return 1 < >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ReturnStmtMissingSemicolon) {
EXPECT("fn f() { return }",
- "test.wgsl:1:17 error: expected ';' for return statement\n"
- "fn f() { return }\n"
- " ^\n");
+ R"(test.wgsl:1:17 error: expected ';' for return statement
+fn f() { return }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, ShiftInvalidExpr) {
EXPECT("fn f() { return 1 << >; }",
- "test.wgsl:1:22 error: unable to parse right side of << expression\n"
- "fn f() { return 1 << >; }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: unable to parse right side of << expression
+fn f() { return 1 << >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtMissingLBrace) {
EXPECT("fn f() { switch(1) }",
- "test.wgsl:1:20 error: expected '{' for switch statement\n"
- "fn f() { switch(1) }\n"
- " ^\n");
+ R"(test.wgsl:1:20 error: expected '{' for switch statement
+fn f() { switch(1) }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtMissingRBrace) {
EXPECT("fn f() { switch(1) {",
- "test.wgsl:1:21 error: expected '}' for switch statement\n"
- "fn f() { switch(1) {\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: expected '}' for switch statement
+fn f() { switch(1) {
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtInvalidCase) {
EXPECT("fn f() { switch(1) { case ^: } }",
- "test.wgsl:1:27 error: unable to parse case selectors\n"
- "fn f() { switch(1) { case ^: } }\n"
- " ^\n");
+ R"(test.wgsl:1:27 error: unable to parse case selectors
+fn f() { switch(1) { case ^: } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtInvalidCase2) {
- EXPECT(
- "fn f() { switch(1) { case false: } }",
- "test.wgsl:1:27 error: invalid case selector must be an integer value\n"
- "fn f() { switch(1) { case false: } }\n"
- " ^^^^^\n");
+ EXPECT("fn f() { switch(1) { case false: } }",
+ R"(test.wgsl:1:27 error: invalid case selector must be an integer value
+fn f() { switch(1) { case false: } }
+ ^^^^^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtCaseMissingColon) {
EXPECT("fn f() { switch(1) { case 1 {} } }",
- "test.wgsl:1:29 error: expected ':' for case statement\n"
- "fn f() { switch(1) { case 1 {} } }\n"
- " ^\n");
+ R"(test.wgsl:1:29 error: expected ':' for case statement
+fn f() { switch(1) { case 1 {} } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtCaseMissingLBrace) {
EXPECT("fn f() { switch(1) { case 1: } }",
- "test.wgsl:1:30 error: expected '{' for case statement\n"
- "fn f() { switch(1) { case 1: } }\n"
- " ^\n");
+ R"(test.wgsl:1:30 error: expected '{' for case statement
+fn f() { switch(1) { case 1: } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtCaseMissingRBrace) {
EXPECT("fn f() { switch(1) { case 1: {",
- "test.wgsl:1:31 error: expected '}' for case statement\n"
- "fn f() { switch(1) { case 1: {\n"
- " ^\n");
+ R"(test.wgsl:1:31 error: expected '}' for case statement
+fn f() { switch(1) { case 1: {
+ ^
+)");
}
TEST_F(ParserImplErrorTest, SwitchStmtCaseFallthroughMissingSemicolon) {
EXPECT("fn f() { switch(1) { case 1: { fallthrough } case 2: {} } }",
- "test.wgsl:1:44 error: expected ';' for fallthrough statement\n"
- "fn f() { switch(1) { case 1: { fallthrough } case 2: {} } }\n"
- " ^\n");
+ R"(test.wgsl:1:44 error: expected ';' for fallthrough statement
+fn f() { switch(1) { case 1: { fallthrough } case 2: {} } }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, VarStmtMissingSemicolon) {
EXPECT("fn f() { var a : u32 }",
- "test.wgsl:1:22 error: expected ';' for variable declaration\n"
- "fn f() { var a : u32 }\n"
- " ^\n");
+ R"(test.wgsl:1:22 error: expected ';' for variable declaration
+fn f() { var a : u32 }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, VarStmtInvalidAssignment) {
EXPECT("fn f() { var a : u32 = >; }",
- "test.wgsl:1:24 error: missing constructor for variable declaration\n"
- "fn f() { var a : u32 = >; }\n"
- " ^\n");
+ R"(test.wgsl:1:24 error: missing constructor for variable declaration
+fn f() { var a : u32 = >; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, UnaryInvalidExpr) {
EXPECT("fn f() { return !<; }",
- "test.wgsl:1:18 error: unable to parse right side of ! expression\n"
- "fn f() { return !<; }\n"
- " ^\n");
+ R"(test.wgsl:1:18 error: unable to parse right side of ! expression
+fn f() { return !<; }
+ ^
+)");
}
TEST_F(ParserImplErrorTest, UnexpectedToken) {
- EXPECT("unexpected",
- "test.wgsl:1:1 error: unexpected token\n"
- "unexpected\n"
- "^^^^^^^^^^\n");
+ EXPECT("unexpected", R"(test.wgsl:1:1 error: unexpected token
+unexpected
+^^^^^^^^^^
+)");
}
TEST_F(ParserImplErrorTest, XorInvalidExpr) {
EXPECT("fn f() { return 1 ^ >; }",
- "test.wgsl:1:21 error: unable to parse right side of ^ expression\n"
- "fn f() { return 1 ^ >; }\n"
- " ^\n");
+ R"(test.wgsl:1:21 error: unable to parse right side of ^ expression
+fn f() { return 1 ^ >; }
+ ^
+)");
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_error_resync_test.cc b/src/reader/wgsl/parser_impl_error_resync_test.cc
index db31ce3..04ae887 100644
--- a/src/reader/wgsl/parser_impl_error_resync_test.cc
+++ b/src/reader/wgsl/parser_impl_error_resync_test.cc
@@ -40,32 +40,29 @@
EXPECT(R"(
fn .() -> . {}
fn x(.) {}
-[[.,.]] fn -> {}
+@_ fn -> {}
fn good() {}
)",
- "test.wgsl:2:4 error: expected identifier for function declaration\n"
- "fn .() -> . {}\n"
- " ^\n"
- "\n"
- "test.wgsl:2:11 error: unable to determine function return type\n"
- "fn .() -> . {}\n"
- " ^\n"
- "\n"
- "test.wgsl:3:6 error: expected ')' for function declaration\n"
- "fn x(.) {}\n"
- " ^\n"
- "\n"
- "test.wgsl:4:3 error: expected decoration\n"
- "[[.,.]] fn -> {}\n"
- " ^\n"
- "\n"
- "test.wgsl:4:5 error: expected decoration\n"
- "[[.,.]] fn -> {}\n"
- " ^\n"
- "\n"
- "test.wgsl:4:12 error: expected identifier for function declaration\n"
- "[[.,.]] fn -> {}\n"
- " ^^\n");
+ R"(test.wgsl:2:4 error: expected identifier for function declaration
+fn .() -> . {}
+ ^
+
+test.wgsl:2:11 error: unable to determine function return type
+fn .() -> . {}
+ ^
+
+test.wgsl:3:6 error: expected ')' for function declaration
+fn x(.) {}
+ ^
+
+test.wgsl:4:2 error: expected decoration
+@_ fn -> {}
+ ^
+
+test.wgsl:4:7 error: expected identifier for function declaration
+@_ fn -> {}
+ ^^
+)");
}
TEST_F(ParserImplErrorResyncTest, AssignmentStatement) {
@@ -78,17 +75,18 @@
good = 1;
}
)",
- "test.wgsl:3:8 error: expected '=' for assignment\n"
- " blah blah blah blah;\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:5:8 error: expected '=' for assignment\n"
- " blah blah blah blah;\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:6:7 error: unable to parse right side of assignment\n"
- " x = .;\n"
- " ^\n");
+ R"(test.wgsl:3:8 error: expected '=' for assignment
+ blah blah blah blah;
+ ^^^^
+
+test.wgsl:5:8 error: expected '=' for assignment
+ blah blah blah blah;
+ ^^^^
+
+test.wgsl:6:7 error: unable to parse right side of assignment
+ x = .;
+ ^
+)");
}
TEST_F(ParserImplErrorResyncTest, DiscardStatement) {
@@ -99,13 +97,14 @@
discard blah blah blah;
}
)",
- "test.wgsl:3:11 error: expected ';' for discard statement\n"
- " discard blah blah blah;\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:5:11 error: expected ';' for discard statement\n"
- " discard blah blah blah;\n"
- " ^^^^\n");
+ R"(test.wgsl:3:11 error: expected ';' for discard statement
+ discard blah blah blah;
+ ^^^^
+
+test.wgsl:5:11 error: expected ';' for discard statement
+ discard blah blah blah;
+ ^^^^
+)");
}
TEST_F(ParserImplErrorResyncTest, StructMembers) {
@@ -115,21 +114,22 @@
a : i32;
blah blah blah;
b : i32;
- [[]] x : i32;
+ @- x : i32;
c : i32;
}
)",
- "test.wgsl:3:10 error: expected ':' for struct member\n"
- " blah blah blah;\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:5:10 error: expected ':' for struct member\n"
- " blah blah blah;\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:7:7 error: empty decoration list\n"
- " [[]] x : i32;\n"
- " ^^\n");
+ R"(test.wgsl:3:10 error: expected ':' for struct member
+ blah blah blah;
+ ^^^^
+
+test.wgsl:5:10 error: expected ':' for struct member
+ blah blah blah;
+ ^^^^
+
+test.wgsl:7:6 error: expected decoration
+ @- x : i32;
+ ^
+)");
}
// Check that the forward scan in resynchronize() stop at nested sync points.
@@ -144,38 +144,36 @@
}
struct S { blah };
)",
- "test.wgsl:5:1 error: expected ';' for discard statement\n"
- "}\n"
- "^\n"
- "\n"
- "test.wgsl:6:17 error: expected ':' for struct member\n"
- "struct S { blah };\n"
- " ^\n");
+ R"(test.wgsl:5:1 error: expected ';' for discard statement
+}
+^
+
+test.wgsl:6:17 error: expected ':' for struct member
+struct S { blah };
+ ^
+)");
}
TEST_F(ParserImplErrorResyncTest, BracketCounting) {
- EXPECT(R"(
-[[woof[[[[]]]]]]
+ EXPECT(
+ R"(
fn f(x(((())))) {
meow = {{{}}}
}
struct S { blah };
)",
- "test.wgsl:2:3 error: expected decoration\n"
- "[[woof[[[[]]]]]]\n"
- " ^^^^\n"
- "\n"
- "test.wgsl:3:7 error: expected ':' for parameter\n"
- "fn f(x(((())))) {\n"
- " ^\n"
- "\n"
- "test.wgsl:4:10 error: unable to parse right side of assignment\n"
- " meow = {{{}}}\n"
- " ^\n"
- "\n"
- "test.wgsl:6:17 error: expected ':' for struct member\n"
- "struct S { blah };\n"
- " ^\n");
+ R"(test.wgsl:2:7 error: expected ':' for parameter
+fn f(x(((())))) {
+ ^
+
+test.wgsl:3:10 error: unable to parse right side of assignment
+ meow = {{{}}}
+ ^
+
+test.wgsl:5:17 error: expected ':' for struct member
+struct S { blah };
+ ^
+)");
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_function_decl_test.cc b/src/reader/wgsl/parser_impl_function_decl_test.cc
index d593c22..5a59562 100644
--- a/src/reader/wgsl/parser_impl_function_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_function_decl_test.cc
@@ -49,7 +49,7 @@
}
TEST_F(ParserImplTest, FunctionDecl_DecorationList) {
- auto p = parser("[[workgroup_size(2, 3, 4)]] fn main() { return; }");
+ auto p = parser("@workgroup_size(2, 3, 4) fn main() { return; }");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error()) << p->error();
ASSERT_FALSE(decos.errored);
@@ -87,7 +87,7 @@
TEST_F(ParserImplTest, FunctionDecl_DecorationList_MultipleEntries) {
auto p = parser(R"(
-[[workgroup_size(2, 3, 4), stage(compute)]]
+@workgroup_size(2, 3, 4) @stage(compute)
fn main() { return; })");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error()) << p->error();
@@ -130,8 +130,8 @@
TEST_F(ParserImplTest, FunctionDecl_DecorationList_MultipleLists) {
auto p = parser(R"(
-[[workgroup_size(2, 3, 4)]]
-[[stage(compute)]]
+@workgroup_size(2, 3, 4)
+@stage(compute)
fn main() { return; })");
auto decorations = p->decoration_list();
EXPECT_FALSE(p->has_error()) << p->error();
@@ -173,7 +173,7 @@
}
TEST_F(ParserImplTest, FunctionDecl_ReturnTypeDecorationList) {
- auto p = parser("fn main() -> [[location(1)]] f32 { return 1.0; }");
+ auto p = parser("fn main() -> @location(1) f32 { return 1.0; }");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error()) << p->error();
ASSERT_FALSE(decos.errored);
diff --git a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc
index 9f5b0b6..8fd6760 100644
--- a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc
+++ b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc
@@ -21,7 +21,7 @@
namespace {
TEST_F(ParserImplTest, DecorationList_Parses) {
- auto p = parser("[[workgroup_size(2), stage(compute)]]");
+ auto p = parser("@workgroup_size(2) @stage(compute)");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error()) << p->error();
EXPECT_FALSE(decos.errored);
@@ -46,23 +46,14 @@
ast::PipelineStage::kCompute);
}
-TEST_F(ParserImplTest, DecorationList_Empty) {
- auto p = parser("[[]]");
- auto decos = p->decoration_list();
- EXPECT_TRUE(p->has_error());
- EXPECT_TRUE(decos.errored);
- EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:3: empty decoration list");
-}
-
TEST_F(ParserImplTest, DecorationList_Invalid) {
- auto p = parser("[[invalid]]");
+ auto p = parser("@invalid");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:3: expected decoration");
+ EXPECT_EQ(p->error(), "1:2: expected decoration");
}
TEST_F(ParserImplTest, DecorationList_ExtraComma) {
@@ -71,34 +62,98 @@
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:22: expected decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:22: expected decoration)");
}
-TEST_F(ParserImplTest, DecorationList_MissingComma) {
+TEST_F(ParserImplTest, DecorationList_BadDecoration) {
+ auto p = parser("@stage()");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_EQ(p->error(), "1:8: invalid value for stage decoration");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_Empty) {
+ auto p = parser("[[]]");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: empty decoration list)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_Invalid) {
+ auto p = parser("[[invalid]]");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: expected decoration)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_ExtraComma) {
+ auto p = parser("[[workgroup_size(2), ]]");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:22: expected decoration)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_MissingComma) {
auto p = parser("[[workgroup_size(2) workgroup_size(2)]]");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:21: expected ',' for decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:21: expected ',' for decoration list)");
}
-TEST_F(ParserImplTest, DecorationList_BadDecoration) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_BadDecoration) {
auto p = parser("[[stage()]]");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:9: invalid value for stage decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:9: invalid value for stage decoration)");
}
-TEST_F(ParserImplTest, DecorationList_MissingRightAttr) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_MissingRightAttr) {
auto p = parser("[[workgroup_size(2), workgroup_size(3, 4, 5)");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:45: expected ']]' for decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:45: expected ']]' for decoration list)");
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_function_header_test.cc b/src/reader/wgsl/parser_impl_function_header_test.cc
index 369e8d0..00d3136 100644
--- a/src/reader/wgsl/parser_impl_function_header_test.cc
+++ b/src/reader/wgsl/parser_impl_function_header_test.cc
@@ -46,7 +46,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_DecoratedReturnType) {
- auto p = parser("fn main() -> [[location(1)]] f32");
+ auto p = parser("fn main() -> @location(1) f32");
auto f = p->function_header();
ASSERT_FALSE(p->has_error()) << p->error();
EXPECT_TRUE(f.matched);
@@ -76,7 +76,7 @@
}
TEST_F(ParserImplTest, FunctionHeader_DecoratedReturnType_WithArrayStride) {
- auto p = parser("fn main() -> [[location(1), stride(16)]] array<f32, 4>");
+ auto p = parser("fn main() -> @location(1) @stride(16) array<f32, 4>");
auto f = p->function_header();
ASSERT_FALSE(p->has_error()) << p->error();
EXPECT_TRUE(f.matched);
diff --git a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
index 2c4cd54..74c2557 100644
--- a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc
@@ -102,7 +102,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDec_Override_WithId) {
- auto p = parser("[[override(7)]] let a : f32 = 1.");
+ auto p = parser("@override(7) let a : f32 = 1.");
auto decos = p->decoration_list();
EXPECT_FALSE(decos.errored);
EXPECT_TRUE(decos.matched);
@@ -119,9 +119,9 @@
EXPECT_TRUE(e->type->Is<ast::F32>());
EXPECT_EQ(e->source.range.begin.line, 1u);
- EXPECT_EQ(e->source.range.begin.column, 21u);
+ EXPECT_EQ(e->source.range.begin.column, 18u);
EXPECT_EQ(e->source.range.end.line, 1u);
- EXPECT_EQ(e->source.range.end.column, 22u);
+ EXPECT_EQ(e->source.range.end.column, 19u);
ASSERT_NE(e->constructor, nullptr);
EXPECT_TRUE(e->constructor->Is<ast::LiteralExpression>());
@@ -165,7 +165,7 @@
}
TEST_F(ParserImplTest, GlobalConstantDec_Override_MissingId) {
- auto p = parser("[[override()]] let a : f32 = 1.");
+ auto p = parser("@override() let a : f32 = 1.");
auto decos = p->decoration_list();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
@@ -177,11 +177,11 @@
EXPECT_TRUE(p->has_error());
EXPECT_EQ(p->error(),
- "1:12: expected signed integer literal for override decoration");
+ "1:11: expected signed integer literal for override decoration");
}
TEST_F(ParserImplTest, GlobalConstantDec_Override_InvalidId) {
- auto p = parser("[[override(-7)]] let a : f32 = 1.");
+ auto p = parser("@override(-7) let a : f32 = 1.");
auto decos = p->decoration_list();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
@@ -192,7 +192,7 @@
ASSERT_NE(e.value, nullptr);
EXPECT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:12: override decoration must be positive");
+ EXPECT_EQ(p->error(), "1:11: override decoration must be positive");
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc
index d880e4a..fe8b24d 100644
--- a/src/reader/wgsl/parser_impl_global_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_decl_test.cc
@@ -132,7 +132,7 @@
}
TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) {
- auto p = parser("[[workgroup_size(2)]] fn main() { return; }");
+ auto p = parser("@workgroup_size(2) fn main() { return; }");
p->expect_global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
@@ -167,7 +167,7 @@
}
TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) {
- auto p = parser("struct A { data: [[stride(4)]] array<f32>; }");
+ auto p = parser("struct A { data: @stride(4) array<f32>; }");
p->expect_global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
diff --git a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
index d79a8ae..52cc75b 100644
--- a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc
@@ -67,7 +67,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration) {
- auto p = parser("[[binding(2), group(1)]] var<uniform> a : f32");
+ auto p = parser("@binding(2) @group(1) var<uniform> a : f32");
auto decos = p->decoration_list();
EXPECT_FALSE(decos.errored);
EXPECT_TRUE(decos.matched);
@@ -83,9 +83,9 @@
EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kUniform);
EXPECT_EQ(e->source.range.begin.line, 1u);
- EXPECT_EQ(e->source.range.begin.column, 39u);
+ EXPECT_EQ(e->source.range.begin.column, 36u);
EXPECT_EQ(e->source.range.end.line, 1u);
- EXPECT_EQ(e->source.range.end.column, 40u);
+ EXPECT_EQ(e->source.range.end.column, 37u);
ASSERT_EQ(e->constructor, nullptr);
@@ -96,7 +96,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration_MulitpleGroups) {
- auto p = parser("[[binding(2)]] [[group(1)]] var<uniform> a : f32");
+ auto p = parser("@binding(2) @group(1) var<uniform> a : f32");
auto decos = p->decoration_list();
EXPECT_FALSE(decos.errored);
EXPECT_TRUE(decos.matched);
@@ -113,9 +113,9 @@
EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kUniform);
EXPECT_EQ(e->source.range.begin.line, 1u);
- EXPECT_EQ(e->source.range.begin.column, 42u);
+ EXPECT_EQ(e->source.range.begin.column, 36u);
EXPECT_EQ(e->source.range.end.line, 1u);
- EXPECT_EQ(e->source.range.end.column, 43u);
+ EXPECT_EQ(e->source.range.end.column, 37u);
ASSERT_EQ(e->constructor, nullptr);
@@ -126,7 +126,7 @@
}
TEST_F(ParserImplTest, GlobalVariableDecl_InvalidDecoration) {
- auto p = parser("[[binding()]] var<uniform> a : f32");
+ auto p = parser("@binding() var<uniform> a : f32");
auto decos = p->decoration_list();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
@@ -138,7 +138,7 @@
EXPECT_TRUE(p->has_error());
EXPECT_EQ(p->error(),
- "1:11: expected signed integer literal for binding decoration");
+ "1:10: expected signed integer literal for binding decoration");
}
TEST_F(ParserImplTest, GlobalVariableDecl_InvalidConstExpr) {
diff --git a/src/reader/wgsl/parser_impl_param_list_test.cc b/src/reader/wgsl/parser_impl_param_list_test.cc
index e29725fc..d8e9b31 100644
--- a/src/reader/wgsl/parser_impl_param_list_test.cc
+++ b/src/reader/wgsl/parser_impl_param_list_test.cc
@@ -92,9 +92,8 @@
}
TEST_F(ParserImplTest, ParamList_Decorations) {
- auto p = parser(
- "[[builtin(position)]] coord : vec4<f32>, "
- "[[location(1)]] loc1 : f32");
+ auto p =
+ parser("@builtin(position) coord : vec4<f32>, @location(1) loc1 : f32");
auto e = p->expect_param_list();
ASSERT_FALSE(p->has_error()) << p->error();
@@ -113,9 +112,9 @@
ast::Builtin::kPosition);
ASSERT_EQ(e.value[0]->source.range.begin.line, 1u);
- ASSERT_EQ(e.value[0]->source.range.begin.column, 23u);
+ ASSERT_EQ(e.value[0]->source.range.begin.column, 20u);
ASSERT_EQ(e.value[0]->source.range.end.line, 1u);
- ASSERT_EQ(e.value[0]->source.range.end.column, 28u);
+ ASSERT_EQ(e.value[0]->source.range.end.column, 25u);
EXPECT_EQ(e.value[1]->symbol, p->builder().Symbols().Get("loc1"));
EXPECT_TRUE(e.value[1]->type->Is<ast::F32>());
@@ -125,10 +124,10 @@
EXPECT_TRUE(decos1[0]->Is<ast::LocationDecoration>());
EXPECT_EQ(decos1[0]->As<ast::LocationDecoration>()->value, 1u);
- ASSERT_EQ(e.value[1]->source.range.begin.line, 1u);
- ASSERT_EQ(e.value[1]->source.range.begin.column, 58u);
- ASSERT_EQ(e.value[1]->source.range.end.line, 1u);
- ASSERT_EQ(e.value[1]->source.range.end.column, 62u);
+ EXPECT_EQ(e.value[1]->source.range.begin.line, 1u);
+ EXPECT_EQ(e.value[1]->source.range.begin.column, 52u);
+ EXPECT_EQ(e.value[1]->source.range.end.line, 1u);
+ EXPECT_EQ(e.value[1]->source.range.end.column, 56u);
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
index 729fac4..86c2954 100644
--- a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc
@@ -46,25 +46,25 @@
TEST_F(ParserImplTest, StructBodyDecl_InvalidAlign) {
auto p = parser(R"(
{
- [[align(nan)]] a : i32;
+ @align(nan) a : i32;
})");
auto m = p->expect_struct_body_decl();
ASSERT_TRUE(p->has_error());
ASSERT_TRUE(m.errored);
EXPECT_EQ(p->error(),
- "3:11: expected signed integer literal for align decoration");
+ "3:10: expected signed integer literal for align decoration");
}
TEST_F(ParserImplTest, StructBodyDecl_InvalidSize) {
auto p = parser(R"(
{
- [[size(nan)]] a : i32;
+ @size(nan) a : i32;
})");
auto m = p->expect_struct_body_decl();
ASSERT_TRUE(p->has_error());
ASSERT_TRUE(m.errored);
EXPECT_EQ(p->error(),
- "3:10: expected signed integer literal for size decoration");
+ "3:9: expected signed integer literal for size decoration");
}
TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) {
diff --git a/src/reader/wgsl/parser_impl_struct_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decl_test.cc
index 8d411ff..aa930d3 100644
--- a/src/reader/wgsl/parser_impl_struct_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_decl_test.cc
@@ -154,7 +154,8 @@
EXPECT_TRUE(p->has_error());
EXPECT_EQ(
p->error(),
- R"(1:3: use of deprecated language feature: [[block]] attributes have been removed from WGSL
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: use of deprecated language feature: [[block]] attributes have been removed from WGSL
1:9: expected ']]' for decoration list)");
}
diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
index 655bb19..b4acaed 100644
--- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc
@@ -21,6 +21,60 @@
namespace {
TEST_F(ParserImplTest, DecorationDecl_Parses) {
+ auto p = parser("@override");
+ auto decos = p->decoration_list();
+ EXPECT_FALSE(p->has_error());
+ EXPECT_FALSE(decos.errored);
+ EXPECT_TRUE(decos.matched);
+ ASSERT_EQ(decos.value.size(), 1u);
+ auto* override_deco = decos.value[0]->As<ast::Decoration>();
+ EXPECT_TRUE(override_deco->Is<ast::OverrideDecoration>());
+}
+
+TEST_F(ParserImplTest, DecorationDecl_MissingParenLeft) {
+ auto p = parser("@location 1)");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(p->error(),
+ "1:11: expected '(' for location decoration");
+}
+
+TEST_F(ParserImplTest, DecorationDecl_MissingValue) {
+ auto p = parser("@location()");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(p->error(),
+ "1:11: expected signed integer literal for location decoration");
+}
+
+TEST_F(ParserImplTest, DecorationDecl_MissingParenRight) {
+ auto p = parser("@location(1");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(p->error(),
+ "1:12: expected ')' for location decoration");
+}
+
+TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) {
+ auto p = parser("@invalid");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_Parses) {
auto p = parser("[[override]]");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error());
@@ -31,17 +85,22 @@
EXPECT_TRUE(override_deco->Is<ast::OverrideDecoration>());
}
-TEST_F(ParserImplTest, DecorationDecl_MissingAttrRight) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_MissingAttrRight) {
auto p = parser("[[override");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:11: expected ']]' for decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:11: expected ']]' for decoration list)");
}
-TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_InvalidDecoration) {
auto p = parser("[[invalid]]");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
index 107c358..a7c1383 100644
--- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc
@@ -28,18 +28,20 @@
EXPECT_EQ(decos.value.size(), 0u);
}
-TEST_F(ParserImplTest, DecorationDecl_EmptyBlock) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_EmptyBlock) {
auto p = parser("[[]]");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_EQ(decos.value.size(), 0u);
- EXPECT_EQ(p->error(), "1:3: empty decoration list");
+ EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: empty decoration list)");
}
TEST_F(ParserImplTest, DecorationDecl_Single) {
- auto p = parser("[[size(4)]]");
+ auto p = parser("@size(4)");
auto decos = p->decoration_list();
EXPECT_FALSE(p->has_error());
EXPECT_FALSE(decos.errored);
@@ -51,13 +53,13 @@
}
TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) {
- auto p = parser("[[size(nan)]]");
+ auto p = parser("@size(nan)");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error()) << p->error();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_EQ(p->error(),
- "1:8: expected signed integer literal for size decoration");
+ "1:7: expected signed integer literal for size decoration");
}
TEST_F(ParserImplTest, DecorationDecl_MissingClose) {
@@ -66,7 +68,8 @@
EXPECT_TRUE(p->has_error()) << p->error();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:10: expected ']]' for decoration list");
+ EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: expected ']]' for decoration list)");
}
TEST_F(ParserImplTest, StructMemberDecorationDecl_SizeMissingClose) {
@@ -75,7 +78,8 @@
EXPECT_TRUE(p->has_error()) << p->error();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
- EXPECT_EQ(p->error(), "1:10: expected ']]' for decoration list");
+ EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: expected ']]' for decoration list)");
}
} // namespace
diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc
index 0f0f980..eccf079 100644
--- a/src/reader/wgsl/parser_impl_struct_member_test.cc
+++ b/src/reader/wgsl/parser_impl_struct_member_test.cc
@@ -43,7 +43,7 @@
}
TEST_F(ParserImplTest, StructMember_ParsesWithAlignDecoration) {
- auto p = parser("[[align(2)]] a : i32;");
+ auto p = parser("@align(2) a : i32;");
auto& builder = p->builder();
@@ -64,12 +64,12 @@
EXPECT_EQ(m->decorations[0]->As<ast::StructMemberAlignDecoration>()->align,
2u);
- EXPECT_EQ(m->source.range, (Source::Range{{1u, 14u}, {1u, 15u}}));
- EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 18u}, {1u, 21u}}));
+ EXPECT_EQ(m->source.range, (Source::Range{{1u, 11u}, {1u, 12u}}));
+ EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 15u}, {1u, 18u}}));
}
TEST_F(ParserImplTest, StructMember_ParsesWithSizeDecoration) {
- auto p = parser("[[size(2)]] a : i32;");
+ auto p = parser("@size(2) a : i32;");
auto& builder = p->builder();
@@ -89,12 +89,12 @@
EXPECT_TRUE(m->decorations[0]->Is<ast::StructMemberSizeDecoration>());
EXPECT_EQ(m->decorations[0]->As<ast::StructMemberSizeDecoration>()->size, 2u);
- EXPECT_EQ(m->source.range, (Source::Range{{1u, 13u}, {1u, 14u}}));
- EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 17u}, {1u, 20u}}));
+ EXPECT_EQ(m->source.range, (Source::Range{{1u, 10u}, {1u, 11u}}));
+ EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 14u}, {1u, 17u}}));
}
TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) {
- auto p = parser("[[size(2)]] a : i32;");
+ auto p = parser("@size(2) a : i32;");
auto& builder = p->builder();
@@ -114,13 +114,13 @@
EXPECT_TRUE(m->decorations[0]->Is<ast::StructMemberSizeDecoration>());
EXPECT_EQ(m->decorations[0]->As<ast::StructMemberSizeDecoration>()->size, 2u);
- EXPECT_EQ(m->source.range, (Source::Range{{1u, 13u}, {1u, 14u}}));
- EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 17u}, {1u, 20u}}));
+ EXPECT_EQ(m->source.range, (Source::Range{{1u, 10u}, {1u, 11u}}));
+ EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 14u}, {1u, 17u}}));
}
TEST_F(ParserImplTest, StructMember_ParsesWithMultipleDecorations) {
- auto p = parser(R"([[size(2)]]
-[[align(4)]] a : i32;)");
+ auto p = parser(R"(@size(2)
+@align(4) a : i32;)");
auto& builder = p->builder();
@@ -143,12 +143,12 @@
EXPECT_EQ(m->decorations[1]->As<ast::StructMemberAlignDecoration>()->align,
4u);
- EXPECT_EQ(m->source.range, (Source::Range{{2u, 14u}, {2u, 15u}}));
- EXPECT_EQ(m->type->source.range, (Source::Range{{2u, 18u}, {2u, 21u}}));
+ EXPECT_EQ(m->source.range, (Source::Range{{2u, 11u}, {2u, 12u}}));
+ EXPECT_EQ(m->type->source.range, (Source::Range{{2u, 15u}, {2u, 18u}}));
}
TEST_F(ParserImplTest, StructMember_InvalidDecoration) {
- auto p = parser("[[size(nan)]] a : i32;");
+ auto p = parser("@size(nan) a : i32;");
auto decos = p->decoration_list();
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
@@ -159,7 +159,7 @@
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(),
- "1:8: expected signed integer literal for size decoration");
+ "1:7: expected signed integer literal for size decoration");
}
TEST_F(ParserImplTest, StructMember_MissingSemicolon) {
diff --git a/src/reader/wgsl/parser_impl_test.cc b/src/reader/wgsl/parser_impl_test.cc
index 269cc9b..09da3b5 100644
--- a/src/reader/wgsl/parser_impl_test.cc
+++ b/src/reader/wgsl/parser_impl_test.cc
@@ -26,8 +26,8 @@
TEST_F(ParserImplTest, Parses) {
auto p = parser(R"(
-[[stage(fragment)]]
-fn main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1);
}
)");
@@ -114,11 +114,11 @@
* /* I can nest /**/ comments. */
* // I can nest line comments too.
**/
-[[stage(fragment)]] // This is the stage
+@stage(fragment) // This is the stage
fn main(/*
no
parameters
-*/) -> [[location(0)]] vec4<f32> {
+*/) -> @location(0) vec4<f32> {
return/*block_comments_delimit_tokens*/vec4<f32>(.4, .2, .3, 1);
}/* block comments are OK at EOF...*/)");
@@ -128,8 +128,8 @@
TEST_F(ParserImplTest, Comments_UnterminatedBlockComment) {
auto p = parser(R"(
-[[stage(fragment)]]
-fn main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1);
} /* unterminated block comments are invalid ...)");
diff --git a/src/reader/wgsl/parser_impl_type_decl_test.cc b/src/reader/wgsl/parser_impl_type_decl_test.cc
index f3cc52d..13e368a 100644
--- a/src/reader/wgsl/parser_impl_type_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_type_decl_test.cc
@@ -440,7 +440,7 @@
}
TEST_F(ParserImplTest, TypeDecl_Array_Stride) {
- auto p = parser("[[stride(16)]] array<f32, 5>");
+ auto p = parser("@stride(16) array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
@@ -460,11 +460,11 @@
auto* stride = a->decorations[0];
ASSERT_TRUE(stride->Is<ast::StrideDecoration>());
ASSERT_EQ(stride->As<ast::StrideDecoration>()->stride, 16u);
- EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 16u}, {1u, 29u}}));
+ EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 13u}, {1u, 26u}}));
}
TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Stride) {
- auto p = parser("[[stride(16)]] array<f32>");
+ auto p = parser("@stride(16) array<f32>");
auto t = p->type_decl();
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
@@ -480,11 +480,11 @@
auto* stride = a->decorations[0];
ASSERT_TRUE(stride->Is<ast::StrideDecoration>());
ASSERT_EQ(stride->As<ast::StrideDecoration>()->stride, 16u);
- EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 16u}, {1u, 26u}}));
+ EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 13u}, {1u, 23u}}));
}
TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_OneBlock) {
- auto p = parser("[[stride(16), stride(32)]] array<f32>");
+ auto p = parser("@stride(16) @stride(32) array<f32>");
auto t = p->type_decl();
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
@@ -502,11 +502,11 @@
EXPECT_EQ(decos[0]->As<ast::StrideDecoration>()->stride, 16u);
EXPECT_TRUE(decos[1]->Is<ast::StrideDecoration>());
EXPECT_EQ(decos[1]->As<ast::StrideDecoration>()->stride, 32u);
- EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 28u}, {1u, 38u}}));
+ EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 25u}, {1u, 35u}}));
}
TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_MultipleBlocks) {
- auto p = parser("[[stride(16)]] [[stride(32)]] array<f32>");
+ auto p = parser("@stride(16) @stride(32) array<f32>");
auto t = p->type_decl();
EXPECT_TRUE(t.matched);
EXPECT_FALSE(t.errored);
@@ -524,89 +524,163 @@
EXPECT_EQ(decos[0]->As<ast::StrideDecoration>()->stride, 16u);
EXPECT_TRUE(decos[1]->Is<ast::StrideDecoration>());
EXPECT_EQ(decos[1]->As<ast::StrideDecoration>()->stride, 32u);
- EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 31u}, {1u, 41u}}));
+ EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 25u}, {1u, 35u}}));
}
TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingArray) {
- auto p = parser("[[stride(16)]] f32");
+ auto p = parser("@stride(16) f32");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:3: unexpected decorations");
+ EXPECT_EQ(p->error(), "1:2: unexpected decorations");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingClosingAttr) {
+TEST_F(ParserImplTest, TypeDecl_Array_Decoration_UnknownDecoration) {
+ auto p = parser("@unknown(16) array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(), R"(1:2: expected decoration)");
+}
+TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingLeftParen) {
+ auto p = parser("@stride 4) array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(), R"(1:9: expected '(' for stride decoration)");
+}
+
+TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingRightParen) {
+ auto p = parser("@stride(4 array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(), R"(1:11: expected ')' for stride decoration)");
+}
+
+TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingValue) {
+ auto p = parser("@stride() array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(),
+ "1:9: expected signed integer literal for stride decoration");
+}
+
+TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue) {
+ auto p = parser("@stride(invalid) array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(),
+ "1:9: expected signed integer literal for stride decoration");
+}
+
+TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue_Negative) {
+ auto p = parser("@stride(-1) array<f32, 5>");
+ auto t = p->type_decl();
+ EXPECT_TRUE(t.errored);
+ EXPECT_FALSE(t.matched);
+ ASSERT_EQ(t.value, nullptr);
+ ASSERT_TRUE(p->has_error());
+ EXPECT_EQ(p->error(), "1:9: stride decoration must be greater than 0");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest,
+ DEPRECATED_TypeDecl_Array_Decoration_MissingClosingAttr) {
auto p = parser("[[stride(16) array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:14: expected ']]' for decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:14: expected ']]' for decoration list)");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Decoration_UnknownDecoration) {
- auto p = parser("[[unknown 16]] array<f32, 5>");
- auto t = p->type_decl();
- EXPECT_TRUE(t.errored);
- EXPECT_FALSE(t.matched);
- ASSERT_EQ(t.value, nullptr);
- ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:3: expected decoration");
-}
-
-TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingLeftParen) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_TypeDecl_Array_Stride_MissingLeftParen) {
auto p = parser("[[stride 4)]] array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:10: expected '(' for stride decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: expected '(' for stride decoration)");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingRightParen) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_TypeDecl_Array_Stride_MissingRightParen) {
auto p = parser("[[stride(4]] array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:11: expected ')' for stride decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:11: expected ')' for stride decoration)");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingValue) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_TypeDecl_Array_Stride_MissingValue) {
auto p = parser("[[stride()]] array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(),
- "1:10: expected signed integer literal for stride decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: expected signed integer literal for stride decoration)");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_TypeDecl_Array_Stride_InvalidValue) {
auto p = parser("[[stride(invalid)]] array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(),
- "1:10: expected signed integer literal for stride decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: expected signed integer literal for stride decoration)");
}
-TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue_Negative) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_TypeDecl_Array_Stride_InvalidValue_Negative) {
auto p = parser("[[stride(-1)]] array<f32, 5>");
auto t = p->type_decl();
EXPECT_TRUE(t.errored);
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
- EXPECT_EQ(p->error(), "1:10: stride decoration must be greater than 0");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:10: stride decoration must be greater than 0)");
}
TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
diff --git a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
index 5493345..5cb3801 100644
--- a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc
@@ -20,7 +20,7 @@
namespace {
TEST_F(ParserImplTest, DecorationList_Parses) {
- auto p = parser(R"([[location(4), builtin(position)]])");
+ auto p = parser(R"(@location(4) @builtin(position))");
auto decos = p->decoration_list();
ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_FALSE(decos.errored);
@@ -39,65 +39,94 @@
ast::Builtin::kPosition);
}
-TEST_F(ParserImplTest, DecorationList_Empty) {
+TEST_F(ParserImplTest, DecorationList_Invalid) {
+ auto p = parser(R"(@invalid)");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(p->error(), R"(1:2: expected decoration)");
+}
+
+TEST_F(ParserImplTest, DecorationList_InvalidValue) {
+ auto p = parser("@builtin(invalid)");
+ auto decos = p->decoration_list();
+ EXPECT_TRUE(p->has_error());
+ EXPECT_TRUE(decos.errored);
+ EXPECT_FALSE(decos.matched);
+ EXPECT_TRUE(decos.value.empty());
+ EXPECT_EQ(p->error(), "1:10: invalid value for builtin decoration");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_Empty) {
auto p = parser(R"([[]])");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:3: empty decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: empty decoration list)");
}
-TEST_F(ParserImplTest, DecorationList_Invalid) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_Invalid) {
auto p = parser(R"([[invalid]])");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:3: expected decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:3: expected decoration)");
}
-TEST_F(ParserImplTest, DecorationList_ExtraComma) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_ExtraComma) {
auto p = parser(R"([[builtin(position), ]])");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:22: expected decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:22: expected decoration)");
}
-TEST_F(ParserImplTest, DecorationList_MissingComma) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_MissingComma) {
auto p = parser(R"([[binding(4) location(5)]])");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:14: expected ',' for decoration list");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:14: expected ',' for decoration list)");
}
-TEST_F(ParserImplTest, DecorationList_BadDecoration) {
- auto p = parser(R"([[location(bad)]])");
- auto decos = p->decoration_list();
- EXPECT_TRUE(p->has_error());
- EXPECT_TRUE(decos.errored);
- EXPECT_FALSE(decos.matched);
- EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(),
- "1:12: expected signed integer literal for location decoration");
-}
-
-TEST_F(ParserImplTest, DecorationList_InvalidBuiltin) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_DecorationList_InvalidValue) {
auto p = parser("[[builtin(invalid)]]");
auto decos = p->decoration_list();
EXPECT_TRUE(p->has_error());
EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty());
- EXPECT_EQ(p->error(), "1:11: invalid value for builtin decoration");
+ EXPECT_EQ(
+ p->error(),
+ R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:11: invalid value for builtin decoration)");
}
} // namespace
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 489463e..73efe8c 100644
--- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
+++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc
@@ -77,7 +77,7 @@
}
TEST_F(ParserImplTest, VariableIdentDecl_NonAccessDecoFail) {
- auto p = parser("my_var : [[stride(1)]] S");
+ auto p = parser("my_var : @stride(1) S");
auto* mem = Member("a", ty.i32(), ast::DecorationList{});
ast::StructMemberList members;
@@ -90,19 +90,11 @@
auto decl = p->expect_variable_ident_decl("test");
ASSERT_TRUE(p->has_error());
ASSERT_TRUE(decl.errored);
- ASSERT_EQ(p->error(), "1:12: unexpected decorations");
-}
-
-TEST_F(ParserImplTest, VariableIdentDecl_DecorationMissingRightBlock) {
- auto p = parser("my_var : [[stride(4) S");
- auto decl = p->expect_variable_ident_decl("test");
- ASSERT_TRUE(p->has_error());
- ASSERT_TRUE(decl.errored);
- ASSERT_EQ(p->error(), "1:22: expected ']]' for decoration list");
+ ASSERT_EQ(p->error(), "1:11: unexpected decorations");
}
TEST_F(ParserImplTest, VariableIdentDecl_DecorationMissingRightParen) {
- auto p = parser("my_var : [[stride(4]] S");
+ auto p = parser("my_var : @stride(4 S");
auto decl = p->expect_variable_ident_decl("test");
ASSERT_TRUE(p->has_error());
ASSERT_TRUE(decl.errored);
@@ -110,19 +102,62 @@
}
TEST_F(ParserImplTest, VariableIdentDecl_DecorationMissingLeftParen) {
+ auto p = parser("my_var : @stride 4) S");
+ auto decl = p->expect_variable_ident_decl("test");
+ ASSERT_TRUE(p->has_error());
+ ASSERT_TRUE(decl.errored);
+ ASSERT_EQ(p->error(), "1:18: expected '(' for stride decoration");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest,
+ DEPRECATED_VariableIdentDecl_DecorationMissingRightBlock) {
+ auto p = parser("my_var : [[stride(4) S");
+ auto decl = p->expect_variable_ident_decl("test");
+ ASSERT_TRUE(p->has_error());
+ ASSERT_TRUE(decl.errored);
+ ASSERT_EQ(
+ p->error(),
+ R"(1:10: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:22: expected ']]' for decoration list)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest,
+ DEPRECATED_VariableIdentDecl_DecorationMissingRightParen) {
+ auto p = parser("my_var : [[stride(4]] S");
+ auto decl = p->expect_variable_ident_decl("test");
+ ASSERT_TRUE(p->has_error());
+ ASSERT_TRUE(decl.errored);
+ ASSERT_EQ(
+ p->error(),
+ R"(1:10: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:20: expected ')' for stride decoration)");
+}
+
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest,
+ DEPRECATED_VariableIdentDecl_DecorationMissingLeftParen) {
auto p = parser("my_var : [[stride 4)]] 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 '(' for stride decoration");
+ ASSERT_EQ(
+ p->error(),
+ R"(1:10: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:19: expected '(' for stride decoration)");
}
-TEST_F(ParserImplTest, VariableIdentDecl_DecorationEmpty) {
+// TODO(crbug.com/tint/1382): Remove
+TEST_F(ParserImplTest, DEPRECATED_VariableIdentDecl_DecorationEmpty) {
auto p = parser("my_var : [[]] S");
auto decl = p->expect_variable_ident_decl("test");
ASSERT_TRUE(p->has_error());
ASSERT_TRUE(decl.errored);
- ASSERT_EQ(p->error(), "1:12: empty decoration list");
+ ASSERT_EQ(
+ p->error(),
+ R"(1:10: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style
+1:12: empty decoration list)");
}
} // namespace
diff --git a/src/reader/wgsl/parser_test.cc b/src/reader/wgsl/parser_test.cc
index b1e5566..f6031dd 100644
--- a/src/reader/wgsl/parser_test.cc
+++ b/src/reader/wgsl/parser_test.cc
@@ -34,8 +34,8 @@
TEST_F(ParserTest, Parses) {
Source::File file("test.wgsl", R"(
-[[stage(fragment)]]
-fn main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1.);
}
)");
diff --git a/src/reader/wgsl/token.cc b/src/reader/wgsl/token.cc
index 864036c..8ba2cff 100644
--- a/src/reader/wgsl/token.cc
+++ b/src/reader/wgsl/token.cc
@@ -42,6 +42,8 @@
return "&&";
case Token::Type::kArrow:
return "->";
+ case Token::Type::kAttr:
+ return "@";
case Token::Type::kAttrLeft:
return "[[";
case Token::Type::kAttrRight:
diff --git a/src/reader/wgsl/token.h b/src/reader/wgsl/token.h
index dca2112..8fdc87e 100644
--- a/src/reader/wgsl/token.h
+++ b/src/reader/wgsl/token.h
@@ -50,9 +50,11 @@
kAndAnd,
/// A '->'
kArrow,
- /// A '[['
+ /// A '@'
+ kAttr,
+ /// A '[[' - [DEPRECATED] now '@'
kAttrLeft,
- /// A ']]'
+ /// A ']]' - [DEPRECATED] now '@'
kAttrRight,
/// A '/'
kForwardSlash,
diff --git a/src/resolver/assignment_validation_test.cc b/src/resolver/assignment_validation_test.cc
index f573161..39cb300 100644
--- a/src/resolver/assignment_validation_test.cc
+++ b/src/resolver/assignment_validation_test.cc
@@ -27,7 +27,7 @@
TEST_F(ResolverAssignmentValidationTest, ReadOnlyBuffer) {
// [[block]] struct S { m : i32 };
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<storage,read> a : S;
auto* s = Structure("S", {Member("m", ty.i32())},
{create<ast::StructBlockDecoration>()});
@@ -251,7 +251,7 @@
TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Atomic) {
// [[block]] struct S { a : atomic<i32>; };
- // [[group(0), binding(0)]] var<storage, read_write> v : S;
+ // @group(0) @binding(0) var<storage, read_write> v : S;
// v.a = v.a;
auto* s = Structure("S", {Member("a", ty.atomic(ty.i32()))},
@@ -273,7 +273,7 @@
TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_RuntimeArray) {
// [[block]] struct S { a : array<f32>; };
- // [[group(0), binding(0)]] var<storage, read_write> v : S;
+ // @group(0) @binding(0) var<storage, read_write> v : S;
// v.a = v.a;
auto* s = Structure("S", {Member("a", ty.array(ty.f32()))},
@@ -299,7 +299,7 @@
// struct S {
// arr: array<i32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
// fn f() {
// _ = s;
// }
@@ -320,7 +320,7 @@
// struct S {
// arr: array<i32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
// fn f() {
// _ = s.arr;
// }
@@ -347,10 +347,10 @@
// struct U {
// i: i32;
// };
- // [[group(0), binding(0)]] var tex texture_2d;
- // [[group(0), binding(1)]] var smp sampler;
- // [[group(0), binding(2)]] var<uniform> u : U;
- // [[group(0), binding(3)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var tex texture_2d;
+ // @group(0) @binding(1) var smp sampler;
+ // @group(0) @binding(2) var<uniform> u : U;
+ // @group(0) @binding(3) var<storage, read_write> s : S;
// var<workgroup> wg : array<f32, 10>
// fn f() {
// _ = 1;
diff --git a/src/resolver/builtins_validation_test.cc b/src/resolver/builtins_validation_test.cc
index 251be8e..8bbcf3a 100644
--- a/src/resolver/builtins_validation_test.cc
+++ b/src/resolver/builtins_validation_test.cc
@@ -201,10 +201,10 @@
testing::ValuesIn(cases));
TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInput_Fail) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(frag_depth)]] fd: f32,
- // ) -> [[location(0)]] f32 { return 1.0; }
+ // @builtin(frag_depth) fd: f32,
+ // ) -> @location(0) f32 { return 1.0; }
auto* fd = Param(
"fd", ty.f32(),
ast::DecorationList{Builtin(Source{{12, 34}}, ast::Builtin::kFragDepth)});
@@ -219,10 +219,10 @@
TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInputStruct_Fail) {
// struct MyInputs {
- // [[builtin(frag_depth)]] ff: f32;
+ // @builtin(frag_depth) ff: f32;
// };
- // [[stage(fragment)]]
- // fn fragShader(arg: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
"MyInputs", {Member("frag_depth", ty.f32(),
@@ -240,9 +240,9 @@
TEST_F(ResolverBuiltinsValidationTest, StructBuiltinInsideEntryPoint_Ignored) {
// struct S {
- // [[builtin(vertex_index)]] idx: u32;
+ // @builtin(vertex_index) idx: u32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fragShader() { var s : S; }
Structure("S",
@@ -257,10 +257,10 @@
TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_Struct_Fail) {
// struct MyInputs {
- // [[builtin(kPosition)]] p: vec4<u32>;
+ // @builtin(kPosition) p: vec4<u32>;
// };
- // [[stage(fragment)]]
- // fn fragShader(is_front: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* m = Member(
"position", ty.vec4<u32>(),
@@ -275,8 +275,8 @@
}
TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_ReturnType_Fail) {
- // [[stage(vertex)]]
- // fn main() -> [[builtin(position)]] f32 { return 1.0; }
+ // @stage(vertex)
+ // fn main() -> @builtin(position) f32 { return 1.0; }
Func("main", {}, ty.f32(), {Return(1.0f)},
{Stage(ast::PipelineStage::kVertex)},
{Builtin(Source{{12, 34}}, ast::Builtin::kPosition)});
@@ -288,10 +288,10 @@
TEST_F(ResolverBuiltinsValidationTest, FragDepthNotF32_Struct_Fail) {
// struct MyInputs {
- // [[builtin(kFragDepth)]] p: i32;
+ // @builtin(kFragDepth) p: i32;
// };
- // [[stage(fragment)]]
- // fn fragShader(is_front: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* m = Member(
"frag_depth", ty.i32(),
@@ -307,10 +307,10 @@
TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_Struct_Fail) {
// struct MyInputs {
- // [[builtin(sample_mask)]] m: f32;
+ // @builtin(sample_mask) m: f32;
// };
- // [[stage(fragment)]]
- // fn fragShader(is_front: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
"MyInputs", {Member("m", ty.f32(),
@@ -325,8 +325,8 @@
}
TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_ReturnType_Fail) {
- // [[stage(fragment)]]
- // fn main() -> [[builtin(sample_mask)]] i32 { return 1; }
+ // @stage(fragment)
+ // fn main() -> @builtin(sample_mask) i32 { return 1; }
Func("main", {}, ty.i32(), {Return(1)},
{Stage(ast::PipelineStage::kFragment)},
{Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)});
@@ -337,10 +337,10 @@
}
TEST_F(ResolverBuiltinsValidationTest, SampleMaskIsNotU32_Fail) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(sample_mask)]] arg: bool
- // ) -> [[location(0)]] f32 { return 1.0; }
+ // @builtin(sample_mask) arg: bool
+ // ) -> @location(0) f32 { return 1.0; }
auto* arg = Param("arg", ty.bool_(),
ast::DecorationList{
Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)});
@@ -354,10 +354,10 @@
TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Struct_Fail) {
// struct MyInputs {
- // [[builtin(sample_index)]] m: f32;
+ // @builtin(sample_index) m: f32;
// };
- // [[stage(fragment)]]
- // fn fragShader(is_front: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
"MyInputs", {Member("m", ty.f32(),
@@ -372,10 +372,10 @@
}
TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Fail) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(sample_index)]] arg: bool
- // ) -> [[location(0)]] f32 { return 1.0; }
+ // @builtin(sample_index) arg: bool
+ // ) -> @location(0) f32 { return 1.0; }
auto* arg = Param("arg", ty.bool_(),
ast::DecorationList{
Builtin(Source{{12, 34}}, ast::Builtin::kSampleIndex)});
@@ -388,10 +388,10 @@
}
TEST_F(ResolverBuiltinsValidationTest, PositionIsNotF32_Fail) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(kPosition)]] p: vec3<f32>,
- // ) -> [[location(0)]] f32 { return 1.0; }
+ // @builtin(kPosition) p: vec3<f32>,
+ // ) -> @location(0) f32 { return 1.0; }
auto* p = Param(
"p", ty.vec3<f32>(),
ast::DecorationList{Builtin(Source{{12, 34}}, ast::Builtin::kPosition)});
@@ -404,8 +404,8 @@
}
TEST_F(ResolverBuiltinsValidationTest, FragDepthIsNotF32_Fail) {
- // [[stage(fragment)]]
- // fn fs_main() -> [[builtin(kFragDepth)]] f32 { var fd: i32; return fd; }
+ // @stage(fragment)
+ // fn fs_main() -> @builtin(kFragDepth) f32 { var fd: i32; return fd; }
auto* fd = Var("fd", ty.i32());
Func(
"fs_main", {}, ty.i32(), {Decl(fd), Return(fd)},
@@ -417,11 +417,11 @@
}
TEST_F(ResolverBuiltinsValidationTest, VertexIndexIsNotU32_Fail) {
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn main(
- // [[builtin(kVertexIndex)]] vi : f32,
- // [[builtin(kPosition)]] p :vec4<f32>
- // ) -> [[builtin(kPosition)]] vec4<f32> { return vec4<f32>(); }
+ // @builtin(kVertexIndex) vi : f32,
+ // @builtin(kPosition) p :vec4<f32>
+ // ) -> @builtin(kPosition) vec4<f32> { return vec4<f32>(); }
auto* p = Param("p", ty.vec4<f32>(),
ast::DecorationList{Builtin(ast::Builtin::kPosition)});
auto* vi = Param("vi", ty.f32(),
@@ -436,11 +436,11 @@
}
TEST_F(ResolverBuiltinsValidationTest, InstanceIndexIsNotU32) {
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn main(
- // [[builtin(kInstanceIndex)]] ii : f32,
- // [[builtin(kPosition)]] p :vec4<f32>
- // ) -> [[builtin(kPosition)]] vec4<f32> { return vec4<f32>(); }
+ // @builtin(kInstanceIndex) ii : f32,
+ // @builtin(kPosition) p :vec4<f32>
+ // ) -> @builtin(kPosition) vec4<f32> { return vec4<f32>(); }
auto* p = Param("p", ty.vec4<f32>(),
ast::DecorationList{Builtin(ast::Builtin::kPosition)});
auto* ii = Param("ii", ty.f32(),
@@ -455,13 +455,13 @@
}
TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltin_Pass) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(kPosition)]] p: vec4<f32>,
- // [[builtin(front_facing)]] ff: bool,
- // [[builtin(sample_index)]] si: u32,
- // [[builtin(sample_mask)]] sm : u32
- // ) -> [[builtin(frag_depth)]] f32 { var fd: f32; return fd; }
+ // @builtin(kPosition) p: vec4<f32>,
+ // @builtin(front_facing) ff: bool,
+ // @builtin(sample_index) si: u32,
+ // @builtin(sample_mask) sm : u32
+ // ) -> @builtin(frag_depth) f32 { var fd: f32; return fd; }
auto* p = Param("p", ty.vec4<f32>(),
ast::DecorationList{Builtin(ast::Builtin::kPosition)});
auto* ff = Param("ff", ty.bool_(),
@@ -479,11 +479,11 @@
}
TEST_F(ResolverBuiltinsValidationTest, VertexBuiltin_Pass) {
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn main(
- // [[builtin(vertex_index)]] vi : u32,
- // [[builtin(instance_index)]] ii : u32,
- // ) -> [[builtin(position)]] vec4<f32> { var p :vec4<f32>; return p; }
+ // @builtin(vertex_index) vi : u32,
+ // @builtin(instance_index) ii : u32,
+ // ) -> @builtin(position) vec4<f32> { var p :vec4<f32>; return p; }
auto* vi = Param("vi", ty.u32(),
ast::DecorationList{
Builtin(Source{{12, 34}}, ast::Builtin::kVertexIndex)});
@@ -504,13 +504,13 @@
}
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_Pass) {
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn main(
- // [[builtin(local_invocationId)]] li_id: vec3<u32>,
- // [[builtin(local_invocationIndex)]] li_index: u32,
- // [[builtin(global_invocationId)]] gi: vec3<u32>,
- // [[builtin(workgroup_id)]] wi: vec3<u32>,
- // [[builtin(num_workgroups)]] nwgs: vec3<u32>,
+ // @builtin(local_invocationId) li_id: vec3<u32>,
+ // @builtin(local_invocationIndex) li_index: u32,
+ // @builtin(global_invocationId) gi: vec3<u32>,
+ // @builtin(workgroup_id) wi: vec3<u32>,
+ // @builtin(num_workgroups) nwgs: vec3<u32>,
// ) {}
auto* li_id =
@@ -618,13 +618,13 @@
TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltinStruct_Pass) {
// Struct MyInputs {
- // [[builtin(kPosition)]] p: vec4<f32>;
- // [[builtin(frag_depth)]] fd: f32;
- // [[builtin(sample_index)]] si: u32;
- // [[builtin(sample_mask)]] sm : u32;;
+ // @builtin(kPosition) p: vec4<f32>;
+ // @builtin(frag_depth) fd: f32;
+ // @builtin(sample_index) si: u32;
+ // @builtin(sample_mask) sm : u32;;
// };
- // [[stage(fragment)]]
- // fn fragShader(arg: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
"MyInputs",
@@ -642,10 +642,10 @@
}
TEST_F(ResolverBuiltinsValidationTest, FrontFacingParamIsNotBool_Fail) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn fs_main(
- // [[builtin(front_facing)]] is_front: i32;
- // ) -> [[location(0)]] f32 { return 1.0; }
+ // @builtin(front_facing) is_front: i32;
+ // ) -> @location(0) f32 { return 1.0; }
auto* is_front = Param("is_front", ty.i32(),
ast::DecorationList{Builtin(
@@ -661,10 +661,10 @@
TEST_F(ResolverBuiltinsValidationTest, FrontFacingMemberIsNotBool_Fail) {
// struct MyInputs {
- // [[builtin(front_facing)]] pos: f32;
+ // @builtin(front_facing) pos: f32;
// };
- // [[stage(fragment)]]
- // fn fragShader(is_front: MyInputs) -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
"MyInputs", {Member("pos", ty.f32(),
diff --git a/src/resolver/call_validation_test.cc b/src/resolver/call_validation_test.cc
index 86e4a17..5af0bf9 100644
--- a/src/resolver/call_validation_test.cc
+++ b/src/resolver/call_validation_test.cc
@@ -172,7 +172,7 @@
// fn bar(p: ptr<function, i32>) {
// foo(p);
// }
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() {
// var v: i32;
// bar(&v);
@@ -195,7 +195,7 @@
TEST_F(ResolverCallValidationTest, LetPointer) {
// fn x(p : ptr<function, i32>) -> i32 {}
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() {
// var v: i32;
// let p: ptr<function, i32> = &v;
@@ -227,7 +227,7 @@
// let p: ptr<private, i32> = &v;
// fn foo(p : ptr<private, i32>) -> i32 {}
// var v: i32;
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() {
// var c: i32 = foo(p);
// }
diff --git a/src/resolver/decoration_validation_test.cc b/src/resolver/decoration_validation_test.cc
index 8f043d6..592ba15 100644
--- a/src/resolver/decoration_validation_test.cc
+++ b/src/resolver/decoration_validation_test.cc
@@ -973,9 +973,9 @@
Global(Source{{12, 34}}, "G", ty.Of(s), ast::StorageClass::kUniform);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, StorageBufferMissingBinding) {
@@ -985,9 +985,9 @@
ast::Access::kRead);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, TextureMissingBinding) {
@@ -995,9 +995,9 @@
ast::StorageClass::kNone);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, SamplerMissingBinding) {
@@ -1005,9 +1005,9 @@
ast::StorageClass::kNone);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, BindingPairMissingBinding) {
@@ -1018,9 +1018,9 @@
});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, BindingPairMissingGroup) {
@@ -1031,9 +1031,9 @@
});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: resource variables require [[group]] and [[binding]] "
- "decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: resource variables require @group and @binding decorations)");
}
TEST_F(ResourceDecorationTest, BindingPointUsedTwiceByEntryPoint) {
@@ -1064,7 +1064,7 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(56:78 error: entry point 'F' references multiple variables that use the same resource binding [[group(2), binding(1)]]
+ R"(56:78 error: entry point 'F' references multiple variables that use the same resource binding @group(2), @binding(1)
12:34 note: first resource binding usage declared here)");
}
@@ -1108,9 +1108,9 @@
});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: non-resource variables must not have [[group]] or "
- "[[binding]] decorations");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: non-resource variables must not have @group or @binding decorations)");
}
} // namespace
@@ -1368,9 +1368,9 @@
ast::DecorationList{Stage(ast::PipelineStage::kFragment)});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: interpolate attribute must only be used with "
- "[[location]]");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: interpolate attribute must only be used with @location)");
}
TEST_F(InterpolateTest, MissingLocationAttribute_ReturnType) {
@@ -1381,9 +1381,9 @@
ast::InterpolationSampling::kNone)});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: interpolate attribute must only be used with "
- "[[location]]");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: interpolate attribute must only be used with @location)");
}
TEST_F(InterpolateTest, MissingLocationAttribute_Struct) {
@@ -1393,9 +1393,9 @@
ast::InterpolationSampling::kNone)})});
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: interpolate attribute must only be used with "
- "[[location]]");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: interpolate attribute must only be used with @location)");
}
} // namespace
diff --git a/src/resolver/entry_point_validation_test.cc b/src/resolver/entry_point_validation_test.cc
index 0fc620b..a2c0eac 100644
--- a/src/resolver/entry_point_validation_test.cc
+++ b/src/resolver/entry_point_validation_test.cc
@@ -51,8 +51,8 @@
public testing::Test {};
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
- // [[stage(fragment)]]
- // fn main() -> [[location(0)]] f32 { return 1.0; }
+ // @stage(fragment)
+ // fn main() -> @location(0) f32 { return 1.0; }
Func(Source{{12, 34}}, "main", {}, ty.f32(), {Return(1.0f)},
{Stage(ast::PipelineStage::kFragment)}, {Location(0)});
@@ -60,8 +60,8 @@
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
- // [[stage(vertex)]]
- // fn main() -> [[builtin(position)]] vec4<f32> { return vec4<f32>(); }
+ // @stage(vertex)
+ // fn main() -> @builtin(position) vec4<f32> { return vec4<f32>(); }
Func(Source{{12, 34}}, "main", {}, ty.vec4<f32>(),
{Return(Construct(ty.vec4<f32>()))},
{Stage(ast::PipelineStage::kVertex)},
@@ -71,7 +71,7 @@
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) {
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn main() -> f32 {
// return 1.0;
// }
@@ -85,8 +85,8 @@
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Multiple) {
- // [[stage(vertex)]]
- // fn main() -> [[location(0)]] [[builtin(position)]] vec4<f32> {
+ // @stage(vertex)
+ // fn main() -> @location(0) @builtin(position) vec4<f32> {
// return vec4<f32>();
// }
Func(Source{{12, 34}}, "main", {}, ty.vec4<f32>(),
@@ -102,10 +102,10 @@
TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_Valid) {
// struct Output {
- // [[location(0)]] a : f32;
- // [[builtin(frag_depth)]] b : f32;
+ // @location(0) a : f32;
+ // @builtin(frag_depth) b : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -122,9 +122,9 @@
TEST_F(ResolverEntryPointValidationTest,
ReturnType_Struct_MemberMultipleAttributes) {
// struct Output {
- // [[location(0)]] [[builtin(frag_depth)]] a : f32;
+ // @location(0) @builtin(frag_depth) a : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -146,10 +146,10 @@
TEST_F(ResolverEntryPointValidationTest,
ReturnType_Struct_MemberMissingAttribute) {
// struct Output {
- // [[location(0)]] a : f32;
+ // @location(0) a : f32;
// b : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -168,10 +168,10 @@
TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) {
// struct Output {
- // [[builtin(frag_depth)]] a : f32;
- // [[builtin(frag_depth)]] b : f32;
+ // @builtin(frag_depth) a : f32;
+ // @builtin(frag_depth) b : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -190,8 +190,8 @@
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) {
- // [[stage(fragment)]]
- // fn main([[location(0)]] param : f32) {}
+ // @stage(fragment)
+ // fn main(@location(0) param : f32) {}
auto* param = Param("param", ty.f32(), {Location(0)});
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {},
{Stage(ast::PipelineStage::kFragment)});
@@ -200,7 +200,7 @@
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Missing) {
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : f32) {}
auto* param = Param(Source{{13, 43}}, "param", ty.vec4<f32>());
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {},
@@ -212,8 +212,8 @@
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Multiple) {
- // [[stage(fragment)]]
- // fn main([[location(0)]] [[builtin(sample_index)]] param : u32) {}
+ // @stage(fragment)
+ // fn main(@location(0) @builtin(sample_index) param : u32) {}
auto* param = Param("param", ty.u32(),
{Location(Source{{13, 43}}, 0),
Builtin(Source{{14, 52}}, ast::Builtin::kSampleIndex)});
@@ -227,10 +227,10 @@
TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_Valid) {
// struct Input {
- // [[location(0)]] a : f32;
- // [[builtin(sample_index)]] b : u32;
+ // @location(0) a : f32;
+ // @builtin(sample_index) b : u32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : Input) {}
auto* input = Structure(
"Input", {Member("a", ty.f32(), {Location(0)}),
@@ -245,9 +245,9 @@
TEST_F(ResolverEntryPointValidationTest,
Parameter_Struct_MemberMultipleAttributes) {
// struct Input {
- // [[location(0)]] [[builtin(sample_index)]] a : u32;
+ // @location(0) @builtin(sample_index) a : u32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : Input) {}
auto* input = Structure(
"Input",
@@ -267,10 +267,10 @@
TEST_F(ResolverEntryPointValidationTest,
Parameter_Struct_MemberMissingAttribute) {
// struct Input {
- // [[location(0)]] a : f32;
+ // @location(0) a : f32;
// b : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : Input) {}
auto* input = Structure(
"Input", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}),
@@ -285,9 +285,9 @@
}
TEST_F(ResolverEntryPointValidationTest, Parameter_DuplicateBuiltins) {
- // [[stage(fragment)]]
- // fn main([[builtin(sample_index)]] param_a : u32,
- // [[builtin(sample_index)]] param_b : u32) {}
+ // @stage(fragment)
+ // fn main(@builtin(sample_index) param_a : u32,
+ // @builtin(sample_index) param_b : u32) {}
auto* param_a =
Param("param_a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)});
auto* param_b =
@@ -304,12 +304,12 @@
TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) {
// struct InputA {
- // [[builtin(sample_index)]] a : u32;
+ // @builtin(sample_index) a : u32;
// };
// struct InputB {
- // [[builtin(sample_index)]] a : u32;
+ // @builtin(sample_index) a : u32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = Structure(
"InputA", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})});
@@ -328,7 +328,7 @@
}
TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) {
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn main() {}
Func(Source{{12, 34}}, "main", {}, ty.void_(), {},
{Stage(ast::PipelineStage::kVertex)});
@@ -370,8 +370,8 @@
};
TEST_P(TypeValidationTest, BareInputs) {
- // [[stage(fragment)]]
- // fn main([[location(0)]] a : *) {}
+ // @stage(fragment)
+ // fn main(@location(0) a : *) {}
auto params = GetParam();
auto* a = Param("a", params.create_ast_type(*this), {Location(0)});
Func(Source{{12, 34}}, "main", {a}, ty.void_(), {},
@@ -386,9 +386,9 @@
TEST_P(TypeValidationTest, StructInputs) {
// struct Input {
- // [[location(0)]] a : *;
+ // @location(0) a : *;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(a : Input) {}
auto params = GetParam();
auto* input = Structure(
@@ -405,8 +405,8 @@
}
TEST_P(TypeValidationTest, BareOutputs) {
- // [[stage(fragment)]]
- // fn main() -> [[location(0)]] * {
+ // @stage(fragment)
+ // fn main() -> @location(0) * {
// return *();
// }
auto params = GetParam();
@@ -423,9 +423,9 @@
TEST_P(TypeValidationTest, StructOutputs) {
// struct Output {
- // [[location(0)]] a : *;
+ // @location(0) a : *;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -453,8 +453,8 @@
using LocationDecorationTests = ResolverTest;
TEST_F(LocationDecorationTests, Pass) {
- // [[stage(fragment)]]
- // fn frag_main([[location(0)]] a: i32) {}
+ // @stage(fragment)
+ // fn frag_main(@location(0) a: i32) {}
auto* p = Param(Source{{12, 34}}, "a", ty.i32(), {Location(0)});
Func("frag_main", {p}, ty.void_(), {},
@@ -464,8 +464,8 @@
}
TEST_F(LocationDecorationTests, BadType_Input_bool) {
- // [[stage(fragment)]]
- // fn frag_main([[location(0)]] a: bool) {}
+ // @stage(fragment)
+ // fn frag_main(@location(0) a: bool) {}
auto* p =
Param(Source{{12, 34}}, "a", ty.bool_(), {Location(Source{{34, 56}}, 0)});
@@ -481,8 +481,8 @@
}
TEST_F(LocationDecorationTests, BadType_Output_Array) {
- // [[stage(fragment)]]
- // fn frag_main()->[[location(0)]] array<f32, 2> { return array<f32, 2>(); }
+ // @stage(fragment)
+ // fn frag_main()->@location(0) array<f32, 2> { return array<f32, 2>(); }
Func(Source{{12, 34}}, "frag_main", {}, ty.array<f32, 2>(),
{Return(Construct(ty.array<f32, 2>()))},
@@ -500,8 +500,8 @@
// struct Input {
// a : f32;
// };
- // [[stage(fragment)]]
- // fn main([[location(0)]] param : Input) {}
+ // @stage(fragment)
+ // fn main(@location(0) param : Input) {}
auto* input = Structure("Input", {Member("a", ty.f32())});
auto* param = Param(Source{{12, 34}}, "param", ty.Of(input),
{Location(Source{{13, 43}}, 0)});
@@ -518,12 +518,12 @@
TEST_F(LocationDecorationTests, BadType_Input_Struct_NestedStruct) {
// struct Inner {
- // [[location(0)]] b : f32;
+ // @location(0) b : f32;
// };
// struct Input {
// a : Inner;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : Input) {}
auto* inner = Structure(
"Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})});
@@ -542,9 +542,9 @@
TEST_F(LocationDecorationTests, BadType_Input_Struct_RuntimeArray) {
// [[block]]
// struct Input {
- // [[location(0)]] a : array<f32>;
+ // @location(0) a : array<f32>;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param : Input) {}
auto* input = Structure(
"Input",
@@ -564,8 +564,8 @@
TEST_F(LocationDecorationTests, BadMemberType_Input) {
// [[block]]
- // struct S { [[location(0)]] m: array<i32>; };
- // [[stage(fragment)]]
+ // struct S { @location(0) m: array<i32>; };
+ // @stage(fragment)
// fn frag_main( a: S) {}
auto* m = Member(Source{{34, 56}}, "m", ty.array<i32>(),
@@ -585,8 +585,8 @@
}
TEST_F(LocationDecorationTests, BadMemberType_Output) {
- // struct S { [[location(0)]] m: atomic<i32>; };
- // [[stage(fragment)]]
+ // struct S { @location(0) m: atomic<i32>; };
+ // @stage(fragment)
// fn frag_main() -> S {}
auto* m = Member(Source{{34, 56}}, "m", ty.atomic<i32>(),
ast::DecorationList{Location(Source{{12, 34}}, 0u)});
@@ -604,7 +604,7 @@
}
TEST_F(LocationDecorationTests, BadMemberType_Unused) {
- // struct S { [[location(0)]] m: mat3x2<f32>; };
+ // struct S { @location(0) m: mat3x2<f32>; };
auto* m = Member(Source{{34, 56}}, "m", ty.mat3x2<f32>(),
ast::DecorationList{Location(Source{{12, 34}}, 0u)});
@@ -620,10 +620,10 @@
TEST_F(LocationDecorationTests, ReturnType_Struct_Valid) {
// struct Output {
- // [[location(0)]] a : f32;
- // [[builtin(frag_depth)]] b : f32;
+ // @location(0) a : f32;
+ // @builtin(frag_depth) b : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -641,8 +641,8 @@
// struct Output {
// a : f32;
// };
- // [[stage(vertex)]]
- // fn main() -> [[location(0)]] Output {
+ // @stage(vertex)
+ // fn main() -> @location(0) Output {
// return Output();
// }
auto* output = Structure("Output", {Member("a", ty.f32())});
@@ -660,12 +660,12 @@
TEST_F(LocationDecorationTests, ReturnType_Struct_NestedStruct) {
// struct Inner {
- // [[location(0)]] b : f32;
+ // @location(0) b : f32;
// };
// struct Output {
// a : Inner;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output { return Output(); }
auto* inner = Structure(
"Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})});
@@ -684,9 +684,9 @@
TEST_F(LocationDecorationTests, ReturnType_Struct_RuntimeArray) {
// [[block]]
// struct Output {
- // [[location(0)]] a : array<f32>;
+ // @location(0) a : array<f32>;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main() -> Output {
// return Output();
// }
@@ -760,9 +760,9 @@
}
TEST_F(LocationDecorationTests, Duplicate_input) {
- // [[stage(fragment)]]
- // fn main([[location(1)]] param_a : f32,
- // [[location(1)]] param_b : f32) {}
+ // @stage(fragment)
+ // fn main(@location(1) param_a : f32,
+ // @location(1) param_b : f32) {}
auto* param_a = Param("param_a", ty.f32(), {Location(1)});
auto* param_b = Param("param_b", ty.f32(), {Location(Source{{12, 34}}, 1)});
Func(Source{{12, 34}}, "main", {param_a, param_b}, ty.void_(), {},
@@ -775,12 +775,12 @@
TEST_F(LocationDecorationTests, Duplicate_struct) {
// struct InputA {
- // [[location(1)]] a : f32;
+ // @location(1) a : f32;
// };
// struct InputB {
- // [[location(1)]] a : f32;
+ // @location(1) a : f32;
// };
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = Structure("InputA", {Member("a", ty.f32(), {Location(1)})});
auto* input_b = Structure(
diff --git a/src/resolver/function_validation_test.cc b/src/resolver/function_validation_test.cc
index f2976de..6263169 100644
--- a/src/resolver/function_validation_test.cc
+++ b/src/resolver/function_validation_test.cc
@@ -353,7 +353,7 @@
}
TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
- // [[stage(compute), workgroup_size(1)]] fn entrypoint() {}
+ // @stage(compute) @workgroup_size(1) fn entrypoint() {}
// fn func() { return entrypoint(); }
Func("entrypoint", ast::VariableList{}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1)});
@@ -371,8 +371,8 @@
}
TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {
- // [[stage(fragment)]]
- // [[stage(vertex)]]
+ // @stage(fragment)
+ // @stage(vertex)
// fn main() { return; }
Func(Source{{12, 34}}, "main", ast::VariableList{}, ty.void_(),
ast::StatementList{
@@ -440,7 +440,7 @@
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) {
// let x = 4u;
// let x = 8u;
- // [[stage(compute), workgroup_size(x, y, 16u)]]
+ // @stage(compute) @workgroup_size(x, y, 16u)
// fn main() {}
auto* x = GlobalConst("x", ty.u32(), Expr(4u));
auto* y = GlobalConst("y", ty.u32(), Expr(8u));
diff --git a/src/resolver/intrinsic_validation_test.cc b/src/resolver/intrinsic_validation_test.cc
index edae91f..80a3dc9 100644
--- a/src/resolver/intrinsic_validation_test.cc
+++ b/src/resolver/intrinsic_validation_test.cc
@@ -36,7 +36,7 @@
}
TEST_F(ResolverIntrinsicValidationTest, InvalidPipelineStageDirect) {
- // [[stage(compute), workgroup_size(1)]] fn func { return dpdx(1.0); }
+ // @stage(compute) @workgroup_size(1) fn func { return dpdx(1.0); }
auto* dpdx = create<ast::CallExpression>(Source{{3, 4}}, Expr("dpdx"),
ast::ExpressionList{Expr(1.0f)});
@@ -53,7 +53,7 @@
// fn f0 { return dpdx(1.0); }
// fn f1 { f0(); }
// fn f2 { f1(); }
- // [[stage(compute), workgroup_size(1)]] fn main { return f2(); }
+ // @stage(compute) @workgroup_size(1) fn main { return f2(); }
auto* dpdx = create<ast::CallExpression>(Source{{3, 4}}, Expr("dpdx"),
ast::ExpressionList{Expr(1.0f)});
diff --git a/src/resolver/ptr_ref_validation_test.cc b/src/resolver/ptr_ref_validation_test.cc
index 367b209..003388a 100644
--- a/src/resolver/ptr_ref_validation_test.cc
+++ b/src/resolver/ptr_ref_validation_test.cc
@@ -53,7 +53,7 @@
}
TEST_F(ResolverPtrRefValidationTest, AddressOfHandle) {
- // [[group(0), binding(0)]] var t: texture_3d<f32>;
+ // @group(0) @binding(0) var t: texture_3d<f32>;
// &t
Global("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()),
GroupAndBinding(0u, 0u));
@@ -95,7 +95,7 @@
}
TEST_F(ResolverPtrRefValidationTest, IndirectOfAddressOfHandle) {
- // [[group(0), binding(0)]] var t: texture_3d<f32>;
+ // @group(0) @binding(0) var t: texture_3d<f32>;
// *&t
Global("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()),
GroupAndBinding(0u, 0u));
@@ -142,7 +142,7 @@
// [[block]] struct S {
// inner: Inner;
// }
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
// fn f() {
// let p : pointer<storage, i32> = &s.inner.arr[2];
// }
diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc
index 434f7ff..1cfed25 100644
--- a/src/resolver/resolver.cc
+++ b/src/resolver/resolver.cc
@@ -2151,7 +2151,7 @@
return nullptr;
}
- // Look for explicit stride via [[stride(n)]] decoration
+ // Look for explicit stride via @stride(n) decoration
uint32_t explicit_stride = 0;
for (auto* deco : arr->decorations) {
Mark(deco);
diff --git a/src/resolver/resolver_test.cc b/src/resolver/resolver_test.cc
index a32f563..5b97b25 100644
--- a/src/resolver/resolver_test.cc
+++ b/src/resolver/resolver_test.cc
@@ -920,7 +920,7 @@
}
TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) {
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn main() {}
auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, {});
@@ -938,7 +938,7 @@
}
TEST_F(ResolverTest, Function_WorkgroupSize_Literals) {
- // [[stage(compute), workgroup_size(8, 2, 3)]]
+ // @stage(compute) @workgroup_size(8, 2, 3)
// fn main() {}
auto* func =
Func("main", ast::VariableList{}, ty.void_(), {},
@@ -961,7 +961,7 @@
// let width = 16;
// let height = 8;
// let depth = 2;
- // [[stage(compute), workgroup_size(width, height, depth)]]
+ // @stage(compute) @workgroup_size(width, height, depth)
// fn main() {}
GlobalConst("width", ty.i32(), Expr(16));
GlobalConst("height", ty.i32(), Expr(8));
@@ -986,7 +986,7 @@
TEST_F(ResolverTest, Function_WorkgroupSize_Consts_NestedInitializer) {
// let width = i32(i32(i32(8)));
// let height = i32(i32(i32(4)));
- // [[stage(compute), workgroup_size(width, height)]]
+ // @stage(compute) @workgroup_size(width, height)
// fn main() {}
GlobalConst("width", ty.i32(),
Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32(), 8))));
@@ -1010,10 +1010,10 @@
}
TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts) {
- // [[override(0)]] let width = 16;
- // [[override(1)]] let height = 8;
- // [[override(2)]] let depth = 2;
- // [[stage(compute), workgroup_size(width, height, depth)]]
+ // @override(0) let width = 16;
+ // @override(1) let height = 8;
+ // @override(2) let depth = 2;
+ // @stage(compute) @workgroup_size(width, height, depth)
// fn main() {}
auto* width = GlobalConst("width", ty.i32(), Expr(16), {Override(0)});
auto* height = GlobalConst("height", ty.i32(), Expr(8), {Override(1)});
@@ -1036,10 +1036,10 @@
}
TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts_NoInit) {
- // [[override(0)]] let width : i32;
- // [[override(1)]] let height : i32;
- // [[override(2)]] let depth : i32;
- // [[stage(compute), workgroup_size(width, height, depth)]]
+ // @override(0) let width : i32;
+ // @override(1) let height : i32;
+ // @override(2) let depth : i32;
+ // @stage(compute) @workgroup_size(width, height, depth)
// fn main() {}
auto* width = GlobalConst("width", ty.i32(), nullptr, {Override(0)});
auto* height = GlobalConst("height", ty.i32(), nullptr, {Override(1)});
@@ -1062,9 +1062,9 @@
}
TEST_F(ResolverTest, Function_WorkgroupSize_Mixed) {
- // [[override(1)]] let height = 2;
+ // @override(1) let height = 2;
// let depth = 3;
- // [[stage(compute), workgroup_size(8, height, depth)]]
+ // @stage(compute) @workgroup_size(8, height, depth)
// fn main() {}
auto* height = GlobalConst("height", ty.i32(), Expr(2), {Override(0)});
GlobalConst("depth", ty.i32(), Expr(3));
@@ -1816,8 +1816,8 @@
}
TEST_F(ResolverTest, BindingPoint_SetForResources) {
- // [[group(1), binding(2)]] var s1 : sampler;
- // [[group(3), binding(4)]] var s2 : sampler;
+ // @group(1) @binding(2) var s1 : sampler;
+ // @group(3) @binding(4) var s2 : sampler;
auto* s1 = Global(Sym(), ty.sampler(ast::SamplerKind::kSampler),
ast::DecorationList{create<ast::GroupDecoration>(1),
create<ast::BindingDecoration>(2)});
diff --git a/src/resolver/resolver_validation.cc b/src/resolver/resolver_validation.cc
index 3218e4a..5edc4ee 100644
--- a/src/resolver/resolver_validation.cc
+++ b/src/resolver/resolver_validation.cc
@@ -271,8 +271,8 @@
"' must be a multiple of " + std::to_string(required_align) +
" bytes, but '" + member_name_of(m) +
"' is currently at offset " + std::to_string(m->Offset()) +
- ". Consider setting [[align(" +
- std::to_string(required_align) + ")]] on this member",
+ ". Consider setting @align(" +
+ std::to_string(required_align) + ") on this member",
m->Declaration()->source);
AddNote("see layout of struct:\n" + str->Layout(builder_->Symbols()),
@@ -299,7 +299,7 @@
"member be a multiple of 16 bytes, but there are currently " +
std::to_string(prev_to_curr_offset) + " bytes between '" +
member_name_of(prev_member) + "' and '" + member_name_of(m) +
- "'. Consider setting [[align(16)]] on this member",
+ "'. Consider setting @align(16) on this member",
m->Declaration()->source);
AddNote("see layout of struct:\n" + str->Layout(builder_->Symbols()),
@@ -326,10 +326,10 @@
"bytes, but array stride of '" +
member_name_of(m) + "' is currently " +
std::to_string(arr->Stride()) +
- ". Consider setting [[stride(" +
+ ". Consider setting @stride(" +
std::to_string(
utils::RoundUp(required_align, arr->Stride())) +
- ")]] on the array type",
+ ") on the array type",
m->Declaration()->type->source);
AddNote("see layout of struct:\n" + str->Layout(builder_->Symbols()),
str->Declaration()->source);
@@ -429,7 +429,7 @@
// attributes.
if (!binding_point) {
AddError(
- "resource variables require [[group]] and [[binding]] "
+ "resource variables require @group and @binding "
"decorations",
decl->source);
return false;
@@ -441,7 +441,7 @@
// https://gpuweb.github.io/gpuweb/wgsl/#attribute-binding
// Must only be applied to a resource variable
AddError(
- "non-resource variables must not have [[group]] or [[binding]] "
+ "non-resource variables must not have @group or @binding "
"decorations",
decl->source);
return false;
@@ -1037,7 +1037,7 @@
if (interpolate_attribute) {
if (!pipeline_io_attribute ||
!pipeline_io_attribute->Is<ast::LocationDecoration>()) {
- AddError("interpolate attribute must only be used with [[location]]",
+ AddError("interpolate attribute must only be used with @location",
interpolate_attribute->source);
return false;
}
@@ -1167,9 +1167,9 @@
auto func_name = builder_->Symbols().NameFor(decl->symbol);
AddError("entry point '" + func_name +
"' references multiple variables that use the "
- "same resource binding [[group(" +
- std::to_string(bp.group) + "), binding(" +
- std::to_string(bp.binding) + ")]]",
+ "same resource binding @group(" +
+ std::to_string(bp.group) + "), @binding(" +
+ std::to_string(bp.binding) + ")",
var_decl->source);
AddNote("first resource binding usage declared here",
res.first->second->source);
@@ -2035,7 +2035,7 @@
}
if (interpolate_attribute && !has_location) {
- AddError("interpolate attribute must only be used with [[location]]",
+ AddError("interpolate attribute must only be used with @location",
interpolate_attribute->source);
return false;
}
diff --git a/src/resolver/storage_class_layout_validation_test.cc b/src/resolver/storage_class_layout_validation_test.cc
index 467608d..f9fcc12 100644
--- a/src/resolver/storage_class_layout_validation_test.cc
+++ b/src/resolver/storage_class_layout_validation_test.cc
@@ -28,10 +28,10 @@
StorageBuffer_UnalignedMember) {
// [[block]]
// struct S {
- // [[size(5)]] a : f32;
- // [[align(1)]] b : f32;
+ // @size(5) a : f32;
+ // @align(1) b : f32;
// };
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<storage> a : S;
Structure(Source{{12, 34}}, "S",
@@ -45,7 +45,7 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(34:56 error: the offset of a struct member of type 'f32' in storage class 'storage' must be a multiple of 4 bytes, but 'b' is currently at offset 5. Consider setting [[align(4)]] on this member
+ R"(34:56 error: the offset of a struct member of type 'f32' in storage class 'storage' must be a multiple of 4 bytes, but 'b' is currently at offset 5. Consider setting @align(4) on this member
12:34 note: see layout of struct:
/* align(4) size(12) */ struct S {
/* offset(0) align(4) size( 5) */ a : f32;
@@ -59,10 +59,10 @@
StorageBuffer_UnalignedMember_SuggestedFix) {
// [[block]]
// struct S {
- // [[size(5)]] a : f32;
- // [[align(4)]] b : f32;
+ // @size(5) a : f32;
+ // @align(4) b : f32;
// };
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<storage> a : S;
Structure(Source{{12, 34}}, "S",
@@ -89,7 +89,7 @@
// inner : Inner;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner", {Member("scalar", ty.i32())});
@@ -107,7 +107,7 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(56:78 error: the offset of a struct member of type 'Inner' in storage class 'uniform' must be a multiple of 16 bytes, but 'inner' is currently at offset 4. Consider setting [[align(16)]] on this member
+ R"(56:78 error: the offset of a struct member of type 'Inner' in storage class 'uniform' must be a multiple of 16 bytes, but 'inner' is currently at offset 4. Consider setting @align(16) on this member
34:56 note: see layout of struct:
/* align(4) size(8) */ struct Outer {
/* offset(0) align(4) size(4) */ scalar : f32;
@@ -129,10 +129,10 @@
// [[block]]
// struct Outer {
// scalar : f32;
- // [[align(16)]] inner : Inner;
+ // @align(16) inner : Inner;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner", {Member("scalar", ty.i32())});
@@ -154,7 +154,7 @@
// Detect unaligned array member for uniform buffers
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_UnalignedMember_Array) {
- // type Inner = [[stride(16)]] array<f32, 10>;
+ // type Inner = @stride(16) array<f32, 10>;
//
// [[block]]
// struct Outer {
@@ -162,7 +162,7 @@
// inner : Inner;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Alias("Inner", ty.array(ty.f32(), 10, 16));
@@ -179,26 +179,26 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(56:78 error: the offset of a struct member of type '[[stride(16)]] array<f32, 10>' in storage class 'uniform' must be a multiple of 16 bytes, but 'inner' is currently at offset 4. Consider setting [[align(16)]] on this member
+ R"(56:78 error: the offset of a struct member of type '@stride(16) array<f32, 10>' in storage class 'uniform' must be a multiple of 16 bytes, but 'inner' is currently at offset 4. Consider setting @align(16) on this member
12:34 note: see layout of struct:
/* align(4) size(164) */ struct Outer {
/* offset( 0) align(4) size( 4) */ scalar : f32;
-/* offset( 4) align(4) size(160) */ inner : [[stride(16)]] array<f32, 10>;
+/* offset( 4) align(4) size(160) */ inner : @stride(16) array<f32, 10>;
/* */ };
78:90 note: see declaration of variable)");
}
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_UnalignedMember_Array_SuggestedFix) {
- // type Inner = [[stride(16)]] array<f32, 10>;
+ // type Inner = @stride(16) array<f32, 10>;
//
// [[block]]
// struct Outer {
// scalar : f32;
- // [[align(16)]] inner : Inner;
+ // @align(16) inner : Inner;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Alias("Inner", ty.array(ty.f32(), 10, 16));
@@ -221,7 +221,7 @@
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_MembersOffsetNotMultipleOf16) {
// struct Inner {
- // [[align(1), size(5)]] scalar : i32;
+ // @align(1) @size(5) scalar : i32;
// };
//
// [[block]]
@@ -230,7 +230,7 @@
// scalar : i32;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
@@ -249,7 +249,7 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(78:90 error: uniform storage requires that the number of bytes between the start of the previous member of type struct and the current member be a multiple of 16 bytes, but there are currently 8 bytes between 'inner' and 'scalar'. Consider setting [[align(16)]] on this member
+ R"(78:90 error: uniform storage requires that the number of bytes between the start of the previous member of type struct and the current member be a multiple of 16 bytes, but there are currently 8 bytes between 'inner' and 'scalar'. Consider setting @align(16) on this member
34:56 note: see layout of struct:
/* align(4) size(12) */ struct Outer {
/* offset( 0) align(1) size( 5) */ inner : Inner;
@@ -270,7 +270,7 @@
// a : i32;
// b : i32;
// c : i32;
- // [[align(1), size(5)]] scalar : i32;
+ // @align(1) @size(5) scalar : i32;
// };
//
// [[block]]
@@ -279,7 +279,7 @@
// scalar : i32;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
@@ -303,7 +303,7 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(78:90 error: uniform storage requires that the number of bytes between the start of the previous member of type struct and the current member be a multiple of 16 bytes, but there are currently 20 bytes between 'inner' and 'scalar'. Consider setting [[align(16)]] on this member
+ R"(78:90 error: uniform storage requires that the number of bytes between the start of the previous member of type struct and the current member be a multiple of 16 bytes, but there are currently 20 bytes between 'inner' and 'scalar'. Consider setting @align(16) on this member
34:56 note: see layout of struct:
/* align(4) size(24) */ struct Outer {
/* offset( 0) align(4) size(20) */ inner : Inner;
@@ -323,16 +323,16 @@
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_MembersOffsetNotMultipleOf16_SuggestedFix) {
// struct Inner {
- // [[align(1), size(5)]] scalar : i32;
+ // @align(1) @size(5) scalar : i32;
// };
//
// [[block]]
// struct Outer {
- // [[align(16)]] inner : Inner;
+ // @align(16) inner : Inner;
// scalar : i32;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
@@ -360,7 +360,7 @@
// v : vec3<f32>;
// s : f32;
// };
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : ScalarPackedAtEndOfVec3;
Structure("ScalarPackedAtEndOfVec3",
@@ -379,7 +379,7 @@
// Detect array stride must be a multiple of 16 bytes for uniform buffers
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_InvalidArrayStride) {
- // type Inner = [[stride(8)]] array<f32, 10>;
+ // type Inner = @stride(8) array<f32, 10>;
//
// [[block]]
// struct Outer {
@@ -387,7 +387,7 @@
// scalar : i32;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Alias("Inner", ty.array(ty.f32(), 10, 8));
@@ -405,10 +405,10 @@
ASSERT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
- R"(34:56 error: uniform storage requires that array elements be aligned to 16 bytes, but array stride of 'inner' is currently 8. Consider setting [[stride(16)]] on the array type
+ R"(34:56 error: uniform storage requires that array elements be aligned to 16 bytes, but array stride of 'inner' is currently 8. Consider setting @stride(16) on the array type
12:34 note: see layout of struct:
/* align(4) size(84) */ struct Outer {
-/* offset( 0) align(4) size(80) */ inner : [[stride(8)]] array<f32, 10>;
+/* offset( 0) align(4) size(80) */ inner : @stride(8) array<f32, 10>;
/* offset(80) align(4) size( 4) */ scalar : i32;
/* */ };
78:90 note: see declaration of variable)");
@@ -416,7 +416,7 @@
TEST_F(ResolverStorageClassLayoutValidationTest,
UniformBuffer_InvalidArrayStride_SuggestedFix) {
- // type Inner = [[stride(16)]] array<f32, 10>;
+ // type Inner = @stride(16) array<f32, 10>;
//
// [[block]]
// struct Outer {
@@ -424,7 +424,7 @@
// scalar : i32;
// };
//
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var<uniform> a : Outer;
Alias("Inner", ty.array(ty.f32(), 10, 16));
diff --git a/src/resolver/storage_class_validation_test.cc b/src/resolver/storage_class_validation_test.cc
index 5d922c2..9965e08 100644
--- a/src/resolver/storage_class_validation_test.cc
+++ b/src/resolver/storage_class_validation_test.cc
@@ -226,7 +226,7 @@
TEST_F(ResolverStorageClassValidationTest, UniformBuffer_Struct_Runtime) {
// [[block]] struct S { m: array<f32>; };
- // [[group(0), binding(0)]] var<uniform, > svar : S;
+ // @group(0) @binding(0) var<uniform, > svar : S;
auto* s = Structure(Source{{12, 34}}, "S", {Member("m", ty.array<i32>())},
{create<ast::StructBlockDecoration>()});
diff --git a/src/resolver/type_validation_test.cc b/src/resolver/type_validation_test.cc
index 08f37be..292a57f 100644
--- a/src/resolver/type_validation_test.cc
+++ b/src/resolver/type_validation_test.cc
@@ -79,7 +79,7 @@
}
TEST_F(ResolverTypeValidationTest, GlobalConstantNoConstructor_Pass) {
- // [[override(0)]] let a :i32;
+ // @override(0) let a :i32;
GlobalConst(Source{{12, 34}}, "a", ty.i32(), nullptr,
ast::DecorationList{create<ast::OverrideDecoration>(0)});
@@ -336,7 +336,7 @@
}
TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ExplicitStride) {
- // var<private> a : [[stride(8)]] array<f32, 0x20000000>;
+ // var<private> a : @stride(8) array<f32, 0x20000000>;
Global("a", ty.array(Source{{12, 34}}, ty.f32(), 0x20000000, 8),
ast::StorageClass::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -396,7 +396,7 @@
}
TEST_F(ResolverTypeValidationTest, RuntimeArrayInFunction_Fail) {
- /// [[stage(vertex)]]
+ /// @stage(vertex)
// fn func() { var a : array<i32>; }
auto* var =
@@ -594,7 +594,7 @@
TEST_F(ResolverTypeValidationTest, RuntimeArrayAsParameter_Fail) {
// fn func(a : array<u32>) {}
- // [[stage(vertex)]] fn main() {}
+ // @stage(vertex) fn main() {}
auto* param = Param(Source{{12, 34}}, "a", ty.array<i32>());
@@ -855,7 +855,7 @@
using StorageTextureDimensionTest = ResolverTestWithParam<DimensionParams>;
TEST_P(StorageTextureDimensionTest, All) {
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_*<ru32int, write>;
auto& params = GetParam();
@@ -905,13 +905,13 @@
using StorageTextureFormatTest = ResolverTestWithParam<FormatParams>;
TEST_P(StorageTextureFormatTest, All) {
auto& params = GetParam();
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_1d<*, write>;
- // [[group(0), binding(1)]]
+ // @group(0) @binding(1)
// var b : texture_storage_2d<*, write>;
- // [[group(0), binding(2)]]
+ // @group(0) @binding(2)
// var c : texture_storage_2d_array<*, write>;
- // [[group(0), binding(3)]]
+ // @group(0) @binding(3)
// var d : texture_storage_3d<*, write>;
auto* st_a = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d,
@@ -951,7 +951,7 @@
using StorageTextureAccessTest = ResolverTest;
TEST_F(StorageTextureAccessTest, MissingAccess_Fail) {
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_1d<ru32int>;
auto* st =
@@ -967,7 +967,7 @@
}
TEST_F(StorageTextureAccessTest, RWAccess_Fail) {
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_1d<ru32int, read_write>;
auto* st =
@@ -984,7 +984,7 @@
}
TEST_F(StorageTextureAccessTest, ReadOnlyAccess_Fail) {
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_1d<ru32int, read>;
auto* st = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d,
@@ -1000,7 +1000,7 @@
}
TEST_F(StorageTextureAccessTest, WriteOnlyAccess_Pass) {
- // [[group(0), binding(0)]]
+ // @group(0) @binding(0)
// var a : texture_storage_1d<ru32int, write>;
auto* st =
diff --git a/src/resolver/validation_test.cc b/src/resolver/validation_test.cc
index 0b3152a..2a8e41b 100644
--- a/src/resolver/validation_test.cc
+++ b/src/resolver/validation_test.cc
@@ -80,7 +80,7 @@
// var<workgroup> dst : vec4<f32>;
// fn f2(){ dst = wg; }
// fn f1() { f2(); }
- // [[stage(fragment)]]
+ // @stage(fragment)
// fn f0() {
// f1();
//}
diff --git a/src/resolver/var_let_test.cc b/src/resolver/var_let_test.cc
index 631537b..0bce039 100644
--- a/src/resolver/var_let_test.cc
+++ b/src/resolver/var_let_test.cc
@@ -288,7 +288,7 @@
// [[block]] struct S {
// inner: Inner;
// }
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
// fn f() {
// let p = &s.inner.arr[2];
// }
diff --git a/src/resolver/var_let_validation_test.cc b/src/resolver/var_let_validation_test.cc
index 9ee07b0..8260136 100644
--- a/src/resolver/var_let_validation_test.cc
+++ b/src/resolver/var_let_validation_test.cc
@@ -79,7 +79,7 @@
}
TEST_F(ResolverVarLetValidationTest, LetTypeNotConstructible) {
- // [[group(0), binding(0)]] var t1 : texture_2d<f32>;
+ // @group(0) @binding(0) var t1 : texture_2d<f32>;
// let t2 : t1;
auto* t1 =
Global("t1", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()),
@@ -223,7 +223,7 @@
// [[block]] struct S {
// inner: Inner;
// }
- // [[group(0), binding(0)]] var<storage> s : S;
+ // @group(0) @binding(0) var<storage> s : S;
// fn f() {
// let p : pointer<storage, i32, read_write> = &s.inner.arr[2];
// }
@@ -286,7 +286,7 @@
}
TEST_F(ResolverVarLetValidationTest, NonConstructibleType_InferredType) {
- // [[group(0), binding(0)]] var s : sampler;
+ // @group(0) @binding(0) var s : sampler;
// fn foo() {
// var v = s;
// }
diff --git a/src/sem/array.cc b/src/sem/array.cc
index a5757be..9bb3604 100644
--- a/src/sem/array.cc
+++ b/src/sem/array.cc
@@ -58,7 +58,7 @@
std::string Array::FriendlyName(const SymbolTable& symbols) const {
std::ostringstream out;
if (!IsStrideImplicit()) {
- out << "[[stride(" << stride_ << ")]] ";
+ out << "@stride(" << stride_ << ") ";
}
out << "array<" << element_->FriendlyName(symbols);
if (!IsRuntimeSized()) {
diff --git a/src/sem/array.h b/src/sem/array.h
index b1992ff..feb4020 100644
--- a/src/sem/array.h
+++ b/src/sem/array.h
@@ -61,12 +61,12 @@
/// @returns the byte alignment of the array
/// @note this may differ from the alignment of a structure member of this
- /// array type, if the member is annotated with the `[[align(n)]]` decoration.
+ /// array type, if the member is annotated with the `@align(n)` decoration.
uint32_t Align() const override;
/// @returns the byte size of the array
/// @note this may differ from the size of a structure member of this array
- /// type, if the member is annotated with the `[[size(n)]]` decoration.
+ /// type, if the member is annotated with the `@size(n)` decoration.
uint32_t Size() const override;
/// @returns the number of bytes from the start of one element of the
diff --git a/src/sem/sem_array_test.cc b/src/sem/sem_array_test.cc
index 04207b6..a74c58f 100644
--- a/src/sem/sem_array_test.cc
+++ b/src/sem/sem_array_test.cc
@@ -65,12 +65,12 @@
TEST_F(ArrayTest, FriendlyNameRuntimeSizedNonImplicitStride) {
auto* arr = create<Array>(create<I32>(), 0, 0, 4, 8, 4);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "[[stride(8)]] array<i32>");
+ EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32>");
}
TEST_F(ArrayTest, FriendlyNameStaticSizedNonImplicitStride) {
auto* arr = create<Array>(create<I32>(), 5, 4, 20, 8, 4);
- EXPECT_EQ(arr->FriendlyName(Symbols()), "[[stride(8)]] array<i32, 5>");
+ EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(8) array<i32, 5>");
}
TEST_F(ArrayTest, TypeName_RuntimeArray) {
diff --git a/src/sem/struct.h b/src/sem/struct.h
index 3c42c6c..f041058 100644
--- a/src/sem/struct.h
+++ b/src/sem/struct.h
@@ -89,13 +89,13 @@
/// @returns the byte alignment of the structure
/// @note this may differ from the alignment of a structure member of this
- /// structure type, if the member is annotated with the `[[align(n)]]`
+ /// structure type, if the member is annotated with the `@align(n)`
/// decoration.
uint32_t Align() const override;
/// @returns the byte size of the structure
/// @note this may differ from the size of a structure member of this
- /// structure type, if the member is annotated with the `[[size(n)]]`
+ /// structure type, if the member is annotated with the `@size(n)`
/// decoration.
uint32_t Size() const override;
diff --git a/src/transform/add_empty_entry_point_test.cc b/src/transform/add_empty_entry_point_test.cc
index 722af1a..4cee0bc 100644
--- a/src/transform/add_empty_entry_point_test.cc
+++ b/src/transform/add_empty_entry_point_test.cc
@@ -28,7 +28,7 @@
auto* src = R"()";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn unused_entry_point() {
}
)";
@@ -40,7 +40,7 @@
TEST_F(AddEmptyEntryPointTest, ExistingEntryPoint) {
auto* src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
}
)";
@@ -56,7 +56,7 @@
auto* src = R"(var<private> unused_entry_point : f32;)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn unused_entry_point_1() {
}
diff --git a/src/transform/add_spirv_block_decoration.h b/src/transform/add_spirv_block_decoration.h
index c5e67bb..2f23fb9 100644
--- a/src/transform/add_spirv_block_decoration.h
+++ b/src/transform/add_spirv_block_decoration.h
@@ -24,10 +24,10 @@
namespace transform {
/// AddSpirvBlockDecoration is a transform that adds an
-/// [[internal(spirv_block)]] attribute to any structure that is used as the
+/// `@internal(spirv_block)` attribute to any structure that is used as the
/// store type of a buffer. If that structure is nested inside another structure
/// or an array, then it is wrapped inside another structure which gets the
-/// [[internal(spirv_block)]] attribute instead.
+/// `@internal(spirv_block)` attribute instead.
class AddSpirvBlockDecoration
: public Castable<AddSpirvBlockDecoration, Transform> {
public:
@@ -43,7 +43,7 @@
~SpirvBlockDecoration() override;
/// @return a short description of the internal decoration which will be
- /// displayed as `[[internal(<name>)]]`
+ /// displayed as `@internal(<name>)`
std::string InternalName() const override;
/// Performs a deep clone of this object using the CloneContext `ctx`.
diff --git a/src/transform/add_spirv_block_decoration_test.cc b/src/transform/add_spirv_block_decoration_test.cc
index e504c50..3a8455f 100644
--- a/src/transform/add_spirv_block_decoration_test.cc
+++ b/src/transform/add_spirv_block_decoration_test.cc
@@ -42,7 +42,7 @@
var<private> p : S;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
p.f = 1.0;
}
@@ -57,11 +57,11 @@
TEST_F(AddSpirvBlockDecorationTest, Noop_UsedForShaderIO) {
auto* src = R"(
struct S {
- [[location(0)]]
+ @location(0)
f : f32;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() -> S {
return S();
}
@@ -75,23 +75,23 @@
TEST_F(AddSpirvBlockDecorationTest, BasicScalar) {
auto* src = R"(
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : f32;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u;
}
)";
auto* expect = R"(
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u_block {
inner : f32;
}
-[[group(0), binding(0)]] var<uniform> u : u_block;
+@group(0) @binding(0) var<uniform> u : u_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.inner;
}
@@ -104,23 +104,23 @@
TEST_F(AddSpirvBlockDecorationTest, BasicArray) {
auto* src = R"(
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : array<vec4<f32>, 4u>;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let a = u;
}
)";
auto* expect = R"(
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u_block {
inner : array<vec4<f32>, 4u>;
}
-[[group(0), binding(0)]] var<uniform> u : u_block;
+@group(0) @binding(0) var<uniform> u : u_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let a = u.inner;
}
@@ -135,10 +135,10 @@
auto* src = R"(
type Numbers = array<vec4<f32>, 4u>;
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : Numbers;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let a = u;
}
@@ -146,14 +146,14 @@
auto* expect = R"(
type Numbers = array<vec4<f32>, 4u>;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u_block {
inner : array<vec4<f32>, 4u>;
}
-[[group(0), binding(0)]] var<uniform> u : u_block;
+@group(0) @binding(0) var<uniform> u : u_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let a = u.inner;
}
@@ -170,23 +170,23 @@
f : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : S;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.f;
}
)";
auto* expect = R"(
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct S {
f : f32;
}
-[[group(0), binding(0)]] var<uniform> u : S;
+@group(0) @binding(0) var<uniform> u : S;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.f;
}
@@ -207,10 +207,10 @@
i : Inner;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : Outer;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.i.f;
}
@@ -220,14 +220,14 @@
f : f32;
}
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct Outer {
i : Inner;
}
-[[group(0), binding(0)]] var<uniform> u : Outer;
+@group(0) @binding(0) var<uniform> u : Outer;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.i.f;
}
@@ -248,13 +248,13 @@
i : Inner;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u0 : Outer;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<uniform> u1 : Inner;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@@ -265,21 +265,21 @@
f : f32;
}
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct Outer {
i : Inner;
}
-[[group(0), binding(0)]] var<uniform> u0 : Outer;
+@group(0) @binding(0) var<uniform> u0 : Outer;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u1_block {
inner : Inner;
}
-[[group(0), binding(1)]] var<uniform> u1 : u1_block;
+@group(0) @binding(1) var<uniform> u1 : u1_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
@@ -303,10 +303,10 @@
var<private> p : Outer;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<uniform> u : Inner;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = p.i.f;
let f1 = u.f;
@@ -323,14 +323,14 @@
var<private> p : Outer;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u_block {
inner : Inner;
}
-[[group(0), binding(1)]] var<uniform> u : u_block;
+@group(0) @binding(1) var<uniform> u : u_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = p.i.f;
let f1 = u.inner.f;
@@ -352,16 +352,16 @@
i : Inner;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u0 : S;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<uniform> u1 : Inner;
-[[group(0), binding(2)]]
+@group(0) @binding(2)
var<uniform> u2 : Inner;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@@ -373,23 +373,23 @@
f : f32;
}
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct S {
i : Inner;
}
-[[group(0), binding(0)]] var<uniform> u0 : S;
+@group(0) @binding(0) var<uniform> u0 : S;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u1_block {
inner : Inner;
}
-[[group(0), binding(1)]] var<uniform> u1 : u1_block;
+@group(0) @binding(1) var<uniform> u1 : u1_block;
-[[group(0), binding(2)]] var<uniform> u2 : u1_block;
+@group(0) @binding(2) var<uniform> u2 : u1_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
@@ -408,10 +408,10 @@
f : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : S;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.f;
let a = array<S, 4>();
@@ -422,14 +422,14 @@
f : f32;
}
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u_block {
inner : S;
}
-[[group(0), binding(0)]] var<uniform> u : u_block;
+@group(0) @binding(0) var<uniform> u : u_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f = u.inner.f;
let a = array<S, 4>();
@@ -447,13 +447,13 @@
f : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u0 : S;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<uniform> u1 : S;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.f;
let f1 = u1.f;
@@ -465,16 +465,16 @@
f : f32;
}
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u0_block {
inner : S;
}
-[[group(0), binding(0)]] var<uniform> u0 : u0_block;
+@group(0) @binding(0) var<uniform> u0 : u0_block;
-[[group(0), binding(1)]] var<uniform> u1 : u0_block;
+@group(0) @binding(1) var<uniform> u1 : u0_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.inner.f;
let f1 = u1.inner.f;
@@ -501,13 +501,13 @@
type MyOuter = Outer;
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u0 : MyOuter;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<uniform> u1 : MyInner;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@@ -520,23 +520,23 @@
type MyInner = Inner;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct Outer {
i : MyInner;
}
type MyOuter = Outer;
-[[group(0), binding(0)]] var<uniform> u0 : MyOuter;
+@group(0) @binding(0) var<uniform> u0 : MyOuter;
-[[internal(spirv_block)]]
+@internal(spirv_block)
struct u1_block {
inner : Inner;
}
-[[group(0), binding(1)]] var<uniform> u1 : u1_block;
+@group(0) @binding(1) var<uniform> u1 : u1_block;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
diff --git a/src/transform/array_length_from_uniform.h b/src/transform/array_length_from_uniform.h
index 6ab1598..bd7a461 100644
--- a/src/transform/array_length_from_uniform.h
+++ b/src/transform/array_length_from_uniform.h
@@ -38,7 +38,7 @@
/// buffer_size : array<u32, 8>;
/// };
///
-/// [[group(0), binding(30)]]
+/// @group(0) @binding(30)
/// var<uniform> buffer_size_ubo : buffer_size_struct;
/// ```
/// The binding group and number used for this uniform buffer is provided via
diff --git a/src/transform/array_length_from_uniform_test.cc b/src/transform/array_length_from_uniform_test.cc
index b9139a9..944fc6a 100644
--- a/src/transform/array_length_from_uniform_test.cc
+++ b/src/transform/array_length_from_uniform_test.cc
@@ -52,9 +52,9 @@
TEST_F(ArrayLengthFromUniformTest, Basic) {
auto* src = R"(
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
@@ -65,11 +65,11 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = (tint_symbol_1.buffer_size[0u][0u] / 4u);
}
@@ -95,9 +95,9 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@@ -108,16 +108,16 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
struct SB {
x : i32;
arr : array<i32>;
}
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
}
@@ -138,9 +138,9 @@
TEST_F(ArrayLengthFromUniformTest, WithStride) {
auto* src = R"(
-[[group(0), binding(0)]] var<storage, read> sb : [[stride(64)]] array<i32>;
+@group(0) @binding(0) var<storage, read> sb : @stride(64) array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
@@ -151,11 +151,11 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
-[[group(0), binding(0)]] var<storage, read> sb : [[stride(64)]] array<i32>;
+@group(0) @binding(0) var<storage, read> sb : @stride(64) array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = (tint_symbol_1.buffer_size[0u][0u] / 64u);
}
@@ -179,12 +179,12 @@
struct SB {
x : i32;
y : f32;
- arr : [[stride(64)]] array<i32>;
+ arr : @stride(64) array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@@ -195,17 +195,17 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
struct SB {
x : i32;
y : f32;
- arr : [[stride(64)]] array<i32>;
+ arr : @stride(64) array<i32>;
}
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 8u) / 64u);
}
@@ -239,13 +239,13 @@
arr4 : array<vec4<f32>>;
};
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
-[[group(2), binding(2)]] var<storage, read> sb3 : array<vec4<f32>>;
-[[group(3), binding(2)]] var<storage, read> sb4 : SB4;
-[[group(4), binding(2)]] var<storage, read> sb5 : array<vec4<f32>>;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
+@group(2) @binding(2) var<storage, read> sb3 : array<vec4<f32>>;
+@group(3) @binding(2) var<storage, read> sb4 : SB4;
+@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@@ -261,7 +261,7 @@
buffer_size : array<vec4<u32>, 2u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
@@ -278,17 +278,17 @@
arr4 : array<vec4<f32>>;
}
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
-[[group(2), binding(2)]] var<storage, read> sb3 : array<vec4<f32>>;
+@group(2) @binding(2) var<storage, read> sb3 : array<vec4<f32>>;
-[[group(3), binding(2)]] var<storage, read> sb4 : SB4;
+@group(3) @binding(2) var<storage, read> sb4 : SB4;
-[[group(4), binding(2)]] var<storage, read> sb5 : array<vec4<f32>>;
+@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = ((tint_symbol_1.buffer_size[0u][1u] - 16u) / 16u);
@@ -331,13 +331,13 @@
arr4 : array<vec4<f32>>;
};
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
-[[group(2), binding(2)]] var<storage, read> sb3 : array<vec4<f32>>;
-[[group(3), binding(2)]] var<storage, read> sb4 : SB4;
-[[group(4), binding(2)]] var<storage, read> sb5 : array<vec4<f32>>;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
+@group(2) @binding(2) var<storage, read> sb3 : array<vec4<f32>>;
+@group(3) @binding(2) var<storage, read> sb4 : SB4;
+@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len3 : u32 = arrayLength(&sb3);
@@ -350,7 +350,7 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
@@ -367,17 +367,17 @@
arr4 : array<vec4<f32>>;
}
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
-[[group(2), binding(2)]] var<storage, read> sb3 : array<vec4<f32>>;
+@group(2) @binding(2) var<storage, read> sb3 : array<vec4<f32>>;
-[[group(3), binding(2)]] var<storage, read> sb4 : SB4;
+@group(3) @binding(2) var<storage, read> sb4 : SB4;
-[[group(4), binding(2)]] var<storage, read> sb5 : array<vec4<f32>>;
+@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len3 : u32 = (tint_symbol_1.buffer_size[0u][2u] / 16u);
@@ -409,9 +409,9 @@
arr : array<i32>;
}
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
ignore(&(sb.arr));
}
@@ -442,11 +442,11 @@
arr2 : array<vec4<f32>>;
};
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@@ -459,7 +459,7 @@
buffer_size : array<vec4<u32>, 1u>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
+@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
@@ -471,11 +471,11 @@
arr2 : array<vec4<f32>>;
}
-[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(2) var<storage, read> sb1 : SB1;
-[[group(1), binding(2)]] var<storage, read> sb2 : SB2;
+@group(1) @binding(2) var<storage, read> sb2 : SB2;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = arrayLength(&(sb2.arr2));
diff --git a/src/transform/binding_remapper_test.cc b/src/transform/binding_remapper_test.cc
index de85cb0..5827cb2 100644
--- a/src/transform/binding_remapper_test.cc
+++ b/src/transform/binding_remapper_test.cc
@@ -30,11 +30,11 @@
a : f32;
}
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -55,11 +55,11 @@
a : f32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -69,11 +69,11 @@
a : f32;
}
-[[group(1), binding(2)]] var<storage, read> a : S;
+@group(1) @binding(2) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -83,7 +83,7 @@
BindingRemapper::BindingPoints{
{{2, 1}, {1, 2}}, // Remap
{{4, 5}, {6, 7}}, // Not found
- // Keep [[group(3), binding(2)]] as is
+ // Keep @group(3) @binding(2) as is
},
BindingRemapper::AccessControls{});
auto got = Run<BindingRemapper>(src, data);
@@ -97,13 +97,13 @@
a : f32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, write> b : S;
+@group(3) @binding(2) var<storage, write> b : S;
-[[group(4), binding(3)]] var<storage, read> c : S;
+@group(4) @binding(3) var<storage, read> c : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -113,13 +113,13 @@
a : f32;
}
-[[group(2), binding(1)]] var<storage, write> a : S;
+@group(2) @binding(1) var<storage, write> a : S;
-[[group(3), binding(2)]] var<storage, write> b : S;
+@group(3) @binding(2) var<storage, write> b : S;
-[[group(4), binding(3)]] var<storage, read> c : S;
+@group(4) @binding(3) var<storage, read> c : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -129,7 +129,7 @@
BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{
{{2, 1}, ast::Access::kWrite}, // Modify access control
- // Keep [[group(3), binding(2)]] as is
+ // Keep @group(3) @binding(2) as is
{{4, 3}, ast::Access::kRead}, // Add access control
});
auto got = Run<BindingRemapper>(src, data);
@@ -151,13 +151,13 @@
type A = S;
-[[group(2), binding(1)]] var<storage> a : ReadOnlyS;
+@group(2) @binding(1) var<storage> a : ReadOnlyS;
-[[group(3), binding(2)]] var<storage> b : WriteOnlyS;
+@group(3) @binding(2) var<storage> b : WriteOnlyS;
-[[group(4), binding(3)]] var<storage> c : A;
+@group(4) @binding(3) var<storage> c : A;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -173,13 +173,13 @@
type A = S;
-[[group(2), binding(1)]] var<storage, write> a : S;
+@group(2) @binding(1) var<storage, write> a : S;
-[[group(3), binding(2)]] var<storage> b : WriteOnlyS;
+@group(3) @binding(2) var<storage> b : WriteOnlyS;
-[[group(4), binding(3)]] var<storage, write> c : S;
+@group(4) @binding(3) var<storage, write> c : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -189,7 +189,7 @@
BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{
{{2, 1}, ast::Access::kWrite}, // Modify access control
- // Keep [[group(3), binding(2)]] as is
+ // Keep @group(3) @binding(2) as is
{{4, 3}, ast::Access::kRead}, // Add access control
});
auto got = Run<BindingRemapper>(src, data);
@@ -203,11 +203,11 @@
a : f32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -217,11 +217,11 @@
a : f32;
}
-[[group(4), binding(5)]] var<storage, write> a : S;
+@group(4) @binding(5) var<storage, write> a : S;
-[[group(6), binding(7)]] var<storage, write> b : S;
+@group(6) @binding(7) var<storage, write> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -247,15 +247,15 @@
i : i32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[group(4), binding(3)]] var<storage, read> c : S;
+@group(4) @binding(3) var<storage, read> c : S;
-[[group(5), binding(4)]] var<storage, read> d : S;
+@group(5) @binding(4) var<storage, read> d : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i);
}
@@ -266,15 +266,15 @@
i : i32;
}
-[[internal(disable_validation__binding_point_collision), group(1), binding(1)]] var<storage, read> a : S;
+@internal(disable_validation__binding_point_collision) @group(1) @binding(1) var<storage, read> a : S;
-[[internal(disable_validation__binding_point_collision), group(1), binding(1)]] var<storage, read> b : S;
+@internal(disable_validation__binding_point_collision) @group(1) @binding(1) var<storage, read> b : S;
-[[internal(disable_validation__binding_point_collision), group(5), binding(4)]] var<storage, read> c : S;
+@internal(disable_validation__binding_point_collision) @group(5) @binding(4) var<storage, read> c : S;
-[[internal(disable_validation__binding_point_collision), group(5), binding(4)]] var<storage, read> d : S;
+@internal(disable_validation__binding_point_collision) @group(5) @binding(4) var<storage, read> d : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i);
}
@@ -299,20 +299,20 @@
i : i32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
+@group(2) @binding(1) var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[group(4), binding(3)]] var<storage, read> c : S;
+@group(4) @binding(3) var<storage, read> c : S;
-[[group(5), binding(4)]] var<storage, read> d : S;
+@group(5) @binding(4) var<storage, read> d : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f1() {
let x : i32 = (a.i + c.i);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f2() {
let x : i32 = (b.i + d.i);
}
@@ -323,20 +323,20 @@
i : i32;
}
-[[group(1), binding(1)]] var<storage, read> a : S;
+@group(1) @binding(1) var<storage, read> a : S;
-[[group(1), binding(1)]] var<storage, read> b : S;
+@group(1) @binding(1) var<storage, read> b : S;
-[[group(5), binding(4)]] var<storage, read> c : S;
+@group(5) @binding(4) var<storage, read> c : S;
-[[group(5), binding(4)]] var<storage, read> d : S;
+@group(5) @binding(4) var<storage, read> d : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f1() {
let x : i32 = (a.i + c.i);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f2() {
let x : i32 = (b.i + d.i);
}
@@ -361,10 +361,10 @@
a : f32;
};
-[[group(2), binding(1)]] var<storage, read> a : S;
-[[group(3), binding(2)]] var<storage, read> b : S;
+@group(2) @binding(1) var<storage, read> a : S;
+@group(3) @binding(2) var<storage, read> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {}
)";
diff --git a/src/transform/calculate_array_length_test.cc b/src/transform/calculate_array_length_test.cc
index 83e0ac7..88643ae 100644
--- a/src/transform/calculate_array_length_test.cc
+++ b/src/transform/calculate_array_length_test.cc
@@ -38,21 +38,21 @@
TEST_F(CalculateArrayLengthTest, Basic) {
auto* src = R"(
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
)";
auto* expect = R"(
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : array<i32>, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -73,9 +73,9 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@@ -87,12 +87,12 @@
arr : array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -108,9 +108,9 @@
TEST_F(CalculateArrayLengthTest, InSameBlock) {
auto* src = R"(
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : u32 = arrayLength(&sb);
var b : u32 = arrayLength(&sb);
@@ -119,12 +119,12 @@
)";
auto* expect = R"(
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : array<i32>, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : array<i32>;
+@group(0) @binding(0) var<storage, read> sb : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -147,9 +147,9 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : u32 = arrayLength(&sb.arr);
var b : u32 = arrayLength(&sb.arr);
@@ -163,12 +163,12 @@
arr : array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -186,21 +186,21 @@
TEST_F(CalculateArrayLengthTest, WithStride) {
auto* src = R"(
-[[group(0), binding(0)]] var<storage, read> sb : [[stride(64)]] array<i32>;
+@group(0) @binding(0) var<storage, read> sb : @stride(64) array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
)";
auto* expect = R"(
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : [[stride(64)]] array<i32>, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : @stride(64) array<i32>, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : [[stride(64)]] array<i32>;
+@group(0) @binding(0) var<storage, read> sb : @stride(64) array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -219,12 +219,12 @@
struct SB {
x : i32;
y : f32;
- arr : [[stride(64)]] array<i32>;
+ arr : @stride(64) array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@@ -234,15 +234,15 @@
struct SB {
x : i32;
y : f32;
- arr : [[stride(64)]] array<i32>;
+ arr : @stride(64) array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@@ -263,9 +263,9 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
if (true) {
var len : u32 = arrayLength(&sb.arr);
@@ -283,12 +283,12 @@
arr : array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb : SB;
+@group(0) @binding(0) var<storage, read> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
if (true) {
var tint_symbol_1 : u32 = 0u;
@@ -323,13 +323,13 @@
arr2 : array<vec4<f32>>;
};
-[[group(0), binding(0)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(0) var<storage, read> sb1 : SB1;
-[[group(0), binding(1)]] var<storage, read> sb2 : SB2;
+@group(0) @binding(1) var<storage, read> sb2 : SB2;
-[[group(0), binding(2)]] var<storage, read> sb3 : array<i32>;
+@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@@ -339,32 +339,32 @@
)";
auto* expect = R"(
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : array<i32>, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>)
struct SB1 {
x : i32;
arr1 : array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB1, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB1, result : ptr<function, u32>)
struct SB2 {
x : i32;
arr2 : array<vec4<f32>>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB2, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB2, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> sb1 : SB1;
+@group(0) @binding(0) var<storage, read> sb1 : SB1;
-[[group(0), binding(1)]] var<storage, read> sb2 : SB2;
+@group(0) @binding(1) var<storage, read> sb2 : SB2;
-[[group(0), binding(2)]] var<storage, read> sb3 : array<i32>;
+@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, &(tint_symbol_1));
@@ -394,10 +394,10 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read> a : SB;
-[[group(0), binding(1)]] var<storage, read> b : SB;
+@group(0) @binding(0) var<storage, read> a : SB;
+@group(0) @binding(1) var<storage, read> b : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x = &a;
var a : u32 = arrayLength(&a.arr);
@@ -414,14 +414,14 @@
arr : array<i32>;
}
-[[internal(intrinsic_buffer_size)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
+@internal(intrinsic_buffer_size)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr<function, u32>)
-[[group(0), binding(0)]] var<storage, read> a : SB;
+@group(0) @binding(0) var<storage, read> a : SB;
-[[group(0), binding(1)]] var<storage, read> b : SB;
+@group(0) @binding(1) var<storage, read> b : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(a, &(tint_symbol_1));
diff --git a/src/transform/canonicalize_entry_point_io.h b/src/transform/canonicalize_entry_point_io.h
index baaa65a..0bf16ba 100644
--- a/src/transform/canonicalize_entry_point_io.h
+++ b/src/transform/canonicalize_entry_point_io.h
@@ -31,13 +31,13 @@
/// Before:
/// ```
/// struct Locations{
-/// [[location(1)]] loc1 : f32;
-/// [[location(2)]] loc2 : vec4<u32>;
+/// @location(1) loc1 : f32;
+/// @location(2) loc2 : vec4<u32>;
/// };
///
-/// [[stage(fragment)]]
-/// fn frag_main([[builtin(position)]] coord : vec4<f32>,
-/// locations : Locations) -> [[location(0)]] f32 {
+/// @stage(fragment)
+/// fn frag_main(@builtin(position) coord : vec4<f32>,
+/// locations : Locations) -> @location(0) f32 {
/// if (coord.w > 1.0) {
/// return 0.0;
/// }
@@ -54,13 +54,13 @@
/// };
///
/// struct frag_main_in {
-/// [[builtin(position)]] coord : vec4<f32>;
-/// [[location(1)]] loc1 : f32;
-/// [[location(2)]] loc2 : vec4<u32>
+/// @builtin(position) coord : vec4<f32>;
+/// @location(1) loc1 : f32;
+/// @location(2) loc2 : vec4<u32>
/// };
///
/// struct frag_main_out {
-/// [[location(0)]] loc0 : f32;
+/// @location(0) loc0 : f32;
/// };
///
/// fn frag_main_inner(coord : vec4<f32>,
@@ -72,7 +72,7 @@
/// return col;
/// }
///
-/// [[stage(fragment)]]
+/// @stage(fragment)
/// fn frag_main(in : frag_main_in) -> frag_main_out {
/// let inner_retval = frag_main_inner(in.coord, Locations(in.loc1, in.loc2));
/// var wrapper_result : frag_main_out;
diff --git a/src/transform/canonicalize_entry_point_io_test.cc b/src/transform/canonicalize_entry_point_io_test.cc
index 3c16ee5..0219ff2 100644
--- a/src/transform/canonicalize_entry_point_io_test.cc
+++ b/src/transform/canonicalize_entry_point_io_test.cc
@@ -51,11 +51,11 @@
// Test that we do not introduce wrapper functions when there is no shader IO
// to process.
auto* src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main() {
}
)";
@@ -72,26 +72,26 @@
TEST_F(CanonicalizeEntryPointIOTest, Parameters_Spirv) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main([[location(1)]] loc1 : f32,
- [[location(2)]] loc2 : vec4<u32>,
- [[builtin(position)]] coord : vec4<f32>) {
+@stage(fragment)
+fn frag_main(@location(1) loc1 : f32,
+ @location(2) loc2 : vec4<u32>,
+ @builtin(position) coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
}
)";
auto* expect = R"(
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> loc1_1 : f32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> loc1_1 : f32;
-[[location(2), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> loc2_1 : vec4<u32>;
+@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> loc2_1 : vec4<u32>;
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<in> coord_1 : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<in> coord_1 : vec4<f32>;
fn frag_main_inner(loc1 : f32, loc2 : vec4<u32>, coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
frag_main_inner(loc1_1, loc2_1, coord_1);
}
@@ -107,19 +107,19 @@
TEST_F(CanonicalizeEntryPointIOTest, Parameters_Msl) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main([[location(1)]] loc1 : f32,
- [[location(2)]] loc2 : vec4<u32>,
- [[builtin(position)]] coord : vec4<f32>) {
+@stage(fragment)
+fn frag_main(@location(1) loc1 : f32,
+ @location(2) loc2 : vec4<u32>,
+ @builtin(position) coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
}
)";
auto* expect = R"(
struct tint_symbol_1 {
- [[location(1)]]
+ @location(1)
loc1 : f32;
- [[location(2)]]
+ @location(2)
loc2 : vec4<u32>;
}
@@ -127,8 +127,8 @@
var col : f32 = (coord.x * loc1);
}
-[[stage(fragment)]]
-fn frag_main([[builtin(position)]] coord : vec4<f32>, tint_symbol : tint_symbol_1) {
+@stage(fragment)
+fn frag_main(@builtin(position) coord : vec4<f32>, tint_symbol : tint_symbol_1) {
frag_main_inner(tint_symbol.loc1, tint_symbol.loc2, coord);
}
)";
@@ -143,21 +143,21 @@
TEST_F(CanonicalizeEntryPointIOTest, Parameters_Hlsl) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main([[location(1)]] loc1 : f32,
- [[location(2)]] loc2 : vec4<u32>,
- [[builtin(position)]] coord : vec4<f32>) {
+@stage(fragment)
+fn frag_main(@location(1) loc1 : f32,
+ @location(2) loc2 : vec4<u32>,
+ @builtin(position) coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
}
)";
auto* expect = R"(
struct tint_symbol_1 {
- [[location(1)]]
+ @location(1)
loc1 : f32;
- [[location(2)]]
+ @location(2)
loc2 : vec4<u32>;
- [[builtin(position)]]
+ @builtin(position)
coord : vec4<f32>;
}
@@ -165,7 +165,7 @@
var col : f32 = (coord.x * loc1);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol : tint_symbol_1) {
frag_main_inner(tint_symbol.loc1, tint_symbol.loc2, tint_symbol.coord);
}
@@ -183,8 +183,8 @@
auto* src = R"(
type myf32 = f32;
-[[stage(fragment)]]
-fn frag_main([[location(1)]] loc1 : myf32) {
+@stage(fragment)
+fn frag_main(@location(1) loc1 : myf32) {
var x : myf32 = loc1;
}
)";
@@ -193,7 +193,7 @@
type myf32 = f32;
struct tint_symbol_1 {
- [[location(1)]]
+ @location(1)
loc1 : f32;
}
@@ -201,7 +201,7 @@
var x : myf32 = loc1;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol : tint_symbol_1) {
frag_main_inner(tint_symbol.loc1);
}
@@ -218,15 +218,15 @@
TEST_F(CanonicalizeEntryPointIOTest, StructParameters_Spirv) {
auto* src = R"(
struct FragBuiltins {
- [[builtin(position)]] coord : vec4<f32>;
+ @builtin(position) coord : vec4<f32>;
};
struct FragLocations {
- [[location(1)]] loc1 : f32;
- [[location(2)]] loc2 : vec4<u32>;
+ @location(1) loc1 : f32;
+ @location(2) loc2 : vec4<u32>;
};
-[[stage(fragment)]]
-fn frag_main([[location(0)]] loc0 : f32,
+@stage(fragment)
+fn frag_main(@location(0) loc0 : f32,
locations : FragLocations,
builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@@ -234,13 +234,13 @@
)";
auto* expect = R"(
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<in> loc0_1 : f32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<in> loc0_1 : f32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> loc1_1 : f32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> loc1_1 : f32;
-[[location(2), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> loc2_1 : vec4<u32>;
+@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> loc2_1 : vec4<u32>;
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<in> coord_1 : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<in> coord_1 : vec4<f32>;
struct FragBuiltins {
coord : vec4<f32>;
@@ -255,7 +255,7 @@
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
frag_main_inner(loc0_1, FragLocations(loc1_1, loc2_1), FragBuiltins(coord_1));
}
@@ -272,15 +272,15 @@
TEST_F(CanonicalizeEntryPointIOTest, StructParameters_kMsl) {
auto* src = R"(
struct FragBuiltins {
- [[builtin(position)]] coord : vec4<f32>;
+ @builtin(position) coord : vec4<f32>;
};
struct FragLocations {
- [[location(1)]] loc1 : f32;
- [[location(2)]] loc2 : vec4<u32>;
+ @location(1) loc1 : f32;
+ @location(2) loc2 : vec4<u32>;
};
-[[stage(fragment)]]
-fn frag_main([[location(0)]] loc0 : f32,
+@stage(fragment)
+fn frag_main(@location(0) loc0 : f32,
locations : FragLocations,
builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@@ -298,11 +298,11 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
loc0 : f32;
- [[location(1)]]
+ @location(1)
loc1 : f32;
- [[location(2)]]
+ @location(2)
loc2 : vec4<u32>;
}
@@ -310,8 +310,8 @@
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
}
-[[stage(fragment)]]
-fn frag_main([[builtin(position)]] coord : vec4<f32>, tint_symbol : tint_symbol_1) {
+@stage(fragment)
+fn frag_main(@builtin(position) coord : vec4<f32>, tint_symbol : tint_symbol_1) {
frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(coord));
}
)";
@@ -327,15 +327,15 @@
TEST_F(CanonicalizeEntryPointIOTest, StructParameters_Hlsl) {
auto* src = R"(
struct FragBuiltins {
- [[builtin(position)]] coord : vec4<f32>;
+ @builtin(position) coord : vec4<f32>;
};
struct FragLocations {
- [[location(1)]] loc1 : f32;
- [[location(2)]] loc2 : vec4<u32>;
+ @location(1) loc1 : f32;
+ @location(2) loc2 : vec4<u32>;
};
-[[stage(fragment)]]
-fn frag_main([[location(0)]] loc0 : f32,
+@stage(fragment)
+fn frag_main(@location(0) loc0 : f32,
locations : FragLocations,
builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@@ -353,13 +353,13 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
loc0 : f32;
- [[location(1)]]
+ @location(1)
loc1 : f32;
- [[location(2)]]
+ @location(2)
loc2 : vec4<u32>;
- [[builtin(position)]]
+ @builtin(position)
coord : vec4<f32>;
}
@@ -367,7 +367,7 @@
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol : tint_symbol_1) {
frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(tint_symbol.coord));
}
@@ -383,20 +383,20 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Spirv) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main() -> [[builtin(frag_depth)]] f32 {
+@stage(fragment)
+fn frag_main() -> @builtin(frag_depth) f32 {
return 1.0;
}
)";
auto* expect = R"(
-[[builtin(frag_depth), internal(disable_validation__ignore_storage_class)]] var<out> value : f32;
+@builtin(frag_depth) @internal(disable_validation__ignore_storage_class) var<out> value : f32;
fn frag_main_inner() -> f32 {
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
let inner_result = frag_main_inner();
value = inner_result;
@@ -413,15 +413,15 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Msl) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main() -> [[builtin(frag_depth)]] f32 {
+@stage(fragment)
+fn frag_main() -> @builtin(frag_depth) f32 {
return 1.0;
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
value : f32;
}
@@ -429,7 +429,7 @@
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -448,15 +448,15 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Hlsl) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main() -> [[builtin(frag_depth)]] f32 {
+@stage(fragment)
+fn frag_main() -> @builtin(frag_depth) f32 {
return 1.0;
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
value : f32;
}
@@ -464,7 +464,7 @@
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -484,12 +484,12 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Spirv) {
auto* src = R"(
struct FragOutput {
- [[location(0)]] color : vec4<f32>;
- [[builtin(frag_depth)]] depth : f32;
- [[builtin(sample_mask)]] mask : u32;
+ @location(0) color : vec4<f32>;
+ @builtin(frag_depth) depth : f32;
+ @builtin(sample_mask) mask : u32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> FragOutput {
var output : FragOutput;
output.depth = 1.0;
@@ -500,11 +500,11 @@
)";
auto* expect = R"(
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<out> color_1 : vec4<f32>;
+@location(0) @internal(disable_validation__ignore_storage_class) var<out> color_1 : vec4<f32>;
-[[builtin(frag_depth), internal(disable_validation__ignore_storage_class)]] var<out> depth_1 : f32;
+@builtin(frag_depth) @internal(disable_validation__ignore_storage_class) var<out> depth_1 : f32;
-[[builtin(sample_mask), internal(disable_validation__ignore_storage_class)]] var<out> mask_1 : array<u32, 1>;
+@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var<out> mask_1 : array<u32, 1>;
struct FragOutput {
color : vec4<f32>;
@@ -520,7 +520,7 @@
return output;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
let inner_result = frag_main_inner();
color_1 = inner_result.color;
@@ -540,12 +540,12 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Msl) {
auto* src = R"(
struct FragOutput {
- [[location(0)]] color : vec4<f32>;
- [[builtin(frag_depth)]] depth : f32;
- [[builtin(sample_mask)]] mask : u32;
+ @location(0) color : vec4<f32>;
+ @builtin(frag_depth) depth : f32;
+ @builtin(sample_mask) mask : u32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> FragOutput {
var output : FragOutput;
output.depth = 1.0;
@@ -563,11 +563,11 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
color : vec4<f32>;
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
depth : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
mask : u32;
}
@@ -579,7 +579,7 @@
return output;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -601,12 +601,12 @@
TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Hlsl) {
auto* src = R"(
struct FragOutput {
- [[location(0)]] color : vec4<f32>;
- [[builtin(frag_depth)]] depth : f32;
- [[builtin(sample_mask)]] mask : u32;
+ @location(0) color : vec4<f32>;
+ @builtin(frag_depth) depth : f32;
+ @builtin(sample_mask) mask : u32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> FragOutput {
var output : FragOutput;
output.depth = 1.0;
@@ -624,11 +624,11 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
color : vec4<f32>;
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
depth : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
mask : u32;
}
@@ -640,7 +640,7 @@
return output;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -663,33 +663,33 @@
StructParameters_SharedDeviceFunction_Spirv) {
auto* src = R"(
struct FragmentInput {
- [[location(0)]] value : f32;
- [[location(1)]] mul : f32;
+ @location(0) value : f32;
+ @location(1) mul : f32;
};
fn foo(x : FragmentInput) -> f32 {
return x.value * x.mul;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
)";
auto* expect = R"(
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<in> value_1 : f32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<in> value_1 : f32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> mul_1 : f32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> mul_1 : f32;
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<in> value_2 : f32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<in> value_2 : f32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> mul_2 : f32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> mul_2 : f32;
struct FragmentInput {
value : f32;
@@ -704,7 +704,7 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1() {
frag_main1_inner(FragmentInput(value_1, mul_1));
}
@@ -713,7 +713,7 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2() {
frag_main2_inner(FragmentInput(value_2, mul_2));
}
@@ -731,20 +731,20 @@
StructParameters_SharedDeviceFunction_Msl) {
auto* src = R"(
struct FragmentInput {
- [[location(0)]] value : f32;
- [[location(1)]] mul : f32;
+ @location(0) value : f32;
+ @location(1) mul : f32;
};
fn foo(x : FragmentInput) -> f32 {
return x.value * x.mul;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
@@ -761,9 +761,9 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
value : f32;
- [[location(1)]]
+ @location(1)
mul : f32;
}
@@ -771,15 +771,15 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(tint_symbol : tint_symbol_1) {
frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul));
}
struct tint_symbol_3 {
- [[location(0)]]
+ @location(0)
value : f32;
- [[location(1)]]
+ @location(1)
mul : f32;
}
@@ -787,7 +787,7 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2(tint_symbol_2 : tint_symbol_3) {
frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul));
}
@@ -805,20 +805,20 @@
StructParameters_SharedDeviceFunction_Hlsl) {
auto* src = R"(
struct FragmentInput {
- [[location(0)]] value : f32;
- [[location(1)]] mul : f32;
+ @location(0) value : f32;
+ @location(1) mul : f32;
};
fn foo(x : FragmentInput) -> f32 {
return x.value * x.mul;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2(inputs : FragmentInput) {
var x : f32 = foo(inputs);
}
@@ -835,9 +835,9 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
value : f32;
- [[location(1)]]
+ @location(1)
mul : f32;
}
@@ -845,15 +845,15 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(tint_symbol : tint_symbol_1) {
frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul));
}
struct tint_symbol_3 {
- [[location(0)]]
+ @location(0)
value : f32;
- [[location(1)]]
+ @location(1)
mul : f32;
}
@@ -861,7 +861,7 @@
var x : f32 = foo(inputs);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2(tint_symbol_2 : tint_symbol_3) {
frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul));
}
@@ -878,8 +878,8 @@
TEST_F(CanonicalizeEntryPointIOTest, Struct_ModuleScopeVariable) {
auto* src = R"(
struct FragmentInput {
- [[location(0)]] col1 : f32;
- [[location(1)]] col2 : f32;
+ @location(0) col1 : f32;
+ @location(1) col2 : f32;
};
var<private> global_inputs : FragmentInput;
@@ -892,7 +892,7 @@
return global_inputs.col2 * 2.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(inputs : FragmentInput) {
global_inputs = inputs;
var r : f32 = foo();
@@ -917,9 +917,9 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
col1 : f32;
- [[location(1)]]
+ @location(1)
col2 : f32;
}
@@ -929,7 +929,7 @@
var g : f32 = bar();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1(tint_symbol : tint_symbol_1) {
frag_main1_inner(FragmentInput(tint_symbol.col1, tint_symbol.col2));
}
@@ -948,13 +948,13 @@
type myf32 = f32;
struct FragmentInput {
- [[location(0)]] col1 : myf32;
- [[location(1)]] col2 : myf32;
+ @location(0) col1 : myf32;
+ @location(1) col2 : myf32;
};
struct FragmentOutput {
- [[location(0)]] col1 : myf32;
- [[location(1)]] col2 : myf32;
+ @location(0) col1 : myf32;
+ @location(1) col2 : myf32;
};
type MyFragmentInput = FragmentInput;
@@ -965,7 +965,7 @@
return x.col1;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(inputs : MyFragmentInput) -> MyFragmentOutput {
var x : myf32 = foo(inputs);
return MyFragmentOutput(x, inputs.col2);
@@ -994,16 +994,16 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
col1 : f32;
- [[location(1)]]
+ @location(1)
col2 : f32;
}
struct tint_symbol_2 {
- [[location(0)]]
+ @location(0)
col1 : f32;
- [[location(1)]]
+ @location(1)
col2 : f32;
}
@@ -1012,7 +1012,7 @@
return MyFragmentOutput(x, inputs.col2);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inner_result = frag_main_inner(MyFragmentInput(tint_symbol.col1, tint_symbol.col2));
var wrapper_result : tint_symbol_2;
@@ -1033,25 +1033,25 @@
TEST_F(CanonicalizeEntryPointIOTest, InterpolateAttributes) {
auto* src = R"(
struct VertexOut {
- [[builtin(position)]] pos : vec4<f32>;
- [[location(1), interpolate(flat)]] loc1: f32;
- [[location(2), interpolate(linear, sample)]] loc2 : f32;
- [[location(3), interpolate(perspective, centroid)]] loc3 : f32;
+ @builtin(position) pos : vec4<f32>;
+ @location(1) @interpolate(flat) loc1: f32;
+ @location(2) @interpolate(linear, sample) loc2 : f32;
+ @location(3) @interpolate(perspective, centroid) loc3 : f32;
};
struct FragmentIn {
- [[location(1), interpolate(flat)]] loc1: f32;
- [[location(2), interpolate(linear, sample)]] loc2 : f32;
+ @location(1) @interpolate(flat) loc1: f32;
+ @location(2) @interpolate(linear, sample) loc2 : f32;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> VertexOut {
return VertexOut();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(inputs : FragmentIn,
- [[location(3), interpolate(perspective, centroid)]] loc3 : f32) {
+ @location(3) @interpolate(perspective, centroid) loc3 : f32) {
let x = inputs.loc1 + inputs.loc2 + loc3;
}
)";
@@ -1070,13 +1070,13 @@
}
struct tint_symbol {
- [[location(1), interpolate(flat)]]
+ @location(1) @interpolate(flat)
loc1 : f32;
- [[location(2), interpolate(linear, sample)]]
+ @location(2) @interpolate(linear, sample)
loc2 : f32;
- [[location(3), interpolate(perspective, centroid)]]
+ @location(3) @interpolate(perspective, centroid)
loc3 : f32;
- [[builtin(position)]]
+ @builtin(position)
pos : vec4<f32>;
}
@@ -1084,7 +1084,7 @@
return VertexOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> tint_symbol {
let inner_result = vert_main_inner();
var wrapper_result : tint_symbol;
@@ -1096,11 +1096,11 @@
}
struct tint_symbol_2 {
- [[location(1), interpolate(flat)]]
+ @location(1) @interpolate(flat)
loc1 : f32;
- [[location(2), interpolate(linear, sample)]]
+ @location(2) @interpolate(linear, sample)
loc2 : f32;
- [[location(3), interpolate(perspective, centroid)]]
+ @location(3) @interpolate(perspective, centroid)
loc3 : f32;
}
@@ -1108,7 +1108,7 @@
let x = ((inputs.loc1 + inputs.loc2) + loc3);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol_1 : tint_symbol_2) {
frag_main_inner(FragmentIn(tint_symbol_1.loc1, tint_symbol_1.loc2), tint_symbol_1.loc3);
}
@@ -1127,33 +1127,33 @@
// fragment inputs, but not vertex inputs or fragment outputs.
auto* src = R"(
struct VertexIn {
- [[location(0)]] i : i32;
- [[location(1)]] u : u32;
- [[location(2)]] vi : vec4<i32>;
- [[location(3)]] vu : vec4<u32>;
+ @location(0) i : i32;
+ @location(1) u : u32;
+ @location(2) vi : vec4<i32>;
+ @location(3) vu : vec4<u32>;
};
struct VertexOut {
- [[location(0)]] i : i32;
- [[location(1)]] u : u32;
- [[location(2)]] vi : vec4<i32>;
- [[location(3)]] vu : vec4<u32>;
- [[builtin(position)]] pos : vec4<f32>;
+ @location(0) i : i32;
+ @location(1) u : u32;
+ @location(2) vi : vec4<i32>;
+ @location(3) vu : vec4<u32>;
+ @builtin(position) pos : vec4<f32>;
};
struct FragmentInterface {
- [[location(0)]] i : i32;
- [[location(1)]] u : u32;
- [[location(2)]] vi : vec4<i32>;
- [[location(3)]] vu : vec4<u32>;
+ @location(0) i : i32;
+ @location(1) u : u32;
+ @location(2) vi : vec4<i32>;
+ @location(3) vu : vec4<u32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(in : VertexIn) -> VertexOut {
return VertexOut(in.i, in.u, in.vi, in.vu, vec4<f32>());
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(inputs : FragmentInterface) -> FragmentInterface {
return inputs;
}
@@ -1161,39 +1161,39 @@
auto* expect =
R"(
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<in> i_1 : i32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<in> i_1 : i32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> u_1 : u32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> u_1 : u32;
-[[location(2), internal(disable_validation__ignore_storage_class)]] var<in> vi_1 : vec4<i32>;
+@location(2) @internal(disable_validation__ignore_storage_class) var<in> vi_1 : vec4<i32>;
-[[location(3), internal(disable_validation__ignore_storage_class)]] var<in> vu_1 : vec4<u32>;
+@location(3) @internal(disable_validation__ignore_storage_class) var<in> vu_1 : vec4<u32>;
-[[location(0), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<out> i_2 : i32;
+@location(0) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<out> i_2 : i32;
-[[location(1), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<out> u_2 : u32;
+@location(1) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<out> u_2 : u32;
-[[location(2), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<out> vi_2 : vec4<i32>;
+@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<out> vi_2 : vec4<i32>;
-[[location(3), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<out> vu_2 : vec4<u32>;
+@location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<out> vu_2 : vec4<u32>;
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<out> pos_1 : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<out> pos_1 : vec4<f32>;
-[[location(0), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> i_3 : i32;
+@location(0) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> i_3 : i32;
-[[location(1), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> u_3 : u32;
+@location(1) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> u_3 : u32;
-[[location(2), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> vi_3 : vec4<i32>;
+@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> vi_3 : vec4<i32>;
-[[location(3), interpolate(flat), internal(disable_validation__ignore_storage_class)]] var<in> vu_3 : vec4<u32>;
+@location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var<in> vu_3 : vec4<u32>;
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<out> i_4 : i32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<out> i_4 : i32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<out> u_4 : u32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<out> u_4 : u32;
-[[location(2), internal(disable_validation__ignore_storage_class)]] var<out> vi_4 : vec4<i32>;
+@location(2) @internal(disable_validation__ignore_storage_class) var<out> vi_4 : vec4<i32>;
-[[location(3), internal(disable_validation__ignore_storage_class)]] var<out> vu_4 : vec4<u32>;
+@location(3) @internal(disable_validation__ignore_storage_class) var<out> vu_4 : vec4<u32>;
struct VertexIn {
i : i32;
@@ -1221,7 +1221,7 @@
return VertexOut(in.i, in.u, in.vi, in.vu, vec4<f32>());
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() {
let inner_result = vert_main_inner(VertexIn(i_1, u_1, vi_1, vu_1));
i_2 = inner_result.i;
@@ -1235,7 +1235,7 @@
return inputs;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
let inner_result_1 = frag_main_inner(FragmentInterface(i_3, u_3, vi_3, vu_3));
i_4 = inner_result_1.i;
@@ -1259,12 +1259,12 @@
[[builtin(position), invariant]] pos : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn main1() -> VertexOut {
return VertexOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn main2() -> [[builtin(position), invariant]] vec4<f32> {
return vec4<f32>();
}
@@ -1276,7 +1276,7 @@
}
struct tint_symbol {
- [[builtin(position), invariant]]
+ @builtin(position) @invariant
pos : vec4<f32>;
}
@@ -1284,7 +1284,7 @@
return VertexOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn main1() -> tint_symbol {
let inner_result = main1_inner();
var wrapper_result : tint_symbol;
@@ -1293,7 +1293,7 @@
}
struct tint_symbol_1 {
- [[builtin(position), invariant]]
+ @builtin(position) @invariant
value : vec4<f32>;
}
@@ -1301,7 +1301,7 @@
return vec4<f32>();
}
-[[stage(vertex)]]
+@stage(vertex)
fn main2() -> tint_symbol_1 {
let inner_result_1 = main2_inner();
var wrapper_result_1 : tint_symbol_1;
@@ -1321,16 +1321,16 @@
TEST_F(CanonicalizeEntryPointIOTest, Struct_LayoutDecorations) {
auto* src = R"(
struct FragmentInput {
- [[size(16), location(1)]] value : f32;
- [[builtin(position)]] [[align(32)]] coord : vec4<f32>;
- [[location(0), interpolate(linear, sample)]] [[align(128)]] loc0 : f32;
+ @size(16) @location(1) value : f32;
+ @builtin(position) @align(32) coord : vec4<f32>;
+ @location(0) @interpolate(linear, sample) @align(128) loc0 : f32;
};
struct FragmentOutput {
- [[size(16), location(1), interpolate(flat)]] value : f32;
+ @size(16) @location(1) @interpolate(flat) value : f32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(inputs : FragmentInput) -> FragmentOutput {
return FragmentOutput(inputs.coord.x * inputs.value + inputs.loc0);
}
@@ -1338,30 +1338,30 @@
auto* expect = R"(
struct FragmentInput {
- [[size(16)]]
+ @size(16)
value : f32;
- [[align(32)]]
+ @align(32)
coord : vec4<f32>;
- [[align(128)]]
+ @align(128)
loc0 : f32;
}
struct FragmentOutput {
- [[size(16)]]
+ @size(16)
value : f32;
}
struct tint_symbol_1 {
- [[location(0), interpolate(linear, sample)]]
+ @location(0) @interpolate(linear, sample)
loc0 : f32;
- [[location(1)]]
+ @location(1)
value : f32;
- [[builtin(position)]]
+ @builtin(position)
coord : vec4<f32>;
}
struct tint_symbol_2 {
- [[location(1), interpolate(flat)]]
+ @location(1) @interpolate(flat)
value : f32;
}
@@ -1369,7 +1369,7 @@
return FragmentOutput(((inputs.coord.x * inputs.value) + inputs.loc0));
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inner_result = frag_main_inner(FragmentInput(tint_symbol.value, tint_symbol.coord, tint_symbol.loc0));
var wrapper_result : tint_symbol_2;
@@ -1389,29 +1389,29 @@
TEST_F(CanonicalizeEntryPointIOTest, SortedMembers) {
auto* src = R"(
struct VertexOutput {
- [[location(1)]] b : u32;
- [[builtin(position)]] pos : vec4<f32>;
- [[location(3)]] d : u32;
- [[location(0)]] a : f32;
- [[location(2)]] c : i32;
+ @location(1) b : u32;
+ @builtin(position) pos : vec4<f32>;
+ @location(3) d : u32;
+ @location(0) a : f32;
+ @location(2) c : i32;
};
struct FragmentInputExtra {
- [[location(3)]] d : u32;
- [[builtin(position)]] pos : vec4<f32>;
- [[location(0)]] a : f32;
+ @location(3) d : u32;
+ @builtin(position) pos : vec4<f32>;
+ @location(0) a : f32;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> VertexOutput {
return VertexOutput();
}
-[[stage(fragment)]]
-fn frag_main([[builtin(front_facing)]] ff : bool,
- [[location(2)]] c : i32,
+@stage(fragment)
+fn frag_main(@builtin(front_facing) ff : bool,
+ @location(2) c : i32,
inputs : FragmentInputExtra,
- [[location(1)]] b : u32) {
+ @location(1) b : u32) {
}
)";
@@ -1431,15 +1431,15 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
a : f32;
- [[location(1)]]
+ @location(1)
b : u32;
- [[location(2)]]
+ @location(2)
c : i32;
- [[location(3)]]
+ @location(3)
d : u32;
- [[builtin(position)]]
+ @builtin(position)
pos : vec4<f32>;
}
@@ -1447,7 +1447,7 @@
return VertexOutput();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> tint_symbol {
let inner_result = vert_main_inner();
var wrapper_result : tint_symbol;
@@ -1460,24 +1460,24 @@
}
struct tint_symbol_2 {
- [[location(0)]]
+ @location(0)
a : f32;
- [[location(1)]]
+ @location(1)
b : u32;
- [[location(2)]]
+ @location(2)
c : i32;
- [[location(3)]]
+ @location(3)
d : u32;
- [[builtin(position)]]
+ @builtin(position)
pos : vec4<f32>;
- [[builtin(front_facing)]]
+ @builtin(front_facing)
ff : bool;
}
fn frag_main_inner(ff : bool, c : i32, inputs : FragmentInputExtra, b : u32) {
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main(tint_symbol_1 : tint_symbol_2) {
frag_main_inner(tint_symbol_1.ff, tint_symbol_1.c, FragmentInputExtra(tint_symbol_1.d, tint_symbol_1.pos, tint_symbol_1.a), tint_symbol_1.b);
}
@@ -1493,21 +1493,21 @@
TEST_F(CanonicalizeEntryPointIOTest, DontRenameSymbols) {
auto* src = R"(
-[[stage(fragment)]]
-fn tint_symbol_1([[location(0)]] col : f32) {
+@stage(fragment)
+fn tint_symbol_1(@location(0) col : f32) {
}
)";
auto* expect = R"(
struct tint_symbol_2 {
- [[location(0)]]
+ @location(0)
col : f32;
}
fn tint_symbol_1_inner(col : f32) {
}
-[[stage(fragment)]]
+@stage(fragment)
fn tint_symbol_1(tint_symbol : tint_symbol_2) {
tint_symbol_1_inner(tint_symbol.col);
}
@@ -1523,21 +1523,21 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_VoidNoReturn) {
auto* src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask : u32;
}
fn frag_main_inner() {
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1556,7 +1556,7 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_VoidWithReturn) {
auto* src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
return;
}
@@ -1564,7 +1564,7 @@
auto* expect = R"(
struct tint_symbol {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask : u32;
}
@@ -1572,7 +1572,7 @@
return;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1591,15 +1591,15 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_WithAuthoredMask) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main() -> [[builtin(sample_mask)]] u32 {
+@stage(fragment)
+fn frag_main() -> @builtin(sample_mask) u32 {
return 7u;
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
value : u32;
}
@@ -1607,7 +1607,7 @@
return 7u;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1626,17 +1626,17 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_WithoutAuthoredMask) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main() -> [[location(0)]] f32 {
+@stage(fragment)
+fn frag_main() -> @location(0) f32 {
return 1.0;
}
)";
auto* expect = R"(
struct tint_symbol {
- [[location(0)]]
+ @location(0)
value : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask : u32;
}
@@ -1644,7 +1644,7 @@
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1665,12 +1665,12 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_StructWithAuthoredMask) {
auto* src = R"(
struct Output {
- [[builtin(frag_depth)]] depth : f32;
- [[builtin(sample_mask)]] mask : u32;
- [[location(0)]] value : f32;
+ @builtin(frag_depth) depth : f32;
+ @builtin(sample_mask) mask : u32;
+ @location(0) value : f32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> Output {
return Output(0.5, 7u, 1.0);
}
@@ -1684,11 +1684,11 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
value : f32;
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
depth : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
mask : u32;
}
@@ -1696,7 +1696,7 @@
return Output(0.5, 7u, 1.0);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1719,11 +1719,11 @@
FixedSampleMask_StructWithoutAuthoredMask) {
auto* src = R"(
struct Output {
- [[builtin(frag_depth)]] depth : f32;
- [[location(0)]] value : f32;
+ @builtin(frag_depth) depth : f32;
+ @location(0) value : f32;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> Output {
return Output(0.5, 1.0);
}
@@ -1736,11 +1736,11 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
value : f32;
- [[builtin(frag_depth)]]
+ @builtin(frag_depth)
depth : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask : u32;
}
@@ -1748,7 +1748,7 @@
return Output(0.5, 1.0);
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1769,29 +1769,29 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_MultipleShaders) {
auto* src = R"(
-[[stage(fragment)]]
-fn frag_main1() -> [[builtin(sample_mask)]] u32 {
+@stage(fragment)
+fn frag_main1() -> @builtin(sample_mask) u32 {
return 7u;
}
-[[stage(fragment)]]
-fn frag_main2() -> [[location(0)]] f32 {
+@stage(fragment)
+fn frag_main2() -> @location(0) f32 {
return 1.0;
}
-[[stage(vertex)]]
-fn vert_main1() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main1() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
value : u32;
}
@@ -1799,7 +1799,7 @@
return 7u;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main1() -> tint_symbol {
let inner_result = frag_main1_inner();
var wrapper_result : tint_symbol;
@@ -1808,9 +1808,9 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
value : f32;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask : u32;
}
@@ -1818,7 +1818,7 @@
return 1.0;
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main2() -> tint_symbol_1 {
let inner_result_1 = frag_main2_inner();
var wrapper_result_1 : tint_symbol_1;
@@ -1828,7 +1828,7 @@
}
struct tint_symbol_2 {
- [[builtin(position)]]
+ @builtin(position)
value : vec4<f32>;
}
@@ -1836,7 +1836,7 @@
return vec4<f32>();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main1() -> tint_symbol_2 {
let inner_result_2 = vert_main1_inner();
var wrapper_result_2 : tint_symbol_2;
@@ -1844,7 +1844,7 @@
return wrapper_result_2;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
}
)";
@@ -1860,11 +1860,11 @@
TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_AvoidNameClash) {
auto* src = R"(
struct FragOut {
- [[location(0)]] fixed_sample_mask : vec4<f32>;
- [[location(1)]] fixed_sample_mask_1 : vec4<f32>;
+ @location(0) fixed_sample_mask : vec4<f32>;
+ @location(1) fixed_sample_mask_1 : vec4<f32>;
};
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> FragOut {
return FragOut();
}
@@ -1877,11 +1877,11 @@
}
struct tint_symbol {
- [[location(0)]]
+ @location(0)
fixed_sample_mask : vec4<f32>;
- [[location(1)]]
+ @location(1)
fixed_sample_mask_1 : vec4<f32>;
- [[builtin(sample_mask)]]
+ @builtin(sample_mask)
fixed_sample_mask_2 : u32;
}
@@ -1889,7 +1889,7 @@
return FragOut();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() -> tint_symbol {
let inner_result = frag_main_inner();
var wrapper_result : tint_symbol;
@@ -1911,22 +1911,22 @@
TEST_F(CanonicalizeEntryPointIOTest,
EmitVertexPointSize_ReturnNonStruct_Spirv) {
auto* src = R"(
-[[stage(vertex)]]
-fn vert_main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
auto* expect = R"(
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<out> value : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<out> value : vec4<f32>;
-[[builtin(pointsize), internal(disable_validation__ignore_storage_class)]] var<out> vertex_point_size : f32;
+@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var<out> vertex_point_size : f32;
fn vert_main_inner() -> vec4<f32> {
return vec4<f32>();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() {
let inner_result = vert_main_inner();
value = inner_result;
@@ -1944,17 +1944,17 @@
TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnNonStruct_Msl) {
auto* src = R"(
-[[stage(vertex)]]
-fn vert_main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
auto* expect = R"(
struct tint_symbol {
- [[builtin(position)]]
+ @builtin(position)
value : vec4<f32>;
- [[builtin(pointsize)]]
+ @builtin(pointsize)
vertex_point_size : f32;
}
@@ -1962,7 +1962,7 @@
return vec4<f32>();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> tint_symbol {
let inner_result = vert_main_inner();
var wrapper_result : tint_symbol;
@@ -1983,19 +1983,19 @@
TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnStruct_Spirv) {
auto* src = R"(
struct VertOut {
- [[builtin(position)]] pos : vec4<f32>;
+ @builtin(position) pos : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> VertOut {
return VertOut();
}
)";
auto* expect = R"(
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<out> pos_1 : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<out> pos_1 : vec4<f32>;
-[[builtin(pointsize), internal(disable_validation__ignore_storage_class)]] var<out> vertex_point_size : f32;
+@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var<out> vertex_point_size : f32;
struct VertOut {
pos : vec4<f32>;
@@ -2005,7 +2005,7 @@
return VertOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() {
let inner_result = vert_main_inner();
pos_1 = inner_result.pos;
@@ -2024,10 +2024,10 @@
TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnStruct_Msl) {
auto* src = R"(
struct VertOut {
- [[builtin(position)]] pos : vec4<f32>;
+ @builtin(position) pos : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> VertOut {
return VertOut();
}
@@ -2039,9 +2039,9 @@
}
struct tint_symbol {
- [[builtin(position)]]
+ @builtin(position)
pos : vec4<f32>;
- [[builtin(pointsize)]]
+ @builtin(pointsize)
vertex_point_size : f32;
}
@@ -2049,7 +2049,7 @@
return VertOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() -> tint_symbol {
let inner_result = vert_main_inner();
var wrapper_result : tint_symbol;
@@ -2074,19 +2074,19 @@
var<private> vertex_point_size_2 : f32;
struct VertIn1 {
- [[location(0)]] collide : f32;
+ @location(0) collide : f32;
};
struct VertIn2 {
- [[location(1)]] collide : f32;
+ @location(1) collide : f32;
};
struct VertOut {
- [[location(0)]] vertex_point_size : f32;
- [[builtin(position)]] vertex_point_size_1 : vec4<f32>;
+ @location(0) vertex_point_size : f32;
+ @builtin(position) vertex_point_size_1 : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = collide.collide + collide_1.collide;
return VertOut();
@@ -2094,15 +2094,15 @@
)";
auto* expect = R"(
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<in> collide_2 : f32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<in> collide_2 : f32;
-[[location(1), internal(disable_validation__ignore_storage_class)]] var<in> collide_3 : f32;
+@location(1) @internal(disable_validation__ignore_storage_class) var<in> collide_3 : f32;
-[[location(0), internal(disable_validation__ignore_storage_class)]] var<out> vertex_point_size_3 : f32;
+@location(0) @internal(disable_validation__ignore_storage_class) var<out> vertex_point_size_3 : f32;
-[[builtin(position), internal(disable_validation__ignore_storage_class)]] var<out> vertex_point_size_1_1 : vec4<f32>;
+@builtin(position) @internal(disable_validation__ignore_storage_class) var<out> vertex_point_size_1_1 : vec4<f32>;
-[[builtin(pointsize), internal(disable_validation__ignore_storage_class)]] var<out> vertex_point_size_4 : f32;
+@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var<out> vertex_point_size_4 : f32;
var<private> vertex_point_size : f32;
@@ -2128,7 +2128,7 @@
return VertOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main() {
let inner_result = vert_main_inner(VertIn1(collide_2), VertIn2(collide_3));
vertex_point_size_3 = inner_result.vertex_point_size;
@@ -2148,19 +2148,19 @@
TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_AvoidNameClash_Msl) {
auto* src = R"(
struct VertIn1 {
- [[location(0)]] collide : f32;
+ @location(0) collide : f32;
};
struct VertIn2 {
- [[location(1)]] collide : f32;
+ @location(1) collide : f32;
};
struct VertOut {
- [[location(0)]] vertex_point_size : vec4<f32>;
- [[builtin(position)]] vertex_point_size_1 : vec4<f32>;
+ @location(0) vertex_point_size : vec4<f32>;
+ @builtin(position) vertex_point_size_1 : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = collide.collide + collide_1.collide;
return VertOut();
@@ -2182,18 +2182,18 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
collide : f32;
- [[location(1)]]
+ @location(1)
collide_2 : f32;
}
struct tint_symbol_2 {
- [[location(0)]]
+ @location(0)
vertex_point_size : vec4<f32>;
- [[builtin(position)]]
+ @builtin(position)
vertex_point_size_1 : vec4<f32>;
- [[builtin(pointsize)]]
+ @builtin(pointsize)
vertex_point_size_2 : f32;
}
@@ -2202,7 +2202,7 @@
return VertOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2));
var wrapper_result : tint_symbol_2;
@@ -2224,19 +2224,19 @@
TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_AvoidNameClash_Hlsl) {
auto* src = R"(
struct VertIn1 {
- [[location(0)]] collide : f32;
+ @location(0) collide : f32;
};
struct VertIn2 {
- [[location(1)]] collide : f32;
+ @location(1) collide : f32;
};
struct VertOut {
- [[location(0)]] vertex_point_size : vec4<f32>;
- [[builtin(position)]] vertex_point_size_1 : vec4<f32>;
+ @location(0) vertex_point_size : vec4<f32>;
+ @builtin(position) vertex_point_size_1 : vec4<f32>;
};
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = collide.collide + collide_1.collide;
return VertOut();
@@ -2258,18 +2258,18 @@
}
struct tint_symbol_1 {
- [[location(0)]]
+ @location(0)
collide : f32;
- [[location(1)]]
+ @location(1)
collide_2 : f32;
}
struct tint_symbol_2 {
- [[location(0)]]
+ @location(0)
vertex_point_size : vec4<f32>;
- [[builtin(position)]]
+ @builtin(position)
vertex_point_size_1 : vec4<f32>;
- [[builtin(pointsize)]]
+ @builtin(pointsize)
vertex_point_size_2 : f32;
}
@@ -2278,7 +2278,7 @@
return VertOut();
}
-[[stage(vertex)]]
+@stage(vertex)
fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2));
var wrapper_result : tint_symbol_2;
@@ -2299,26 +2299,26 @@
TEST_F(CanonicalizeEntryPointIOTest, SpirvSampleMaskBuiltins) {
auto* src = R"(
-[[stage(fragment)]]
-fn main([[builtin(sample_index)]] sample_index : u32,
- [[builtin(sample_mask)]] mask_in : u32
- ) -> [[builtin(sample_mask)]] u32 {
+@stage(fragment)
+fn main(@builtin(sample_index) sample_index : u32,
+ @builtin(sample_mask) mask_in : u32
+ ) -> @builtin(sample_mask) u32 {
return mask_in;
}
)";
auto* expect = R"(
-[[builtin(sample_index), internal(disable_validation__ignore_storage_class)]] var<in> sample_index_1 : u32;
+@builtin(sample_index) @internal(disable_validation__ignore_storage_class) var<in> sample_index_1 : u32;
-[[builtin(sample_mask), internal(disable_validation__ignore_storage_class)]] var<in> mask_in_1 : array<u32, 1>;
+@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var<in> mask_in_1 : array<u32, 1>;
-[[builtin(sample_mask), internal(disable_validation__ignore_storage_class)]] var<out> value : array<u32, 1>;
+@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var<out> value : array<u32, 1>;
fn main_inner(sample_index : u32, mask_in : u32) -> u32 {
return mask_in;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let inner_result = main_inner(sample_index_1, mask_in_1[0]);
value[0] = inner_result;
diff --git a/src/transform/decompose_memory_access.h b/src/transform/decompose_memory_access.h
index 67f3eb9..9fb1b0f 100644
--- a/src/transform/decompose_memory_access.h
+++ b/src/transform/decompose_memory_access.h
@@ -82,7 +82,7 @@
~Intrinsic() override;
/// @return a short description of the internal decoration which will be
- /// displayed as `[[internal(<name>)]]`
+ /// displayed as `@internal(<name>)`
std::string InternalName() const override;
/// Performs a deep clone of this object using the CloneContext `ctx`.
diff --git a/src/transform/decompose_memory_access_test.cc b/src/transform/decompose_memory_access_test.cc
index c28f48e..2fd6e10 100644
--- a/src/transform/decompose_memory_access_test.cc
+++ b/src/transform/decompose_memory_access_test.cc
@@ -49,9 +49,9 @@
v : array<vec3<f32>, 2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : i32 = sb.a;
var b : u32 = sb.b;
@@ -104,81 +104,81 @@
v : array<vec3<f32>, 2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_load_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> i32
+@internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32
-[[internal(intrinsic_load_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> u32
+@internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32
-[[internal(intrinsic_load_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> f32
+@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
-[[internal(intrinsic_load_storage_vec2_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<i32>
+@internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<i32>
-[[internal(intrinsic_load_storage_vec2_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<u32>
+@internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<u32>
-[[internal(intrinsic_load_storage_vec2_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<f32>
+@internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<f32>
-[[internal(intrinsic_load_storage_vec3_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<i32>
+@internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<i32>
-[[internal(intrinsic_load_storage_vec3_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<u32>
+@internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<u32>
-[[internal(intrinsic_load_storage_vec3_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<f32>
+@internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<f32>
-[[internal(intrinsic_load_storage_vec4_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<i32>
+@internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<i32>
-[[internal(intrinsic_load_storage_vec4_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<u32>
+@internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<u32>
-[[internal(intrinsic_load_storage_vec4_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<f32>
+@internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<f32>
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x2<f32> {
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)));
}
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x3<f32> {
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)));
}
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x4<f32> {
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)));
}
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x2<f32> {
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)));
}
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x3<f32> {
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)));
}
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x4<f32> {
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)));
}
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x2<f32> {
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)));
}
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x3<f32> {
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u)));
}
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x4<f32> {
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u)));
}
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> array<vec3<f32>, 2u> {
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array<vec3<f32>, 2u> {
var arr : array<vec3<f32>, 2u>;
for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u)));
@@ -186,7 +186,7 @@
return arr;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u);
@@ -245,9 +245,9 @@
v : array<vec3<f32>, 2>;
};
-[[group(0), binding(0)]] var<uniform> ub : UB;
+@group(0) @binding(0) var<uniform> ub : UB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : i32 = ub.a;
var b : u32 = ub.b;
@@ -300,81 +300,81 @@
v : array<vec3<f32>, 2>;
}
-[[group(0), binding(0)]] var<uniform> ub : UB;
+@group(0) @binding(0) var<uniform> ub : UB;
-[[internal(intrinsic_load_uniform_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> i32
+@internal(intrinsic_load_uniform_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> i32
-[[internal(intrinsic_load_uniform_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> u32
+@internal(intrinsic_load_uniform_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> u32
-[[internal(intrinsic_load_uniform_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> f32
+@internal(intrinsic_load_uniform_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> f32
-[[internal(intrinsic_load_uniform_vec2_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec2<i32>
+@internal(intrinsic_load_uniform_vec2_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2<i32>
-[[internal(intrinsic_load_uniform_vec2_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec2<u32>
+@internal(intrinsic_load_uniform_vec2_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2<u32>
-[[internal(intrinsic_load_uniform_vec2_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec2<f32>
+@internal(intrinsic_load_uniform_vec2_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2<f32>
-[[internal(intrinsic_load_uniform_vec3_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec3<i32>
+@internal(intrinsic_load_uniform_vec3_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3<i32>
-[[internal(intrinsic_load_uniform_vec3_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec3<u32>
+@internal(intrinsic_load_uniform_vec3_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3<u32>
-[[internal(intrinsic_load_uniform_vec3_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec3<f32>
+@internal(intrinsic_load_uniform_vec3_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3<f32>
-[[internal(intrinsic_load_uniform_vec4_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec4<i32>
+@internal(intrinsic_load_uniform_vec4_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4<i32>
-[[internal(intrinsic_load_uniform_vec4_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec4<u32>
+@internal(intrinsic_load_uniform_vec4_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4<u32>
-[[internal(intrinsic_load_uniform_vec4_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> vec4<f32>
+@internal(intrinsic_load_uniform_vec4_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4<f32>
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat2x2<f32> {
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)));
}
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat2x3<f32> {
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)));
}
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat2x4<f32> {
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)));
}
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat3x2<f32> {
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)));
}
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat3x3<f32> {
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)));
}
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat3x4<f32> {
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)));
}
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat4x2<f32> {
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)));
}
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat4x3<f32> {
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u)));
}
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> mat4x4<f32> {
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u)));
}
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : UB, offset : u32) -> array<vec3<f32>, 2u> {
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> array<vec3<f32>, 2u> {
var arr : array<vec3<f32>, 2u>;
for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u)));
@@ -382,7 +382,7 @@
return arr;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(ub, 0u);
var b : u32 = tint_symbol_1(ub, 4u);
@@ -441,9 +441,9 @@
v : array<vec3<f32>, 2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
sb.a = i32();
sb.b = u32();
@@ -496,106 +496,106 @@
v : array<vec3<f32>, 2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_store_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : i32)
+@internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32)
-[[internal(intrinsic_store_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : u32)
+@internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32)
-[[internal(intrinsic_store_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : f32)
+@internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32)
-[[internal(intrinsic_store_storage_vec2_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<i32>)
+@internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<i32>)
-[[internal(intrinsic_store_storage_vec2_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<u32>)
+@internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<u32>)
-[[internal(intrinsic_store_storage_vec2_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<f32>)
+@internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<f32>)
-[[internal(intrinsic_store_storage_vec3_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<i32>)
+@internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<i32>)
-[[internal(intrinsic_store_storage_vec3_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<u32>)
+@internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<u32>)
-[[internal(intrinsic_store_storage_vec3_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<f32>)
+@internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<f32>)
-[[internal(intrinsic_store_storage_vec4_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<i32>)
+@internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<i32>)
-[[internal(intrinsic_store_storage_vec4_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<u32>)
+@internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<u32>)
-[[internal(intrinsic_store_storage_vec4_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<f32>)
+@internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<f32>)
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x2<f32>) {
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_5(buffer, (offset + 0u), value[0u]);
tint_symbol_5(buffer, (offset + 8u), value[1u]);
}
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x3<f32>) {
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 16u), value[1u]);
}
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x4<f32>) {
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_11(buffer, (offset + 0u), value[0u]);
tint_symbol_11(buffer, (offset + 16u), value[1u]);
}
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x2<f32>) {
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_5(buffer, (offset + 0u), value[0u]);
tint_symbol_5(buffer, (offset + 8u), value[1u]);
tint_symbol_5(buffer, (offset + 16u), value[2u]);
}
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x3<f32>) {
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 16u), value[1u]);
tint_symbol_8(buffer, (offset + 32u), value[2u]);
}
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x4<f32>) {
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_11(buffer, (offset + 0u), value[0u]);
tint_symbol_11(buffer, (offset + 16u), value[1u]);
tint_symbol_11(buffer, (offset + 32u), value[2u]);
}
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x2<f32>) {
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_5(buffer, (offset + 0u), value[0u]);
tint_symbol_5(buffer, (offset + 8u), value[1u]);
tint_symbol_5(buffer, (offset + 16u), value[2u]);
tint_symbol_5(buffer, (offset + 24u), value[3u]);
}
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x3<f32>) {
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 16u), value[1u]);
tint_symbol_8(buffer, (offset + 32u), value[2u]);
tint_symbol_8(buffer, (offset + 48u), value[3u]);
}
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x4<f32>) {
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_11(buffer, (offset + 0u), value[0u]);
tint_symbol_11(buffer, (offset + 16u), value[1u]);
tint_symbol_11(buffer, (offset + 32u), value[2u]);
tint_symbol_11(buffer, (offset + 48u), value[3u]);
}
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : array<vec3<f32>, 2u>) {
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array<vec3<f32>, 2u>) {
var array = value;
for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
tint_symbol_8(buffer, (offset + (i_1 * 16u)), array[i_1]);
}
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32());
@@ -654,9 +654,9 @@
v : array<vec3<f32>, 2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var x : SB = sb;
}
@@ -688,81 +688,81 @@
v : array<vec3<f32>, 2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_load_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> i32
+@internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32
-[[internal(intrinsic_load_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> u32
+@internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32
-[[internal(intrinsic_load_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> f32
+@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
-[[internal(intrinsic_load_storage_vec2_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<i32>
+@internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<i32>
-[[internal(intrinsic_load_storage_vec2_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<u32>
+@internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<u32>
-[[internal(intrinsic_load_storage_vec2_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec2<f32>
+@internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2<f32>
-[[internal(intrinsic_load_storage_vec3_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<i32>
+@internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<i32>
-[[internal(intrinsic_load_storage_vec3_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<u32>
+@internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<u32>
-[[internal(intrinsic_load_storage_vec3_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec3<f32>
+@internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3<f32>
-[[internal(intrinsic_load_storage_vec4_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<i32>
+@internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<i32>
-[[internal(intrinsic_load_storage_vec4_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<u32>
+@internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<u32>
-[[internal(intrinsic_load_storage_vec4_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> vec4<f32>
+@internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4<f32>
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x2<f32> {
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)));
}
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x3<f32> {
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)));
}
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat2x4<f32> {
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)));
}
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x2<f32> {
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u)));
}
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x3<f32> {
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u)));
}
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat3x4<f32> {
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u)));
}
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x2<f32> {
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 24u)));
}
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x3<f32> {
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u)), tint_symbol_9(buffer, (offset + 48u)));
}
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> mat4x4<f32> {
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u)), tint_symbol_12(buffer, (offset + 48u)));
}
-fn tint_symbol_22([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> array<vec3<f32>, 2u> {
+fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array<vec3<f32>, 2u> {
var arr : array<vec3<f32>, 2u>;
for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
arr[i_1] = tint_symbol_9(buffer, (offset + (i_1 * 16u)));
@@ -770,11 +770,11 @@
return arr;
}
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> SB {
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> SB {
return SB(tint_symbol_1(buffer, (offset + 0u)), tint_symbol_2(buffer, (offset + 4u)), tint_symbol_3(buffer, (offset + 8u)), tint_symbol_4(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)), tint_symbol_6(buffer, (offset + 32u)), tint_symbol_7(buffer, (offset + 48u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_9(buffer, (offset + 80u)), tint_symbol_10(buffer, (offset + 96u)), tint_symbol_11(buffer, (offset + 112u)), tint_symbol_12(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_14(buffer, (offset + 160u)), tint_symbol_15(buffer, (offset + 192u)), tint_symbol_16(buffer, (offset + 224u)), tint_symbol_17(buffer, (offset + 256u)), tint_symbol_18(buffer, (offset + 304u)), tint_symbol_19(buffer, (offset + 352u)), tint_symbol_20(buffer, (offset + 384u)), tint_symbol_21(buffer, (offset + 448u)), tint_symbol_22(buffer, (offset + 512u)));
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var x : SB = tint_symbol(sb, 0u);
}
@@ -812,9 +812,9 @@
v : array<vec3<f32>, 2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
sb = SB();
}
@@ -846,106 +846,106 @@
v : array<vec3<f32>, 2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_store_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : i32)
+@internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32)
-[[internal(intrinsic_store_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : u32)
+@internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32)
-[[internal(intrinsic_store_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : f32)
+@internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32)
-[[internal(intrinsic_store_storage_vec2_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<i32>)
+@internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<i32>)
-[[internal(intrinsic_store_storage_vec2_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<u32>)
+@internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<u32>)
-[[internal(intrinsic_store_storage_vec2_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec2<f32>)
+@internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2<f32>)
-[[internal(intrinsic_store_storage_vec3_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<i32>)
+@internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<i32>)
-[[internal(intrinsic_store_storage_vec3_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<u32>)
+@internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<u32>)
-[[internal(intrinsic_store_storage_vec3_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec3<f32>)
+@internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3<f32>)
-[[internal(intrinsic_store_storage_vec4_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<i32>)
+@internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<i32>)
-[[internal(intrinsic_store_storage_vec4_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<u32>)
+@internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<u32>)
-[[internal(intrinsic_store_storage_vec4_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : vec4<f32>)
+@internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4<f32>)
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x2<f32>) {
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_6(buffer, (offset + 0u), value[0u]);
tint_symbol_6(buffer, (offset + 8u), value[1u]);
}
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x3<f32>) {
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_9(buffer, (offset + 0u), value[0u]);
tint_symbol_9(buffer, (offset + 16u), value[1u]);
}
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat2x4<f32>) {
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 16u), value[1u]);
}
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x2<f32>) {
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_6(buffer, (offset + 0u), value[0u]);
tint_symbol_6(buffer, (offset + 8u), value[1u]);
tint_symbol_6(buffer, (offset + 16u), value[2u]);
}
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x3<f32>) {
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_9(buffer, (offset + 0u), value[0u]);
tint_symbol_9(buffer, (offset + 16u), value[1u]);
tint_symbol_9(buffer, (offset + 32u), value[2u]);
}
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat3x4<f32>) {
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 16u), value[1u]);
tint_symbol_12(buffer, (offset + 32u), value[2u]);
}
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x2<f32>) {
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_6(buffer, (offset + 0u), value[0u]);
tint_symbol_6(buffer, (offset + 8u), value[1u]);
tint_symbol_6(buffer, (offset + 16u), value[2u]);
tint_symbol_6(buffer, (offset + 24u), value[3u]);
}
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x3<f32>) {
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_9(buffer, (offset + 0u), value[0u]);
tint_symbol_9(buffer, (offset + 16u), value[1u]);
tint_symbol_9(buffer, (offset + 32u), value[2u]);
tint_symbol_9(buffer, (offset + 48u), value[3u]);
}
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : mat4x4<f32>) {
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 16u), value[1u]);
tint_symbol_12(buffer, (offset + 32u), value[2u]);
tint_symbol_12(buffer, (offset + 48u), value[3u]);
}
-fn tint_symbol_22([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : array<vec3<f32>, 2u>) {
+fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array<vec3<f32>, 2u>) {
var array = value;
for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1]);
}
}
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, value : SB) {
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : SB) {
tint_symbol_1(buffer, (offset + 0u), value.a);
tint_symbol_2(buffer, (offset + 4u), value.b);
tint_symbol_3(buffer, (offset + 8u), value.c);
@@ -970,7 +970,7 @@
tint_symbol_22(buffer, (offset + 512u), value.v);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, SB());
}
@@ -991,19 +991,19 @@
struct S2 {
a : i32;
- b : [[stride(32)]] array<S1, 3>;
+ b : @stride(32) array<S1, 3>;
c : i32;
};
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
- b : [[stride(256)]] array<S2>;
+ b : @stride(256) array<S2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var x : f32 = sb.b[4].b[1].b.z;
}
@@ -1025,22 +1025,22 @@
struct S2 {
a : i32;
- b : [[stride(32)]] array<S1, 3>;
+ b : @stride(32) array<S1, 3>;
c : i32;
}
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
- b : [[stride(256)]] array<S2>;
+ b : @stride(256) array<S2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_load_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> f32
+@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var x : f32 = tint_symbol(sb, 1224u);
}
@@ -1061,19 +1061,19 @@
struct S2 {
a : i32;
- b : [[stride(32)]] array<S1, 3>;
+ b : @stride(32) array<S1, 3>;
c : i32;
};
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
- b : [[stride(256)]] array<S2>;
+ b : @stride(256) array<S2>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@@ -1091,22 +1091,22 @@
struct S2 {
a : i32;
- b : [[stride(32)]] array<S1, 3>;
+ b : @stride(32) array<S1, 3>;
c : i32;
}
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
- b : [[stride(256)]] array<S2>;
+ b : @stride(256) array<S2>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_load_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> f32
+@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@@ -1130,7 +1130,7 @@
type A1 = S1;
-type A1_Array = [[stride(32)]] array<S1, 3>;
+type A1_Array = @stride(32) array<S1, 3>;
struct S2 {
a : i32;
@@ -1140,17 +1140,17 @@
type A2 = S2;
-type A2_Array = [[stride(256)]] array<S2>;
+type A2_Array = @stride(256) array<S2>;
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
b : A2_Array;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@@ -1168,7 +1168,7 @@
type A1 = S1;
-type A1_Array = [[stride(32)]] array<S1, 3>;
+type A1_Array = @stride(32) array<S1, 3>;
struct S2 {
a : i32;
@@ -1178,20 +1178,20 @@
type A2 = S2;
-type A2_Array = [[stride(256)]] array<S2>;
+type A2_Array = @stride(256) array<S2>;
struct SB {
- [[size(128)]]
+ @size(128)
a : i32;
b : A2_Array;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_load_storage_f32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> f32
+@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@@ -1213,9 +1213,9 @@
b : atomic<u32>;
};
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
atomicStore(&sb.a, 123);
atomicLoad(&sb.a);
@@ -1250,75 +1250,75 @@
b : atomic<u32>;
}
-[[group(0), binding(0)]] var<storage, read_write> sb : SB;
+@group(0) @binding(0) var<storage, read_write> sb : SB;
-[[internal(intrinsic_atomic_store_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32)
+@internal(intrinsic_atomic_store_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32)
-[[internal(intrinsic_atomic_load_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_1([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> i32
+@internal(intrinsic_atomic_load_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32
-[[internal(intrinsic_atomic_add_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_2([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_add_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_sub_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_sub_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_max_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_4([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_max_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_min_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_5([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_min_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_and_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_and_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_or_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_7([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_or_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_xor_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_8([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_xor_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_exchange_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_9([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32) -> i32
+@internal(intrinsic_atomic_exchange_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32
-[[internal(intrinsic_atomic_compare_exchange_weak_storage_i32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_10([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : i32, param_2 : i32) -> vec2<i32>
+@internal(intrinsic_atomic_compare_exchange_weak_storage_i32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32, param_2 : i32) -> vec2<i32>
-[[internal(intrinsic_atomic_store_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_11([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32)
+@internal(intrinsic_atomic_store_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32)
-[[internal(intrinsic_atomic_load_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_12([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32) -> u32
+@internal(intrinsic_atomic_load_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32
-[[internal(intrinsic_atomic_add_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_13([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_add_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_sub_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_14([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_sub_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_max_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_15([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_max_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_min_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_16([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_min_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_and_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_17([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_and_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_or_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_18([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_or_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_xor_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_19([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_xor_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_exchange_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_20([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32) -> u32
+@internal(intrinsic_atomic_exchange_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32
-[[internal(intrinsic_atomic_compare_exchange_weak_storage_u32), internal(disable_validation__function_has_no_body)]]
-fn tint_symbol_21([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> vec2<u32>
+@internal(intrinsic_atomic_compare_exchange_weak_storage_u32) @internal(disable_validation__function_has_no_body)
+fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> vec2<u32>
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
tint_symbol(sb, 16u, 123);
tint_symbol_1(sb, 16u);
@@ -1360,7 +1360,7 @@
var<workgroup> w : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
atomicStore(&(w.a), 123);
atomicLoad(&(w.a));
diff --git a/src/transform/decompose_strided_matrix_test.cc b/src/transform/decompose_strided_matrix_test.cc
index db31c62..8561ccf 100644
--- a/src/transform/decompose_strided_matrix_test.cc
+++ b/src/transform/decompose_strided_matrix_test.cc
@@ -52,13 +52,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) {
// struct S {
- // [[offset(16), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(16) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<uniform> s : S;
+ // @group(0) @binding(0) var<uniform> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@@ -88,18 +88,18 @@
auto* expect = R"(
struct S {
- [[size(16)]]
+ @size(16)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<uniform> s : S;
+@group(0) @binding(0) var<uniform> s : S;
-fn arr_to_mat2x2_stride_32(arr : [[stride(32)]] array<vec2<f32>, 2u>) -> mat2x2<f32> {
+fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32> {
return mat2x2<f32>(arr[0u], arr[1u]);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m);
}
@@ -113,13 +113,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) {
// struct S {
- // [[offset(16), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(16) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<uniform> s : S;
+ // @group(0) @binding(0) var<uniform> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : vec2<f32> = s.m[1];
// }
@@ -149,14 +149,14 @@
auto* expect = R"(
struct S {
- [[size(16)]]
+ @size(16)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<uniform> s : S;
+@group(0) @binding(0) var<uniform> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : vec2<f32> = s.m[1];
}
@@ -170,13 +170,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
// struct S {
- // [[offset(16), stride(8)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(16) @stride(8)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<uniform> s : S;
+ // @group(0) @binding(0) var<uniform> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@@ -206,15 +206,15 @@
auto* expect = R"(
struct S {
- [[size(16)]]
+ @size(16)
padding : u32;
- [[stride(8), internal(disable_validation__ignore_stride)]]
+ @stride(8) @internal(disable_validation__ignore_stride)
m : mat2x2<f32>;
}
-[[group(0), binding(0)]] var<uniform> s : S;
+@group(0) @binding(0) var<uniform> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : mat2x2<f32> = s.m;
}
@@ -228,13 +228,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@@ -264,18 +264,18 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
-fn arr_to_mat2x2_stride_32(arr : [[stride(32)]] array<vec2<f32>, 2u>) -> mat2x2<f32> {
+fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32> {
return mat2x2<f32>(arr[0u], arr[1u]);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m);
}
@@ -289,13 +289,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) {
// struct S {
- // [[offset(16), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(16) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : vec2<f32> = s.m[1];
// }
@@ -325,14 +325,14 @@
auto* expect = R"(
struct S {
- [[size(16)]]
+ @size(16)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : vec2<f32> = s.m[1];
}
@@ -346,13 +346,13 @@
TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0));
// }
@@ -383,18 +383,18 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
-fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> [[stride(32)]] array<vec2<f32>, 2u> {
- return [[stride(32)]] array<vec2<f32>, 2u>(mat[0u], mat[1u]);
+fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
+ return @stride(32) array<vec2<f32>, 2u>(mat[0u], mat[1u]);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
s.m = mat2x2_stride_32_to_arr(mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0)));
}
@@ -408,13 +408,13 @@
TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// s.m[1] = vec2<f32>(1.0, 2.0);
// }
@@ -444,14 +444,14 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
s.m[1] = vec2<f32>(1.0, 2.0);
}
@@ -465,13 +465,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
- // [[group(0), binding(0)]] var<storage, read_write> s : S;
+ // @group(0) @binding(0) var<storage, read_write> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let a = &s.m;
// let b = &*&*(a);
@@ -516,22 +516,22 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- m : [[stride(32)]] array<vec2<f32>, 2u>;
+ m : @stride(32) array<vec2<f32>, 2u>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
-fn arr_to_mat2x2_stride_32(arr : [[stride(32)]] array<vec2<f32>, 2u>) -> mat2x2<f32> {
+fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32> {
return mat2x2<f32>(arr[0u], arr[1u]);
}
-fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> [[stride(32)]] array<vec2<f32>, 2u> {
- return [[stride(32)]] array<vec2<f32>, 2u>(mat[0u], mat[1u]);
+fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
+ return @stride(32) array<vec2<f32>, 2u>(mat[0u], mat[1u]);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x = arr_to_mat2x2_stride_32(s.m);
let y = s.m[1];
@@ -549,13 +549,13 @@
TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
// var<private> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@@ -584,15 +584,15 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- [[stride(32), internal(disable_validation__ignore_stride)]]
+ @stride(32) @internal(disable_validation__ignore_stride)
m : mat2x2<f32>;
}
var<private> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
let x : mat2x2<f32> = s.m;
}
@@ -606,13 +606,13 @@
TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
// struct S {
- // [[offset(8), stride(32)]]
- // [[internal(ignore_stride_decoration)]]
+ // @offset(8) @stride(32)
+ // @internal(ignore_stride_decoration)
// m : mat2x2<f32>;
// };
// var<private> s : S;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0));
// }
@@ -642,15 +642,15 @@
auto* expect = R"(
struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
- [[stride(32), internal(disable_validation__ignore_stride)]]
+ @stride(32) @internal(disable_validation__ignore_stride)
m : mat2x2<f32>;
}
var<private> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0));
}
diff --git a/src/transform/external_texture_transform_test.cc b/src/transform/external_texture_transform_test.cc
index d9fef8f..28baadf 100644
--- a/src/transform/external_texture_transform_test.cc
+++ b/src/transform/external_texture_transform_test.cc
@@ -24,23 +24,23 @@
TEST_F(ExternalTextureTransformTest, SampleLevelSinglePlane) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
+@group(0) @binding(0) var s : sampler;
-[[group(0), binding(1)]] var t : texture_external;
+@group(0) @binding(1) var t : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(t, s, (coord.xy / vec2<f32>(4.0, 4.0)));
}
)";
auto* expect = R"(
-[[group(0), binding(0)]] var s : sampler;
+@group(0) @binding(0) var s : sampler;
-[[group(0), binding(1)]] var t : texture_2d<f32>;
+@group(0) @binding(1) var t : texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(t, s, (coord.xy / vec2<f32>(4.0, 4.0)), 0.0);
}
)";
@@ -52,19 +52,19 @@
TEST_F(ExternalTextureTransformTest, LoadSinglePlane) {
auto* src = R"(
-[[group(0), binding(0)]] var t : texture_external;
+@group(0) @binding(0) var t : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(t, vec2<i32>(1, 1));
}
)";
auto* expect = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
+@group(0) @binding(0) var t : texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(t, vec2<i32>(1, 1), 0);
}
)";
@@ -76,10 +76,10 @@
TEST_F(ExternalTextureTransformTest, DimensionsSinglePlane) {
auto* src = R"(
-[[group(0), binding(0)]] var t : texture_external;
+@group(0) @binding(0) var t : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(t);
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
@@ -87,10 +87,10 @@
)";
auto* expect = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
+@group(0) @binding(0) var t : texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(t);
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
diff --git a/src/transform/first_index_offset.h b/src/transform/first_index_offset.h
index ffbb138..a885581 100644
--- a/src/transform/first_index_offset.h
+++ b/src/transform/first_index_offset.h
@@ -35,24 +35,28 @@
/// Therefore, these values must by passed to the shader.
///
/// Before:
-/// [[builtin(vertex_index)]] var<in> vert_idx : u32;
+/// ```
+/// @builtin(vertex_index) var<in> vert_idx : u32;
/// fn func() -> u32 {
/// return vert_idx;
/// }
+/// ```
///
/// After:
+/// ```
/// struct TintFirstIndexOffsetData {
/// tint_first_vertex_index : u32;
/// tint_first_instance_index : u32;
/// };
-/// [[builtin(vertex_index)]] var<in> tint_first_index_offset_vert_idx : u32;
-/// [[binding(N), group(M)]] var<uniform> tint_first_index_data :
+/// @builtin(vertex_index) var<in> tint_first_index_offset_vert_idx : u32;
+/// @binding(N) @group(M) var<uniform> tint_first_index_data :
/// TintFirstIndexOffsetData;
/// fn func() -> u32 {
/// const vert_idx = (tint_first_index_offset_vert_idx +
/// tint_first_index_data.tint_first_vertex_index);
/// return vert_idx;
/// }
+/// ```
///
class FirstIndexOffset : public Castable<FirstIndexOffset, Transform> {
public:
@@ -71,9 +75,9 @@
/// Destructor
~BindingPoint() override;
- /// [[binding()]] for the first vertex / first instance uniform buffer
+ /// `@binding()` for the first vertex / first instance uniform buffer
uint32_t binding = 0;
- /// [[group()]] for the first vertex / first instance uniform buffer
+ /// `@group()` for the first vertex / first instance uniform buffer
uint32_t group = 0;
};
diff --git a/src/transform/first_index_offset_test.cc b/src/transform/first_index_offset_test.cc
index 6368d29..c0c95f6 100644
--- a/src/transform/first_index_offset_test.cc
+++ b/src/transform/first_index_offset_test.cc
@@ -51,8 +51,8 @@
return vert_idx;
}
-[[stage(vertex)]]
-fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test(vert_idx);
return vec4<f32>();
}
@@ -63,14 +63,14 @@
first_vertex_index : u32;
}
-[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
+@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
fn test(vert_idx : u32) -> u32 {
return vert_idx;
}
-[[stage(vertex)]]
-fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
@@ -97,8 +97,8 @@
return inst_idx;
}
-[[stage(vertex)]]
-fn entry([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test(inst_idx);
return vec4<f32>();
}
@@ -109,14 +109,14 @@
first_instance_index : u32;
}
-[[binding(1), group(7)]] var<uniform> tint_symbol_1 : tint_symbol;
+@binding(1) @group(7) var<uniform> tint_symbol_1 : tint_symbol;
fn test(inst_idx : u32) -> u32 {
return inst_idx;
}
-[[stage(vertex)]]
-fn entry([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();
}
@@ -144,12 +144,12 @@
}
struct Inputs {
- [[builtin(instance_index)]] instance_idx : u32;
- [[builtin(vertex_index)]] vert_idx : u32;
+ @builtin(instance_index) instance_idx : u32;
+ @builtin(vertex_index) vert_idx : u32;
};
-[[stage(vertex)]]
-fn entry(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test(inputs.instance_idx, inputs.vert_idx);
return vec4<f32>();
}
@@ -161,21 +161,21 @@
first_instance_index : u32;
}
-[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
+@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
fn test(instance_idx : u32, vert_idx : u32) -> u32 {
return (instance_idx + vert_idx);
}
struct Inputs {
- [[builtin(instance_index)]]
+ @builtin(instance_index)
instance_idx : u32;
- [[builtin(vertex_index)]]
+ @builtin(vertex_index)
vert_idx : u32;
}
-[[stage(vertex)]]
-fn entry(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
@@ -206,8 +206,8 @@
return func1(vert_idx);
}
-[[stage(vertex)]]
-fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2(vert_idx);
return vec4<f32>();
}
@@ -218,7 +218,7 @@
first_vertex_index : u32;
}
-[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
+@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
fn func1(vert_idx : u32) -> u32 {
return vert_idx;
@@ -228,8 +228,8 @@
return func1(vert_idx);
}
-[[stage(vertex)]]
-fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
@@ -256,20 +256,20 @@
return i;
}
-[[stage(vertex)]]
-fn entry_a([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx);
return vec4<f32>();
}
-[[stage(vertex)]]
-fn entry_b([[builtin(vertex_index)]] vert_idx : u32, [[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx + inst_idx);
return vec4<f32>();
}
-[[stage(vertex)]]
-fn entry_c([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(inst_idx);
return vec4<f32>();
}
@@ -281,26 +281,26 @@
first_instance_index : u32;
}
-[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
+@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
fn func(i : u32) -> u32 {
return i;
}
-[[stage(vertex)]]
-fn entry_a([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
-[[stage(vertex)]]
-fn entry_b([[builtin(vertex_index)]] vert_idx : u32, [[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index)));
return vec4<f32>();
}
-[[stage(vertex)]]
-fn entry_c([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();
}
diff --git a/src/transform/glsl_test.cc b/src/transform/glsl_test.cc
index b280e33..49b0dfd 100644
--- a/src/transform/glsl_test.cc
+++ b/src/transform/glsl_test.cc
@@ -26,7 +26,7 @@
auto* src = R"()";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn unused_entry_point() {
}
)";
diff --git a/src/transform/localize_struct_array_assignment_test.cc b/src/transform/localize_struct_array_assignment_test.cc
index 2b3b0c9..878a89c 100644
--- a/src/transform/localize_struct_array_assignment_test.cc
+++ b/src/transform/localize_struct_array_assignment_test.cc
@@ -44,7 +44,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, StructArray) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
};
@@ -56,9 +56,9 @@
a1 : array<InnerS, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -67,7 +67,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
@@ -80,9 +80,9 @@
a1 : array<InnerS, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -102,7 +102,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, StructStructArray) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
};
@@ -118,9 +118,9 @@
s2 : S1;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -129,7 +129,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
@@ -146,9 +146,9 @@
s2 : S1;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -168,7 +168,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayArray) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
j : u32;
};
@@ -181,9 +181,9 @@
a1 : array<array<InnerS, 8>, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -192,7 +192,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
j : u32;
@@ -206,9 +206,9 @@
a1 : array<array<InnerS, 8>, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -228,7 +228,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStruct) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
};
@@ -244,9 +244,9 @@
a1 : array<S1, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -255,7 +255,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
@@ -272,9 +272,9 @@
a1 : array<S1, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -294,7 +294,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStructArray) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
j : u32;
};
@@ -311,9 +311,9 @@
a1 : array<S1, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@@ -322,7 +322,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
j : u32;
@@ -340,9 +340,9 @@
a1 : array<S1, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@@ -365,7 +365,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, IndexingWithSideEffectFunc) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
j : u32;
};
@@ -388,9 +388,9 @@
return nextIndex;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@@ -399,7 +399,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
j : u32;
@@ -424,9 +424,9 @@
return nextIndex;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@@ -449,7 +449,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerArg) {
auto* src = R"(
-[[block]] struct Uniforms {
+@block struct Uniforms {
i : u32;
};
struct InnerS {
@@ -458,14 +458,14 @@
struct OuterS {
a1 : array<InnerS, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) {
var v : InnerS;
(*p).a1[uniforms.i] = v;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&s1);
@@ -473,7 +473,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
@@ -486,7 +486,7 @@
a1 : array<InnerS, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) {
var v : InnerS;
@@ -498,7 +498,7 @@
}
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&(s1));
@@ -512,7 +512,7 @@
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerVar) {
auto* src = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
};
@@ -525,13 +525,13 @@
a1 : array<InnerS, 8>;
};
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -541,7 +541,7 @@
)";
auto* expect = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
@@ -554,13 +554,13 @@
a1 : array<InnerS, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@@ -581,23 +581,23 @@
TEST_F(LocalizeStructArrayAssignmentTest, VectorAssignment) {
auto* src = R"(
-[[block]]
+@block
struct Uniforms {
i : u32;
}
-[[block]]
+@block
struct OuterS {
a1 : array<u32, 8>;
}
-[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
+@group(1) @binding(4) var<uniform> uniforms : Uniforms;
fn f(i : u32) -> u32 {
return (i + 1u);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var s1 : OuterS;
var v : vec3<f32>;
diff --git a/src/transform/module_scope_var_to_entry_point_param.h b/src/transform/module_scope_var_to_entry_point_param.h
index 34db3e6..29132c8 100644
--- a/src/transform/module_scope_var_to_entry_point_param.h
+++ b/src/transform/module_scope_var_to_entry_point_param.h
@@ -36,7 +36,7 @@
/// struct S {
/// f : f32;
/// };
-/// [[binding(0), group(0)]]
+/// @binding(0) @group(0)
/// var<storage, read> s : S;
/// var<private> p : f32 = 2.0;
///
@@ -44,7 +44,7 @@
/// p = p + f;
/// }
///
-/// [[stage(compute), workgroup_size(1)]]
+/// @stage(compute) @workgroup_size(1)
/// fn main() {
/// foo();
/// }
@@ -56,7 +56,7 @@
/// *p = *p + (*sptr).f;
/// }
///
-/// [[stage(compute), workgroup_size(1)]]
+/// @stage(compute) @workgroup_size(1)
/// fn main(sptr : ptr<storage, S, read>) {
/// var<private> p : f32 = 2.0;
/// foo(&p, sptr);
diff --git a/src/transform/module_scope_var_to_entry_point_param_test.cc b/src/transform/module_scope_var_to_entry_point_param_test.cc
index ffbd635..d8b0f63 100644
--- a/src/transform/module_scope_var_to_entry_point_param_test.cc
+++ b/src/transform/module_scope_var_to_entry_point_param_test.cc
@@ -29,17 +29,17 @@
var<private> p : f32;
var<workgroup> w : f32;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
w = p;
}
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
- [[internal(disable_validation__ignore_storage_class)]] var<workgroup> tint_symbol : f32;
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol_1 : f32;
+ @internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol : f32;
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32;
tint_symbol = tint_symbol_1;
}
)";
@@ -68,7 +68,7 @@
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
foo(1.0);
}
@@ -78,21 +78,21 @@
fn no_uses() {
}
-fn bar(a : f32, b : f32, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol : ptr<private, f32>, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_1 : ptr<workgroup, f32>) {
+fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr<private, f32>, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr<workgroup, f32>) {
*(tint_symbol) = a;
*(tint_symbol_1) = b;
}
-fn foo(a : f32, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_2 : ptr<private, f32>, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_3 : ptr<workgroup, f32>) {
+fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr<private, f32>, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr<workgroup, f32>) {
let b : f32 = 2.0;
bar(a, b, tint_symbol_2, tint_symbol_3);
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol_4 : f32;
- [[internal(disable_validation__ignore_storage_class)]] var<workgroup> tint_symbol_5 : f32;
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol_4 : f32;
+ @internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_5 : f32;
foo(1.0, &(tint_symbol_4), &(tint_symbol_5));
}
)";
@@ -107,17 +107,17 @@
var<private> a : f32 = 1.0;
var<private> b : f32 = f32();
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x : f32 = a + b;
}
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol : f32 = 1.0;
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol_1 : f32 = f32();
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32 = 1.0;
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32 = f32();
let x : f32 = (tint_symbol + tint_symbol_1);
}
)";
@@ -132,7 +132,7 @@
var<private> p : f32;
var<workgroup> w : f32;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let p_ptr : ptr<private, f32> = &p;
let w_ptr : ptr<workgroup, f32> = &w;
@@ -142,10 +142,10 @@
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol : f32;
- [[internal(disable_validation__ignore_storage_class)]] var<workgroup> tint_symbol_1 : f32;
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32;
+ @internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_1 : f32;
let p_ptr : ptr<private, f32> = &(tint_symbol);
let w_ptr : ptr<workgroup, f32> = &(tint_symbol_1);
let x : f32 = (*(p_ptr) + *(w_ptr));
@@ -170,7 +170,7 @@
bar(&v);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
foo();
}
@@ -181,13 +181,13 @@
*(p) = 0.0;
}
-fn foo([[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol : ptr<private, f32>) {
+fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr<private, f32>) {
bar(tint_symbol);
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
- [[internal(disable_validation__ignore_storage_class)]] var<private> tint_symbol_1 : f32;
+ @internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32;
foo(&(tint_symbol_1));
}
)";
@@ -203,12 +203,12 @@
a : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : S;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<storage> s : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
_ = u;
_ = s;
@@ -220,8 +220,8 @@
a : f32;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<uniform, S>, [[group(0), binding(1), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_1 : ptr<storage, S>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, S>) {
_ = *(tint_symbol);
_ = *(tint_symbol_1);
}
@@ -234,10 +234,10 @@
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray) {
auto* src = R"(
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<storage> buffer : array<f32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@@ -248,8 +248,8 @@
arr : array<f32>;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<storage, tint_symbol_1>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
)";
@@ -261,14 +261,14 @@
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArrayInsideFunction) {
auto* src = R"(
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<storage> buffer : array<f32>;
fn foo() {
_ = buffer[0];
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
foo();
}
@@ -279,12 +279,12 @@
arr : array<f32>;
}
-fn foo([[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol : ptr<storage, array<f32>>) {
+fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr<storage, array<f32>>) {
_ = (*(tint_symbol))[0];
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_1 : ptr<storage, tint_symbol_2>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, tint_symbol_2>) {
foo(&((*(tint_symbol_1)).arr));
}
)";
@@ -298,10 +298,10 @@
auto* src = R"(
type myarray = array<f32>;
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<storage> buffer : myarray;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@@ -314,8 +314,8 @@
type myarray = array<f32>;
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<storage, tint_symbol_1>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
)";
@@ -331,10 +331,10 @@
f : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<storage> buffer : array<S>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@@ -349,8 +349,8 @@
arr : array<S>;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<storage, tint_symbol_1>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
)";
@@ -366,9 +366,9 @@
a : f32;
};
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> u : S;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<storage> s : S;
fn no_uses() {
@@ -386,7 +386,7 @@
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
foo(1.0);
}
@@ -400,20 +400,20 @@
fn no_uses() {
}
-fn bar(a : f32, b : f32, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol : ptr<uniform, S>, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_1 : ptr<storage, S>) {
+fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr<uniform, S>, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr<storage, S>) {
_ = *(tint_symbol);
_ = *(tint_symbol_1);
}
-fn foo(a : f32, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_2 : ptr<uniform, S>, [[internal(disable_validation__ignore_storage_class), internal(disable_validation__ignore_invalid_pointer_argument)]] tint_symbol_3 : ptr<storage, S>) {
+fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr<uniform, S>, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr<storage, S>) {
let b : f32 = 2.0;
_ = *(tint_symbol_2);
bar(a, b, tint_symbol_2, tint_symbol_3);
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_4 : ptr<uniform, S>, [[group(0), binding(1), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_5 : ptr<storage, S>) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_4 : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_5 : ptr<storage, S>) {
foo(1.0, tint_symbol_4, tint_symbol_5);
}
)";
@@ -425,10 +425,10 @@
TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_Basic) {
auto* src = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
-[[group(0), binding(1)]] var s : sampler;
+@group(0) @binding(0) var t : texture_2d<f32>;
+@group(0) @binding(1) var s : sampler;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
_ = t;
_ = s;
@@ -436,8 +436,8 @@
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter)]] tint_symbol : texture_2d<f32>, [[group(0), binding(1), internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : sampler) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol : texture_2d<f32>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_1 : sampler) {
_ = tint_symbol;
_ = tint_symbol_1;
}
@@ -450,8 +450,8 @@
TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_FunctionCalls) {
auto* src = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
-[[group(0), binding(1)]] var s : sampler;
+@group(0) @binding(0) var t : texture_2d<f32>;
+@group(0) @binding(1) var s : sampler;
fn no_uses() {
}
@@ -468,7 +468,7 @@
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
foo(1.0);
}
@@ -490,8 +490,8 @@
no_uses();
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter)]] tint_symbol_4 : texture_2d<f32>, [[group(0), binding(1), internal(disable_validation__entry_point_parameter)]] tint_symbol_5 : sampler) {
+@stage(compute) @workgroup_size(1)
+fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol_4 : texture_2d<f32>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_5 : sampler) {
foo(1.0, tint_symbol_4, tint_symbol_5);
}
)";
@@ -505,7 +505,7 @@
auto* src = R"(
var<workgroup> m : mat2x2<f32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x = m;
}
@@ -516,8 +516,8 @@
m : mat2x2<f32>;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
+@stage(compute) @workgroup_size(1)
+fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
let tint_symbol : ptr<workgroup, mat2x2<f32>> = &((*(tint_symbol_1)).m);
let x = *(tint_symbol);
}
@@ -538,7 +538,7 @@
};
var<workgroup> m : array<S2, 4>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x = m;
}
@@ -557,8 +557,8 @@
m : array<S2, 4u>;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
+@stage(compute) @workgroup_size(1)
+fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
let tint_symbol : ptr<workgroup, array<S2, 4u>> = &((*(tint_symbol_1)).m);
let x = *(tint_symbol);
}
@@ -581,7 +581,7 @@
var<workgroup> b : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x = a;
let y = b;
@@ -598,8 +598,8 @@
b : S;
}
-[[stage(compute), workgroup_size(1)]]
-fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_3>) {
+@stage(compute) @workgroup_size(1)
+fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_3>) {
let tint_symbol : ptr<workgroup, S> = &((*(tint_symbol_1)).a);
let tint_symbol_2 : ptr<workgroup, S> = &((*(tint_symbol_1)).b);
let x = *(tint_symbol);
@@ -621,15 +621,15 @@
var<private> p : f32;
var<workgroup> w : f32;
-[[group(0), binding(0)]]
+@group(0) @binding(0)
var<uniform> ub : S;
-[[group(0), binding(1)]]
+@group(0) @binding(1)
var<storage> sb : S;
-[[group(0), binding(2)]] var t : texture_2d<f32>;
-[[group(0), binding(3)]] var s : sampler;
+@group(0) @binding(2) var t : texture_2d<f32>;
+@group(0) @binding(3) var s : sampler;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
}
)";
@@ -639,7 +639,7 @@
a : f32;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
}
)";
diff --git a/src/transform/multiplanar_external_texture_test.cc b/src/transform/multiplanar_external_texture_test.cc
index e4c1d55..be8137a 100644
--- a/src/transform/multiplanar_external_texture_test.cc
+++ b/src/transform/multiplanar_external_texture_test.cc
@@ -25,11 +25,11 @@
// result in an error.
TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
-[[group(0), binding(1)]] var ext_tex : texture_external;
+@group(0) @binding(0) var s : sampler;
+@group(0) @binding(1) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
)";
@@ -43,11 +43,11 @@
// Running the transform with incorrect binding data should result in an error.
TEST_F(MultiplanarExternalTextureTest, ErrorIncorrectBindingPont) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
-[[group(0), binding(1)]] var ext_tex : texture_external;
+@group(0) @binding(0) var s : sampler;
+@group(0) @binding(1) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
)";
@@ -67,10 +67,10 @@
// Tests that the transform works with a textureDimensions call.
TEST_F(MultiplanarExternalTextureTest, Dimensions) {
auto* src = R"(
-[[group(0), binding(0)]] var ext_tex : texture_external;
+@group(0) @binding(0) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
@@ -86,14 +86,14 @@
ub : f32;
}
-[[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d<f32>;
+@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
-[[group(0), binding(2)]] var<uniform> ext_tex_params : ExternalTextureParams;
+@group(0) @binding(2) var<uniform> ext_tex_params : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
@@ -110,17 +110,17 @@
// Test that the transform works with a textureSampleLevel call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
-[[group(0), binding(1)]] var ext_tex : texture_external;
+@group(0) @binding(0) var s : sampler;
+@group(0) @binding(1) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
)";
auto* expect = R"(
-[[group(0), binding(0)]] var s : sampler;
+@group(0) @binding(0) var s : sampler;
struct ExternalTextureParams {
numPlanes : u32;
@@ -130,11 +130,11 @@
ub : f32;
}
-[[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
-[[group(0), binding(3)]] var<uniform> ext_tex_params : ExternalTextureParams;
+@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
-[[group(0), binding(1)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(1) var ext_tex : texture_2d<f32>;
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@@ -150,8 +150,8 @@
return vec4<f32>(r, g, b, 1.0);
}
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params);
}
)";
@@ -166,10 +166,10 @@
// Tests that the transform works with a textureLoad call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad) {
auto* src = R"(
-[[group(0), binding(0)]] var ext_tex : texture_external;
+@group(0) @binding(0) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(ext_tex, vec2<i32>(1, 1));
}
)";
@@ -183,11 +183,11 @@
ub : f32;
}
-[[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d<f32>;
+@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
-[[group(0), binding(2)]] var<uniform> ext_tex_params : ExternalTextureParams;
+@group(0) @binding(2) var<uniform> ext_tex_params : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@@ -203,8 +203,8 @@
return vec4<f32>(r, g, b, 1.0);
}
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params);
}
)";
@@ -220,17 +220,17 @@
// call.
TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
-[[group(0), binding(1)]] var ext_tex : texture_external;
+@group(0) @binding(0) var s : sampler;
+@group(0) @binding(1) var ext_tex : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2<i32>(1, 1));
}
)";
auto* expect = R"(
-[[group(0), binding(0)]] var s : sampler;
+@group(0) @binding(0) var s : sampler;
struct ExternalTextureParams {
numPlanes : u32;
@@ -240,11 +240,11 @@
ub : f32;
}
-[[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
-[[group(0), binding(3)]] var<uniform> ext_tex_params : ExternalTextureParams;
+@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
-[[group(0), binding(1)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(1) var ext_tex : texture_2d<f32>;
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@@ -274,8 +274,8 @@
return vec4<f32>(r, g, b, 1.0);
}
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params));
}
)";
@@ -290,20 +290,20 @@
// Tests that the transform works with many instances of texture_external.
TEST_F(MultiplanarExternalTextureTest, ManyTextureSampleLevel) {
auto* src = R"(
-[[group(0), binding(0)]] var s : sampler;
-[[group(0), binding(1)]] var ext_tex : texture_external;
-[[group(0), binding(2)]] var ext_tex_1 : texture_external;
-[[group(0), binding(3)]] var ext_tex_2 : texture_external;
-[[group(1), binding(0)]] var ext_tex_3 : texture_external;
+@group(0) @binding(0) var s : sampler;
+@group(0) @binding(1) var ext_tex : texture_external;
+@group(0) @binding(2) var ext_tex_1 : texture_external;
+@group(0) @binding(3) var ext_tex_2 : texture_external;
+@group(1) @binding(0) var ext_tex_3 : texture_external;
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy) + textureSampleLevel(ext_tex_1, s, coord.xy) + textureSampleLevel(ext_tex_2, s, coord.xy) + textureSampleLevel(ext_tex_3, s, coord.xy);
}
)";
auto* expect = R"(
-[[group(0), binding(0)]] var s : sampler;
+@group(0) @binding(0) var s : sampler;
struct ExternalTextureParams {
numPlanes : u32;
@@ -313,29 +313,29 @@
ub : f32;
}
-[[group(0), binding(4)]] var ext_tex_plane_1 : texture_2d<f32>;
+@group(0) @binding(4) var ext_tex_plane_1 : texture_2d<f32>;
-[[group(0), binding(5)]] var<uniform> ext_tex_params : ExternalTextureParams;
+@group(0) @binding(5) var<uniform> ext_tex_params : ExternalTextureParams;
-[[group(0), binding(1)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(1) var ext_tex : texture_2d<f32>;
-[[group(0), binding(6)]] var ext_tex_plane_1_1 : texture_2d<f32>;
+@group(0) @binding(6) var ext_tex_plane_1_1 : texture_2d<f32>;
-[[group(0), binding(7)]] var<uniform> ext_tex_params_1 : ExternalTextureParams;
+@group(0) @binding(7) var<uniform> ext_tex_params_1 : ExternalTextureParams;
-[[group(0), binding(2)]] var ext_tex_1 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_1 : texture_2d<f32>;
-[[group(0), binding(8)]] var ext_tex_plane_1_2 : texture_2d<f32>;
+@group(0) @binding(8) var ext_tex_plane_1_2 : texture_2d<f32>;
-[[group(0), binding(9)]] var<uniform> ext_tex_params_2 : ExternalTextureParams;
+@group(0) @binding(9) var<uniform> ext_tex_params_2 : ExternalTextureParams;
-[[group(0), binding(3)]] var ext_tex_2 : texture_2d<f32>;
+@group(0) @binding(3) var ext_tex_2 : texture_2d<f32>;
-[[group(1), binding(1)]] var ext_tex_plane_1_3 : texture_2d<f32>;
+@group(1) @binding(1) var ext_tex_plane_1_3 : texture_2d<f32>;
-[[group(1), binding(2)]] var<uniform> ext_tex_params_3 : ExternalTextureParams;
+@group(1) @binding(2) var<uniform> ext_tex_params_3 : ExternalTextureParams;
-[[group(1), binding(0)]] var ext_tex_3 : texture_2d<f32>;
+@group(1) @binding(0) var ext_tex_3 : texture_2d<f32>;
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@@ -351,8 +351,8 @@
return vec4<f32>(r, g, b, 1.0);
}
-[[stage(fragment)]]
-fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return (((textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureSampleExternal(ext_tex_1, ext_tex_plane_1_1, s, coord.xy, ext_tex_params_1)) + textureSampleExternal(ext_tex_2, ext_tex_plane_1_2, s, coord.xy, ext_tex_params_2)) + textureSampleExternal(ext_tex_3, ext_tex_plane_1_3, s, coord.xy, ext_tex_params_3));
}
)";
@@ -377,10 +377,10 @@
textureSampleLevel(t, s, vec2<f32>(1.0, 2.0));
}
-[[group(0), binding(0)]] var ext_tex : texture_external;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(0) var ext_tex : texture_external;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, smp);
}
@@ -413,15 +413,15 @@
textureSampleExternal(t, ext_tex_plane_1, s, vec2<f32>(1.0, 2.0), ext_tex_params);
}
-[[group(0), binding(2)]] var ext_tex_plane_1_1 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_plane_1_1 : texture_2d<f32>;
-[[group(0), binding(3)]] var<uniform> ext_tex_params_1 : ExternalTextureParams;
+@group(0) @binding(3) var<uniform> ext_tex_params_1 : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, ext_tex_plane_1_1, ext_tex_params_1, smp);
}
@@ -443,10 +443,10 @@
textureSampleLevel(t, s, vec2<f32>(1.0, 2.0));
}
-[[group(0), binding(0)]] var ext_tex : texture_external;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(0) var ext_tex : texture_external;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(smp, ext_tex);
}
@@ -479,15 +479,15 @@
textureSampleExternal(t, ext_tex_plane_1, s, vec2<f32>(1.0, 2.0), ext_tex_params);
}
-[[group(0), binding(2)]] var ext_tex_plane_1_1 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_plane_1_1 : texture_2d<f32>;
-[[group(0), binding(3)]] var<uniform> ext_tex_params_1 : ExternalTextureParams;
+@group(0) @binding(3) var<uniform> ext_tex_params_1 : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(smp, ext_tex, ext_tex_plane_1_1, ext_tex_params_1);
}
@@ -510,11 +510,11 @@
textureSampleLevel(t2, s, vec2<f32>(1.0, 2.0));
}
-[[group(0), binding(0)]] var ext_tex : texture_external;
-[[group(0), binding(1)]] var smp : sampler;
-[[group(0), binding(2)]] var ext_tex2 : texture_external;
+@group(0) @binding(0) var ext_tex : texture_external;
+@group(0) @binding(1) var smp : sampler;
+@group(0) @binding(2) var ext_tex2 : texture_external;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, smp, ext_tex2);
}
@@ -548,21 +548,21 @@
textureSampleExternal(t2, ext_tex_plane_1_1, s, vec2<f32>(1.0, 2.0), ext_tex_params_1);
}
-[[group(0), binding(3)]] var ext_tex_plane_1_2 : texture_2d<f32>;
+@group(0) @binding(3) var ext_tex_plane_1_2 : texture_2d<f32>;
-[[group(0), binding(4)]] var<uniform> ext_tex_params_2 : ExternalTextureParams;
+@group(0) @binding(4) var<uniform> ext_tex_params_2 : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(1) var smp : sampler;
-[[group(0), binding(5)]] var ext_tex_plane_1_3 : texture_2d<f32>;
+@group(0) @binding(5) var ext_tex_plane_1_3 : texture_2d<f32>;
-[[group(0), binding(6)]] var<uniform> ext_tex_params_3 : ExternalTextureParams;
+@group(0) @binding(6) var<uniform> ext_tex_params_3 : ExternalTextureParams;
-[[group(0), binding(2)]] var ext_tex2 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex2 : texture_2d<f32>;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, ext_tex_plane_1_2, ext_tex_params_2, smp, ext_tex2, ext_tex_plane_1_3, ext_tex_params_3);
}
@@ -589,10 +589,10 @@
nested(t, s);
}
-[[group(0), binding(0)]] var ext_tex : texture_external;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(0) var ext_tex : texture_external;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, smp);
}
@@ -629,15 +629,15 @@
nested(t, ext_tex_plane_1_1, ext_tex_params_1, s);
}
-[[group(0), binding(2)]] var ext_tex_plane_1_2 : texture_2d<f32>;
+@group(0) @binding(2) var ext_tex_plane_1_2 : texture_2d<f32>;
-[[group(0), binding(3)]] var<uniform> ext_tex_params_2 : ExternalTextureParams;
+@group(0) @binding(3) var<uniform> ext_tex_params_2 : ExternalTextureParams;
-[[group(0), binding(0)]] var ext_tex : texture_2d<f32>;
+@group(0) @binding(0) var ext_tex : texture_2d<f32>;
-[[group(0), binding(1)]] var smp : sampler;
+@group(0) @binding(1) var smp : sampler;
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
f(ext_tex, ext_tex_plane_1_2, ext_tex_params_2, smp);
}
diff --git a/src/transform/num_workgroups_from_uniform.h b/src/transform/num_workgroups_from_uniform.h
index af922c2..ab8daa6 100644
--- a/src/transform/num_workgroups_from_uniform.h
+++ b/src/transform/num_workgroups_from_uniform.h
@@ -34,7 +34,7 @@
/// num_workgroups : vec3<u32>;
/// };
///
-/// [[group(0), binding(0)]]
+/// @group(0) @binding(0)
/// var<uniform> num_workgroups_ubo : num_workgroups_struct;
/// ```
/// The binding group and number used for this uniform buffer is provided via
diff --git a/src/transform/num_workgroups_from_uniform_test.cc b/src/transform/num_workgroups_from_uniform_test.cc
index ecb221a..bea5222 100644
--- a/src/transform/num_workgroups_from_uniform_test.cc
+++ b/src/transform/num_workgroups_from_uniform_test.cc
@@ -57,8 +57,8 @@
TEST_F(NumWorkgroupsFromUniformTest, Basic) {
auto* src = R"(
-[[stage(compute), workgroup_size(1)]]
-fn main([[builtin(num_workgroups)]] num_wgs : vec3<u32>) {
+@stage(compute) @workgroup_size(1)
+fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
let groups_z = num_wgs.z;
@@ -70,7 +70,7 @@
num_workgroups : vec3<u32>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
+@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
fn main_inner(num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
@@ -78,7 +78,7 @@
let groups_z = num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
main_inner(tint_symbol_3.num_workgroups);
}
@@ -96,10 +96,10 @@
TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember) {
auto* src = R"(
struct Builtins {
- [[builtin(num_workgroups)]] num_wgs : vec3<u32>;
+ @builtin(num_workgroups) num_wgs : vec3<u32>;
};
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@@ -112,7 +112,7 @@
num_workgroups : vec3<u32>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
+@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
struct Builtins {
num_wgs : vec3<u32>;
@@ -124,7 +124,7 @@
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
main_inner(Builtins(tint_symbol_3.num_workgroups));
}
@@ -142,12 +142,12 @@
TEST_F(NumWorkgroupsFromUniformTest, StructMultipleMembers) {
auto* src = R"(
struct Builtins {
- [[builtin(global_invocation_id)]] gid : vec3<u32>;
- [[builtin(num_workgroups)]] num_wgs : vec3<u32>;
- [[builtin(workgroup_id)]] wgid : vec3<u32>;
+ @builtin(global_invocation_id) gid : vec3<u32>;
+ @builtin(num_workgroups) num_wgs : vec3<u32>;
+ @builtin(workgroup_id) wgid : vec3<u32>;
};
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@@ -160,7 +160,7 @@
num_workgroups : vec3<u32>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
+@group(0) @binding(30) var<uniform> tint_symbol_3 : tint_symbol_2;
struct Builtins {
gid : vec3<u32>;
@@ -169,9 +169,9 @@
}
struct tint_symbol_1 {
- [[builtin(global_invocation_id)]]
+ @builtin(global_invocation_id)
gid : vec3<u32>;
- [[builtin(workgroup_id)]]
+ @builtin(workgroup_id)
wgid : vec3<u32>;
}
@@ -181,7 +181,7 @@
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid));
}
@@ -199,31 +199,31 @@
TEST_F(NumWorkgroupsFromUniformTest, MultipleEntryPoints) {
auto* src = R"(
struct Builtins1 {
- [[builtin(num_workgroups)]] num_wgs : vec3<u32>;
+ @builtin(num_workgroups) num_wgs : vec3<u32>;
};
struct Builtins2 {
- [[builtin(global_invocation_id)]] gid : vec3<u32>;
- [[builtin(num_workgroups)]] num_wgs : vec3<u32>;
- [[builtin(workgroup_id)]] wgid : vec3<u32>;
+ @builtin(global_invocation_id) gid : vec3<u32>;
+ @builtin(num_workgroups) num_wgs : vec3<u32>;
+ @builtin(workgroup_id) wgid : vec3<u32>;
};
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
-fn main3([[builtin(num_workgroups)]] num_wgs : vec3<u32>) {
+@stage(compute) @workgroup_size(1)
+fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
let groups_z = num_wgs.z;
@@ -235,7 +235,7 @@
num_workgroups : vec3<u32>;
}
-[[group(0), binding(30)]] var<uniform> tint_symbol_7 : tint_symbol_6;
+@group(0) @binding(30) var<uniform> tint_symbol_7 : tint_symbol_6;
struct Builtins1 {
num_wgs : vec3<u32>;
@@ -253,15 +253,15 @@
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups));
}
struct tint_symbol_3 {
- [[builtin(global_invocation_id)]]
+ @builtin(global_invocation_id)
gid : vec3<u32>;
- [[builtin(workgroup_id)]]
+ @builtin(workgroup_id)
wgid : vec3<u32>;
}
@@ -271,7 +271,7 @@
let groups_z = in.num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid));
}
@@ -282,7 +282,7 @@
let groups_z = num_wgs.z;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main3() {
main3_inner(tint_symbol_7.num_workgroups);
}
@@ -300,11 +300,11 @@
TEST_F(NumWorkgroupsFromUniformTest, NoUsages) {
auto* src = R"(
struct Builtins {
- [[builtin(global_invocation_id)]] gid : vec3<u32>;
- [[builtin(workgroup_id)]] wgid : vec3<u32>;
+ @builtin(global_invocation_id) gid : vec3<u32>;
+ @builtin(workgroup_id) wgid : vec3<u32>;
};
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main(in : Builtins) {
}
)";
@@ -316,16 +316,16 @@
}
struct tint_symbol_1 {
- [[builtin(global_invocation_id)]]
+ @builtin(global_invocation_id)
gid : vec3<u32>;
- [[builtin(workgroup_id)]]
+ @builtin(workgroup_id)
wgid : vec3<u32>;
}
fn main_inner(in : Builtins) {
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol.wgid));
}
diff --git a/src/transform/pad_array_elements_test.cc b/src/transform/pad_array_elements_test.cc
index 05ca2da..441eadc 100644
--- a/src/transform/pad_array_elements_test.cc
+++ b/src/transform/pad_array_elements_test.cc
@@ -46,11 +46,11 @@
TEST_F(PadArrayElementsTest, ArrayAsGlobal) {
auto* src = R"(
-var<private> arr : [[stride(8)]] array<i32, 4>;
+var<private> arr : @stride(8) array<i32, 4>;
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(8)]]
+ @size(8)
el : i32;
}
@@ -65,12 +65,12 @@
TEST_F(PadArrayElementsTest, RuntimeArray) {
auto* src = R"(
struct S {
- rta : [[stride(8)]] array<i32>;
+ rta : @stride(8) array<i32>;
};
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(8)]]
+ @size(8)
el : i32;
}
@@ -87,15 +87,15 @@
TEST_F(PadArrayElementsTest, ArrayFunctionVar) {
auto* src = R"(
fn f() {
- var arr : [[stride(16)]] array<i32, 4>;
- arr = [[stride(16)]] array<i32, 4>();
- arr = [[stride(16)]] array<i32, 4>(1, 2, 3, 4);
+ var arr : @stride(16) array<i32, 4>;
+ arr = @stride(16) array<i32, 4>();
+ arr = @stride(16) array<i32, 4>(1, 2, 3, 4);
let x = arr[3];
}
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(16)]]
+ @size(16)
el : i32;
}
@@ -114,13 +114,13 @@
TEST_F(PadArrayElementsTest, ArrayAsParam) {
auto* src = R"(
-fn f(a : [[stride(12)]] array<i32, 4>) -> i32 {
+fn f(a : @stride(12) array<i32, 4>) -> i32 {
return a[2];
}
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(12)]]
+ @size(12)
el : i32;
}
@@ -137,14 +137,14 @@
// TODO(crbug.com/tint/781): Cannot parse the stride on the return array type.
TEST_F(PadArrayElementsTest, DISABLED_ArrayAsReturn) {
auto* src = R"(
-fn f() -> [[stride(8)]] array<i32, 4> {
+fn f() -> @stride(8) array<i32, 4> {
return array<i32, 4>(1, 2, 3, 4);
}
)";
auto* expect = R"(
struct tint_padded_array_element {
el : i32;
- [[size(4)]]
+ @size(4)
padding : u32;
};
@@ -160,7 +160,7 @@
TEST_F(PadArrayElementsTest, ArrayAlias) {
auto* src = R"(
-type Array = [[stride(16)]] array<i32, 4>;
+type Array = @stride(16) array<i32, 4>;
fn f() {
var arr : Array;
@@ -173,7 +173,7 @@
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(16)]]
+ @size(16)
el : i32;
}
@@ -197,25 +197,25 @@
TEST_F(PadArrayElementsTest, ArraysInStruct) {
auto* src = R"(
struct S {
- a : [[stride(8)]] array<i32, 4>;
- b : [[stride(8)]] array<i32, 8>;
- c : [[stride(8)]] array<i32, 4>;
- d : [[stride(12)]] array<i32, 8>;
+ a : @stride(8) array<i32, 4>;
+ b : @stride(8) array<i32, 8>;
+ c : @stride(8) array<i32, 4>;
+ d : @stride(12) array<i32, 8>;
};
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(8)]]
+ @size(8)
el : i32;
}
struct tint_padded_array_element_1 {
- [[size(8)]]
+ @size(8)
el : i32;
}
struct tint_padded_array_element_2 {
- [[size(12)]]
+ @size(12)
el : i32;
}
@@ -235,39 +235,39 @@
TEST_F(PadArrayElementsTest, ArraysOfArraysInStruct) {
auto* src = R"(
struct S {
- a : [[stride(512)]] array<i32, 4>;
- b : [[stride(512)]] array<[[stride(32)]] array<i32, 4>, 4>;
- c : [[stride(512)]] array<[[stride(64)]] array<[[stride(8)]] array<i32, 4>, 4>, 4>;
+ a : @stride(512) array<i32, 4>;
+ b : @stride(512) array<@stride(32) array<i32, 4>, 4>;
+ c : @stride(512) array<@stride(64) array<@stride(8) array<i32, 4>, 4>, 4>;
};
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(512)]]
+ @size(512)
el : i32;
}
struct tint_padded_array_element_2 {
- [[size(32)]]
+ @size(32)
el : i32;
}
struct tint_padded_array_element_1 {
- [[size(512)]]
+ @size(512)
el : array<tint_padded_array_element_2, 4u>;
}
struct tint_padded_array_element_5 {
- [[size(8)]]
+ @size(8)
el : i32;
}
struct tint_padded_array_element_4 {
- [[size(64)]]
+ @size(64)
el : array<tint_padded_array_element_5, 4u>;
}
struct tint_padded_array_element_3 {
- [[size(512)]]
+ @size(512)
el : array<tint_padded_array_element_4, 4u>;
}
@@ -286,9 +286,9 @@
TEST_F(PadArrayElementsTest, AccessArraysOfArraysInStruct) {
auto* src = R"(
struct S {
- a : [[stride(512)]] array<i32, 4>;
- b : [[stride(512)]] array<[[stride(32)]] array<i32, 4>, 4>;
- c : [[stride(512)]] array<[[stride(64)]] array<[[stride(8)]] array<i32, 4>, 4>, 4>;
+ a : @stride(512) array<i32, 4>;
+ b : @stride(512) array<@stride(32) array<i32, 4>, 4>;
+ c : @stride(512) array<@stride(64) array<@stride(8) array<i32, 4>, 4>, 4>;
};
fn f(s : S) -> i32 {
@@ -297,32 +297,32 @@
)";
auto* expect = R"(
struct tint_padded_array_element {
- [[size(512)]]
+ @size(512)
el : i32;
}
struct tint_padded_array_element_2 {
- [[size(32)]]
+ @size(32)
el : i32;
}
struct tint_padded_array_element_1 {
- [[size(512)]]
+ @size(512)
el : array<tint_padded_array_element_2, 4u>;
}
struct tint_padded_array_element_5 {
- [[size(8)]]
+ @size(8)
el : i32;
}
struct tint_padded_array_element_4 {
- [[size(64)]]
+ @size(64)
el : array<tint_padded_array_element_5, 4u>;
}
struct tint_padded_array_element_3 {
- [[size(512)]]
+ @size(512)
el : array<tint_padded_array_element_4, 4u>;
}
@@ -346,24 +346,24 @@
auto* src = R"(
type T0 = i32;
-type T1 = [[stride(8)]] array<i32, 1>;
+type T1 = @stride(8) array<i32, 1>;
type T2 = i32;
-fn f1(a : [[stride(8)]] array<i32, 2>) {
+fn f1(a : @stride(8) array<i32, 2>) {
}
type T3 = i32;
fn f2() {
- var v : [[stride(8)]] array<i32, 3>;
+ var v : @stride(8) array<i32, 3>;
}
)";
auto* expect = R"(
type T0 = i32;
struct tint_padded_array_element {
- [[size(8)]]
+ @size(8)
el : i32;
}
@@ -372,7 +372,7 @@
type T2 = i32;
struct tint_padded_array_element_1 {
- [[size(8)]]
+ @size(8)
el : i32;
}
@@ -382,7 +382,7 @@
type T3 = i32;
struct tint_padded_array_element_2 {
- [[size(8)]]
+ @size(8)
el : i32;
}
diff --git a/src/transform/remove_phonies_test.cc b/src/transform/remove_phonies_test.cc
index 6d6c86d..6e8a1f1 100644
--- a/src/transform/remove_phonies_test.cc
+++ b/src/transform/remove_phonies_test.cc
@@ -37,7 +37,7 @@
TEST_F(RemovePhoniesTest, NoSideEffects) {
auto* src = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
+@group(0) @binding(0) var t : texture_2d<f32>;
fn f() {
var v : i32;
@@ -54,7 +54,7 @@
)";
auto* expect = R"(
-[[group(0), binding(0)]] var t : texture_2d<f32>;
+@group(0) @binding(0) var t : texture_2d<f32>;
fn f() {
var v : i32;
@@ -177,7 +177,7 @@
arr : array<i32>;
};
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
fn x() -> i32 {
return 0;
@@ -206,7 +206,7 @@
arr : array<i32>;
}
-[[group(0), binding(0)]] var<storage, read_write> s : S;
+@group(0) @binding(0) var<storage, read_write> s : S;
fn x() -> i32 {
return 0;
diff --git a/src/transform/renamer_test.cc b/src/transform/renamer_test.cc
index 7f83043..5ef8ee5 100644
--- a/src/transform/renamer_test.cc
+++ b/src/transform/renamer_test.cc
@@ -46,9 +46,9 @@
return vert_idx;
}
-[[stage(vertex)]]
-fn entry([[builtin(vertex_index)]] vert_idx : u32
- ) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry(@builtin(vertex_index) vert_idx : u32
+ ) -> @builtin(position) vec4<f32> {
ignore(test(vert_idx));
return vec4<f32>();
}
@@ -59,8 +59,8 @@
return tint_symbol_1;
}
-[[stage(vertex)]]
-fn tint_symbol_2([[builtin(vertex_index)]] tint_symbol_1 : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(position) vec4<f32> {
ignore(tint_symbol(tint_symbol_1));
return vec4<f32>();
}
@@ -83,8 +83,8 @@
TEST_F(RenamerTest, PreserveSwizzles) {
auto* src = R"(
-[[stage(vertex)]]
-fn entry() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry() -> @builtin(position) vec4<f32> {
var v : vec4<f32>;
var rgba : f32;
var xyzw : f32;
@@ -93,8 +93,8 @@
)";
auto* expect = R"(
-[[stage(vertex)]]
-fn tint_symbol() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
var tint_symbol_2 : f32;
var tint_symbol_3 : f32;
@@ -120,16 +120,16 @@
TEST_F(RenamerTest, PreserveIntrinsics) {
auto* src = R"(
-[[stage(vertex)]]
-fn entry() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry() -> @builtin(position) vec4<f32> {
var blah : vec4<f32>;
return abs(blah);
}
)";
auto* expect = R"(
-[[stage(vertex)]]
-fn tint_symbol() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
return abs(tint_symbol_1);
}
@@ -151,7 +151,7 @@
TEST_F(RenamerTest, PreserveBuiltinTypes) {
auto* src = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn entry() {
var a = modf(1.0).whole;
var b = modf(1.0).fract;
@@ -161,7 +161,7 @@
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn tint_symbol() {
var tint_symbol_1 = modf(1.0).whole;
var tint_symbol_2 = modf(1.0).fract;
@@ -186,8 +186,8 @@
TEST_F(RenamerTest, AttemptSymbolCollision) {
auto* src = R"(
-[[stage(vertex)]]
-fn entry() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn entry() -> @builtin(position) vec4<f32> {
var tint_symbol : vec4<f32>;
var tint_symbol_2 : vec4<f32>;
var tint_symbol_4 : vec4<f32>;
@@ -196,8 +196,8 @@
)";
auto* expect = R"(
-[[stage(vertex)]]
-fn tint_symbol() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
var tint_symbol_2 : vec4<f32>;
var tint_symbol_3 : vec4<f32>;
@@ -229,7 +229,7 @@
auto keyword = GetParam();
auto src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var )" + keyword +
R"( : i32;
@@ -237,7 +237,7 @@
)";
auto* expect = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var tint_symbol : i32;
}
@@ -254,7 +254,7 @@
auto keyword = GetParam();
auto src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var )" + keyword +
R"( : i32;
@@ -262,7 +262,7 @@
)";
auto* expect = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var tint_symbol : i32;
}
@@ -279,7 +279,7 @@
auto keyword = GetParam();
auto src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var )" + keyword +
R"( : i32;
@@ -287,7 +287,7 @@
)";
auto* expect = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
var tint_symbol : i32;
}
diff --git a/src/transform/robustness_test.cc b/src/transform/robustness_test.cc
index a471381..8af6cce 100644
--- a/src/transform/robustness_test.cc
+++ b/src/transform/robustness_test.cc
@@ -178,7 +178,7 @@
a : array<f32, 0x7fffffff>;
b : array<f32>;
};
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
fn f() {
// Signed
@@ -217,7 +217,7 @@
b : array<f32>;
};
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
fn f() {
var i32_a1 : f32 = s.a[2147483646];
@@ -579,7 +579,7 @@
// TODO(dsinclair): Implement when constant_id exists
TEST_F(RobustnessTest, DISABLED_Vector_Constant_Id_Clamps) {
- // [[override(1300)]] let idx : i32;
+ // @override(1300) let idx : i32;
// var a : vec3<f32>
// var b : f32 = a[idx]
//
@@ -588,7 +588,7 @@
// TODO(dsinclair): Implement when constant_id exists
TEST_F(RobustnessTest, DISABLED_Array_Constant_Id_Clamps) {
- // [[override(1300)]] let idx : i32;
+ // @override(1300) let idx : i32;
// var a : array<f32, 4>
// var b : f32 = a[idx]
//
@@ -597,7 +597,7 @@
// TODO(dsinclair): Implement when constant_id exists
TEST_F(RobustnessTest, DISABLED_Matrix_Column_Constant_Id_Clamps) {
- // [[override(1300)]] let idx : i32;
+ // @override(1300) let idx : i32;
// var a : mat3x2<f32>
// var b : f32 = a[idx][1]
//
@@ -606,7 +606,7 @@
// TODO(dsinclair): Implement when constant_id exists
TEST_F(RobustnessTest, DISABLED_Matrix_Row_Constant_Id_Clamps) {
- // [[override(1300)]] let idx : i32;
+ // @override(1300) let idx : i32;
// var a : mat3x2<f32>
// var b : f32 = a[1][idx]
//
@@ -619,7 +619,7 @@
a : f32;
b : array<f32>;
};
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
fn f() {
var d : f32 = s.b[25];
@@ -632,7 +632,7 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
fn f() {
var d : f32 = s.b[min(25u, (arrayLength(&(s.b)) - 1u))];
@@ -652,14 +652,14 @@
// Clamp textureLoad() coord, array_index and level values
TEST_F(RobustnessTest, TextureLoad_Clamp) {
auto* src = R"(
-[[group(0), binding(0)]] var tex_1d : texture_1d<f32>;
-[[group(0), binding(0)]] var tex_2d : texture_2d<f32>;
-[[group(0), binding(0)]] var tex_2d_arr : texture_2d_array<f32>;
-[[group(0), binding(0)]] var tex_3d : texture_3d<f32>;
-[[group(0), binding(0)]] var tex_ms_2d : texture_multisampled_2d<f32>;
-[[group(0), binding(0)]] var tex_depth_2d : texture_depth_2d;
-[[group(0), binding(0)]] var tex_depth_2d_arr : texture_depth_2d_array;
-[[group(0), binding(0)]] var tex_external : texture_external;
+@group(0) @binding(0) var tex_1d : texture_1d<f32>;
+@group(0) @binding(0) var tex_2d : texture_2d<f32>;
+@group(0) @binding(0) var tex_2d_arr : texture_2d_array<f32>;
+@group(0) @binding(0) var tex_3d : texture_3d<f32>;
+@group(0) @binding(0) var tex_ms_2d : texture_multisampled_2d<f32>;
+@group(0) @binding(0) var tex_depth_2d : texture_depth_2d;
+@group(0) @binding(0) var tex_depth_2d_arr : texture_depth_2d_array;
+@group(0) @binding(0) var tex_external : texture_external;
fn f() {
var array_idx : i32;
@@ -679,21 +679,21 @@
auto* expect =
R"(
-[[group(0), binding(0)]] var tex_1d : texture_1d<f32>;
+@group(0) @binding(0) var tex_1d : texture_1d<f32>;
-[[group(0), binding(0)]] var tex_2d : texture_2d<f32>;
+@group(0) @binding(0) var tex_2d : texture_2d<f32>;
-[[group(0), binding(0)]] var tex_2d_arr : texture_2d_array<f32>;
+@group(0) @binding(0) var tex_2d_arr : texture_2d_array<f32>;
-[[group(0), binding(0)]] var tex_3d : texture_3d<f32>;
+@group(0) @binding(0) var tex_3d : texture_3d<f32>;
-[[group(0), binding(0)]] var tex_ms_2d : texture_multisampled_2d<f32>;
+@group(0) @binding(0) var tex_ms_2d : texture_multisampled_2d<f32>;
-[[group(0), binding(0)]] var tex_depth_2d : texture_depth_2d;
+@group(0) @binding(0) var tex_depth_2d : texture_depth_2d;
-[[group(0), binding(0)]] var tex_depth_2d_arr : texture_depth_2d_array;
+@group(0) @binding(0) var tex_depth_2d_arr : texture_depth_2d_array;
-[[group(0), binding(0)]] var tex_external : texture_external;
+@group(0) @binding(0) var tex_external : texture_external;
fn f() {
var array_idx : i32;
@@ -718,13 +718,13 @@
// Clamp textureStore() coord, array_index and level values
TEST_F(RobustnessTest, TextureStore_Clamp) {
auto* src = R"(
-[[group(0), binding(0)]] var tex1d : texture_storage_1d<rgba8sint, write>;
+@group(0) @binding(0) var tex1d : texture_storage_1d<rgba8sint, write>;
-[[group(0), binding(1)]] var tex2d : texture_storage_2d<rgba8sint, write>;
+@group(0) @binding(1) var tex2d : texture_storage_2d<rgba8sint, write>;
-[[group(0), binding(2)]] var tex2d_arr : texture_storage_2d_array<rgba8sint, write>;
+@group(0) @binding(2) var tex2d_arr : texture_storage_2d_array<rgba8sint, write>;
-[[group(0), binding(3)]] var tex3d : texture_storage_3d<rgba8sint, write>;
+@group(0) @binding(3) var tex3d : texture_storage_3d<rgba8sint, write>;
fn f() {
textureStore(tex1d, 10, vec4<i32>());
@@ -735,13 +735,13 @@
)";
auto* expect = R"(
-[[group(0), binding(0)]] var tex1d : texture_storage_1d<rgba8sint, write>;
+@group(0) @binding(0) var tex1d : texture_storage_1d<rgba8sint, write>;
-[[group(0), binding(1)]] var tex2d : texture_storage_2d<rgba8sint, write>;
+@group(0) @binding(1) var tex2d : texture_storage_2d<rgba8sint, write>;
-[[group(0), binding(2)]] var tex2d_arr : texture_storage_2d_array<rgba8sint, write>;
+@group(0) @binding(2) var tex2d_arr : texture_storage_2d_array<rgba8sint, write>;
-[[group(0), binding(3)]] var tex3d : texture_storage_3d<rgba8sint, write>;
+@group(0) @binding(3) var tex3d : texture_storage_3d<rgba8sint, write>;
fn f() {
textureStore(tex1d, clamp(10, i32(), (textureDimensions(tex1d) - i32(1))), vec4<i32>());
@@ -779,7 +779,7 @@
b : array<f32>;
};
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
let c : u32 = 1u;
@@ -796,7 +796,7 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
let c : u32 = 1u;
@@ -817,13 +817,13 @@
a : array<f32, 4>;
b : array<f32>;
};
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
-type UArr = [[stride(16)]] array<f32, 4>;
+type UArr = @stride(16) array<f32, 4>;
struct U {
a : UArr;
};
-[[group(1), binding(0)]] var<uniform> u : U;
+@group(1) @binding(0) var<uniform> u : U;
fn f() {
// Signed
@@ -876,15 +876,15 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
-type UArr = [[stride(16)]] array<f32, 4>;
+type UArr = @stride(16) array<f32, 4>;
struct U {
a : UArr;
}
-[[group(1), binding(0)]] var<uniform> u : U;
+@group(1) @binding(0) var<uniform> u : U;
fn f() {
var i32_sa1 : f32 = s.a[3];
@@ -939,15 +939,15 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
-type UArr = [[stride(16)]] array<f32, 4>;
+type UArr = @stride(16) array<f32, 4>;
struct U {
a : UArr;
}
-[[group(1), binding(0)]] var<uniform> u : U;
+@group(1) @binding(0) var<uniform> u : U;
fn f() {
var i32_sa1 : f32 = s.a[4];
@@ -1004,15 +1004,15 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
-type UArr = [[stride(16)]] array<f32, 4>;
+type UArr = @stride(16) array<f32, 4>;
struct U {
a : UArr;
}
-[[group(1), binding(0)]] var<uniform> u : U;
+@group(1) @binding(0) var<uniform> u : U;
fn f() {
var i32_sa1 : f32 = s.a[3];
@@ -1069,15 +1069,15 @@
b : array<f32>;
}
-[[group(0), binding(0)]] var<storage, read> s : S;
+@group(0) @binding(0) var<storage, read> s : S;
-type UArr = [[stride(16)]] array<f32, 4>;
+type UArr = @stride(16) array<f32, 4>;
struct U {
a : UArr;
}
-[[group(1), binding(0)]] var<uniform> u : U;
+@group(1) @binding(0) var<uniform> u : U;
fn f() {
var i32_sa1 : f32 = s.a[4];
diff --git a/src/transform/simplify_pointers_test.cc b/src/transform/simplify_pointers_test.cc
index 6b55d32..a9cce89 100644
--- a/src/transform/simplify_pointers_test.cc
+++ b/src/transform/simplify_pointers_test.cc
@@ -249,7 +249,7 @@
return 1;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
var arr = array<f32, 4>();
for (let a = &arr[foo()]; ;) {
@@ -264,7 +264,7 @@
return 1;
}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
var arr = array<f32, 4>();
let a_save = foo();
@@ -350,7 +350,7 @@
auto* src = R"(
var<private> a : array<i32, 2>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
let x = &a;
var a : i32 = (*x)[0];
@@ -363,7 +363,7 @@
auto* expect = R"(
var<private> a : array<i32, 2>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
var a_1 : i32 = a[0];
{
diff --git a/src/transform/single_entry_point_test.cc b/src/transform/single_entry_point_test.cc
index b2193b1..6b950fe 100644
--- a/src/transform/single_entry_point_test.cc
+++ b/src/transform/single_entry_point_test.cc
@@ -49,8 +49,8 @@
TEST_F(SingleEntryPointTest, Error_InvalidEntryPoint) {
auto* src = R"(
-[[stage(vertex)]]
-fn main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
@@ -70,7 +70,7 @@
auto* src = R"(
fn foo() {}
-[[stage(fragment)]]
+@stage(fragment)
fn main() {}
)";
@@ -87,7 +87,7 @@
TEST_F(SingleEntryPointTest, SingleEntryPoint) {
auto* src = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn main() {
}
)";
@@ -103,26 +103,26 @@
TEST_F(SingleEntryPointTest, MultipleEntryPoints) {
auto* src = R"(
-[[stage(vertex)]]
-fn vert_main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
}
)";
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
}
)";
@@ -146,23 +146,23 @@
var<private> d : f32;
-[[stage(vertex)]]
-fn vert_main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main() -> @builtin(position) vec4<f32> {
a = 0.0;
return vec4<f32>();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
b = 0.0;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
c = 0.0;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
d = 0.0;
}
@@ -171,7 +171,7 @@
auto* expect = R"(
var<private> c : f32;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
c = 0.0;
}
@@ -196,23 +196,23 @@
let d : f32 = 1.0;
-[[stage(vertex)]]
-fn vert_main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main() -> @builtin(position) vec4<f32> {
let local_a : f32 = a;
return vec4<f32>();
}
-[[stage(fragment)]]
+@stage(fragment)
fn frag_main() {
let local_b : f32 = b;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
let local_c : f32 = c;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
let local_d : f32 = d;
}
@@ -221,7 +221,7 @@
auto* expect = R"(
let c : f32 = 1.0;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
let local_c : f32 = c;
}
@@ -240,7 +240,7 @@
auto* src = R"(
let size : i32 = 1;
-[[stage(compute), workgroup_size(size)]]
+@stage(compute) @workgroup_size(size)
fn main() {
}
)";
@@ -258,32 +258,32 @@
TEST_F(SingleEntryPointTest, OverridableConstants) {
auto* src = R"(
-[[override(1001)]] let c1 : u32 = 1u;
+@override(1001) let c1 : u32 = 1u;
[[override]] let c2 : u32 = 1u;
-[[override(0)]] let c3 : u32 = 1u;
-[[override(9999)]] let c4 : u32 = 1u;
+@override(0) let c3 : u32 = 1u;
+@override(9999) let c4 : u32 = 1u;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
let local_d = c1;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
let local_d = c2;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main3() {
let local_d = c3;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main4() {
let local_d = c4;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main5() {
let local_d = 1u;
}
@@ -292,9 +292,9 @@
{
SingleEntryPoint::Config cfg("comp_main1");
auto* expect = R"(
-[[override(1001)]] let c1 : u32 = 1u;
+@override(1001) let c1 : u32 = 1u;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
let local_d = c1;
}
@@ -310,9 +310,9 @@
// The decorator is replaced with the one with explicit id
// And should not be affected by other constants stripped away
auto* expect = R"(
-[[override(1)]] let c2 : u32 = 1u;
+@override(1) let c2 : u32 = 1u;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
let local_d = c2;
}
@@ -326,9 +326,9 @@
{
SingleEntryPoint::Config cfg("comp_main3");
auto* expect = R"(
-[[override(0)]] let c3 : u32 = 1u;
+@override(0) let c3 : u32 = 1u;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main3() {
let local_d = c3;
}
@@ -342,9 +342,9 @@
{
SingleEntryPoint::Config cfg("comp_main4");
auto* expect = R"(
-[[override(9999)]] let c4 : u32 = 1u;
+@override(9999) let c4 : u32 = 1u;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main4() {
let local_d = c4;
}
@@ -358,7 +358,7 @@
{
SingleEntryPoint::Config cfg("comp_main5");
auto* expect = R"(
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main5() {
let local_d = 1u;
}
@@ -391,12 +391,12 @@
inner_shared();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
outer1();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
outer2();
}
@@ -414,7 +414,7 @@
inner_shared();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
outer1();
}
@@ -465,12 +465,12 @@
outer2_var = 0.0;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
outer1();
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main2() {
outer2();
}
@@ -497,7 +497,7 @@
outer1_var = 0.0;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn comp_main1() {
outer1();
}
diff --git a/src/transform/vectorize_scalar_matrix_constructors_test.cc b/src/transform/vectorize_scalar_matrix_constructors_test.cc
index c603ee2..7e72e4c 100644
--- a/src/transform/vectorize_scalar_matrix_constructors_test.cc
+++ b/src/transform/vectorize_scalar_matrix_constructors_test.cc
@@ -54,7 +54,7 @@
}
std::string tmpl = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let m = ${matrix}(${values});
}
@@ -83,7 +83,7 @@
}
std::string tmpl = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {
let m = ${matrix}(${columns});
}
diff --git a/src/transform/vertex_pulling_test.cc b/src/transform/vertex_pulling_test.cc
index 10b8ee8..b2482af 100644
--- a/src/transform/vertex_pulling_test.cc
+++ b/src/transform/vertex_pulling_test.cc
@@ -38,8 +38,8 @@
TEST_F(VertexPullingTest, Error_InvalidEntryPoint) {
auto* src = R"(
-[[stage(vertex)]]
-fn main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
@@ -58,7 +58,7 @@
TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
auto* src = R"(
-[[stage(fragment)]]
+@stage(fragment)
fn main() {}
)";
@@ -76,8 +76,8 @@
TEST_F(VertexPullingTest, Error_BadStride) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
)";
@@ -100,19 +100,19 @@
TEST_F(VertexPullingTest, BasicModule) {
auto* src = R"(
-[[stage(vertex)]]
-fn main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[stage(vertex)]]
-fn main() -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
@@ -129,21 +129,21 @@
TEST_F(VertexPullingTest, OneAttribute) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
let buffer_array_base_0 = tint_pulling_vertex_index;
@@ -167,21 +167,21 @@
TEST_F(VertexPullingTest, OneInstancedAttribute) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(instance_index)]] tint_pulling_instance_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(instance_index) tint_pulling_instance_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
let buffer_array_base_0 = tint_pulling_instance_index;
@@ -205,21 +205,21 @@
TEST_F(VertexPullingTest, OneAttributeDifferentOutputSet) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(5)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(5) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
let buffer_array_base_0 = tint_pulling_vertex_index;
@@ -245,29 +245,29 @@
TEST_F(VertexPullingTest, OneAttribute_Struct) {
auto* src = R"(
struct Inputs {
- [[location(0)]] var_a : f32;
+ @location(0) var_a : f32;
};
-[[stage(vertex)]]
-fn main(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
struct Inputs {
- [[location(0)]]
+ @location(0)
var_a : f32;
}
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
{
let buffer_array_base_0 = tint_pulling_vertex_index;
@@ -292,27 +292,27 @@
// We expect the transform to use an existing builtin variables if it finds them
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32,
- [[location(1)]] var_b : f32,
- [[builtin(vertex_index)]] custom_vertex_index : u32,
- [[builtin(instance_index)]] custom_instance_index : u32
- ) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32,
+ @location(1) var_b : f32,
+ @builtin(vertex_index) custom_vertex_index : u32,
+ @builtin(instance_index) custom_instance_index : u32
+ ) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, var_b, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[binding(1), group(4)]] var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
+@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] custom_vertex_index : u32, [[builtin(instance_index)]] custom_instance_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) custom_vertex_index : u32, @builtin(instance_index) custom_instance_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : f32;
{
@@ -350,47 +350,47 @@
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_Struct) {
auto* src = R"(
struct Inputs {
- [[location(0)]] var_a : f32;
- [[location(1)]] var_b : f32;
- [[builtin(vertex_index)]] custom_vertex_index : u32;
- [[builtin(instance_index)]] custom_instance_index : u32;
+ @location(0) var_a : f32;
+ @location(1) var_b : f32;
+ @builtin(vertex_index) custom_vertex_index : u32;
+ @builtin(instance_index) custom_instance_index : u32;
};
-[[stage(vertex)]]
-fn main(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[binding(1), group(4)]] var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
+@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
struct tint_symbol {
- [[builtin(vertex_index)]]
+ @builtin(vertex_index)
custom_vertex_index : u32;
- [[builtin(instance_index)]]
+ @builtin(instance_index)
custom_instance_index : u32;
}
struct Inputs {
- [[location(0)]]
+ @location(0)
var_a : f32;
- [[location(1)]]
+ @location(1)
var_b : f32;
- [[builtin(vertex_index)]]
+ @builtin(vertex_index)
custom_vertex_index : u32;
- [[builtin(instance_index)]]
+ @builtin(instance_index)
custom_instance_index : u32;
}
-[[stage(vertex)]]
-fn main(tint_symbol_1 : tint_symbol) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
inputs.custom_vertex_index = tint_symbol_1.custom_vertex_index;
inputs.custom_instance_index = tint_symbol_1.custom_instance_index;
@@ -429,46 +429,46 @@
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_SeparateStruct) {
auto* src = R"(
struct Inputs {
- [[location(0)]] var_a : f32;
- [[location(1)]] var_b : f32;
+ @location(0) var_a : f32;
+ @location(1) var_b : f32;
};
struct Indices {
- [[builtin(vertex_index)]] custom_vertex_index : u32;
- [[builtin(instance_index)]] custom_instance_index : u32;
+ @builtin(vertex_index) custom_vertex_index : u32;
+ @builtin(instance_index) custom_instance_index : u32;
};
-[[stage(vertex)]]
-fn main(inputs : Inputs, indices : Indices) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[binding(1), group(4)]] var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
+@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
struct Inputs {
- [[location(0)]]
+ @location(0)
var_a : f32;
- [[location(1)]]
+ @location(1)
var_b : f32;
}
struct Indices {
- [[builtin(vertex_index)]]
+ @builtin(vertex_index)
custom_vertex_index : u32;
- [[builtin(instance_index)]]
+ @builtin(instance_index)
custom_instance_index : u32;
}
-[[stage(vertex)]]
-fn main(indices : Indices) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(indices : Indices) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
{
let buffer_array_base_0 = indices.custom_vertex_index;
@@ -504,22 +504,22 @@
TEST_F(VertexPullingTest, TwoAttributesSameBuffer) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32,
- [[location(1)]] var_b : vec4<f32>) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32,
+ @location(1) var_b : vec4<f32>) -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : vec4<f32>;
{
@@ -547,28 +547,28 @@
TEST_F(VertexPullingTest, FloatVectorAttributes) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : vec2<f32>,
- [[location(1)]] var_b : vec3<f32>,
- [[location(2)]] var_c : vec4<f32>
- ) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : vec2<f32>,
+ @location(1) var_b : vec3<f32>,
+ @location(2) var_c : vec4<f32>
+ ) -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[binding(1), group(4)]] var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
+@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
-[[binding(2), group(4)]] var<storage, read> tint_pulling_vertex_buffer_2 : TintVertexData;
+@binding(2) @group(4) var<storage, read> tint_pulling_vertex_buffer_2 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : vec2<f32>;
var var_b : vec3<f32>;
var var_c : vec4<f32>;
@@ -601,9 +601,9 @@
TEST_F(VertexPullingTest, AttemptSymbolCollision) {
auto* src = R"(
-[[stage(vertex)]]
-fn main([[location(0)]] var_a : f32,
- [[location(1)]] var_b : vec4<f32>) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@location(0) var_a : f32,
+ @location(1) var_b : vec4<f32>) -> @builtin(position) vec4<f32> {
var tint_pulling_vertex_index : i32;
var tint_pulling_vertex_buffer_0 : i32;
var tint_vertex_data : i32;
@@ -614,13 +614,13 @@
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data_1 : [[stride(4)]] array<u32>;
+ tint_vertex_data_1 : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0_1 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0_1 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index_1 : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index_1 : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : vec4<f32>;
{
@@ -652,52 +652,52 @@
TEST_F(VertexPullingTest, FormatsAligned) {
auto* src = R"(
-[[stage(vertex)]]
+@stage(vertex)
fn main(
- [[location(0)]] uint8x2 : vec2<u32>,
- [[location(1)]] uint8x4 : vec4<u32>,
- [[location(2)]] sint8x2 : vec2<i32>,
- [[location(3)]] sint8x4 : vec4<i32>,
- [[location(4)]] unorm8x2 : vec2<f32>,
- [[location(5)]] unorm8x4 : vec4<f32>,
- [[location(6)]] snorm8x2 : vec2<f32>,
- [[location(7)]] snorm8x4 : vec4<f32>,
- [[location(8)]] uint16x2 : vec2<u32>,
- [[location(9)]] uint16x4 : vec4<u32>,
- [[location(10)]] sint16x2 : vec2<i32>,
- [[location(11)]] sint16x4 : vec4<i32>,
- [[location(12)]] unorm16x2 : vec2<f32>,
- [[location(13)]] unorm16x4 : vec4<f32>,
- [[location(14)]] snorm16x2 : vec2<f32>,
- [[location(15)]] snorm16x4 : vec4<f32>,
- [[location(16)]] float16x2 : vec2<f32>,
- [[location(17)]] float16x4 : vec4<f32>,
- [[location(18)]] float32 : f32,
- [[location(19)]] float32x2 : vec2<f32>,
- [[location(20)]] float32x3 : vec3<f32>,
- [[location(21)]] float32x4 : vec4<f32>,
- [[location(22)]] uint32 : u32,
- [[location(23)]] uint32x2 : vec2<u32>,
- [[location(24)]] uint32x3 : vec3<u32>,
- [[location(25)]] uint32x4 : vec4<u32>,
- [[location(26)]] sint32 : i32,
- [[location(27)]] sint32x2 : vec2<i32>,
- [[location(28)]] sint32x3 : vec3<i32>,
- [[location(29)]] sint32x4 : vec4<i32>
- ) -> [[builtin(position)]] vec4<f32> {
+ @location(0) uint8x2 : vec2<u32>,
+ @location(1) uint8x4 : vec4<u32>,
+ @location(2) sint8x2 : vec2<i32>,
+ @location(3) sint8x4 : vec4<i32>,
+ @location(4) unorm8x2 : vec2<f32>,
+ @location(5) unorm8x4 : vec4<f32>,
+ @location(6) snorm8x2 : vec2<f32>,
+ @location(7) snorm8x4 : vec4<f32>,
+ @location(8) uint16x2 : vec2<u32>,
+ @location(9) uint16x4 : vec4<u32>,
+ @location(10) sint16x2 : vec2<i32>,
+ @location(11) sint16x4 : vec4<i32>,
+ @location(12) unorm16x2 : vec2<f32>,
+ @location(13) unorm16x4 : vec4<f32>,
+ @location(14) snorm16x2 : vec2<f32>,
+ @location(15) snorm16x4 : vec4<f32>,
+ @location(16) float16x2 : vec2<f32>,
+ @location(17) float16x4 : vec4<f32>,
+ @location(18) float32 : f32,
+ @location(19) float32x2 : vec2<f32>,
+ @location(20) float32x3 : vec3<f32>,
+ @location(21) float32x4 : vec4<f32>,
+ @location(22) uint32 : u32,
+ @location(23) uint32x2 : vec2<u32>,
+ @location(24) uint32x3 : vec3<u32>,
+ @location(25) uint32x4 : vec4<u32>,
+ @location(26) sint32 : i32,
+ @location(27) sint32x2 : vec2<i32>,
+ @location(28) sint32x3 : vec3<i32>,
+ @location(29) sint32x4 : vec4<i32>
+ ) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
var sint8x2 : vec2<i32>;
@@ -811,39 +811,39 @@
TEST_F(VertexPullingTest, FormatsStrideUnaligned) {
auto* src = R"(
-[[stage(vertex)]]
+@stage(vertex)
fn main(
- [[location(0)]] uint8x2 : vec2<u32>,
- [[location(1)]] uint8x4 : vec4<u32>,
- [[location(2)]] sint8x2 : vec2<i32>,
- [[location(3)]] sint8x4 : vec4<i32>,
- [[location(4)]] unorm8x2 : vec2<f32>,
- [[location(5)]] unorm8x4 : vec4<f32>,
- [[location(6)]] snorm8x2 : vec2<f32>,
- [[location(7)]] snorm8x4 : vec4<f32>,
- [[location(8)]] uint16x2 : vec2<u32>,
- [[location(9)]] uint16x4 : vec4<u32>,
- [[location(10)]] sint16x2 : vec2<i32>,
- [[location(11)]] sint16x4 : vec4<i32>,
- [[location(12)]] unorm16x2 : vec2<f32>,
- [[location(13)]] unorm16x4 : vec4<f32>,
- [[location(14)]] snorm16x2 : vec2<f32>,
- [[location(15)]] snorm16x4 : vec4<f32>,
- [[location(16)]] float16x2 : vec2<f32>,
- [[location(17)]] float16x4 : vec4<f32>,
- [[location(18)]] float32 : f32,
- [[location(19)]] float32x2 : vec2<f32>,
- [[location(20)]] float32x3 : vec3<f32>,
- [[location(21)]] float32x4 : vec4<f32>,
- [[location(22)]] uint32 : u32,
- [[location(23)]] uint32x2 : vec2<u32>,
- [[location(24)]] uint32x3 : vec3<u32>,
- [[location(25)]] uint32x4 : vec4<u32>,
- [[location(26)]] sint32 : i32,
- [[location(27)]] sint32x2 : vec2<i32>,
- [[location(28)]] sint32x3 : vec3<i32>,
- [[location(29)]] sint32x4 : vec4<i32>
- ) -> [[builtin(position)]] vec4<f32> {
+ @location(0) uint8x2 : vec2<u32>,
+ @location(1) uint8x4 : vec4<u32>,
+ @location(2) sint8x2 : vec2<i32>,
+ @location(3) sint8x4 : vec4<i32>,
+ @location(4) unorm8x2 : vec2<f32>,
+ @location(5) unorm8x4 : vec4<f32>,
+ @location(6) snorm8x2 : vec2<f32>,
+ @location(7) snorm8x4 : vec4<f32>,
+ @location(8) uint16x2 : vec2<u32>,
+ @location(9) uint16x4 : vec4<u32>,
+ @location(10) sint16x2 : vec2<i32>,
+ @location(11) sint16x4 : vec4<i32>,
+ @location(12) unorm16x2 : vec2<f32>,
+ @location(13) unorm16x4 : vec4<f32>,
+ @location(14) snorm16x2 : vec2<f32>,
+ @location(15) snorm16x4 : vec4<f32>,
+ @location(16) float16x2 : vec2<f32>,
+ @location(17) float16x4 : vec4<f32>,
+ @location(18) float32 : f32,
+ @location(19) float32x2 : vec2<f32>,
+ @location(20) float32x3 : vec3<f32>,
+ @location(21) float32x4 : vec4<f32>,
+ @location(22) uint32 : u32,
+ @location(23) uint32x2 : vec2<u32>,
+ @location(24) uint32x3 : vec3<u32>,
+ @location(25) uint32x4 : vec4<u32>,
+ @location(26) sint32 : i32,
+ @location(27) sint32x2 : vec2<i32>,
+ @location(28) sint32x3 : vec3<i32>,
+ @location(29) sint32x4 : vec4<i32>
+ ) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
@@ -851,13 +851,13 @@
auto* expect =
R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
var sint8x2 : vec2<i32>;
@@ -971,52 +971,52 @@
TEST_F(VertexPullingTest, FormatsWithVectorsResized) {
auto* src = R"(
-[[stage(vertex)]]
+@stage(vertex)
fn main(
- [[location(0)]] uint8x2 : vec3<u32>,
- [[location(1)]] uint8x4 : vec2<u32>,
- [[location(2)]] sint8x2 : i32,
- [[location(3)]] sint8x4 : vec2<i32>,
- [[location(4)]] unorm8x2 : vec4<f32>,
- [[location(5)]] unorm8x4 : f32,
- [[location(6)]] snorm8x2 : vec3<f32>,
- [[location(7)]] snorm8x4 : f32,
- [[location(8)]] uint16x2 : vec3<u32>,
- [[location(9)]] uint16x4 : vec2<u32>,
- [[location(10)]] sint16x2 : vec4<i32>,
- [[location(11)]] sint16x4 : i32,
- [[location(12)]] unorm16x2 : vec3<f32>,
- [[location(13)]] unorm16x4 : f32,
- [[location(14)]] snorm16x2 : vec4<f32>,
- [[location(15)]] snorm16x4 : vec3<f32>,
- [[location(16)]] float16x2 : vec4<f32>,
- [[location(17)]] float16x4 : f32,
- [[location(18)]] float32 : vec4<f32>,
- [[location(19)]] float32x2 : vec4<f32>,
- [[location(20)]] float32x3 : vec2<f32>,
- [[location(21)]] float32x4 : vec3<f32>,
- [[location(22)]] uint32 : vec3<u32>,
- [[location(23)]] uint32x2 : vec4<u32>,
- [[location(24)]] uint32x3 : vec4<u32>,
- [[location(25)]] uint32x4 : vec2<u32>,
- [[location(26)]] sint32 : vec4<i32>,
- [[location(27)]] sint32x2 : vec3<i32>,
- [[location(28)]] sint32x3 : i32,
- [[location(29)]] sint32x4 : vec2<i32>
- ) -> [[builtin(position)]] vec4<f32> {
+ @location(0) uint8x2 : vec3<u32>,
+ @location(1) uint8x4 : vec2<u32>,
+ @location(2) sint8x2 : i32,
+ @location(3) sint8x4 : vec2<i32>,
+ @location(4) unorm8x2 : vec4<f32>,
+ @location(5) unorm8x4 : f32,
+ @location(6) snorm8x2 : vec3<f32>,
+ @location(7) snorm8x4 : f32,
+ @location(8) uint16x2 : vec3<u32>,
+ @location(9) uint16x4 : vec2<u32>,
+ @location(10) sint16x2 : vec4<i32>,
+ @location(11) sint16x4 : i32,
+ @location(12) unorm16x2 : vec3<f32>,
+ @location(13) unorm16x4 : f32,
+ @location(14) snorm16x2 : vec4<f32>,
+ @location(15) snorm16x4 : vec3<f32>,
+ @location(16) float16x2 : vec4<f32>,
+ @location(17) float16x4 : f32,
+ @location(18) float32 : vec4<f32>,
+ @location(19) float32x2 : vec4<f32>,
+ @location(20) float32x3 : vec2<f32>,
+ @location(21) float32x4 : vec3<f32>,
+ @location(22) uint32 : vec3<u32>,
+ @location(23) uint32x2 : vec4<u32>,
+ @location(24) uint32x3 : vec4<u32>,
+ @location(25) uint32x4 : vec2<u32>,
+ @location(26) sint32 : vec4<i32>,
+ @location(27) sint32x2 : vec3<i32>,
+ @location(28) sint32x3 : i32,
+ @location(29) sint32x4 : vec2<i32>
+ ) -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
}
)";
auto* expect = R"(
struct TintVertexData {
- tint_vertex_data : [[stride(4)]] array<u32>;
+ tint_vertex_data : @stride(4) array<u32>;
}
-[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
+@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
-[[stage(vertex)]]
-fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec3<u32>;
var uint8x4 : vec2<u32>;
var sint8x2 : i32;
diff --git a/src/transform/zero_init_workgroup_memory_test.cc b/src/transform/zero_init_workgroup_memory_test.cc
index 166036e..d23e0af 100644
--- a/src/transform/zero_init_workgroup_memory_test.cc
+++ b/src/transform/zero_init_workgroup_memory_test.cc
@@ -60,7 +60,7 @@
b = c;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
}
)";
@@ -75,16 +75,16 @@
auto* src = R"(
var<workgroup> v : i32;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
ignore(v); // Initialization should be inserted above this statement
}
)";
auto* expect = R"(
var<workgroup> v : i32;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
}
@@ -104,10 +104,10 @@
var<workgroup> v : i32;
struct Params {
- [[builtin(local_invocation_index)]] local_idx : u32;
+ @builtin(local_invocation_index) local_idx : u32;
};
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f(params : Params) {
ignore(v); // Initialization should be inserted above this statement
}
@@ -116,11 +116,11 @@
var<workgroup> v : i32;
struct Params {
- [[builtin(local_invocation_index)]]
+ @builtin(local_invocation_index)
local_idx : u32;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f(params : Params) {
{
v = i32();
@@ -139,7 +139,7 @@
auto* src = R"(
var<workgroup> v : i32;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
ignore(v); // Initialization should be inserted above this statement
}
@@ -147,8 +147,8 @@
auto* expect = R"(
var<workgroup> v : i32;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
v = i32();
}
@@ -176,8 +176,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
ignore(a); // Initialization should be inserted above this statement
ignore(b);
ignore(c);
@@ -195,8 +195,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
{
a = i32();
b.x = i32();
@@ -240,8 +240,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(2, 3)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(2, 3)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
ignore(a); // Initialization should be inserted above this statement
ignore(b);
ignore(c);
@@ -259,8 +259,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(2, 3)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(2, 3)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
if ((local_idx < 1u)) {
a = i32();
b.x = i32();
@@ -304,10 +304,10 @@
var<workgroup> c : array<S, 32>;
-[[override(1)]] let X : i32;
+@override(1) let X : i32;
-[[stage(compute), workgroup_size(2, 3, X)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(2, 3, X)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
ignore(a); // Initialization should be inserted above this statement
ignore(b);
ignore(c);
@@ -326,10 +326,10 @@
var<workgroup> c : array<S, 32>;
-[[override(1)]] let X : i32;
+@override(1) let X : i32;
-[[stage(compute), workgroup_size(2, 3, X)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(2, 3, X)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (u32(X) * 6u))) {
a = i32();
b.x = i32();
@@ -374,10 +374,10 @@
var<workgroup> c : array<S, 32>;
-[[override(1)]] let X : u32;
+@override(1) let X : u32;
-[[stage(compute), workgroup_size(5u, X, 10u)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(5u, X, 10u)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
ignore(a); // Initialization should be inserted above this statement
ignore(b);
ignore(c);
@@ -397,10 +397,10 @@
var<workgroup> c : array<S, 32>;
-[[override(1)]] let X : u32;
+@override(1) let X : u32;
-[[stage(compute), workgroup_size(5u, X, 10u)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(5u, X, 10u)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (X * 50u))) {
a = i32();
}
@@ -462,8 +462,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_id)]] local_invocation_id : vec3<u32>) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
ignore(a); // Initialization should be inserted above this statement
ignore(b);
ignore(c);
@@ -481,8 +481,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_id)]] local_invocation_id : vec3<u32>, [[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
b.x = i32();
@@ -525,18 +525,18 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f1() {
ignore(a); // Initialization should be inserted above this statement
ignore(c);
}
-[[stage(compute), workgroup_size(1, 2, 3)]]
-fn f2([[builtin(local_invocation_id)]] local_invocation_id : vec3<u32>) {
+@stage(compute) @workgroup_size(1, 2, 3)
+fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
ignore(b); // Initialization should be inserted above this statement
}
-[[stage(compute), workgroup_size(4, 5, 6)]]
+@stage(compute) @workgroup_size(4, 5, 6)
fn f3() {
ignore(c); // Initialization should be inserted above this statement
ignore(a);
@@ -554,8 +554,8 @@
var<workgroup> c : array<S, 32>;
-[[stage(compute), workgroup_size(1)]]
-fn f1([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f1(@builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
}
@@ -573,8 +573,8 @@
ignore(c);
}
-[[stage(compute), workgroup_size(1, 2, 3)]]
-fn f2([[builtin(local_invocation_id)]] local_invocation_id : vec3<u32>, [[builtin(local_invocation_index)]] local_invocation_index_1 : u32) {
+@stage(compute) @workgroup_size(1, 2, 3)
+fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index_1 : u32) {
if ((local_invocation_index_1 < 1u)) {
b.x = i32();
}
@@ -586,8 +586,8 @@
ignore(b);
}
-[[stage(compute), workgroup_size(4, 5, 6)]]
-fn f3([[builtin(local_invocation_index)]] local_invocation_index_2 : u32) {
+@stage(compute) @workgroup_size(4, 5, 6)
+fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) {
if ((local_invocation_index_2 < 1u)) {
a = i32();
}
@@ -623,8 +623,8 @@
use_v();
}
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
call_use_v(); // Initialization should be inserted above this statement
}
)";
@@ -639,8 +639,8 @@
use_v();
}
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_idx : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
}
@@ -659,7 +659,7 @@
var<workgroup> i : atomic<i32>;
var<workgroup> u : atomic<u32>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
ignore(i); // Initialization should be inserted above this statement
ignore(u);
@@ -670,8 +670,8 @@
var<workgroup> u : atomic<u32>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
atomicStore(&(i), i32());
atomicStore(&(u), u32());
@@ -699,7 +699,7 @@
var<workgroup> w : S;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
ignore(w); // Initialization should be inserted above this statement
}
@@ -715,8 +715,8 @@
var<workgroup> w : S;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
w.a = i32();
atomicStore(&(w.i), i32());
@@ -738,7 +738,7 @@
auto* src = R"(
var<workgroup> w : array<atomic<u32>, 4>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
ignore(w); // Initialization should be inserted above this statement
}
@@ -746,8 +746,8 @@
auto* expect = R"(
var<workgroup> w : array<atomic<u32>, 4>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i : u32 = idx;
atomicStore(&(w[i]), u32());
@@ -774,7 +774,7 @@
var<workgroup> w : array<S, 4>;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn f() {
ignore(w); // Initialization should be inserted above this statement
}
@@ -790,8 +790,8 @@
var<workgroup> w : array<S, 4>;
-[[stage(compute), workgroup_size(1)]]
-fn f([[builtin(local_invocation_index)]] local_invocation_index : u32) {
+@stage(compute) @workgroup_size(1)
+fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i_1 : u32 = idx;
w[i_1].a = i32();
diff --git a/src/writer/glsl/generator_impl_function_test.cc b/src/writer/glsl/generator_impl_function_test.cc
index 3d710f4..19aae88 100644
--- a/src/writer/glsl/generator_impl_function_test.cc
+++ b/src/writer/glsl/generator_impl_function_test.cc
@@ -127,7 +127,7 @@
TEST_F(GlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_WithInOutVars) {
- // fn frag_main([[location(0)]] foo : f32) -> [[location(1)]] f32 {
+ // fn frag_main(@location(0) foo : f32) -> @location(1) f32 {
// return foo;
// }
auto* foo_in = Param("foo", ty.f32(), {Location(0)});
@@ -173,7 +173,7 @@
TEST_F(GlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_WithInOut_Builtins) {
- // fn frag_main([[position(0)]] coord : vec4<f32>) -> [[frag_depth]] f32 {
+ // fn frag_main(@position(0) coord : vec4<f32>) -> @frag_depth f32 {
// return coord.x;
// }
auto* coord_in =
@@ -221,9 +221,9 @@
TEST_F(GlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_SharedStruct_DifferentStages) {
// struct Interface {
- // [[builtin(position)]] pos : vec4<f32>;
- // [[location(1)]] col1 : f32;
- // [[location(2)]] col2 : f32;
+ // @builtin(position) pos : vec4<f32>;
+ // @location(1) col1 : f32;
+ // @location(2) col2 : f32;
// };
// fn vert_main() -> Interface {
// return Interface(vec4<f32>(), 0.4, 0.6);
@@ -332,7 +332,7 @@
TEST_F(GlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_SharedStruct_HelperFunction) {
// struct VertexOutput {
- // [[builtin(position)]] pos : vec4<f32>;
+ // @builtin(position) pos : vec4<f32>;
// };
// fn foo(x : f32) -> VertexOutput {
// return VertexOutput(vec4<f32>(x, x, x, 1.0));
@@ -1032,15 +1032,15 @@
// [[block]] struct Data {
// d : f32;
// };
- // [[binding(0), group(0)]] var<storage> data : Data;
+ // @binding(0) @group(0) var<storage> data : Data;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn a() {
// var v = data.d;
// return;
// }
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn b() {
// var v = data.d;
// return;
diff --git a/src/writer/glsl/generator_impl_member_accessor_test.cc b/src/writer/glsl/generator_impl_member_accessor_test.cc
index 36809b3..07eeaa4 100644
--- a/src/writer/glsl/generator_impl_member_accessor_test.cc
+++ b/src/writer/glsl/generator_impl_member_accessor_test.cc
@@ -372,7 +372,7 @@
TEST_F(GlslGeneratorImplTest_MemberAccessor,
EmitExpression_IndexAccessor_StorageBuffer_Load_Int_FromArray) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[2];
@@ -420,7 +420,7 @@
TEST_F(GlslGeneratorImplTest_MemberAccessor,
EmitExpression_IndexAccessor_StorageBuffer_Load_Int_FromArray_ExprIdx) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[(2 + 4) - 3];
@@ -468,7 +468,7 @@
TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[2] = 2;
@@ -518,7 +518,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -578,7 +578,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -640,7 +640,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -702,7 +702,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -763,7 +763,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -822,7 +822,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index 3af0f4f..7688e85 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -113,7 +113,7 @@
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_WithInOutVars) {
- // fn frag_main([[location(0)]] foo : f32) -> [[location(1)]] f32 {
+ // fn frag_main(@location(0) foo : f32) -> @location(1) f32 {
// return foo;
// }
auto* foo_in = Param("foo", ty.f32(), {Location(0)});
@@ -145,7 +145,7 @@
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_WithInOut_Builtins) {
- // fn frag_main([[position(0)]] coord : vec4<f32>) -> [[frag_depth]] f32 {
+ // fn frag_main(@position(0) coord : vec4<f32>) -> @frag_depth f32 {
// return coord.x;
// }
auto* coord_in =
@@ -181,9 +181,9 @@
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_SharedStruct_DifferentStages) {
// struct Interface {
- // [[builtin(position)]] pos : vec4<f32>;
- // [[location(1)]] col1 : f32;
- // [[location(2)]] col2 : f32;
+ // @builtin(position) pos : vec4<f32>;
+ // @location(1) col1 : f32;
+ // @location(2) col2 : f32;
// };
// fn vert_main() -> Interface {
// return Interface(vec4<f32>(), 0.4, 0.6);
@@ -265,7 +265,7 @@
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoint_SharedStruct_HelperFunction) {
// struct VertexOutput {
- // [[builtin(position)]] pos : vec4<f32>;
+ // @builtin(position) pos : vec4<f32>;
// };
// fn foo(x : f32) -> VertexOutput {
// return VertexOutput(vec4<f32>(x, x, x, 1.0));
@@ -860,15 +860,15 @@
// [[block]] struct Data {
// d : f32;
// };
- // [[binding(0), group(0)]] var<storage> data : Data;
+ // @binding(0) @group(0) var<storage> data : Data;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn a() {
// var v = data.d;
// return;
// }
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn b() {
// var v = data.d;
// return;
diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc
index 195a160..03cf494 100644
--- a/src/writer/hlsl/generator_impl_member_accessor_test.cc
+++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc
@@ -393,7 +393,7 @@
TEST_F(HlslGeneratorImplTest_MemberAccessor,
EmitExpression_IndexAccessor_StorageBuffer_Load_Int_FromArray) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[2];
@@ -425,7 +425,7 @@
TEST_F(HlslGeneratorImplTest_MemberAccessor,
EmitExpression_IndexAccessor_StorageBuffer_Load_Int_FromArray_ExprIdx) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[(2 + 4) - 3];
@@ -457,7 +457,7 @@
TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
// struct Data {
- // a : [[stride(4)]] array<i32, 5>;
+ // a : @stride(4) array<i32, 5>;
// };
// var<storage> data : Data;
// data.a[2] = 2;
@@ -491,7 +491,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -533,7 +533,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -577,7 +577,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -621,7 +621,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -664,7 +664,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
@@ -705,7 +705,7 @@
// b : vec3<f32>;
// };
// struct Data {
- // var c : [[stride(32)]] array<Inner, 4>;
+ // var c : @stride(32) array<Inner, 4>;
// };
//
// var<storage> data : Pre;
diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc
index 6ecef9a..7e0e576 100644
--- a/src/writer/msl/generator_impl_function_test.cc
+++ b/src/writer/msl/generator_impl_function_test.cc
@@ -91,7 +91,7 @@
}
TEST_F(MslGeneratorImplTest, Emit_Decoration_EntryPoint_WithInOutVars) {
- // fn frag_main([[location(0)]] foo : f32) -> [[location(1)]] f32 {
+ // fn frag_main(@location(0) foo : f32) -> @location(1) f32 {
// return foo;
// }
auto* foo_in = Param("foo", ty.f32(), {Location(0)});
@@ -126,7 +126,7 @@
}
TEST_F(MslGeneratorImplTest, Emit_Decoration_EntryPoint_WithInOut_Builtins) {
- // fn frag_main([[position(0)]] coord : vec4<f32>) -> [[frag_depth]] f32 {
+ // fn frag_main(@position(0) coord : vec4<f32>) -> @frag_depth f32 {
// return coord.x;
// }
auto* coord_in =
@@ -163,9 +163,9 @@
TEST_F(MslGeneratorImplTest,
Emit_Decoration_EntryPoint_SharedStruct_DifferentStages) {
// struct Interface {
- // [[location(1)]] col1 : f32;
- // [[location(2)]] col2 : f32;
- // [[builtin(position)]] pos : vec4<f32>;
+ // @location(1) col1 : f32;
+ // @location(2) col2 : f32;
+ // @builtin(position) pos : vec4<f32>;
// };
// fn vert_main() -> Interface {
// return Interface(0.4, 0.6, vec4<f32>());
@@ -248,7 +248,7 @@
TEST_F(MslGeneratorImplTest,
Emit_Decoration_EntryPoint_SharedStruct_HelperFunction) {
// struct VertexOutput {
- // [[builtin(position)]] pos : vec4<f32>;
+ // @builtin(position) pos : vec4<f32>;
// };
// fn foo(x : f32) -> VertexOutput {
// return VertexOutput(vec4<f32>(x, x, x, 1.0));
@@ -643,14 +643,14 @@
// [[block]] struct Data {
// d : f32;
// };
- // [[binding(0), group(0)]] var<storage> data : Data;
+ // @binding(0) @group(0) var<storage> data : Data;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn a() {
// return;
// }
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn b() {
// return;
// }
diff --git a/src/writer/spirv/builder_entry_point_test.cc b/src/writer/spirv/builder_entry_point_test.cc
index 57d4eae..46d6745 100644
--- a/src/writer/spirv/builder_entry_point_test.cc
+++ b/src/writer/spirv/builder_entry_point_test.cc
@@ -37,9 +37,9 @@
using BuilderTest = TestHelper;
TEST_F(BuilderTest, EntryPoint_Parameters) {
- // [[stage(fragment)]]
- // fn frag_main([[builtin(position)]] coord : vec4<f32>,
- // [[location(1)]] loc1 : f32) {
+ // @stage(fragment)
+ // fn frag_main(@builtin(position) coord : vec4<f32>,
+ // @location(1) loc1 : f32) {
// var col : f32 = (coord.x * loc1);
// }
auto* coord =
@@ -106,8 +106,8 @@
}
TEST_F(BuilderTest, EntryPoint_ReturnValue) {
- // [[stage(fragment)]]
- // fn frag_main([[location(0)]] loc_in : u32) -> [[location(0)]] f32 {
+ // @stage(fragment)
+ // fn frag_main(@location(0) loc_in : u32) -> @location(0) f32 {
// if (loc_in > 10) {
// return 0.5;
// }
@@ -183,17 +183,17 @@
TEST_F(BuilderTest, EntryPoint_SharedStruct) {
// struct Interface {
- // [[location(1)]] value : f32;
- // [[builtin(position)]] pos : vec4<f32>;
+ // @location(1) value : f32;
+ // @builtin(position) pos : vec4<f32>;
// };
//
- // [[stage(vertex)]]
+ // @stage(vertex)
// fn vert_main() -> Interface {
// return Interface(42.0, vec4<f32>());
// }
//
- // [[stage(fragment)]]
- // fn frag_main(inputs : Interface) -> [[builtin(frag_depth)]] f32 {
+ // @stage(fragment)
+ // fn frag_main(inputs : Interface) -> @builtin(frag_depth) f32 {
// return inputs.value;
// }
diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc
index 8a9ff94..b86bb4b 100644
--- a/src/writer/spirv/builder_function_test.cc
+++ b/src/writer/spirv/builder_function_test.cc
@@ -189,14 +189,14 @@
// [[block]] struct Data {
// d : f32;
// };
- // [[binding(0), group(0)]] var<storage> data : Data;
+ // @binding(0) @group(0) var<storage> data : Data;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn a() {
// return;
// }
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn b() {
// return;
// }
diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc
index e5da115..114885b 100644
--- a/src/writer/spirv/builder_intrinsic_test.cc
+++ b/src/writer/spirv/builder_intrinsic_test.cc
@@ -1846,9 +1846,9 @@
TEST_F(IntrinsicBuilderTest, Call_ArrayLength_ViaLets_WithPtrNoise) {
// [[block]] struct my_struct {
- // a : [[stride(4)]] array<f32>;
+ // a : @stride(4) array<f32>;
// };
- // [[binding(1), group(2)]] var<storage, read> b : my_struct;
+ // @binding(1) @group(2) var<storage, read> b : my_struct;
//
// fn a_func() {
// let p = &*&b;
@@ -1913,7 +1913,7 @@
// i : atomic<i32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// let u : u32 = atomicLoad(&b.u);
@@ -1979,7 +1979,7 @@
// i : atomic<i32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// var u = 1u;
@@ -2059,7 +2059,7 @@
// v : atomic<i32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// var v = 10;
@@ -2137,7 +2137,7 @@
// v : atomic<u32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// var v = 10u;
@@ -2213,7 +2213,7 @@
// i : atomic<i32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// var u = 10u;
@@ -2295,7 +2295,7 @@
// i : atomic<i32>;
// }
//
- // [[binding(1), group(2)]] var<storage, read_write> b : S;
+ // @binding(1) @group(2) var<storage, read_write> b : S;
//
// fn a_func() {
// let u : vec2<u32> = atomicCompareExchangeWeak(&b.u, 10u);
diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc
index 1295c76..13fd561 100644
--- a/src/writer/wgsl/generator_impl.cc
+++ b/src/writer/wgsl/generator_impl.cc
@@ -369,7 +369,7 @@
if (auto* ary = ty->As<ast::Array>()) {
for (auto* deco : ary->decorations) {
if (auto* stride = deco->As<ast::StrideDecoration>()) {
- out << "[[stride(" << stride->stride << ")]] ";
+ out << "@stride(" << stride->stride << ") ";
}
}
@@ -526,7 +526,7 @@
line() << "struct " << program_->Symbols().NameFor(str->name) << " {";
auto add_padding = [&](uint32_t size) {
- line() << "[[size(" << size << ")]]";
+ line() << "@size(" << size << ")";
// Note: u32 is the smallest primitive we currently support. When WGSL
// supports smaller types, this will need to be updated.
@@ -536,7 +536,7 @@
increment_indent();
uint32_t offset = 0;
for (auto* mem : str->members) {
- // TODO(crbug.com/tint/798) move the [[offset]] decoration handling to the
+ // TODO(crbug.com/tint/798) move the @offset decoration handling to the
// transform::Wgsl sanitizer.
if (auto* mem_sem = program_->Sem().Get(mem)) {
offset = utils::RoundUp(mem_sem->Align(), offset);
@@ -625,14 +625,13 @@
bool GeneratorImpl::EmitDecorations(std::ostream& out,
const ast::DecorationList& decos) {
- out << "[[";
bool first = true;
for (auto* deco : decos) {
if (!first) {
- out << ", ";
+ out << " ";
}
first = false;
-
+ out << "@";
if (auto* workgroup = deco->As<ast::WorkgroupDecoration>()) {
auto values = workgroup->Values();
out << "workgroup_size(";
@@ -686,7 +685,6 @@
return false;
}
}
- out << "]]";
return true;
}
diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc
index 3aebf94..d8843db 100644
--- a/src/writer/wgsl/generator_impl_function_test.cc
+++ b/src/writer/wgsl/generator_impl_function_test.cc
@@ -76,7 +76,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
- EXPECT_EQ(gen.result(), R"( [[stage(compute), workgroup_size(2, 4, 6)]]
+ EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2, 4, 6)
fn my_func() {
return;
}
@@ -98,7 +98,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
- EXPECT_EQ(gen.result(), R"( [[stage(compute), workgroup_size(2, height)]]
+ EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2, height)
fn my_func() {
return;
}
@@ -120,8 +120,8 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
- EXPECT_EQ(gen.result(), R"( [[stage(fragment)]]
- fn frag_main([[builtin(position)]] coord : vec4<f32>, [[location(1)]] loc1 : f32) {
+ EXPECT_EQ(gen.result(), R"( @stage(fragment)
+ fn frag_main(@builtin(position) coord : vec4<f32>, @location(1) loc1 : f32) {
}
)");
}
@@ -143,8 +143,8 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
- EXPECT_EQ(gen.result(), R"( [[stage(fragment)]]
- fn frag_main() -> [[location(1)]] f32 {
+ EXPECT_EQ(gen.result(), R"( @stage(fragment)
+ fn frag_main() -> @location(1) f32 {
return 1.0;
}
)");
@@ -156,14 +156,14 @@
// [[block]] struct Data {
// d : f32;
// };
- // [[binding(0), group(0)]] var<storage> data : Data;
+ // @binding(0) @group(0) var<storage> data : Data;
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn a() {
// return;
// }
//
- // [[stage(compute), workgroup_size(1)]]
+ // @stage(compute) @workgroup_size(1)
// fn b() {
// return;
// }
@@ -210,20 +210,20 @@
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_EQ(gen.result(), R"([[block]]
+ EXPECT_EQ(gen.result(), R"(@block
struct Data {
d : f32;
}
-[[binding(0), group(0)]] var<storage, read_write> data : Data;
+@binding(0) @group(0) var<storage, read_write> data : Data;
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn a() {
var v : f32 = data.d;
return;
}
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
fn b() {
var v : f32 = data.d;
return;
diff --git a/src/writer/wgsl/generator_impl_global_decl_test.cc b/src/writer/wgsl/generator_impl_global_decl_test.cc
index e22a75e..3664534 100644
--- a/src/writer/wgsl/generator_impl_global_decl_test.cc
+++ b/src/writer/wgsl/generator_impl_global_decl_test.cc
@@ -35,7 +35,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_EQ(gen.result(), R"( [[stage(compute), workgroup_size(1, 1, 1)]]
+ EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(1, 1, 1)
fn test_function() {
var a : f32;
}
@@ -91,7 +91,7 @@
a : i32;
}
- [[stage(compute), workgroup_size(1)]]
+ @stage(compute) @workgroup_size(1)
fn main() {
var s0 : S0;
var s1 : S1;
@@ -112,7 +112,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_EQ(gen.result(), " [[group(0), binding(0)]] var s : sampler;\n");
+ EXPECT_EQ(gen.result(), " @group(0) @binding(0) var s : sampler;\n");
}
TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) {
@@ -128,8 +128,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_EQ(gen.result(),
- " [[group(0), binding(0)]] var t : texture_1d<f32>;\n");
+ EXPECT_EQ(gen.result(), " @group(0) @binding(0) var t : texture_1d<f32>;\n");
}
TEST_F(WgslGeneratorImplTest, Emit_OverridableConstants) {
@@ -141,9 +140,9 @@
gen.increment_indent();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_EQ(gen.result(), R"( [[override]] let a : f32;
+ EXPECT_EQ(gen.result(), R"( @override let a : f32;
- [[override(7)]] let b : f32;
+ @override(7) let b : f32;
)");
}
diff --git a/src/writer/wgsl/generator_impl_type_test.cc b/src/writer/wgsl/generator_impl_type_test.cc
index dd1355e..22dfc4b 100644
--- a/src/writer/wgsl/generator_impl_type_test.cc
+++ b/src/writer/wgsl/generator_impl_type_test.cc
@@ -56,7 +56,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitType(out, a)) << gen.error();
- EXPECT_EQ(out.str(), "[[stride(16)]] array<bool, 4>");
+ EXPECT_EQ(out.str(), "@stride(16) array<bool, 4>");
}
TEST_F(WgslGeneratorImplTest, EmitType_RuntimeArray) {
@@ -162,10 +162,10 @@
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
EXPECT_EQ(gen.result(), R"(struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
a : i32;
- [[size(4)]]
+ @size(4)
padding_1 : u32;
b : f32;
}
@@ -183,10 +183,10 @@
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
EXPECT_EQ(gen.result(), R"(struct S {
- [[size(8)]]
+ @size(8)
padding : u32;
tint_0_padding : i32;
- [[size(4)]]
+ @size(4)
padding_1 : u32;
tint_2_padding : f32;
}
@@ -203,9 +203,9 @@
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
EXPECT_EQ(gen.result(), R"(struct S {
- [[align(8)]]
+ @align(8)
a : i32;
- [[align(16)]]
+ @align(16)
b : f32;
}
)");
@@ -221,9 +221,9 @@
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
EXPECT_EQ(gen.result(), R"(struct S {
- [[size(16)]]
+ @size(16)
a : i32;
- [[size(32)]]
+ @size(32)
b : f32;
}
)");
@@ -240,10 +240,10 @@
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
- EXPECT_EQ(gen.result(), R"([[block]]
+ EXPECT_EQ(gen.result(), R"(@block
struct S {
a : i32;
- [[align(8)]]
+ @align(8)
b : f32;
}
)");
@@ -263,11 +263,11 @@
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.EmitStructType(s)) << gen.error();
- EXPECT_EQ(gen.result(), R"([[block]]
+ EXPECT_EQ(gen.result(), R"(@block
struct S {
- [[builtin(vertex_index)]]
+ @builtin(vertex_index)
a : u32;
- [[location(2)]]
+ @location(2)
b : f32;
}
)");
diff --git a/src/writer/wgsl/generator_impl_variable_test.cc b/src/writer/wgsl/generator_impl_variable_test.cc
index 7e54432..6e073fa 100644
--- a/src/writer/wgsl/generator_impl_variable_test.cc
+++ b/src/writer/wgsl/generator_impl_variable_test.cc
@@ -57,7 +57,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error();
- EXPECT_EQ(out.str(), R"([[binding(0), group(0)]] var<storage, read> a : S;)");
+ EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var<storage, read> a : S;)");
}
TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Write) {
@@ -74,8 +74,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error();
- EXPECT_EQ(out.str(),
- R"([[binding(0), group(0)]] var<storage, write> a : S;)");
+ EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var<storage, write> a : S;)");
}
TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) {
@@ -93,7 +92,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error();
EXPECT_EQ(out.str(),
- R"([[binding(0), group(0)]] var<storage, read_write> a : S;)");
+ R"(@binding(0) @group(0) var<storage, read_write> a : S;)");
}
TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) {
@@ -108,7 +107,7 @@
std::stringstream out;
ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error();
- EXPECT_EQ(out.str(), R"([[group(1), binding(2)]] var a : sampler;)");
+ EXPECT_EQ(out.str(), R"(@group(1) @binding(2) var a : sampler;)");
}
TEST_F(WgslGeneratorImplTest, EmitVariable_Constructor) {