Convert @stage to short form

This CL converts remaining @stage instances in the dawn tree to use
the equivalent shorter variant.

Bug: tint:1503
Change-Id: I74594cd68544fbd692f77d4646991d9c27e218f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92484
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/docs/tint/spirv-input-output-variables.md b/docs/tint/spirv-input-output-variables.md
index 0f149e0..0ba4ae4 100644
--- a/docs/tint/spirv-input-output-variables.md
+++ b/docs/tint/spirv-input-output-variables.md
@@ -94,7 +94,7 @@
       return;
     }
 
-    @stage(fragment)
+    @fragment
     fn main() -> void {
       bar_();
       return;
@@ -126,7 +126,7 @@
       @location(0) frag_color : vec4<f32>;
     };
 
-    @stage(fragment)
+    @fragment
     fn main(
 
       // 'in' variables are entry point parameters
diff --git a/src/dawn/native/ComputePassEncoder.cpp b/src/dawn/native/ComputePassEncoder.cpp
index aeaa875..e70aea3 100644
--- a/src/dawn/native/ComputePassEncoder.cpp
+++ b/src/dawn/native/ComputePassEncoder.cpp
@@ -64,7 +64,7 @@
                 @group(0) @binding(1) var<storage, read_write> clientParams: IndirectParams;
                 @group(0) @binding(2) var<storage, write> validatedParams: ValidatedParams;
 
-                @stage(compute) @workgroup_size(1, 1, 1)
+                @compute @workgroup_size(1, 1, 1)
                 fn main() {
                     for (var i = 0u; i < 3u; i = i + 1u) {
                         var numWorkgroups = clientParams.data[uniformParams.clientOffsetInU32 + i];
diff --git a/src/dawn/native/CopyTextureForBrowserHelper.cpp b/src/dawn/native/CopyTextureForBrowserHelper.cpp
index 00f5bd9..48cf6e6 100644
--- a/src/dawn/native/CopyTextureForBrowserHelper.cpp
+++ b/src/dawn/native/CopyTextureForBrowserHelper.cpp
@@ -85,7 +85,7 @@
                 return sign(v) * (pow(params.A * abs(v) + params.B, params.G) + params.E);
             }
 
-            @stage(vertex)
+            @vertex
             fn vs_main(
                 @builtin(vertex_index) VertexIndex : u32
             ) -> VertexOutputs {
@@ -123,7 +123,7 @@
             @binding(1) @group(0) var mySampler: sampler;
             @binding(2) @group(0) var myTexture: texture_2d<f32>;
 
-            @stage(fragment)
+            @fragment
             fn fs_main(
                 @location(0) texcoord : vec2<f32>
             ) -> @location(0) vec4<f32> {
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index 47a9cea..420230b 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -274,7 +274,7 @@
     if (IsToggleEnabled(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline)) {
         // The empty fragment shader, used as a work around for vertex-only render pipeline
         constexpr char kEmptyFragmentShader[] = R"(
-                @stage(fragment) fn fs_empty_main() {}
+                @fragment fn fs_empty_main() {}
             )";
         ShaderModuleDescriptor descriptor;
         ShaderModuleWGSLDescriptor wgslDesc;
diff --git a/src/dawn/native/IndirectDrawValidationEncoder.cpp b/src/dawn/native/IndirectDrawValidationEncoder.cpp
index 0f13182..10a8164 100644
--- a/src/dawn/native/IndirectDrawValidationEncoder.cpp
+++ b/src/dawn/native/IndirectDrawValidationEncoder.cpp
@@ -130,7 +130,7 @@
                 }
             }
 
-            @stage(compute) @workgroup_size(64, 1, 1)
+            @compute @workgroup_size(64, 1, 1)
             fn main(@builtin(global_invocation_id) id : vec3<u32>) {
                 if (id.x >= batch.numDraws) {
                     return;
diff --git a/src/dawn/native/QueryHelper.cpp b/src/dawn/native/QueryHelper.cpp
index e151d2f..e72dfed 100644
--- a/src/dawn/native/QueryHelper.cpp
+++ b/src/dawn/native/QueryHelper.cpp
@@ -66,7 +66,7 @@
 
             let sizeofTimestamp : u32 = 8u;
 
-            @stage(compute) @workgroup_size(8, 1, 1)
+            @compute @workgroup_size(8, 1, 1)
             fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
                 if (GlobalInvocationID.x >= params.count) { return; }
 
diff --git a/src/dawn/samples/Animometer.cpp b/src/dawn/samples/Animometer.cpp
index 41d59c8..2138bb9 100644
--- a/src/dawn/samples/Animometer.cpp
+++ b/src/dawn/samples/Animometer.cpp
@@ -72,7 +72,7 @@
             @builtin(position) Position : vec4<f32>;
         };
 
-        @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut {
+        @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut {
             var positions : array<vec4<f32>, 3> = array<vec4<f32>, 3>(
                 vec4<f32>( 0.0,  0.1, 0.0, 1.0),
                 vec4<f32>(-0.1, -0.1, 0.0, 1.0),
@@ -112,7 +112,7 @@
         })");
 
     wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
-        @stage(fragment) fn main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> {
+        @fragment fn main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> {
             return v_color;
         })");
 
diff --git a/src/dawn/samples/CHelloTriangle.cpp b/src/dawn/samples/CHelloTriangle.cpp
index ed1507e..a912b00 100644
--- a/src/dawn/samples/CHelloTriangle.cpp
+++ b/src/dawn/samples/CHelloTriangle.cpp
@@ -32,7 +32,7 @@
     swapChainFormat = static_cast<WGPUTextureFormat>(GetPreferredSwapChainTextureFormat());
 
     const char* vs = R"(
-        @stage(vertex) fn main(
+        @vertex fn main(
             @builtin(vertex_index) VertexIndex : u32
         ) -> @builtin(position) vec4<f32> {
             var pos = array<vec2<f32>, 3>(
@@ -45,7 +45,7 @@
     WGPUShaderModule vsModule = utils::CreateShaderModule(device, vs).Release();
 
     const char* fs = R"(
-        @stage(fragment) fn main() -> @location(0) vec4<f32> {
+        @fragment fn main() -> @location(0) vec4<f32> {
             return vec4<f32>(1.0, 0.0, 0.0, 1.0);
         })";
     WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release();
diff --git a/src/dawn/samples/ComputeBoids.cpp b/src/dawn/samples/ComputeBoids.cpp
index 2652ebe..8237db4 100644
--- a/src/dawn/samples/ComputeBoids.cpp
+++ b/src/dawn/samples/ComputeBoids.cpp
@@ -102,7 +102,7 @@
             @location(2) a_pos : vec2<f32>;
         };
 
-        @stage(vertex)
+        @vertex
         fn main(input : VertexIn) -> @builtin(position) vec4<f32> {
             var angle : f32 = -atan2(input.a_particleVel.x, input.a_particleVel.y);
             var pos : vec2<f32> = vec2<f32>(
@@ -113,7 +113,7 @@
     )");
 
     wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
-        @stage(fragment)
+        @fragment
         fn main() -> @location(0) vec4<f32> {
             return vec4<f32>(1.0, 1.0, 1.0, 1.0);
         }
@@ -170,7 +170,7 @@
         @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)
+        @compute @workgroup_size(1)
         fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
             var index : u32 = GlobalInvocationID.x;
             if (index >= params.particleCount) {
diff --git a/src/dawn/samples/CppHelloTriangle.cpp b/src/dawn/samples/CppHelloTriangle.cpp
index 66e1ec7..5202f0d 100644
--- a/src/dawn/samples/CppHelloTriangle.cpp
+++ b/src/dawn/samples/CppHelloTriangle.cpp
@@ -95,7 +95,7 @@
     initTextures();
 
     wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
-        @stage(vertex) fn main(@location(0) pos : vec4<f32>)
+        @vertex fn main(@location(0) pos : vec4<f32>)
                             -> @builtin(position) vec4<f32> {
             return pos;
         })");
@@ -104,7 +104,7 @@
         @group(0) @binding(0) var mySampler: sampler;
         @group(0) @binding(1) var myTexture : texture_2d<f32>;
 
-        @stage(fragment) fn main(@builtin(position) FragCoord : vec4<f32>)
+        @fragment fn main(@builtin(position) FragCoord : vec4<f32>)
                               -> @location(0) vec4<f32> {
             return textureSample(myTexture, mySampler, FragCoord.xy / vec2<f32>(640.0, 480.0));
         })");
diff --git a/src/dawn/samples/ManualSwapChainTest.cpp b/src/dawn/samples/ManualSwapChainTest.cpp
index 397842d..c6e61cc 100644
--- a/src/dawn/samples/ManualSwapChainTest.cpp
+++ b/src/dawn/samples/ManualSwapChainTest.cpp
@@ -316,7 +316,7 @@
     // The hacky pipeline to render a triangle.
     utils::ComboRenderPipelineDescriptor pipelineDesc;
     pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
-        @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32)
+        @vertex fn main(@builtin(vertex_index) VertexIndex : u32)
                             -> @builtin(position) vec4<f32> {
             var pos = array<vec2<f32>, 3>(
                 vec2<f32>( 0.0,  0.5),
@@ -326,7 +326,7 @@
             return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
         })");
     pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
-        @stage(fragment) fn main() -> @location(0) vec4<f32> {
+        @fragment fn main() -> @location(0) vec4<f32> {
             return vec4<f32>(1.0, 0.0, 0.0, 1.0);
         })");
     // BGRA shouldn't be hardcoded. Consider having a map[format -> pipeline].
diff --git a/src/dawn/tests/end2end/StorageTextureTests.cpp b/src/dawn/tests/end2end/StorageTextureTests.cpp
index 4981342..d0eb80a 100644
--- a/src/dawn/tests/end2end/StorageTextureTests.cpp
+++ b/src/dawn/tests/end2end/StorageTextureTests.cpp
@@ -337,7 +337,7 @@
 
         std::ostringstream ostream;
         ostream << GetImageDeclaration(format, "write", dimension, 0) << "\n";
-        ostream << "@stage(" << stage << ")" << workgroupSize << "\n";
+        ostream << "@" << stage << workgroupSize << "\n";
         ostream << "fn main() ";
         if (isFragment) {
             ostream << "-> @location(0) vec4<f32> ";
diff --git a/tools/src/cmd/check-spec-examples/main.go b/tools/src/cmd/check-spec-examples/main.go
index 0b891266..b641dc9 100644
--- a/tools/src/cmd/check-spec-examples/main.go
+++ b/tools/src/cmd/check-spec-examples/main.go
@@ -203,7 +203,7 @@
 func tryCompile(compiler, wd string, e example) error {
 	code := e.code
 	if e.functionScope {
-		code = "\n@stage(vertex) fn main() -> @builtin(position) vec4<f32> {\n" + code + " return vec4<f32>();}\n"
+		code = "\n@vertex fn main() -> @builtin(position) vec4<f32> {\n" + code + " return vec4<f32>();}\n"
 	}
 
 	addedStubFunction := false
@@ -214,7 +214,7 @@
 		}
 
 		if !addedStubFunction {
-			code += "\n@stage(vertex) fn main() {}\n"
+			code += "\n@vertex fn main() {}\n"
 			addedStubFunction = true
 			continue
 		}