diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp index 922837863c..b9ca8db80b 100644 --- a/src/dawn/tests/DawnTest.cpp +++ b/src/dawn/tests/DawnTest.cpp @@ -1285,7 +1285,7 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t } } shaderSource << R"( - @stage(compute) @workgroup_size(1) fn main( + @compute @workgroup_size(1) fn main( @builtin(global_invocation_id) GlobalInvocationId : vec3 ) { let baseOutIndex = GlobalInvocationId.y * width + GlobalInvocationId.x; @@ -1429,7 +1429,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, -1.0), @@ -1449,7 +1449,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( @builtin(frag_depth) fragDepth : f32, } - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.result = 1u; @@ -1458,7 +1458,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( })"); } else { pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) u32 { return 1u; })"); diff --git a/src/dawn/tests/end2end/BindGroupTests.cpp b/src/dawn/tests/end2end/BindGroupTests.cpp index 40663bebe8..61d36307e4 100644 --- a/src/dawn/tests/end2end/BindGroupTests.cpp +++ b/src/dawn/tests/end2end/BindGroupTests.cpp @@ -54,7 +54,7 @@ class BindGroupTests : public DawnTest { wgpu::ShaderModule MakeSimpleVSModule() const { return utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -88,7 +88,7 @@ class BindGroupTests : public DawnTest { } } - fs << "\n@stage(fragment) fn main() -> @location(0) vec4{\n"; + fs << "\n@fragment fn main() -> @location(0) vec4{\n"; fs << "var fragColor : vec4 = vec4();\n"; for (size_t i = 0; i < bindingTypes.size(); ++i) { fs << "fragColor = fragColor + buffer" << i << ".color;\n"; @@ -137,7 +137,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) { } @group(0) @binding(0) var contents: Contents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { var f : f32 = contents.f; })"); @@ -173,7 +173,7 @@ TEST_P(BindGroupTests, ReusedUBO) { @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -190,7 +190,7 @@ TEST_P(BindGroupTests, ReusedUBO) { } @group(0) @binding(1) var fragmentUbo : FragmentUniformBuffer; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUbo.color; })"); @@ -250,7 +250,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { } @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -265,7 +265,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { @group(0) @binding(1) var samp : sampler; @group(0) @binding(2) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, FragCoord.xy); })"); @@ -355,7 +355,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { @group(0) @binding(0) var vertexUbo1 : VertexUniformBuffer; @group(1) @binding(0) var vertexUbo2 : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -376,7 +376,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { @group(0) @binding(1) var fragmentUbo1 : FragmentUniformBuffer; @group(1) @binding(1) var fragmentUbo2 : FragmentUniformBuffer; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUbo1.color + fragmentUbo2.color; })"); @@ -445,16 +445,16 @@ TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) { @group(1) @binding(0) var contents1: Contents; @group(2) @binding(0) var contents2: Contents; - @stage(compute) @workgroup_size(1) fn main0() { + @compute @workgroup_size(1) fn main0() { var a : f32 = contents0.f; } - @stage(compute) @workgroup_size(1) fn main1() { + @compute @workgroup_size(1) fn main1() { var a : f32 = contents1.f; var b : f32 = contents2.f; } - @stage(compute) @workgroup_size(1) fn main2() { + @compute @workgroup_size(1) fn main2() { var a : f32 = contents0.f; var b : f32 = contents1.f; var c : f32 = contents2.f; @@ -1054,7 +1054,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) { @group(0) @binding(0) var buffer0 : Buffer; @group(0) @binding(4) var outputBuffer : OutputBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { outputBuffer.value = vec3(buffer0.value, buffer2.value, buffer3.value); })"); pipelineDescriptor.compute.entryPoint = "main"; @@ -1136,7 +1136,7 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping) @group(0) @binding(1) var buffer1 : Buffer; @group(0) @binding(2) var outputBuffer : OutputBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { outputBuffer.value = vec2(buffer0.value, buffer1.value); })"); pipelineDescriptor.compute.entryPoint = "main"; @@ -1239,7 +1239,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -1258,7 +1258,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { @group(0) @binding(47) var ubo2 : Ubo; @group(0) @binding(111) var ubo3 : Ubo; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color; })"); @@ -1358,7 +1358,7 @@ TEST_P(BindGroupTests, EmptyLayout) { pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl); pipelineDesc.compute.entryPoint = "main"; pipelineDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); @@ -1381,7 +1381,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) { utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -1397,7 +1397,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) { } @group(0) @binding(0) var buffer0 : Buffer0; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return buffer0.color; })"); @@ -1550,7 +1550,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { body << "result.value = 1u;\n"; std::string shader = - interface.str() + "@stage(compute) @workgroup_size(1) fn main() {\n" + body.str() + "}\n"; + interface.str() + "@compute @workgroup_size(1) fn main() {\n" + body.str() + "}\n"; wgpu::ComputePipelineDescriptor cpDesc; cpDesc.compute.module = utils::CreateShaderModule(device, shader.c_str()); cpDesc.compute.entryPoint = "main"; diff --git a/src/dawn/tests/end2end/BufferZeroInitTests.cpp b/src/dawn/tests/end2end/BufferZeroInitTests.cpp index 71100b7e7a..459162581a 100644 --- a/src/dawn/tests/end2end/BufferZeroInitTests.cpp +++ b/src/dawn/tests/end2end/BufferZeroInitTests.cpp @@ -212,7 +212,7 @@ class BufferZeroInitTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) i_color : vec4) -> @location(0) vec4 { return i_color; })"); @@ -256,7 +256,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main(@location(0) pos : vec4) -> VertexOut { + @vertex fn main(@location(0) pos : vec4) -> VertexOut { var output : VertexOut; if (all(pos == vec4(0.0, 0.0, 0.0, 0.0))) { output.color = vec4(0.0, 1.0, 0.0, 1.0); @@ -300,7 +300,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var output : VertexOut; if (VertexIndex == 0u) { @@ -350,7 +350,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color = vec4(1.0, 0.0, 0.0, 1.0); output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -391,7 +391,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color = vec4(1.0, 0.0, 0.0, 1.0); output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -432,7 +432,7 @@ class BufferZeroInitTest : public DawnTest { const char* computeShader = R"( @group(0) @binding(0) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureStore(outImage, vec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); })"; @@ -1001,7 +1001,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) { @group(0) @binding(0) var ubo : UBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ubo.value == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); } else { @@ -1040,7 +1040,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) { @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ssbo.value == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); } else { @@ -1079,7 +1079,7 @@ TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) { @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ssbo.value[0] == vec4(0u, 0u, 0u, 0u)) && all(ssbo.value[1] == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); @@ -1152,7 +1152,7 @@ TEST_P(BufferZeroInitTest, PaddingInitialized) { @builtin(position) position : vec4, } - @stage(vertex) fn main(@location(0) pos : vec2) -> VertexOut { + @vertex fn main(@location(0) pos : vec2) -> VertexOut { var output : VertexOut; if (all(pos == vec2(0.0, 0.0))) { output.color = vec4(0.0, 1.0, 0.0, 1.0); diff --git a/src/dawn/tests/end2end/ClipSpaceTests.cpp b/src/dawn/tests/end2end/ClipSpaceTests.cpp index 098913a03c..22dfc800ec 100644 --- a/src/dawn/tests/end2end/ClipSpaceTests.cpp +++ b/src/dawn/tests/end2end/ClipSpaceTests.cpp @@ -26,7 +26,7 @@ class ClipSpaceTest : public DawnTest { // 1. The depth value of the top-left one is >= 0.5 // 2. The depth value of the bottom-right one is <= 0.5 pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, 1.0, 1.0), @@ -39,7 +39,7 @@ class ClipSpaceTest : public DawnTest { })"); pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/ColorStateTests.cpp b/src/dawn/tests/end2end/ColorStateTests.cpp index 1753c9a749..c6094118a7 100644 --- a/src/dawn/tests/end2end/ColorStateTests.cpp +++ b/src/dawn/tests/end2end/ColorStateTests.cpp @@ -40,7 +40,7 @@ class ColorStateTest : public DawnTest { DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsWARP()); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, -1.0), @@ -68,7 +68,7 @@ class ColorStateTest : public DawnTest { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -808,7 +808,7 @@ TEST_P(ColorStateTest, IndependentColorState) { @location(3) fragColor3 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.fragColor0 = myUbo.color0; output.fragColor1 = myUbo.color1; @@ -922,7 +922,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -1048,7 +1048,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -1105,7 +1105,7 @@ TEST_P(ColorStateTest, SparseAttachmentsDifferentColorMask) { @location(3) o3 : vec4, } - @stage(fragment) fn main() -> Outputs { + @fragment fn main() -> Outputs { return Outputs(vec4(1.0), vec4(0.0, 1.0, 1.0, 1.0)); } )"); diff --git a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp index 310a534613..d3586634e1 100644 --- a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp @@ -168,7 +168,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 3>( vec2(-3.0, 1.0), @@ -184,7 +184,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); })"); diff --git a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp index 13252023cd..2dee70014c 100644 --- a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -95,7 +95,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } @@ -118,7 +118,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } @@ -136,7 +136,7 @@ TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } diff --git a/src/dawn/tests/end2end/ComputeDispatchTests.cpp b/src/dawn/tests/end2end/ComputeDispatchTests.cpp index 1568a2812d..dc77e688af 100644 --- a/src/dawn/tests/end2end/ComputeDispatchTests.cpp +++ b/src/dawn/tests/end2end/ComputeDispatchTests.cpp @@ -34,7 +34,7 @@ class ComputeDispatchTests : public DawnTest { @group(0) @binding(0) var output : OutputBuf; - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3, @builtin(num_workgroups) dispatch : vec3) { if (dispatch.x == 0u || dispatch.y == 0u || dispatch.z == 0u) { @@ -64,7 +64,7 @@ class ComputeDispatchTests : public DawnTest { @group(0) @binding(0) var input : InputBuf; @group(0) @binding(1) var output : OutputBuf; - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let dispatch : vec3 = input.expectedDispatch; diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp index 41a88d03a1..b75c9ba992 100644 --- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp @@ -190,7 +190,7 @@ struct Status { @group(0) @binding(1) var output : Output; @group(0) @binding(2) var status : Status; -@stage(compute) @workgroup_size(1,1,1) +@compute @workgroup_size(1,1,1) fn main() { if (input.header != {input_header_code}u) { status.code = {status_bad_input_header}u; diff --git a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp index d7f161a681..f69b5df845 100644 --- a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp @@ -81,7 +81,7 @@ TEST_P(ComputeSharedMemoryTests, Basic) { @group(0) @binding(0) var dst : Dst; var tmp : u32; - @stage(compute) @workgroup_size(4,4,1) + @compute @workgroup_size(4,4,1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { let index : u32 = LocalInvocationID.y * kTileSize + LocalInvocationID.x; if (index == 0u) { @@ -124,7 +124,7 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) { var wg_array : array; var wg_vector : vec4; - @stage(compute) @workgroup_size(4,1,1) + @compute @workgroup_size(4,1,1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { let i = 4u * LocalInvocationID.x; diff --git a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp index c8a9f5158d..e98253ebcd 100644 --- a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp +++ b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp @@ -39,7 +39,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) { @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { buf.data[GlobalInvocationID.x] = buf.data[GlobalInvocationID.x] + 0x1234u; } @@ -90,7 +90,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u; } @@ -156,7 +156,7 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u; } @@ -224,7 +224,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + vec4(0x1234u, 0x1234u, 0x1234u, 0x1234u); @@ -292,7 +292,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + vec4(0x1234u, 0x1234u, 0x1234u, 0x1234u); @@ -348,7 +348,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { } @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { buf.data = array(1u, 1u, 1u); } )"); @@ -367,7 +367,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { } @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.data = 2u; if (buf.data[0] == 1u && buf.data[1] == 1u && buf.data[2] == 1u) { result.data = 1u; diff --git a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp index 736b4bb8ce..77a7dd8721 100644 --- a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp @@ -267,7 +267,7 @@ class CopyTextureForBrowserTests : public Parent { // The value diff should be smaller than the hard coded tolerance. return abs(value - expect) < 0.01; } - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let srcSize = textureDimensions(src); let dstSize = textureDimensions(dst); diff --git a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp index 6b9575533c..2155ae6e2c 100644 --- a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp @@ -135,7 +135,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -165,7 +165,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointAfterCreatComputePipelineAsync) } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); @@ -204,7 +204,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main0"; @@ -236,11 +236,11 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -260,11 +260,11 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointsAfterCreateRenderPipelineAsync utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -325,11 +325,11 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -363,7 +363,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -387,11 +387,11 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipeli TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -419,7 +419,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -444,11 +444,11 @@ TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateComputePipeli TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -482,7 +482,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -541,7 +541,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwiceAtSameTime) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -578,11 +578,11 @@ TEST_P(CreatePipelineAsyncTest, CreateSameRenderPipelineTwiceAtSameTime) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -639,7 +639,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts @builtin(position) position: vec4, } - @stage(vertex) + @vertex fn main(vertexInput : VertexInput) -> VertexOutput { var vertexOutput : VertexOutput; vertexOutput.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -651,7 +651,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts return vertexOutput; })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) fragColorIn : vec4) -> @location(0) vec4 { return fragColorIn; })"); @@ -731,12 +731,12 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithDepthStencilState) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -803,12 +803,12 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineWithMultisampleState) { { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -875,7 +875,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -885,7 +885,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { @location(1) fragColor1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.fragColor0 = vec4(0.4, 0.0, 0.0, 0.4); output.fragColor1 = vec4(0.0, 1.0, 0.0, 1.0); diff --git a/src/dawn/tests/end2end/CullingTests.cpp b/src/dawn/tests/end2end/CullingTests.cpp index d37a70b824..a169b10aaa 100644 --- a/src/dawn/tests/end2end/CullingTests.cpp +++ b/src/dawn/tests/end2end/CullingTests.cpp @@ -26,7 +26,7 @@ class CullingTest : public DawnTest { // 1. The top-left one is counterclockwise (CCW) // 2. The bottom-right one is clockwise (CW) pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -42,7 +42,7 @@ class CullingTest : public DawnTest { // RGBA8 format for the back buffer. So (FragCoord.xy - vec2(0.5)) / 255 in shader code // will make the pixel's R and G channels exactly equal to the pixel's x and y coordinates. pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return vec4( (FragCoord.xy - vec2(0.5, 0.5)) / vec2(255.0, 255.0), diff --git a/src/dawn/tests/end2end/D3D12CachingTests.cpp b/src/dawn/tests/end2end/D3D12CachingTests.cpp index c895a534b0..9cd404226e 100644 --- a/src/dawn/tests/end2end/D3D12CachingTests.cpp +++ b/src/dawn/tests/end2end/D3D12CachingTests.cpp @@ -45,11 +45,11 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) { mMockCache.Disable(); wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -82,11 +82,11 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) { // entrypoints) TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -115,11 +115,11 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) { // Modify the WGSL shader functions and make sure it doesn't hit. wgpu::ShaderModule newModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } )"); @@ -144,11 +144,11 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) { } @binding(0) @group(0) var data : Data; - @stage(compute) @workgroup_size(1) fn write1() { + @compute @workgroup_size(1) fn write1() { data.data = 1u; } - @stage(compute) @workgroup_size(1) fn write42() { + @compute @workgroup_size(1) fn write42() { data.data = 42u; } )"); diff --git a/src/dawn/tests/end2end/DeprecatedAPITests.cpp b/src/dawn/tests/end2end/DeprecatedAPITests.cpp index 0c6d00b1b2..28960b4e5f 100644 --- a/src/dawn/tests/end2end/DeprecatedAPITests.cpp +++ b/src/dawn/tests/end2end/DeprecatedAPITests.cpp @@ -142,7 +142,7 @@ TEST_P(DeprecationTests, EndPass) { // Test that dispatch() and dispatchIndirect() is deprecated. TEST_P(DeprecationTests, Dispatch) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); diff --git a/src/dawn/tests/end2end/DepthBiasTests.cpp b/src/dawn/tests/end2end/DepthBiasTests.cpp index 5a6134b0e6..376a1a4114 100644 --- a/src/dawn/tests/end2end/DepthBiasTests.cpp +++ b/src/dawn/tests/end2end/DepthBiasTests.cpp @@ -39,7 +39,7 @@ class DepthBiasTests : public DawnTest { case QuadAngle::Flat: // Draw a square at z = 0.25 vertexSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -55,7 +55,7 @@ class DepthBiasTests : public DawnTest { case QuadAngle::TiltedX: // Draw a square ranging from 0 to 0.5, bottom to top vertexSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, -1.0, 0.0), @@ -72,7 +72,7 @@ class DepthBiasTests : public DawnTest { wgpu::ShaderModule vertexModule = utils::CreateShaderModule(device, vertexSource); wgpu::ShaderModule fragmentModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp index 1e9130688c..d22d0ff0c4 100644 --- a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp @@ -48,7 +48,7 @@ class DepthStencilCopyTests : public DawnTestWithParams @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -148,12 +148,12 @@ class DepthStencilCopyTests : public DawnTestWithParamsdepthCompare = wgpu::CompareFunction::Always; renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"); } else { depthStencil->depthWriteEnabled = true; renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, std::string(R"( - @stage(fragment) fn main() -> @builtin(frag_depth) f32 { + @fragment fn main() -> @builtin(frag_depth) f32 { return )" + std::to_string(regionDepth) + R"(; })") .c_str()); @@ -704,7 +704,7 @@ TEST_P(StencilCopyTests, ToStencilAspect) { utils::ComboRenderPipelineDescriptor renderPipelineDesc; renderPipelineDesc.vertex.module = mVertexModule; renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); renderPipelineDesc.cFragment.targetCount = 0; wgpu::DepthStencilState* depthStencil = diff --git a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp index 9010acf113..7f72a25f6f 100644 --- a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp @@ -134,7 +134,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams aspects, std::vector components) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -146,7 +146,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams @location(0) vec4 {\n"; + shaderSource << "@fragment fn main() -> @location(0) vec4 {\n"; shaderSource << shaderBody.str() << "return vec4();\n }"; wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shaderSource.str().c_str()); @@ -164,8 +164,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -202,7 +201,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { return textureSampleCompare(tex, samp, vec2(0.5, 0.5), uniforms.compareRef); })"); @@ -229,7 +228,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams samplerResult : SamplerResult; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { samplerResult.value = textureSampleCompare(tex, samp, vec2(0.5, 0.5), uniforms.compareRef); })"); diff --git a/src/dawn/tests/end2end/DepthStencilStateTests.cpp b/src/dawn/tests/end2end/DepthStencilStateTests.cpp index 8690751462..9e53ed287d 100644 --- a/src/dawn/tests/end2end/DepthStencilStateTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilStateTests.cpp @@ -63,7 +63,7 @@ class DepthStencilStateTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -82,7 +82,7 @@ class DepthStencilStateTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(ubo.color, 1.0); })"); } diff --git a/src/dawn/tests/end2end/DestroyTests.cpp b/src/dawn/tests/end2end/DestroyTests.cpp index 7b46a23532..0c6c82a1ed 100644 --- a/src/dawn/tests/end2end/DestroyTests.cpp +++ b/src/dawn/tests/end2end/DestroyTests.cpp @@ -31,13 +31,13 @@ class DestroyTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/DeviceLifetimeTests.cpp b/src/dawn/tests/end2end/DeviceLifetimeTests.cpp index 186b8a3a92..d96ae911c3 100644 --- a/src/dawn/tests/end2end/DeviceLifetimeTests.cpp +++ b/src/dawn/tests/end2end/DeviceLifetimeTests.cpp @@ -286,7 +286,7 @@ TEST_P(DeviceLifetimeTests, DroppedWhileWriteBufferAndSubmit) { TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsync) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; @@ -306,7 +306,7 @@ TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsync) { TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsync) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; @@ -343,7 +343,7 @@ TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsync) { TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncAlreadyCached) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; @@ -372,7 +372,7 @@ TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncAlreadyCached) { TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsyncAlreadyCached) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; @@ -413,7 +413,7 @@ TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsyncAlreadyCached) { TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncRaceCache) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; @@ -437,7 +437,7 @@ TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncRaceCache) { TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsyncRaceCache) { wgpu::ComputePipelineDescriptor desc; desc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); desc.compute.entryPoint = "main"; diff --git a/src/dawn/tests/end2end/DeviceLostTests.cpp b/src/dawn/tests/end2end/DeviceLostTests.cpp index 2ac47f69b3..4a906cd468 100644 --- a/src/dawn/tests/end2end/DeviceLostTests.cpp +++ b/src/dawn/tests/end2end/DeviceLostTests.cpp @@ -93,7 +93,7 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) { pos : vec4 } @group(0) @binding(0) var ubo : UniformBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor descriptor; @@ -176,7 +176,7 @@ TEST_P(DeviceLostTest, CreateShaderModuleFails) { LoseDeviceForTesting(); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })")); @@ -423,7 +423,7 @@ TEST_P(DeviceLostTest, DeviceLostDoesntCallUncapturedError) { // before the callback of Create*PipelineAsync() is called. TEST_P(DeviceLostTest, DeviceLostBeforeCreatePipelineAsyncCallback) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor descriptor; diff --git a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp index 43ffa1a79c..78ee799566 100644 --- a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp @@ -37,13 +37,13 @@ class DrawIndexedIndirectTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -664,7 +664,7 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) { } @group(0) @binding(0) var input: Input; @group(0) @binding(1) var params: Params; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { params.indexCount = 3u; params.instanceCount = 1u; params.firstIndex = input.firstIndex; diff --git a/src/dawn/tests/end2end/DrawIndexedTests.cpp b/src/dawn/tests/end2end/DrawIndexedTests.cpp index c28b297136..8fb7c4a64c 100644 --- a/src/dawn/tests/end2end/DrawIndexedTests.cpp +++ b/src/dawn/tests/end2end/DrawIndexedTests.cpp @@ -27,13 +27,13 @@ class DrawIndexedTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/DrawIndirectTests.cpp b/src/dawn/tests/end2end/DrawIndirectTests.cpp index 84ab2b4634..f0239ef9ab 100644 --- a/src/dawn/tests/end2end/DrawIndirectTests.cpp +++ b/src/dawn/tests/end2end/DrawIndirectTests.cpp @@ -27,13 +27,13 @@ class DrawIndirectTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/DrawTests.cpp b/src/dawn/tests/end2end/DrawTests.cpp index 55e86ce5c4..6ae5b47d84 100644 --- a/src/dawn/tests/end2end/DrawTests.cpp +++ b/src/dawn/tests/end2end/DrawTests.cpp @@ -27,13 +27,13 @@ class DrawTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp index 23dee828c4..3b5d46713d 100644 --- a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp @@ -104,7 +104,7 @@ class DynamicBufferOffsetTests : public DawnTest { wgpu::RenderPipeline CreateRenderPipeline(bool isInheritedPipeline = false) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 0.0), @@ -135,7 +135,7 @@ class DynamicBufferOffsetTests : public DawnTest { fs << "let multipleNumber : u32 = " << multipleNumber << "u;\n"; fs << R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { sBufferNotDynamic.value = uBufferNotDynamic.value.xy; sBuffer.value = vec2(multipleNumber, multipleNumber) * (uBuffer.value.xy + uBufferNotDynamic.value.xy); return vec4(f32(uBuffer.value.x) / 255.0, f32(uBuffer.value.y) / 255.0, @@ -185,7 +185,7 @@ class DynamicBufferOffsetTests : public DawnTest { cs << "let multipleNumber : u32 = " << multipleNumber << "u;\n"; cs << R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { sBufferNotDynamic.value = uBufferNotDynamic.value.xy; sBuffer.value = vec2(multipleNumber, multipleNumber) * (uBuffer.value.xy + uBufferNotDynamic.value.xy); } @@ -480,7 +480,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) { @group(0) @binding(1) var dst : Dst; )"; shader << R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { for (var i: u32 = 0u; i < kArrayLength; i = i + 1u) { dst.values[i + kWriteOffset] = src.values[i + kReadOffset]; } diff --git a/src/dawn/tests/end2end/EntryPointTests.cpp b/src/dawn/tests/end2end/EntryPointTests.cpp index 02266ba2cc..2cd50e8ff9 100644 --- a/src/dawn/tests/end2end/EntryPointTests.cpp +++ b/src/dawn/tests/end2end/EntryPointTests.cpp @@ -24,11 +24,11 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) { // TODO(crbug.com/dawn/658): Crashes on bots DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -83,12 +83,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) { } @binding(0) @group(0) var data : Data; - @stage(compute) @workgroup_size(1) fn write1() { + @compute @workgroup_size(1) fn write1() { data.data = 1u; return; } - @stage(compute) @workgroup_size(1) fn write42() { + @compute @workgroup_size(1) fn write42() { data.data = 42u; return; } diff --git a/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp b/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp index 5e8900eac0..e6ecf3aabd 100644 --- a/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp +++ b/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp @@ -56,7 +56,7 @@ TEST_P(ExperimentalDP4aTests, BasicDP4aFeaturesTest) { } @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main() { var a = 0xFFFFFFFFu; var b = 0xFFFFFFFEu; diff --git a/src/dawn/tests/end2end/ExternalTextureTests.cpp b/src/dawn/tests/end2end/ExternalTextureTests.cpp index 6d15a41139..45314f6337 100644 --- a/src/dawn/tests/end2end/ExternalTextureTests.cpp +++ b/src/dawn/tests/end2end/ExternalTextureTests.cpp @@ -84,7 +84,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); const wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var positions = array, 3>( vec4(-1.0, 1.0, 0.0, 1.0), vec4(-1.0, -1.0, 0.0, 1.0), @@ -97,7 +97,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var t : texture_external; - @stage(fragment) fn main(@builtin(position) FragCoord : vec4) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSampleLevel(t, s, FragCoord.xy / vec2(4.0, 4.0)); })"); @@ -169,7 +169,7 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); const wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var positions = array, 3>( vec4(-1.0, 1.0, 0.0, 1.0), vec4(-1.0, -1.0, 0.0, 1.0), @@ -182,7 +182,7 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var t : texture_external; - @stage(fragment) fn main(@builtin(position) FragCoord : vec4) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSampleLevel(t, s, FragCoord.xy / vec2(4.0, 4.0)); })"); diff --git a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp index 6eb45c8712..2b795d6b8f 100644 --- a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp +++ b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp @@ -135,7 +135,7 @@ struct VertexInputs { struct VertexOutputs { )" + vertexOutputs.str() + R"( } -@stage(vertex) fn main(input : VertexInputs) -> VertexOutputs { +@vertex fn main(input : VertexInputs) -> VertexOutputs { var output : VertexOutputs; )" + vertexBody.str() + R"( output.position = input.position; @@ -152,7 +152,7 @@ struct IndexVals { struct FragInputs { )" + fragmentInputs.str() + R"( } -@stage(fragment) fn main(input : FragInputs) { +@fragment fn main(input : FragInputs) { )" + fragmentBody.str() + R"( })"; diff --git a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp index 5bd06048c7..2afe0f9acf 100644 --- a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -43,7 +43,7 @@ class GpuMemorySyncTests : public DawnTest { a : i32 } @group(0) @binding(0) var data : Data; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { data.a = data.a + 1; })"); @@ -61,7 +61,7 @@ class GpuMemorySyncTests : public DawnTest { const wgpu::Buffer& buffer, wgpu::TextureFormat colorFormat) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -70,7 +70,7 @@ class GpuMemorySyncTests : public DawnTest { i : i32 } @group(0) @binding(0) var data : Data; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { data.i = data.i + 1; return vec4(f32(data.i) / 255.0, 0.0, 0.0, 1.0); })"); @@ -235,7 +235,7 @@ class StorageToUniformSyncTests : public DawnTest { a : f32 } @group(0) @binding(0) var data : Data; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { data.a = 1.0; })"); @@ -252,7 +252,7 @@ class StorageToUniformSyncTests : public DawnTest { std::tuple CreatePipelineAndBindGroupForRender( wgpu::TextureFormat colorFormat) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -262,7 +262,7 @@ class StorageToUniformSyncTests : public DawnTest { } @group(0) @binding(0) var contents : Contents; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(contents.color, 0.0, 0.0, 1.0); })"); @@ -432,7 +432,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { @group(0) @binding(2) var uniformContents : ColorContents; @group(0) @binding(3) var storageContents : ColorContents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { vbContents.pos[0] = vec4(-1.0, 1.0, 0.0, 1.0); vbContents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); vbContents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); @@ -473,7 +473,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { // Create pipeline, bind group, and reuse buffers in render pass. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -486,7 +486,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniformBuffer.color, storageBuffer.color, 0.0, 1.0); })"); @@ -547,7 +547,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { @group(0) @binding(0) var contents : Contents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { contents.pos[0] = vec4(-1.0, 1.0, 0.0, 1.0); contents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); contents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); @@ -590,7 +590,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { // Create pipeline, bind group, and reuse the buffer in render pass. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -602,7 +602,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniformBuffer.color, storageBuffer.color, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp index 79f862c5d6..f027476b3e 100644 --- a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp @@ -229,7 +229,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 6>( vec2(-2.0, -2.0), @@ -257,7 +257,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); } diff --git a/src/dawn/tests/end2end/IndexFormatTests.cpp b/src/dawn/tests/end2end/IndexFormatTests.cpp index b563c64921..33560081b9 100644 --- a/src/dawn/tests/end2end/IndexFormatTests.cpp +++ b/src/dawn/tests/end2end/IndexFormatTests.cpp @@ -39,7 +39,7 @@ class IndexFormatTest : public DawnTest { @builtin(vertex_index) idx : u32, } - @stage(vertex) fn main(input : VertexIn) -> @builtin(position) vec4 { + @vertex fn main(input : VertexIn) -> @builtin(position) vec4 { // 0xFFFFFFFE is a designated invalid index used by some tests. if (input.idx == 0xFFFFFFFEu) { return vec4(0.0, 0.0, 0.0, 1.0); @@ -48,7 +48,7 @@ class IndexFormatTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/MaxLimitTests.cpp b/src/dawn/tests/end2end/MaxLimitTests.cpp index 42affd85a5..ceec790ddb 100644 --- a/src/dawn/tests/end2end/MaxLimitTests.cpp +++ b/src/dawn/tests/end2end/MaxLimitTests.cpp @@ -52,7 +52,7 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) { } var wg_data : WGData; - @stage(compute) @workgroup_size(2,1,1) + @compute @workgroup_size(2,1,1) fn main(@builtin(local_invocation_index) LocalInvocationIndex : u32) { if (LocalInvocationIndex == 0u) { // Put data into the first and last byte of workgroup memory. @@ -144,7 +144,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { @group(0) @binding(0) var buf : Buf; @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1,1,1) + @compute @workgroup_size(1,1,1) fn main() { result.value0 = buf.values[0]; result.value1 = buf.values[arrayLength(&buf.values) - 1u]; @@ -175,7 +175,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { @group(0) @binding(0) var buf : Buf; @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1,1,1) + @compute @workgroup_size(1,1,1) fn main() { result.value0 = buf.value0; result.value1 = buf.value1; diff --git a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp index 69dbd18992..453375986e 100644 --- a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp @@ -57,7 +57,7 @@ class MultisampledRenderingTest : public DawnTest { @builtin(frag_depth) depth : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = uBuffer.color; output.depth = uBuffer.depth; @@ -70,7 +70,7 @@ class MultisampledRenderingTest : public DawnTest { } @group(0) @binding(0) var uBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return uBuffer.color; })"; @@ -95,7 +95,7 @@ class MultisampledRenderingTest : public DawnTest { @location(1) color1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color0 = uBuffer.color0; output.color1 = uBuffer.color1; @@ -224,7 +224,7 @@ class MultisampledRenderingTest : public DawnTest { // Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal, // only two of the samples will be touched. const char* vs = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -236,7 +236,7 @@ class MultisampledRenderingTest : public DawnTest { // Draw a bottom-left triangle. const char* vsFlipped = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -753,7 +753,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut @builtin(sample_mask) sampleMask : u32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = uBuffer.color; output.sampleMask = 6u; @@ -808,7 +808,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut @builtin(sample_mask) sampleMask : u32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color0 = uBuffer.color0; output.color1 = uBuffer.color1; diff --git a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp index 9a8ca2addc..6952500c47 100644 --- a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp @@ -55,7 +55,7 @@ class MultisampledSamplingTest : public DawnTest { utils::ComboRenderPipelineDescriptor desc; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { return vec4(pos, 0.0, 1.0); })"); @@ -66,7 +66,7 @@ class MultisampledSamplingTest : public DawnTest { @builtin(frag_depth) depth : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = 1.0; output.depth = 0.7; @@ -103,7 +103,7 @@ class MultisampledSamplingTest : public DawnTest { } @group(0) @binding(2) var results : Results; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { for (var i : i32 = 0; i < 4; i = i + 1) { results.colorSamples[i] = textureLoad(texture0, vec2(0, 0), i).x; results.depthSamples[i] = textureLoad(texture1, vec2(0, 0), i); diff --git a/src/dawn/tests/end2end/ObjectCachingTests.cpp b/src/dawn/tests/end2end/ObjectCachingTests.cpp index 85139c93f0..cda1fca1ea 100644 --- a/src/dawn/tests/end2end/ObjectCachingTests.cpp +++ b/src/dawn/tests/end2end/ObjectCachingTests.cpp @@ -104,15 +104,15 @@ TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) { // Test that ShaderModules are correctly deduplicated. TEST_P(ObjectCachingTest, ShaderModuleDeduplication) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -124,16 +124,16 @@ TEST_P(ObjectCachingTest, ShaderModuleDeduplication) { TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); EXPECT_NE(module.Get(), otherModule.Get()); @@ -176,7 +176,7 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) { desc.compute.entryPoint = "main"; desc.compute.module = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); @@ -210,11 +210,11 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) { utils::ComboRenderPipelineDescriptor desc; desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); desc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); desc.layout = pl; @@ -233,15 +233,15 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) { // Test that RenderPipelines are correctly deduplicated wrt. their vertex module TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); })"); @@ -251,7 +251,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { utils::ComboRenderPipelineDescriptor desc; desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; desc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); desc.vertex.module = module; @@ -270,13 +270,13 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { // Test that RenderPipelines are correctly deduplicated wrt. their fragment module TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -285,7 +285,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) { utils::ComboRenderPipelineDescriptor desc; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); diff --git a/src/dawn/tests/end2end/OpArrayLengthTests.cpp b/src/dawn/tests/end2end/OpArrayLengthTests.cpp index 5f50dcbcc2..8b2ec17e43 100644 --- a/src/dawn/tests/end2end/OpArrayLengthTests.cpp +++ b/src/dawn/tests/end2end/OpArrayLengthTests.cpp @@ -130,7 +130,7 @@ TEST_P(OpArrayLengthTest, Compute) { } @group(1) @binding(0) var result : ResultBuffer; )" + mShaderInterface + R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.data[0] = arrayLength(&buffer1.data); result.data[1] = arrayLength(&buffer2.data); result.data[2] = arrayLength(&buffer3.data); @@ -168,12 +168,12 @@ TEST_P(OpArrayLengthTest, Fragment) { // Create the pipeline that computes the length of the buffers and writes it to the only render // pass pixel. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, (mShaderInterface + R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { var fragColor : vec4; fragColor.r = f32(arrayLength(&buffer1.data)) / 255.0; fragColor.g = f32(arrayLength(&buffer2.data)) / 255.0; @@ -229,7 +229,7 @@ TEST_P(OpArrayLengthTest, Vertex) { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color.r = f32(arrayLength(&buffer1.data)) / 255.0; output.color.g = f32(arrayLength(&buffer2.data)) / 255.0; @@ -242,7 +242,7 @@ TEST_P(OpArrayLengthTest, Vertex) { .c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); diff --git a/src/dawn/tests/end2end/PipelineCachingTests.cpp b/src/dawn/tests/end2end/PipelineCachingTests.cpp index 94d30c52d9..23ee708002 100644 --- a/src/dawn/tests/end2end/PipelineCachingTests.cpp +++ b/src/dawn/tests/end2end/PipelineCachingTests.cpp @@ -27,32 +27,32 @@ using ::testing::NiceMock; // TODO(dawn:549) Add some sort of pipeline descriptor repository to test more caching. static constexpr std::string_view kComputeShaderDefault = R"( - @stage(compute) @workgroup_size(1) fn main() {} + @compute @workgroup_size(1) fn main() {} )"; static constexpr std::string_view kComputeShaderMultipleEntryPoints = R"( - @stage(compute) @workgroup_size(16) fn main() {} - @stage(compute) @workgroup_size(64) fn main2() {} + @compute @workgroup_size(16) fn main() {} + @compute @workgroup_size(64) fn main2() {} )"; static constexpr std::string_view kVertexShaderDefault = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; static constexpr std::string_view kVertexShaderMultipleEntryPoints = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } - @stage(vertex) fn main2() -> @builtin(position) vec4 { + @vertex fn main2() -> @builtin(position) vec4 { return vec4(0.5, 0.5, 0.5, 1.0); } )"; static constexpr std::string_view kFragmentShaderDefault = R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.1, 0.2, 0.3, 0.4); } )"; @@ -63,7 +63,7 @@ static constexpr std::string_view kFragmentShaderMultipleOutput = R"( @location(1) fragColor1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.fragColor0 = vec4(0.1, 0.2, 0.3, 0.4); output.fragColor1 = vec4(0.5, 0.6, 0.7, 0.8); diff --git a/src/dawn/tests/end2end/PrimitiveStateTests.cpp b/src/dawn/tests/end2end/PrimitiveStateTests.cpp index 08fb99556a..fc6e5bde15 100644 --- a/src/dawn/tests/end2end/PrimitiveStateTests.cpp +++ b/src/dawn/tests/end2end/PrimitiveStateTests.cpp @@ -52,7 +52,7 @@ class DepthClampingTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, ubo.depth, 1.0); })"); @@ -63,7 +63,7 @@ class DepthClampingTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(ubo.color, 1.0); })"); } diff --git a/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp b/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp index 235bdbf359..1f12093078 100644 --- a/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp @@ -155,13 +155,13 @@ class PrimitiveTopologyTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/QueryTests.cpp b/src/dawn/tests/end2end/QueryTests.cpp index 3fa486026a..90e3467483 100644 --- a/src/dawn/tests/end2end/QueryTests.cpp +++ b/src/dawn/tests/end2end/QueryTests.cpp @@ -77,7 +77,7 @@ class OcclusionQueryTests : public QueryTests { // Create basic render pipeline vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2( 1.0, 1.0), @@ -87,7 +87,7 @@ class OcclusionQueryTests : public QueryTests { })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp index ad5c6972d9..2c2ec6558d 100644 --- a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp +++ b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp @@ -71,7 +71,7 @@ class ReadOnlyDepthStencilAttachmentTests // and pass the depth test, and sample from the depth buffer in fragment shader in the same // pipeline. pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, 1.0, 0.4), @@ -86,7 +86,7 @@ class ReadOnlyDepthStencilAttachmentTests if (!sampleFromAttachment) { // Draw a solid blue into color buffer if not sample from depth/stencil attachment. pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 0.0); })"); } else { @@ -96,7 +96,7 @@ class ReadOnlyDepthStencilAttachmentTests @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_depth_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return vec4(textureSample(tex, samp, FragCoord.xy), 0.0, 0.0, 0.0); })"); @@ -105,7 +105,7 @@ class ReadOnlyDepthStencilAttachmentTests pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { var texel = textureLoad(tex, vec2(FragCoord.xy), 0); return vec4(f32(texel[0]) / 255.0, 0.0, 0.0, 0.0); diff --git a/src/dawn/tests/end2end/RenderAttachmentTests.cpp b/src/dawn/tests/end2end/RenderAttachmentTests.cpp index eacc6663ef..25184c46ee 100644 --- a/src/dawn/tests/end2end/RenderAttachmentTests.cpp +++ b/src/dawn/tests/end2end/RenderAttachmentTests.cpp @@ -23,7 +23,7 @@ class RenderAttachmentTest : public DawnTest {}; // There should be no backend validation errors or indexing out-of-bounds. TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -36,7 +36,7 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { @location(3) color3 : vec4, } - @stage(fragment) + @fragment fn main() -> Output { var output : Output; output.color0 = vec4(1.0, 0.0, 0.0, 1.0); diff --git a/src/dawn/tests/end2end/RenderBundleTests.cpp b/src/dawn/tests/end2end/RenderBundleTests.cpp index 98ccce841d..acbb960f2b 100644 --- a/src/dawn/tests/end2end/RenderBundleTests.cpp +++ b/src/dawn/tests/end2end/RenderBundleTests.cpp @@ -32,7 +32,7 @@ class RenderBundleTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -43,7 +43,7 @@ class RenderBundleTest : public DawnTest { } @group(0) @binding(0) var fragmentUniformBuffer : Ubo; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUniformBuffer.color; })"); diff --git a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp index 6fb5ddf8ba..69a250c836 100644 --- a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp @@ -76,7 +76,7 @@ class RenderPassLoadOpTests : public DawnTest { // draws a blue quad on the right half of the screen const char* vsSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2( 0.0, -1.0), @@ -90,7 +90,7 @@ class RenderPassLoadOpTests : public DawnTest { })"; const char* fsSource = R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 1.0); })"; blueQuad = DrawQuad(device, vsSource, fsSource); diff --git a/src/dawn/tests/end2end/RenderPassTests.cpp b/src/dawn/tests/end2end/RenderPassTests.cpp index adf093e24b..f26cae96c2 100644 --- a/src/dawn/tests/end2end/RenderPassTests.cpp +++ b/src/dawn/tests/end2end/RenderPassTests.cpp @@ -27,7 +27,7 @@ class RenderPassTest : public DawnTest { // Shaders to draw a bottom-left triangle in blue. mVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -38,7 +38,7 @@ class RenderPassTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 1.0); })"); @@ -138,7 +138,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { { // Next we use a pipeline whose fragment shader has no outputs. wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = mVSModule; diff --git a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp index 1e5a91ed75..be4bf0c5de 100644 --- a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp +++ b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp @@ -54,7 +54,7 @@ class SamplerFilterAnisotropicTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.uv = input.uv; @@ -71,7 +71,7 @@ class SamplerFilterAnisotropicTest : public DawnTest { @builtin(position) fragCoord : vec4, } - @stage(fragment) + @fragment fn main(input : FragmentIn) -> @location(0) vec4 { return textureSample(texture0, sampler0, input.uv); })"); diff --git a/src/dawn/tests/end2end/SamplerTests.cpp b/src/dawn/tests/end2end/SamplerTests.cpp index 3ad38ecade..b6db24ec4f 100644 --- a/src/dawn/tests/end2end/SamplerTests.cpp +++ b/src/dawn/tests/end2end/SamplerTests.cpp @@ -56,7 +56,7 @@ class SamplerTest : public DawnTest { mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); auto vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-2.0, -2.0), @@ -72,7 +72,7 @@ class SamplerTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(texture0, sampler0, FragCoord.xy / vec2(2.0, 2.0)); })"); diff --git a/src/dawn/tests/end2end/ScissorTests.cpp b/src/dawn/tests/end2end/ScissorTests.cpp index a66044097b..cfdc5dad76 100644 --- a/src/dawn/tests/end2end/ScissorTests.cpp +++ b/src/dawn/tests/end2end/ScissorTests.cpp @@ -21,7 +21,7 @@ class ScissorTest : public DawnTest { protected: wgpu::RenderPipeline CreateQuadPipeline(wgpu::TextureFormat format) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -34,7 +34,7 @@ class ScissorTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/ShaderTests.cpp b/src/dawn/tests/end2end/ShaderTests.cpp index c72a77bc1b..6ff12552d2 100644 --- a/src/dawn/tests/end2end/ShaderTests.cpp +++ b/src/dawn/tests/end2end/ShaderTests.cpp @@ -56,7 +56,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { let factor : f32 = 1.0001; buf.data[0] = u32(log2(1.0 * factor)); @@ -115,7 +115,7 @@ I am an invalid shader and should never pass validation! // can compile and link successfully. TEST_P(ShaderTests, WGSLParamIO) { std::string vertexShader = R"( -@stage(vertex) +@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -126,7 +126,7 @@ fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4) -> @location(0) vec4 { return vec4(fragCoord.xy, 0.0, 1.0); })"; @@ -152,7 +152,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -162,7 +162,7 @@ fn main(input : VertexIn) -> VertexOut { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader.c_str()); std::string fragmentShader = R"( -@stage(fragment) +@fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"; @@ -195,7 +195,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -210,7 +210,7 @@ struct FragmentIn { @builtin(position) fragCoord : vec4, } -@stage(fragment) +@fragment fn main(input : FragmentIn) -> @location(0) vec4 { return input.color * input.fragCoord; })"; @@ -242,7 +242,7 @@ struct VertexOut { @location(0) color : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -257,7 +257,7 @@ struct FragmentIn { @builtin(position) fragCoord : vec4, } -@stage(fragment) +@fragment fn main(input : FragmentIn) -> @location(0) vec4 { return input.color * input.fragCoord; })"; @@ -289,7 +289,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn vertexMain(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -297,7 +297,7 @@ fn vertexMain(input : VertexIn) -> VertexOut { return output; } -@stage(fragment) +@fragment fn fragmentMain(input : VertexOut) -> @location(0) vec4 { return input.color; })"; @@ -338,12 +338,12 @@ struct Inputs { struct S1 { data : array, 20> } @group(0) @binding(1) var providedData1 : S1; -@stage(vertex) fn vsMain(input : Inputs) -> @builtin(position) vec4 { +@vertex fn vsMain(input : Inputs) -> @builtin(position) vec4 { _ = providedData1.data[input.vertexIndex][0]; return vec4(); } -@stage(fragment) fn fsMain() -> @location(0) vec4 { +@fragment fn fsMain() -> @location(0) vec4 { return vec4(); } )"; @@ -369,13 +369,13 @@ TEST_P(ShaderTests, SampleIndex) { DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_sample_variables")); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( -@stage(vertex) +@vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( -@stage(fragment) fn main(@builtin(sample_index) sampleIndex : u32) +@fragment fn main(@builtin(sample_index) sampleIndex : u32) -> @location(0) vec4 { return vec4(f32(sampleIndex), 1.0, 0.0, 1.0); })"); @@ -422,7 +422,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = u32(c0); buf.data[1] = u32(c1); buf.data[2] = u32(c2); @@ -492,7 +492,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = c1; buf.data[1] = c2; buf.data[2] = c3; @@ -549,7 +549,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = c1; buf.data[1] = c2; })"; @@ -603,15 +603,15 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main1() { +@compute @workgroup_size(1) fn main1() { buf.data[0] = c1; } -@stage(compute) @workgroup_size(1) fn main2() { +@compute @workgroup_size(1) fn main2() { buf.data[0] = c2; } -@stage(compute) @workgroup_size(1) fn main3() { +@compute @workgroup_size(1) fn main3() { buf.data[0] = 3u; } )"; @@ -687,7 +687,7 @@ TEST_P(ShaderTests, OverridableConstantsRenderPipeline) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @id(1111) override xright: f32; @id(2222) override ytop: f32; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( @@ -700,7 +700,7 @@ fn main(@builtin(vertex_index) VertexIndex : u32) wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @id(1000) override intensity: f32 = 0.0; -@stage(fragment) fn main() +@fragment fn main() -> @location(0) vec4 { return vec4(intensity, intensity, intensity, 1.0); })"); @@ -744,12 +744,12 @@ TEST_P(ShaderTests, ConflictingBindingsDueToTransformOrder) { @group(0) @binding(0) var b0 : u32; @group(0) @binding(1) var b1 : u32; - @stage(vertex) fn vertex() -> @builtin(position) vec4 { + @vertex fn vertex() -> @builtin(position) vec4 { _ = b0; return vec4(0.0); } - @stage(fragment) fn fragment() -> @location(0) vec4 { + @fragment fn fragment() -> @location(0) vec4 { _ = b0; _ = b1; return vec4(0.0); diff --git a/src/dawn/tests/end2end/StorageTextureTests.cpp b/src/dawn/tests/end2end/StorageTextureTests.cpp index 058e108d3f..4981342082 100644 --- a/src/dawn/tests/end2end/StorageTextureTests.cpp +++ b/src/dawn/tests/end2end/StorageTextureTests.cpp @@ -648,7 +648,7 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { const char* kSimpleVertexShader = R"( ; -@stage(vertex) fn main() -> @builtin(position) vec4 { +@vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"; @@ -799,7 +799,7 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var Src : texture_2d; @group(0) @binding(1) var Dst : texture_storage_2d; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { var srcValue : vec4 = textureLoad(Src, vec2(0, 0), 0); srcValue.x = srcValue.x + 1u; textureStore(Dst, vec2(0, 0), srcValue); @@ -898,14 +898,14 @@ fn doTest() -> bool { const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"( @group(0) @binding(0) var dstImage : texture_storage_2d; -@stage(fragment) fn main() -> @location(0) vec4 { +@fragment fn main() -> @location(0) vec4 { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); return vec4(); })"; const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"( @group(0) @binding(0) var dstImage : texture_storage_2d; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); })"; }; diff --git a/src/dawn/tests/end2end/SwapChainValidationTests.cpp b/src/dawn/tests/end2end/SwapChainValidationTests.cpp index adb5c61bd3..b351be7325 100644 --- a/src/dawn/tests/end2end/SwapChainValidationTests.cpp +++ b/src/dawn/tests/end2end/SwapChainValidationTests.cpp @@ -228,7 +228,7 @@ TEST_P(SwapChainValidationTests, ViewDestroyedAfterPresent) { TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) { utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @@ -236,7 +236,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) { @location(0) target0 : vec4, @location(1) target1 : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var out : FragmentOut; out.target0 = vec4(0.0, 1.0, 0.0, 1.0); out.target1 = 0.5; diff --git a/src/dawn/tests/end2end/Texture3DTests.cpp b/src/dawn/tests/end2end/Texture3DTests.cpp index 9472087aad..98a986fd7a 100644 --- a/src/dawn/tests/end2end/Texture3DTests.cpp +++ b/src/dawn/tests/end2end/Texture3DTests.cpp @@ -30,7 +30,7 @@ TEST_P(Texture3DTests, Sampling) { // Set up pipeline. Two triangles will be drawn via the pipeline. They will fill the entire // color attachment with data sampled from 3D texture. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -47,7 +47,7 @@ TEST_P(Texture3DTests, Sampling) { @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_3d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, vec3(FragCoord.xy / 4.0, 1.5 / 4.0)); })"); diff --git a/src/dawn/tests/end2end/TextureFormatTests.cpp b/src/dawn/tests/end2end/TextureFormatTests.cpp index 0c7de09638..c0e9a31aec 100644 --- a/src/dawn/tests/end2end/TextureFormatTests.cpp +++ b/src/dawn/tests/end2end/TextureFormatTests.cpp @@ -143,7 +143,7 @@ class TextureFormatTest : public DawnTest { utils::ComboRenderPipelineDescriptor desc; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-3.0, -1.0), @@ -161,7 +161,7 @@ class TextureFormatTest : public DawnTest { fsSource << "struct FragmentOut {\n"; fsSource << " @location(0) color : vec4<" << type << ">\n"; fsSource << R"(} - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.color = textureLoad(myTexture, vec2(FragCoord.xy), 0); diff --git a/src/dawn/tests/end2end/TextureSubresourceTests.cpp b/src/dawn/tests/end2end/TextureSubresourceTests.cpp index 391d94434d..f7ed7ccef6 100644 --- a/src/dawn/tests/end2end/TextureSubresourceTests.cpp +++ b/src/dawn/tests/end2end/TextureSubresourceTests.cpp @@ -50,7 +50,7 @@ class TextureSubresourceTest : public DawnTest { void DrawTriangle(const wgpu::TextureView& view) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -61,7 +61,7 @@ class TextureSubresourceTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -87,7 +87,7 @@ class TextureSubresourceTest : public DawnTest { void SampleAndDraw(const wgpu::TextureView& samplerView, const wgpu::TextureView& renderView) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -104,7 +104,7 @@ class TextureSubresourceTest : public DawnTest { @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, FragCoord.xy / vec2(4.0, 4.0)); })"); diff --git a/src/dawn/tests/end2end/TextureViewTests.cpp b/src/dawn/tests/end2end/TextureViewTests.cpp index 38ac5238dc..6ef53fa068 100644 --- a/src/dawn/tests/end2end/TextureViewTests.cpp +++ b/src/dawn/tests/end2end/TextureViewTests.cpp @@ -68,7 +68,7 @@ wgpu::ShaderModule CreateDefaultVertexShaderModule(wgpu::Device device) { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var output : VertexOut; var pos = array, 6>( @@ -222,7 +222,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); } @@ -258,7 +258,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0) + textureSample(texture0, sampler0, texCoord, 1) + @@ -293,7 +293,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : )" << textureType << R"(; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { var sc : f32 = 2.0 * texCoord.x - 1.0; var tc : f32 = 2.0 * texCoord.y - 1.0; @@ -367,7 +367,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0) + textureSample(texture0, sampler0, texCoord, 1) + @@ -408,7 +408,7 @@ TEST_P(TextureViewSamplingTest, Texture2DArrayViewOnSingleLayer2DTexture) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0); } @@ -470,7 +470,7 @@ TEST_P(TextureViewSamplingTest, SRGBReinterpretation) { utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -485,7 +485,7 @@ TEST_P(TextureViewSamplingTest, SRGBReinterpretation) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -603,7 +603,7 @@ class TextureViewRenderingTest : public DawnTest { renderPassInfo.cColorAttachments[0].clearValue = {1.0f, 0.0f, 0.0f, 1.0f}; const char* oneColorFragmentShader = R"( - @stage(fragment) fn main(@location(0) texCoord : vec2) -> + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); } @@ -802,7 +802,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { // Create a render pipeline to blit |sampledTexture| into |textureView|. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -817,7 +817,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -916,7 +916,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { // Create a render pipeline to blit |sampledTexture| into |multisampledTextureView|. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -931,7 +931,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -1065,7 +1065,7 @@ TEST_P(TextureView1DTest, Sampling) { // Create a pipeline that will sample from the 1D texture and output to an attachment. wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn vs(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec4( 0., 2., 0., 1.), @@ -1076,7 +1076,7 @@ TEST_P(TextureView1DTest, Sampling) { @group(0) @binding(0) var tex : texture_1d; @group(0) @binding(1) var samp : sampler; - @stage(fragment) + @fragment fn fs(@builtin(position) pos: vec4) -> @location(0) vec4 { return textureSample(tex, samp, pos.x / 4.0); } diff --git a/src/dawn/tests/end2end/TextureZeroInitTests.cpp b/src/dawn/tests/end2end/TextureZeroInitTests.cpp index 2e545b1ece..684e89bd54 100644 --- a/src/dawn/tests/end2end/TextureZeroInitTests.cpp +++ b/src/dawn/tests/end2end/TextureZeroInitTests.cpp @@ -72,7 +72,7 @@ class TextureZeroInitTest : public DawnTest { pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth); const char* fs = R"( ; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"; @@ -85,7 +85,7 @@ class TextureZeroInitTest : public DawnTest { } wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) { std::string source = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -106,7 +106,7 @@ class TextureZeroInitTest : public DawnTest { struct FragmentOut { @location(0) color : vec4 } - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.color = textureLoad(texture0, vec2(FragCoord.xy), 0); @@ -992,7 +992,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) { value : vec4 } @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.value = textureLoad(tex, vec2(0,0), 0); } )"; diff --git a/src/dawn/tests/end2end/VertexFormatTests.cpp b/src/dawn/tests/end2end/VertexFormatTests.cpp index 336ac0f171..bfef05686e 100644 --- a/src/dawn/tests/end2end/VertexFormatTests.cpp +++ b/src/dawn/tests/end2end/VertexFormatTests.cpp @@ -273,7 +273,7 @@ class VertexFormatTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(input : VertexIn) -> VertexOut { var pos = array, 3>( vec2(-1.0, -1.0), @@ -362,7 +362,7 @@ class VertexFormatTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vs.str().c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); diff --git a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp index 25532773f7..cd8a5b0dba 100644 --- a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp +++ b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp @@ -102,13 +102,13 @@ class VertexOnlyRenderPipelineTest : public DawnTest { bool writeDepth = false, bool useFragment = true) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/VertexStateTests.cpp b/src/dawn/tests/end2end/VertexStateTests.cpp index aea465d227..ce95585997 100644 --- a/src/dawn/tests/end2end/VertexStateTests.cpp +++ b/src/dawn/tests/end2end/VertexStateTests.cpp @@ -91,7 +91,7 @@ class VertexStateTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main(input : VertexIn) -> VertexOut { + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; )"; @@ -139,7 +139,7 @@ class VertexStateTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vs.str().c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; } @@ -602,7 +602,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { @builtin(position) position : vec4, } - @stage(vertex) fn main(input : VertexIn) -> VertexOut { + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -622,7 +622,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { return output; })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); @@ -659,12 +659,12 @@ TEST_P(OptionalVertexStateTest, Basic) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/VideoViewsTests.cpp b/src/dawn/tests/end2end/VideoViewsTests.cpp index 3e937c1d9c..c9081958c3 100644 --- a/src/dawn/tests/end2end/VideoViewsTests.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests.cpp @@ -177,7 +177,7 @@ wgpu::ShaderModule VideoViewsTests::GetTestVertexShaderModule() const { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 6>( vec2(-1.0, 1.0), @@ -230,7 +230,7 @@ TEST_P(VideoViewsTests, NV12SampleYtoR) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let y : f32 = textureSample(texture, sampler0, texCoord).r; return vec4(y, 0.0, 0.0, 1.0); @@ -289,7 +289,7 @@ TEST_P(VideoViewsTests, NV12SampleUVtoRG) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let u : f32 = textureSample(texture, sampler0, texCoord).r; let v : f32 = textureSample(texture, sampler0, texCoord).g; @@ -359,7 +359,7 @@ TEST_P(VideoViewsTests, NV12SampleYUVtoRGB) { @group(0) @binding(1) var lumaTexture : texture_2d; @group(0) @binding(2) var chromaTexture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let y : f32 = textureSample(lumaTexture, sampler0, texCoord).r; let u : f32 = textureSample(chromaTexture, sampler0, texCoord).r; diff --git a/src/dawn/tests/end2end/ViewportOrientationTests.cpp b/src/dawn/tests/end2end/ViewportOrientationTests.cpp index 9a29049175..1d8d3c600e 100644 --- a/src/dawn/tests/end2end/ViewportOrientationTests.cpp +++ b/src/dawn/tests/end2end/ViewportOrientationTests.cpp @@ -24,12 +24,12 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(-0.5, 0.5, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/end2end/ViewportTests.cpp b/src/dawn/tests/end2end/ViewportTests.cpp index f27d052e2a..fb2c1cc7be 100644 --- a/src/dawn/tests/end2end/ViewportTests.cpp +++ b/src/dawn/tests/end2end/ViewportTests.cpp @@ -24,7 +24,7 @@ class ViewportTest : public DawnTest { DawnTest::SetUp(); mQuadVS = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -37,7 +37,7 @@ class ViewportTest : public DawnTest { })"); mQuadFS = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); })"); } @@ -93,7 +93,7 @@ class ViewportTest : public DawnTest { // Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var points : array, 3> = array, 3>( vec3(-0.9, 0.0, 1.0), diff --git a/src/dawn/tests/perf_tests/DrawCallPerf.cpp b/src/dawn/tests/perf_tests/DrawCallPerf.cpp index 7b2cc02890..335f73b8c5 100644 --- a/src/dawn/tests/perf_tests/DrawCallPerf.cpp +++ b/src/dawn/tests/perf_tests/DrawCallPerf.cpp @@ -34,7 +34,7 @@ constexpr float kVertexData[12] = { }; constexpr char kVertexShader[] = R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) pos : vec4 ) -> @builtin(position) vec4 { return pos; @@ -45,7 +45,7 @@ constexpr char kFragmentShaderA[] = R"( color : vec3 } @group(0) @binding(0) var uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniforms.color * (1.0 / 5000.0), 1.0); })"; @@ -59,7 +59,7 @@ constexpr char kFragmentShaderB[] = R"( @group(0) @binding(0) var constants : Constants; @group(1) @binding(0) var uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0); })"; diff --git a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp index b6cc974b95..d3faea0aea 100644 --- a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp +++ b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp @@ -75,7 +75,7 @@ const std::string& kMatMulFloatSharedArray2D = R"( var mm_Asub : array, 32>; var mm_Bsub : array, 32>;)"; const std::string& kMatMulFloatBodyPart1 = R"( - @stage(compute) @workgroup_size(8, 8, 1) + @compute @workgroup_size(8, 8, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = local_id.y * RowPerThread; @@ -240,7 +240,7 @@ const std::string& kMatMulVec4SharedArray2D = R"( var mm_Asub : array, 8>, 32>; var mm_Bsub : array, 8>, 32>;)"; const std::string& kMatMulVec4BodyPart1 = R"( - @stage(compute) @workgroup_size(8, 8, 1) + @compute @workgroup_size(8, 8, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = local_id.y * RowPerThread; diff --git a/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp b/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp index 33ae07e925..2fe41acd46 100644 --- a/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp +++ b/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp @@ -68,13 +68,13 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var materials : texture_2d; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { let foo : vec2 = textureDimensions(materials); return vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp b/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp index cf76918a95..aaf1f3b5f6 100644 --- a/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp +++ b/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp @@ -60,7 +60,7 @@ TEST_F(CommandBufferEncodingTests, ComputePassEncoderIndirectDispatchStateRestor // Create a simple pipeline wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -290,7 +290,7 @@ TEST_F(CommandBufferEncodingTests, StateNotLeakedAfterRestore) { // Create a simple pipeline wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); csDesc.compute.entryPoint = "main"; diff --git a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp index 95979583bb..2cfb844d75 100644 --- a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp +++ b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp @@ -73,7 +73,7 @@ class DestroyObjectTests : public Test { } DAWN_TRY_ASSIGN_WITH_CLEANUP( mVsModule, ShaderModuleMock::Create(&mDevice, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"), { ASSERT(false); }, mVsModule); @@ -87,7 +87,7 @@ class DestroyObjectTests : public Test { } DAWN_TRY_ASSIGN_WITH_CLEANUP( mCsModule, ShaderModuleMock::Create(&mDevice, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"), { ASSERT(false); }, mCsModule); EXPECT_CALL(*mCsModule.Get(), DestroyImpl).Times(1); @@ -428,7 +428,7 @@ TEST_F(DestroyObjectTests, ShaderModuleImplicit) { { ShaderModuleWGSLDescriptor wgslDesc; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { } )"; ShaderModuleDescriptor desc = {}; @@ -698,7 +698,7 @@ TEST_F(DestroyObjectTests, DestroyObjects) { { ShaderModuleWGSLDescriptor wgslDesc; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { } )"; ShaderModuleDescriptor desc = {}; @@ -755,17 +755,17 @@ TEST_F(DestroyObjectTests, DestroyObjects) { } static constexpr std::string_view kComputeShader = R"( - @stage(compute) @workgroup_size(1) fn main() {} + @compute @workgroup_size(1) fn main() {} )"; static constexpr std::string_view kVertexShader = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; static constexpr std::string_view kFragmentShader = R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"; class DestroyObjectRegressionTests : public DawnNativeTest {}; diff --git a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp index a4293cb0f8..5784a3e5a1 100644 --- a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1457,7 +1457,7 @@ class SetBindGroupValidationTest : public ValidationTest { wgpu::RenderPipeline CreateRenderPipeline() { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -1471,7 +1471,7 @@ class SetBindGroupValidationTest : public ValidationTest { @group(0) @binding(2) var sBufferDynamic : S; @group(0) @binding(3) var sReadonlyBufferDynamic : S; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; @@ -1495,7 +1495,7 @@ class SetBindGroupValidationTest : public ValidationTest { @group(0) @binding(2) var sBufferDynamic : S; @group(0) @binding(3) var sReadonlyBufferDynamic : S; - @stage(compute) @workgroup_size(4, 4, 1) fn main() { + @compute @workgroup_size(4, 4, 1) fn main() { })"); wgpu::PipelineLayout pipelineLayout = @@ -1866,7 +1866,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest { ValidationTest::SetUp(); mVsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -1936,7 +1936,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest { } } - ss << "@stage(fragment) fn main() {}"; + ss << "@fragment fn main() {}"; wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str()); @@ -2068,7 +2068,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { const char* fsShader, std::vector bindGroupLayout) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -2095,7 +2095,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; - @stage(fragment) fn main() { + @fragment fn main() { var val : vec2 = sBufferDynamic.value; val = sReadonlyBufferDynamic.value; })", @@ -2130,7 +2130,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; - @stage(compute) @workgroup_size(4, 4, 1) fn main() { + @compute @workgroup_size(4, 4, 1) fn main() { var val : vec2 = sBufferDynamic.value; val = sReadonlyBufferDynamic.value; })", @@ -2173,12 +2173,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) { TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DShaderFS[] = R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; constexpr char kTexture2DShaderCS[] = R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(myTexture); })"; @@ -2212,12 +2212,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DArrayShaderFS[] = R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; constexpr char kTexture2DArrayShaderCS[] = R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(myTexture); })"; @@ -2259,7 +2259,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi // Test that an external texture binding works with a texture_external in the shader. CreateFSRenderPipeline(R"( @group(0) @binding(0) var myExternalTexture: texture_external; - @stage(fragment) fn main() { + @fragment fn main() { _ = myExternalTexture; })", {bgl}); @@ -2267,7 +2267,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi // Test that an external texture binding doesn't work with a texture_2d in the shader. ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(R"( @group(0) @binding(0) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { _ = myTexture; })", {bgl})); @@ -2473,7 +2473,7 @@ class SamplerTypeBindingTest : public ValidationTest { wgpu::RenderPipeline CreateFragmentPipeline(wgpu::BindGroupLayout* bindGroupLayout, const char* fragmentSource) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -2500,7 +2500,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2512,7 +2512,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2524,7 +2524,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2536,7 +2536,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2548,7 +2548,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2560,7 +2560,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2574,7 +2574,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2588,7 +2588,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2602,7 +2602,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2616,7 +2616,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2630,7 +2630,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSampleCompare(myTexture, mySampler, vec2(0.0, 0.0), 0.0); })"); } @@ -2644,7 +2644,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })")); } @@ -2658,7 +2658,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } diff --git a/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp b/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp index d9edd357e0..2363c85dac 100644 --- a/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp @@ -23,7 +23,7 @@ class ComputeIndirectValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); // Set up compute pipeline diff --git a/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp b/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp index 5e2b492819..77ab331ba3 100644 --- a/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp @@ -25,7 +25,7 @@ class ComputeValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); // Set up compute pipeline diff --git a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp index 805deeeceb..aa9db1c424 100644 --- a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp @@ -24,12 +24,12 @@ class DrawIndirectValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4{ + @fragment fn main() -> @location(0) vec4{ return vec4(0.0, 0.0, 0.0, 0.0); })"); diff --git a/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp b/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp index 4b91c27f2f..2a2e3159c8 100644 --- a/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp @@ -83,7 +83,7 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); } @@ -117,7 +117,7 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { std::stringstream shaderStringStream; shaderStringStream << R"( - @stage(vertex) + @vertex fn main()" << inputStringStream.str() << R"() -> @builtin(position) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); diff --git a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index b976ed18f6..1bf2af4c24 100644 --- a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -21,7 +21,7 @@ class GetBindGroupLayoutTests : public ValidationTest { protected: wgpu::RenderPipeline RenderPipelineFromFragmentShader(const char* shader) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -52,7 +52,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniform0.pos; pos = uniform1.pos; return vec4(); @@ -69,7 +69,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { } @group(3) @binding(0) var storage3 : S3; - @stage(fragment) fn main() { + @fragment fn main() { var pos_u : vec4 = uniform2.pos; var pos_s : mat4x4 = storage3.pos; })"); @@ -103,7 +103,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultBindGroupLayoutPipelineCompatibility) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -125,7 +125,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -178,7 +178,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule emptyVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { _ = myTexture; _ = mySampler; return vec4(); @@ -187,7 +187,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureLoadVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureLoad(myTexture, vec2(), 0); _ = mySampler; return vec4(); @@ -196,7 +196,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureSampleVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureSampleLevel(myTexture, mySampler, vec2(), 0.0); return vec4(); })"); @@ -204,7 +204,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule unusedTextureFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = myTexture; _ = mySampler; })"); @@ -212,7 +212,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureLoadFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { textureLoad(myTexture, vec2(), 0); _ = mySampler; })"); @@ -220,7 +220,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureSampleFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2()); })"); @@ -295,7 +295,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) { } @group(0) @binding(0) var uniforms : S; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { var pos : vec4 = uniforms.pos; })"); @@ -348,7 +348,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -362,7 +362,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -377,7 +377,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -391,7 +391,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -403,7 +403,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_multisampled_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -416,7 +416,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -444,7 +444,7 @@ TEST_F(GetBindGroupLayoutTests, ExternalTextureBindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myExternalTexture: texture_external; - @stage(fragment) fn main() { + @fragment fn main() { _ = myExternalTexture; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -472,7 +472,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_1d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -484,7 +484,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -496,7 +496,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -508,7 +508,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_3d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -520,7 +520,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_cube; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -532,7 +532,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_cube_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -560,7 +560,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -572,7 +572,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -584,7 +584,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -617,7 +617,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -632,7 +632,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(1) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -647,7 +647,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(1) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -664,7 +664,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniform0.pos; pos = uniform1.pos; return vec4(); @@ -676,7 +676,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { } @group(1) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -702,7 +702,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : f32 = uniforms.pos; return vec4(); })"); @@ -713,7 +713,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : mat4x4 = uniforms.pos; return vec4(); })"); @@ -724,7 +724,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : f32 = uniforms.pos; })"); @@ -734,7 +734,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : mat4x4 = uniforms.pos; })"); @@ -793,24 +793,24 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { DAWN_SKIP_TEST_IF(UsesWire()); wgpu::ShaderModule vsModuleNoSampler = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { _ = mySampler; return vec4(); })"); wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); @@ -869,7 +869,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { } @group(0) @binding(0) var ubo : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = ubo.pos; return vec4(); })"); @@ -880,7 +880,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); @@ -897,7 +897,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -905,7 +905,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_multisampled_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -922,7 +922,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -930,7 +930,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_3d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -947,7 +947,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -955,7 +955,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -970,12 +970,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { // Test it is an error to query an out of range bind group layout. TEST_F(GetBindGroupLayoutTests, OutOfRangeIndex) { ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"( - @stage(fragment) fn main() { + @fragment fn main() { })") .GetBindGroupLayout(kMaxBindGroups)); ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"( - @stage(fragment) fn main() { + @fragment fn main() { })") .GetBindGroupLayout(kMaxBindGroups + 1)); } @@ -994,7 +994,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) { @group(0) @binding(0) var uniforms0 : S; @group(2) @binding(0) var uniforms2 : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms0.pos; pos = uniforms2.pos; })"); @@ -1046,13 +1046,13 @@ TEST_F(GetBindGroupLayoutTests, Reflection) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniforms.pos; return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDesc; @@ -1088,11 +1088,11 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) { @group(0) @binding(0) var data0 : Data; @group(0) @binding(1) var data1 : Data; - @stage(compute) @workgroup_size(1) fn compute0() { + @compute @workgroup_size(1) fn compute0() { data0.data = 0.0; } - @stage(compute) @workgroup_size(1) fn compute1() { + @compute @workgroup_size(1) fn compute1() { data1.data = 0.0; } )"); diff --git a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp index 1d4dbb6e63..3805ef9c4a 100644 --- a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp @@ -23,12 +23,12 @@ class IndexBufferValidationTest : public ValidationTest { wgpu::RenderPipeline MakeTestPipeline(wgpu::IndexFormat format, wgpu::PrimitiveTopology primitiveTopology) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/unittests/validation/LabelTests.cpp b/src/dawn/tests/unittests/validation/LabelTests.cpp index 7b70db6e95..a6d0b44e71 100644 --- a/src/dawn/tests/unittests/validation/LabelTests.cpp +++ b/src/dawn/tests/unittests/validation/LabelTests.cpp @@ -533,12 +533,12 @@ TEST_F(LabelTest, RenderPipeline) { std::string label = "test"; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -574,7 +574,7 @@ TEST_F(LabelTest, ComputePipeline) { std::string label = "test"; wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, nullptr); wgpu::ComputePipelineDescriptor descriptor; @@ -610,7 +610,7 @@ TEST_F(LabelTest, ShaderModule) { std::string label = "test"; const char* source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"; wgpu::ShaderModuleWGSLDescriptor wgslDesc; diff --git a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index ae213f48b6..f27a46deca 100644 --- a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -118,21 +118,21 @@ static const std::string kStructs = "struct ThreeFloats {f1 : f32, f2 : f32, f3 // Creates a compute shader with given bindings std::string CreateComputeShaderWithBindings(const std::vector& bindings) { return kStructs + GenerateBindingString(bindings) + - "@stage(compute) @workgroup_size(1,1,1) fn main() {\n" + + "@compute @workgroup_size(1,1,1) fn main() {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Compute) + "}"; } // Creates a vertex shader with given bindings std::string CreateVertexShaderWithBindings(const std::vector& bindings) { return kStructs + GenerateBindingString(bindings) + - "@stage(vertex) fn main() -> @builtin(position) vec4 {\n" + + "@vertex fn main() -> @builtin(position) vec4 {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Vertex) + "\n return vec4(); " + "}"; } // Creates a fragment shader with given bindings std::string CreateFragmentShaderWithBindings(const std::vector& bindings) { - return kStructs + GenerateBindingString(bindings) + "@stage(fragment) fn main() {\n" + + return kStructs + GenerateBindingString(bindings) + "@fragment fn main() {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Fragment) + "}"; } diff --git a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp index 829e883282..3498f1da04 100644 --- a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp +++ b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp @@ -38,7 +38,7 @@ TEST_F(MultipleDeviceTest, ValidatesSameDevice) { TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { wgpu::ShaderModuleWGSLDescriptor wgslDesc = {}; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1, 1, 1) fn main() { + @compute @workgroup_size(1, 1, 1) fn main() { } )"; diff --git a/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp b/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp index c42aa1e675..882bf25d24 100644 --- a/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp @@ -34,7 +34,7 @@ override c8: u32 = 0u; // type: uint32 override c9: u32 = 0u; // default override @id(1000) override c10: u32 = 10u; // default -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out _ = u32(c0); _ = u32(c1); @@ -64,7 +64,7 @@ override c8: u32; // type: uint32 override c9: u32 = 0u; // default override @id(1000) override c10: u32 = 10u; // default -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out _ = u32(c0); _ = u32(c1); diff --git a/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp b/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp index 49195c0bd0..7821933bb3 100644 --- a/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp +++ b/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp @@ -33,11 +33,11 @@ class RenderPipelineAndPassCompatibilityTests : public ValidationTest { // Create a NoOp pipeline utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); pipelineDescriptor.cFragment.targets = nullptr; pipelineDescriptor.cFragment.targetCount = 0; diff --git a/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp index b099e79950..954e038251 100644 --- a/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -175,12 +175,12 @@ TEST_F(QueueSubmitValidationTest, SubmitInCreateRenderPipelineAsyncCallback) { }; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -211,7 +211,7 @@ TEST_F(QueueSubmitValidationTest, SubmitInCreateComputePipelineAsyncCallback) { wgpu::ComputePipelineDescriptor descriptor; descriptor.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); descriptor.compute.entryPoint = "main"; device.CreateComputePipelineAsync(&descriptor, callback, &callbackData); @@ -236,7 +236,7 @@ TEST_F(QueueSubmitValidationTest, SubmitWithUnusedComputeBuffer) { cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL}); cpDesc.compute.entryPoint = "main"; cpDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::BufferDescriptor bufDesc; @@ -304,7 +304,7 @@ TEST_F(QueueSubmitValidationTest, SubmitWithUnusedComputeTextures) { cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL}); cpDesc.compute.entryPoint = "main"; cpDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::TextureDescriptor texDesc; diff --git a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp index 817f302b7f..aebdc0e88a 100644 --- a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -33,7 +33,7 @@ class RenderBundleValidationTest : public ValidationTest { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { + @vertex fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { return vec4(); })"); @@ -48,7 +48,7 @@ class RenderBundleValidationTest : public ValidationTest { } @group(1) @binding(1) var ssbo : Storage; - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::BindGroupLayout bgls[] = { diff --git a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp index 1810495307..bc47381c34 100644 --- a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -28,17 +28,17 @@ class RenderPipelineValidationTest : public ValidationTest { ValidationTest::SetUp(); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); fsModuleUint = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0u, 255u, 0u, 255u); })"); } @@ -336,7 +336,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) { descriptor.vertex.module = vsModule; std::ostringstream stream; stream << R"( - @stage(fragment) fn main() -> @location(0) vec4<)" + @fragment fn main() -> @location(0) vec4<)" << kScalarTypes[i] << R"(> { var result : vec4<)" << kScalarTypes[i] << R"(>; @@ -377,7 +377,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputComponentCountCompatibility) std::ostringstream stream; stream << R"( - @stage(fragment) fn main() -> @location(0) )"; + @fragment fn main() -> @location(0) )"; switch (componentCount) { case 1: stream << R"(f32 { @@ -788,7 +788,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) { @group(0) @binding(0) var myTexture : texture_2d<)" << kScalarTypes[i] << R"(>; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); @@ -837,7 +837,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) { stream << R"( @group(0) @binding(0) var myTexture : )" << kTextureKeywords[i] << R"(; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); @@ -865,7 +865,7 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) { data : array } @group(0) @binding(0) var dst : Dst; - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { dst.data[VertexIndex] = 0x1234u; return vec4(); })"); @@ -966,11 +966,11 @@ TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) { // Test that the entryPoint names must be present for the correct stage in the shader module. TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -1012,11 +1012,11 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) { // Test that vertex attrib validation is for the correct entryPoint TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex0(@location(0) attrib0 : vec4) + @vertex fn vertex0(@location(0) attrib0 : vec4) -> @builtin(position) vec4 { return attrib0; } - @stage(vertex) fn vertex1(@location(1) attrib1 : vec4) + @vertex fn vertex1(@location(1) attrib1 : vec4) -> @builtin(position) vec4 { return attrib1; } @@ -1054,10 +1054,10 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { // Test that fragment output validation is for the correct entryPoint TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn fragmentFloat() -> @location(0) vec4 { + @fragment fn fragmentFloat() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } - @stage(fragment) fn fragmentUint() -> @location(0) vec4 { + @fragment fn fragmentUint() -> @location(0) vec4 { return vec4(0u, 0u, 0u, 0u); } )"); @@ -1088,23 +1088,23 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) { // Test that unwritten fragment outputs must have a write mask of 0. TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); } )"); wgpu::ShaderModule fsModuleWriteNone = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"); wgpu::ShaderModule fsModuleWrite0 = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(); } )"); wgpu::ShaderModule fsModuleWrite1 = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(1) vec4 { + @fragment fn main() -> @location(1) vec4 { return vec4(); } )"); @@ -1114,7 +1114,7 @@ TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { @location(0) target0 : vec4, @location(1) target1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var out : FragmentOut; return out; } @@ -1226,10 +1226,10 @@ TEST_F(RenderPipelineValidationTest, BindingsFromCorrectEntryPoint) { @group(0) @binding(0) var var0 : Uniforms; @group(0) @binding(1) var var1 : Uniforms; - @stage(vertex) fn vertex0() -> @builtin(position) vec4 { + @vertex fn vertex0() -> @builtin(position) vec4 { return var0.data; } - @stage(vertex) fn vertex1() -> @builtin(position) vec4 { + @vertex fn vertex1() -> @builtin(position) vec4 { return var1.data; } )"); @@ -1323,7 +1323,7 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio @location(0) vout: f32, @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1332,14 +1332,14 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio struct B { @location(0) fin: f32 } - @stage(fragment) fn main(fragmentIn: B) -> @location(0) vec4 { + @fragment fn main(fragmentIn: B) -> @location(0) vec4 { return vec4(fragmentIn.fin, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fragmentModuleInputAtLocation1 = utils::CreateShaderModule(device, R"( struct A { @location(1) vout: f32 } - @stage(fragment) fn main(vertexOut: A) -> @location(0) vec4 { + @fragment fn main(vertexOut: A) -> @location(0) vec4 { return vec4(vertexOut.vout, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule vertexModuleOutputAtLocation1 = utils::CreateShaderModule(device, R"( @@ -1347,7 +1347,7 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio @location(1) fin: f32, @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> B { + @vertex fn main() -> B { var fragmentIn: B; fragmentIn.pos = vec4(0.0, 0.0, 0.0, 1.0); return fragmentIn; @@ -1391,7 +1391,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { vertexStream << interfaceDeclaration << R"( @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1402,7 +1402,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( } - @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { + @fragment fn main(fragmentIn: A) -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"; fragmentModules[i] = utils::CreateShaderModule(device, fragmentStream.str().c_str()); @@ -1489,7 +1489,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute vertexStream << interfaceDeclaration << R"( @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1500,7 +1500,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( } - @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { + @fragment fn main(fragmentIn: A) -> @location(0) vec4 { return fragmentIn.a; })"; fragmentModules[i] = utils::CreateShaderModule(device, fragmentStream.str().c_str()); diff --git a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 8e842b3427..9958b3fc02 100644 --- a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -50,12 +50,12 @@ class ResourceUsageTrackingTest : public ValidationTest { // pipeline. But those bind groups in caller can be used for validation for other purposes. wgpu::RenderPipeline CreateNoOpRenderPipeline() { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; @@ -67,7 +67,7 @@ class ResourceUsageTrackingTest : public ValidationTest { wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector bgls) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls)); @@ -749,7 +749,7 @@ TEST_F(ResourceUsageTrackingTest, BufferUsageConflictWithUnusedPipelineBindings) // Create a passthrough render pipeline with a readonly buffer wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -758,7 +758,7 @@ TEST_F(ResourceUsageTrackingTest, BufferUsageConflictWithUnusedPipelineBindings) value : f32 } @group(0) @binding(0) var rBuffer : RBuffer; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; @@ -1567,13 +1567,13 @@ TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithUnusedPipelineBindings { // Create a passthrough render pipeline with a sampled storage texture wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var tex : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; diff --git a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp index d6add45355..17e25f96ee 100644 --- a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -59,7 +59,7 @@ TEST_F(ShaderModuleValidationTest, CreationSuccess) { // be compiled. TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) { std::ostringstream stream; - stream << "@stage(fragment) fn main() -> @location(" << kMaxColorAttachments << R"() vec4 { + stream << "@fragment fn main() -> @location(" << kMaxColorAttachments << R"() vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"; ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, stream.str().c_str())); @@ -161,7 +161,7 @@ TEST_F(ShaderModuleValidationTest, GetCompilationMessages) { DAWN_SKIP_TEST_IF(UsesWire()); wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -241,7 +241,7 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { errorMatcher = "failingVertex"; pDesc.vertex.entryPoint = "failingVertex"; pDesc.vertex.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(vertex) fn failingVertex() -> ShaderIO { + @vertex fn failingVertex() -> ShaderIO { var shaderIO : ShaderIO; shaderIO.pos = vec4(0.0, 0.0, 0.0, 1.0); return shaderIO; @@ -249,7 +249,7 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { )") .c_str()); pDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0); } )"); @@ -260,13 +260,13 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { errorMatcher = "failingFragment"; pDesc.cFragment.entryPoint = "failingFragment"; pDesc.cFragment.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(fragment) fn failingFragment(io : ShaderIO) -> @location(0) vec4 { + @fragment fn failingFragment(io : ShaderIO) -> @location(0) vec4 { return vec4(0.0); } )") .c_str()); pDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0); } )"); @@ -354,7 +354,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { errorMatcher = "failingVertex"; pDesc.vertex.entryPoint = "failingVertex"; pDesc.vertex.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(vertex) fn failingVertex() -> ShaderIO { + @vertex fn failingVertex() -> ShaderIO { var shaderIO : ShaderIO; shaderIO.pos = vec4(0.0, 0.0, 0.0, 1.0); return shaderIO; @@ -362,7 +362,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { )") .c_str()); pDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0); } )"); @@ -373,13 +373,13 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { errorMatcher = "failingFragment"; pDesc.cFragment.entryPoint = "failingFragment"; pDesc.cFragment.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(fragment) fn failingFragment(io : ShaderIO) -> @location(0) vec4 { + @fragment fn failingFragment(io : ShaderIO) -> @location(0) vec4 { return vec4(0.0); } )") .c_str()); pDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0); } )"); @@ -454,7 +454,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { TEST_F(ShaderModuleValidationTest, ComputeWorkgroupSizeLimits) { auto CheckShaderWithWorkgroupSize = [this](bool success, uint32_t x, uint32_t y, uint32_t z) { std::ostringstream ss; - ss << "@stage(compute) @workgroup_size(" << x << "," << y << "," << z << ") fn main() {}"; + ss << "@compute @workgroup_size(" << x << "," << y << "," << z << ") fn main() {}"; wgpu::ComputePipelineDescriptor desc; desc.compute.entryPoint = "main"; @@ -506,7 +506,7 @@ TEST_F(ShaderModuleValidationTest, ComputeWorkgroupStorageSizeLimits) { ss << "var mat4_data: array, " << mat4_count << ">;"; body << "_ = mat4_data;"; } - ss << "@stage(compute) @workgroup_size(1) fn main() { " << body.str() << " }"; + ss << "@compute @workgroup_size(1) fn main() { " << body.str() << " }"; wgpu::ComputePipelineDescriptor desc; desc.compute.entryPoint = "main"; @@ -543,7 +543,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out buf.data[0] = c0; buf.data[1] = c1; @@ -560,7 +560,7 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { // kMaxBindingNumber is valid. desc.compute.module = utils::CreateShaderModule(device, R"( @group(0) @binding(65535) var s : sampler; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { _ = s; } )"); @@ -569,7 +569,7 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { // kMaxBindingNumber + 1 is an error desc.compute.module = utils::CreateShaderModule(device, R"( @group(0) @binding(65536) var s : sampler; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { _ = s; } )"); @@ -580,12 +580,12 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Vertex input. utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@location(0) a : vec4) -> @builtin(position) vec4 { + @vertex fn main(@location(0) a : vec4) -> @builtin(position) vec4 { return vec4(1.0); } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(a : vec4) -> @builtin(position) vec4 { + @vertex fn main(a : vec4) -> @builtin(position) vec4 { return vec4(1.0); } )")); @@ -596,7 +596,7 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { @builtin(position) pos : vec4, @location(0) a : f32, } - @stage(vertex) fn main() -> Output { + @vertex fn main() -> Output { var output : Output; return output; } @@ -606,7 +606,7 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { @builtin(position) pos : vec4, a : f32, } - @stage(vertex) fn main() -> Output { + @vertex fn main() -> Output { var output : Output; return output; } @@ -614,24 +614,24 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Fragment input utils::CreateShaderModule(device, R"( - @stage(fragment) fn main(@location(0) a : vec4) -> @location(0) f32 { + @fragment fn main(@location(0) a : vec4) -> @location(0) f32 { return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) fn main(a : vec4) -> @location(0) f32 { + @fragment fn main(a : vec4) -> @location(0) f32 { return 1.0; } )")); // Fragment input utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> f32 { + @fragment fn main() -> f32 { return 1.0; } )")); @@ -639,21 +639,21 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Binding decorations utils::CreateShaderModule(device, R"( @group(0) @binding(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @binding(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } )")); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } @@ -665,5 +665,5 @@ TEST_F(ShaderModuleValidationTest, ExtensionMustBeAllowed) { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( enable f16; -@stage(compute) @workgroup_size(1) fn main() {})")); +@compute @workgroup_size(1) fn main() {})")); } diff --git a/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp index 41968fc7e0..5222b81082 100644 --- a/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -26,11 +26,11 @@ class StorageTextureValidationTests : public ValidationTest { ValidationTest::SetUp(); mDefaultVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); mDefaultFSModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); } @@ -84,7 +84,7 @@ class StorageTextureValidationTests : public ValidationTest { ostream << "@group(0) @binding(0) var image0 : " << imageTypeDeclaration << "<" << imageFormatQualifier << ", " << access << ">;\n" - "@stage(compute) @workgroup_size(1) fn main() {\n" + "@compute @workgroup_size(1) fn main() {\n" " textureDimensions(image0);\n" "}\n"; @@ -120,7 +120,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) vertex_index : u32) -> @builtin(position) vec4 { textureStore(image0, vec2(i32(vertex_index), 0), vec4(1.0, 0.0, 0.0, 1.0)); return vec4(0.0); @@ -137,7 +137,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(fragment) fn main(@builtin(position) position : vec4) { + @fragment fn main(@builtin(position) position : vec4) { textureStore(image0, vec2(position.xy), vec4(1.0, 0.0, 0.0, 1.0)); })"); @@ -158,7 +158,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { + @compute @workgroup_size(1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { textureStore(image0, vec2(LocalInvocationID.xy), vec4(0.0, 0.0, 0.0, 0.0)); })"); @@ -177,7 +177,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(vertex) fn main() { + @vertex fn main() { textureDimensions(image0); })")); } @@ -186,7 +186,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(image0); })")); } @@ -195,7 +195,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(image0); })")); } diff --git a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 712e2be1fa..10d7a0049e 100644 --- a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -48,7 +48,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { { wgpu::ComputePipelineDescriptor pipelineDesc = pipelineDescBase; pipelineDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); device.CreateComputePipeline(&pipelineDesc); } @@ -59,7 +59,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { @id(1000) override c0: u32 = 1u; @id(1000) override c1: u32; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { _ = c0; _ = c1; })")); @@ -69,7 +69,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { { wgpu::ComputePipelineDescriptor pipelineDesc = pipelineDescBase; pipelineDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); std::vector constants{{nullptr, "c", 1u}}; pipelineDesc.compute.constants = constants.data(); pipelineDesc.compute.constantCount = constants.size(); diff --git a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp index 5b79eb5a4e..a70c582cf7 100644 --- a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -27,11 +27,11 @@ class VertexBufferValidationTest : public ValidationTest { // Placeholder vertex shader module vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); } @@ -46,7 +46,7 @@ class VertexBufferValidationTest : public ValidationTest { wgpu::ShaderModule MakeVertexShader(unsigned int bufferCount) { std::ostringstream vs; - vs << "@stage(vertex) fn main(\n"; + vs << "@vertex fn main(\n"; for (unsigned int i = 0; i < bufferCount; ++i) { // TODO(cwallez@chromium.org): remove this special handling of 0 once Tint supports // trailing commas in argument lists. diff --git a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp index b4de1bb641..422fa9fc41 100644 --- a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp @@ -26,7 +26,7 @@ class VertexStateTest : public ValidationTest { const char* vertexSource) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -46,7 +46,7 @@ class VertexStateTest : public ValidationTest { } const char* kPlaceholderVertexShader = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; @@ -98,7 +98,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Control case: pipeline with one input per attribute CreatePipeline(true, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) a : vec4, @location(1) b : vec4 ) -> @builtin(position) vec4 { @@ -108,7 +108,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Check it is valid for the pipeline to use a subset of the VertexState CreatePipeline(true, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) a : vec4 ) -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); @@ -117,7 +117,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Check for an error when the pipeline uses an attribute not in the vertex input CreatePipeline(false, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(2) a : vec4 ) -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); @@ -360,7 +360,7 @@ TEST_F(VertexStateTest, BaseTypeMatching) { state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].format = format; - std::string shader = "@stage(vertex) fn main(@location(0) attrib : " + shaderType + + std::string shader = "@vertex fn main(@location(0) attrib : " + shaderType + R"() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"; @@ -414,7 +414,7 @@ TEST_F(VertexStateTest, BaseTypeMatchingForInexistentInput) { state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].format = format; - std::string shader = R"(@stage(vertex) fn main() -> @builtin(position) vec4 { + std::string shader = R"(@vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"; diff --git a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp index 16f8c54e9b..5ec17ab562 100644 --- a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp @@ -44,7 +44,7 @@ class D3D12DescriptorHeapTests : public DawnTest { mSimpleVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -61,7 +61,7 @@ class D3D12DescriptorHeapTests : public DawnTest { } @group(0) @binding(0) var colorBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return colorBuffer.color; })"); } @@ -176,13 +176,13 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) { // a sampler bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps WILL NOT switch over // because the sampler heap allocations are de-duplicated. renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var sampler0 : sampler; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { _ = sampler0; return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -453,7 +453,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) { } @group(0) @binding(0) var buffer0 : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(buffer0.heapSize, 0.0, 0.0, 1.0); })"); @@ -786,7 +786,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { } @group(0) @binding(0) var buffer0 : U; - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -804,7 +804,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { @group(0) @binding(2) var texture0 : texture_2d; @group(0) @binding(3) var buffer0 : U; - @stage(fragment) fn main( + @fragment fn main( @builtin(position) FragCoord : vec4 ) -> @location(0) vec4 { return textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color; diff --git a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp index 8bab67477c..6298d82f4e 100644 --- a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp +++ b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp @@ -341,7 +341,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) { // Fill in a view heap with "view only" bindgroups (1x view per group) by creating a // view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over. renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -358,7 +358,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) { } @group(0) @binding(0) var colorBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return colorBuffer.color; })"); diff --git a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp index bf73bccb42..492ef1b92c 100644 --- a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp +++ b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp @@ -38,7 +38,7 @@ class InternalStorageBufferBindingTests : public DawnTest { @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { buf.data[GlobalInvocationID.x] = buf.data[GlobalInvocationID.x] + 0x1234u; } diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp index ca8acb81ca..46cb1b75c1 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp @@ -810,7 +810,7 @@ TEST_P(VulkanImageWrappingUsageTests, SRGBReinterpretation) { utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -825,7 +825,7 @@ TEST_P(VulkanImageWrappingUsageTests, SRGBReinterpretation) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); }