Remove support for [[attribute]] syntax

Fixed: tint:1382
Change-Id: I7bebeb59fd0a57a69929e9bf5aa768ae1ff8a33d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83961
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price
2022-03-21 16:09:17 +00:00
parent 8bcecf365d
commit 6bd90d666e
32 changed files with 63 additions and 910 deletions

View File

@@ -32,7 +32,7 @@ TEST_F(AddEmptyEntryPointTest, ShouldRunEmptyModule) {
TEST_F(AddEmptyEntryPointTest, ShouldRunExistingEntryPoint) {
auto* src = R"(
[[stage(compute), workgroup_size(1)]]
@stage(compute) @workgroup_size(1)
fn existing() {}
)";

View File

@@ -39,9 +39,9 @@ struct SB {
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() {
}
)";
@@ -56,9 +56,9 @@ struct SB {
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);
}
@@ -74,9 +74,9 @@ struct SB {
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);
}

View File

@@ -37,9 +37,9 @@ struct SB {
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() {
}
)";
@@ -54,9 +54,9 @@ struct SB {
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);
}

View File

@@ -2219,7 +2219,7 @@ struct FragmentInterface {
TEST_F(CanonicalizeEntryPointIOTest, InvariantAttributes) {
auto* src = R"(
struct VertexOut {
[[builtin(position), invariant]] pos : vec4<f32>;
@builtin(position) @invariant pos : vec4<f32>;
};
@stage(vertex)
@@ -2228,7 +2228,7 @@ fn main1() -> VertexOut {
}
@stage(vertex)
fn main2() -> [[builtin(position), invariant]] vec4<f32> {
fn main2() -> @builtin(position) @invariant vec4<f32> {
return vec4<f32>();
}
)";
@@ -2289,12 +2289,12 @@ fn main1() -> VertexOut {
}
@stage(vertex)
fn main2() -> [[builtin(position), invariant]] vec4<f32> {
fn main2() -> @builtin(position) @invariant vec4<f32> {
return vec4<f32>();
}
struct VertexOut {
[[builtin(position), invariant]] pos : vec4<f32>;
@builtin(position) @invariant pos : vec4<f32>;
};
)";

View File

@@ -33,7 +33,7 @@ TEST_F(DecomposeMemoryAccessTest, ShouldRunStorageBuffer) {
struct Buffer {
i : i32;
};
[[group(0), binding(0)]] var<storage, read_write> sb : Buffer;
@group(0) @binding(0) var<storage, read_write> sb : Buffer;
)";
EXPECT_TRUE(ShouldRun<DecomposeMemoryAccess>(src));
@@ -44,7 +44,7 @@ TEST_F(DecomposeMemoryAccessTest, ShouldRunUniformBuffer) {
struct Buffer {
i : i32;
};
[[group(0), binding(0)]] var<uniform> ub : Buffer;
@group(0) @binding(0) var<uniform> ub : Buffer;
)";
EXPECT_TRUE(ShouldRun<DecomposeMemoryAccess>(src));

View File

@@ -21,7 +21,7 @@ namespace tint {
namespace transform {
/// DecomposeStridedMatrix transforms replaces matrix members of storage or
/// uniform buffer structures, that have a [[stride]] attribute, into an array
/// uniform buffer structures, that have a stride attribute, into an array
/// of N column vectors.
/// This transform is used by the SPIR-V reader to handle the SPIR-V
/// MatrixStride attribute.

View File

@@ -34,7 +34,7 @@ TEST_F(FirstIndexOffsetTest, ShouldRunEmptyModule) {
TEST_F(FirstIndexOffsetTest, ShouldRunFragmentStage) {
auto* src = R"(
[[stage(fragment)]]
@stage(fragment)
fn entry() {
return;
}
@@ -45,8 +45,8 @@ fn entry() {
TEST_F(FirstIndexOffsetTest, ShouldRunVertexStage) {
auto* src = R"(
[[stage(vertex)]]
fn entry() -> [[builtin(position)]] vec4<f32> {
@stage(vertex)
fn entry() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
)";

View File

@@ -36,7 +36,7 @@ type ET = texture_external;
}
TEST_F(MultiplanarExternalTextureTest, ShouldRunHasExternalTextureGlobal) {
auto* src = R"(
[[group(0), binding(0)]] var ext_tex : texture_external;
@group(0) @binding(0) var ext_tex : texture_external;
)";
EXPECT_TRUE(ShouldRun<MultiplanarExternalTexture>(src));
@@ -1163,10 +1163,10 @@ fn f(t : ET, s : sampler) {
textureSampleLevel(t, s, vec2<f32>(1.0, 2.0));
}
[[group(0), binding(0)]] var ext_tex : ET;
[[group(0), binding(1)]] var smp : sampler;
@group(0) @binding(0) var ext_tex : ET;
@group(0) @binding(1) var smp : sampler;
[[stage(fragment)]]
@stage(fragment)
fn main() {
f(ext_tex, smp);
}
@@ -1226,7 +1226,7 @@ fn main() {
// Tests that the the transform handles aliases to external textures
TEST_F(MultiplanarExternalTextureTest, ExternalTextureAlias_OutOfOrder) {
auto* src = R"(
[[stage(fragment)]]
@stage(fragment)
fn main() {
f(ext_tex, smp);
}
@@ -1235,8 +1235,8 @@ fn f(t : ET, s : sampler) {
textureSampleLevel(t, s, vec2<f32>(1.0, 2.0));
}
[[group(0), binding(0)]] var ext_tex : ET;
[[group(0), binding(1)]] var smp : sampler;
@group(0) @binding(0) var ext_tex : ET;
@group(0) @binding(1) var smp : sampler;
type ET = texture_external;
)";

View File

@@ -34,8 +34,8 @@ TEST_F(NumWorkgroupsFromUniformTest, ShouldRunEmptyModule) {
TEST_F(NumWorkgroupsFromUniformTest, ShouldRunHasNumWorkgroups) {
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>) {
}
)";
@@ -44,8 +44,8 @@ fn main([[builtin(num_workgroups)]] num_wgs : vec3<u32>) {
TEST_F(NumWorkgroupsFromUniformTest, Error_MissingTransformData) {
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>) {
}
)";

View File

@@ -40,7 +40,7 @@ var<private> arr : array<i32, 4>;
TEST_F(PadArrayElementsTest, ShouldRunHasExplicitArrayStride) {
auto* src = R"(
var<private> arr : [[stride(8)]] array<i32, 4>;
var<private> arr : @stride(8) array<i32, 4>;
)";
EXPECT_TRUE(ShouldRun<PadArrayElements>(src));