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/test/samples/compute_boids.wgsl b/test/samples/compute_boids.wgsl
index 53ea4c5..269ac5d 100644
--- a/test/samples/compute_boids.wgsl
+++ b/test/samples/compute_boids.wgsl
@@ -14,11 +14,11 @@
 
 // vertex shader
 
-[[stage(vertex)]]
-fn vert_main([[location(0)]] a_particlePos : vec2<f32>,
-             [[location(1)]] a_particleVel : vec2<f32>,
-             [[location(2)]] a_pos : vec2<f32>)
-          -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main(@location(0) a_particlePos : vec2<f32>,
+             @location(1) a_particleVel : vec2<f32>,
+             @location(2) a_pos : vec2<f32>)
+          -> @builtin(position) vec4<f32> {
   var angle : f32 = -atan2(a_particleVel.x, a_particleVel.y);
   var pos : vec2<f32> = vec2<f32>(
       (a_pos.x * cos(angle)) - (a_pos.y * sin(angle)),
@@ -28,8 +28,8 @@
 
 // fragment shader
 
-[[stage(fragment)]]
-fn frag_main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main() -> @location(0) vec4<f32> {
   return vec4<f32>(1.0, 1.0, 1.0, 1.0);
 }
 
@@ -53,14 +53,14 @@
   particles : array<Particle, 5>;
 };
 
-[[binding(0), group(0)]] var<uniform> params : SimParams;
-[[binding(1), group(0)]] var<storage, read_write> particlesA : Particles;
-[[binding(2), group(0)]] var<storage, read_write> particlesB : Particles;
+@binding(0) @group(0) var<uniform> params : SimParams;
+@binding(1) @group(0) var<storage, read_write> particlesA : Particles;
+@binding(2) @group(0) var<storage, read_write> particlesB : Particles;
 
 // https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp
-[[stage(compute), workgroup_size(1)]]
+@stage(compute) @workgroup_size(1)
 fn comp_main(
-  [[builtin(global_invocation_id)]] gl_GlobalInvocationID : vec3<u32>) {
+  @builtin(global_invocation_id) gl_GlobalInvocationID : vec3<u32>) {
   var index : u32 = gl_GlobalInvocationID.x;
   if (index >= 5u) {
     return;
diff --git a/test/samples/compute_boids.wgsl.expected.wgsl b/test/samples/compute_boids.wgsl.expected.wgsl
index 394631c..5abf9fa 100644
--- a/test/samples/compute_boids.wgsl.expected.wgsl
+++ b/test/samples/compute_boids.wgsl.expected.wgsl
@@ -1,12 +1,12 @@
-[[stage(vertex)]]
-fn vert_main([[location(0)]] a_particlePos : vec2<f32>, [[location(1)]] a_particleVel : vec2<f32>, [[location(2)]] a_pos : vec2<f32>) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vert_main(@location(0) a_particlePos : vec2<f32>, @location(1) a_particleVel : vec2<f32>, @location(2) a_pos : vec2<f32>) -> @builtin(position) vec4<f32> {
   var angle : f32 = -(atan2(a_particleVel.x, a_particleVel.y));
   var pos : vec2<f32> = vec2<f32>(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle))));
   return vec4<f32>((pos + a_particlePos), 0.0, 1.0);
 }
 
-[[stage(fragment)]]
-fn frag_main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main() -> @location(0) vec4<f32> {
   return vec4<f32>(1.0, 1.0, 1.0, 1.0);
 }
 
@@ -29,14 +29,14 @@
   particles : array<Particle, 5>;
 }
 
-[[binding(0), group(0)]] var<uniform> params : SimParams;
+@binding(0) @group(0) var<uniform> params : SimParams;
 
-[[binding(1), group(0)]] var<storage, read_write> particlesA : Particles;
+@binding(1) @group(0) var<storage, read_write> particlesA : Particles;
 
-[[binding(2), group(0)]] var<storage, read_write> particlesB : Particles;
+@binding(2) @group(0) var<storage, read_write> particlesB : Particles;
 
-[[stage(compute), workgroup_size(1)]]
-fn comp_main([[builtin(global_invocation_id)]] gl_GlobalInvocationID : vec3<u32>) {
+@stage(compute) @workgroup_size(1)
+fn comp_main(@builtin(global_invocation_id) gl_GlobalInvocationID : vec3<u32>) {
   var index : u32 = gl_GlobalInvocationID.x;
   if ((index >= 5u)) {
     return;
diff --git a/test/samples/cube.wgsl b/test/samples/cube.wgsl
index 5b9fab1..93519e4 100644
--- a/test/samples/cube.wgsl
+++ b/test/samples/cube.wgsl
@@ -17,19 +17,19 @@
   modelViewProjectionMatrix : mat4x4<f32>;
 };
 
-[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
+@binding(0) @group(0) var<uniform> uniforms : Uniforms;
 
 struct VertexInput {
-  [[location(0)]] cur_position : vec4<f32>;
-  [[location(1)]] color : vec4<f32>;
+  @location(0) cur_position : vec4<f32>;
+  @location(1) color : vec4<f32>;
 };
 
 struct VertexOutput {
-  [[location(0)]] vtxFragColor : vec4<f32>;
-  [[builtin(position)]] Position : vec4<f32>;
+  @location(0) vtxFragColor : vec4<f32>;
+  @builtin(position) Position : vec4<f32>;
 };
 
-[[stage(vertex)]]
+@stage(vertex)
 fn vtx_main(input : VertexInput) -> VertexOutput {
   var output : VertexOutput;
   output.Position = uniforms.modelViewProjectionMatrix * input.cur_position;
@@ -39,8 +39,8 @@
 
 // Fragment shader
 
-[[stage(fragment)]]
-fn frag_main([[location(0)]] fragColor : vec4<f32>)
-          -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main(@location(0) fragColor : vec4<f32>)
+          -> @location(0) vec4<f32> {
   return fragColor;
 }
diff --git a/test/samples/cube.wgsl.expected.wgsl b/test/samples/cube.wgsl.expected.wgsl
index a764703..ba0371f 100644
--- a/test/samples/cube.wgsl.expected.wgsl
+++ b/test/samples/cube.wgsl.expected.wgsl
@@ -2,23 +2,23 @@
   modelViewProjectionMatrix : mat4x4<f32>;
 }
 
-[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
+@binding(0) @group(0) var<uniform> uniforms : Uniforms;
 
 struct VertexInput {
-  [[location(0)]]
+  @location(0)
   cur_position : vec4<f32>;
-  [[location(1)]]
+  @location(1)
   color : vec4<f32>;
 }
 
 struct VertexOutput {
-  [[location(0)]]
+  @location(0)
   vtxFragColor : vec4<f32>;
-  [[builtin(position)]]
+  @builtin(position)
   Position : vec4<f32>;
 }
 
-[[stage(vertex)]]
+@stage(vertex)
 fn vtx_main(input : VertexInput) -> VertexOutput {
   var output : VertexOutput;
   output.Position = (uniforms.modelViewProjectionMatrix * input.cur_position);
@@ -26,7 +26,7 @@
   return output;
 }
 
-[[stage(fragment)]]
-fn frag_main([[location(0)]] fragColor : vec4<f32>) -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main(@location(0) fragColor : vec4<f32>) -> @location(0) vec4<f32> {
   return fragColor;
 }
diff --git a/test/samples/function.wgsl b/test/samples/function.wgsl
index 257a664..92ffb04 100644
--- a/test/samples/function.wgsl
+++ b/test/samples/function.wgsl
@@ -16,6 +16,6 @@
     return ((2. * 3.) - 4.) / 5.;
 }
 
-[[stage(compute), workgroup_size(2)]]
+@stage(compute) @workgroup_size(2)
 fn ep() {
 }
diff --git a/test/samples/function.wgsl.expected.wgsl b/test/samples/function.wgsl.expected.wgsl
index 4cd4fb6..5a3a80c 100644
--- a/test/samples/function.wgsl.expected.wgsl
+++ b/test/samples/function.wgsl.expected.wgsl
@@ -2,6 +2,6 @@
   return (((2.0 * 3.0) - 4.0) / 5.0);
 }
 
-[[stage(compute), workgroup_size(2)]]
+@stage(compute) @workgroup_size(2)
 fn ep() {
 }
diff --git a/test/samples/simple.wgsl b/test/samples/simple.wgsl
index bec6a0f..d30b8a0 100644
--- a/test/samples/simple.wgsl
+++ b/test/samples/simple.wgsl
@@ -15,8 +15,8 @@
 fn bar() {
 }
 
-[[stage(fragment)]]
-fn main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main() -> @location(0) vec4<f32> {
     var a : vec2<f32> = vec2<f32>();
     bar();
     return vec4<f32>(0.4, 0.4, 0.8, 1.0);
diff --git a/test/samples/simple.wgsl.expected.wgsl b/test/samples/simple.wgsl.expected.wgsl
index b5a4dc0..83388f8 100644
--- a/test/samples/simple.wgsl.expected.wgsl
+++ b/test/samples/simple.wgsl.expected.wgsl
@@ -1,8 +1,8 @@
 fn bar() {
 }
 
-[[stage(fragment)]]
-fn main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn main() -> @location(0) vec4<f32> {
   var a : vec2<f32> = vec2<f32>();
   bar();
   return vec4<f32>(0.400000006, 0.400000006, 0.800000012, 1.0);
diff --git a/test/samples/simple_vertex.spvasm.expected.wgsl b/test/samples/simple_vertex.spvasm.expected.wgsl
index 372bb24..91ccaf9 100644
--- a/test/samples/simple_vertex.spvasm.expected.wgsl
+++ b/test/samples/simple_vertex.spvasm.expected.wgsl
@@ -6,11 +6,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);
diff --git a/test/samples/triangle.wgsl b/test/samples/triangle.wgsl
index ba3cb52..69d2281 100644
--- a/test/samples/triangle.wgsl
+++ b/test/samples/triangle.wgsl
@@ -18,14 +18,14 @@
     vec2<f32>(-0.5, -0.5),
     vec2<f32>(0.5, -0.5));
 
-[[stage(vertex)]]
-fn vtx_main([[builtin(vertex_index)]] VertexIndex : u32)
-         -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vtx_main(@builtin(vertex_index) VertexIndex : u32)
+         -> @builtin(position) vec4<f32> {
   return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
 }
 
 // Fragment shader
-[[stage(fragment)]]
-fn frag_main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main() -> @location(0) vec4<f32> {
   return vec4<f32>(1.0, 0.0, 0.0, 1.0);
 }
diff --git a/test/samples/triangle.wgsl.expected.wgsl b/test/samples/triangle.wgsl.expected.wgsl
index bd398e0..c92f0a6 100644
--- a/test/samples/triangle.wgsl.expected.wgsl
+++ b/test/samples/triangle.wgsl.expected.wgsl
@@ -1,11 +1,11 @@
 let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
 
-[[stage(vertex)]]
-fn vtx_main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
+@stage(vertex)
+fn vtx_main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> {
   return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
 }
 
-[[stage(fragment)]]
-fn frag_main() -> [[location(0)]] vec4<f32> {
+@stage(fragment)
+fn frag_main() -> @location(0) vec4<f32> {
   return vec4<f32>(1.0, 0.0, 0.0, 1.0);
 }