From 29b72c87e98bdf1b35c833ebd14f4dacd3962631 Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Tue, 5 Apr 2022 18:41:23 +0000 Subject: [PATCH] Updated the syntax for WGSL structs in all tests. Change-Id: Ia80b1bed84aa7d16421d432d5da861e55175b335 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85841 Commit-Queue: Brandon Jones Auto-Submit: Brandon Jones Reviewed-by: Austin Eng Commit-Queue: Austin Eng Reviewed-by: James Price --- src/dawn/tests/DawnTest.cpp | 10 +- src/dawn/tests/end2end/BindGroupTests.cpp | 68 +++++++------- .../tests/end2end/BufferZeroInitTests.cpp | 42 ++++----- src/dawn/tests/end2end/ColorStateTests.cpp | 36 ++++---- .../end2end/CompressedTextureFormatTests.cpp | 6 +- .../end2end/ComputeCopyStorageBufferTests.cpp | 18 ++-- .../tests/end2end/ComputeDispatchTests.cpp | 12 +-- .../ComputeLayoutMemoryBufferTests.cpp | 24 ++--- .../end2end/ComputeSharedMemoryTests.cpp | 18 ++-- .../ComputeStorageBufferBarrierTests.cpp | 32 +++---- .../end2end/CopyTextureForBrowserTests.cpp | 20 ++-- .../end2end/CreatePipelineAsyncTests.cpp | 38 ++++---- src/dawn/tests/end2end/D3D12CachingTests.cpp | 4 +- .../end2end/DepthStencilSamplingTests.cpp | 20 ++-- .../tests/end2end/DepthStencilStateTests.cpp | 12 +-- src/dawn/tests/end2end/DeviceLostTests.cpp | 4 +- .../end2end/DrawIndexedIndirectTests.cpp | 10 +- .../end2end/DynamicBufferOffsetTests.cpp | 20 ++-- src/dawn/tests/end2end/EntryPointTests.cpp | 4 +- .../tests/end2end/FirstIndexOffsetTests.cpp | 28 +++--- .../end2end/GpuMemorySynchronizationTests.cpp | 46 +++++----- .../tests/end2end/IOSurfaceWrappingTests.cpp | 6 +- src/dawn/tests/end2end/IndexFormatTests.cpp | 6 +- src/dawn/tests/end2end/MaxLimitTests.cpp | 38 ++++---- .../end2end/MultisampledRenderingTests.cpp | 52 +++++------ .../end2end/MultisampledSamplingTests.cpp | 12 +-- src/dawn/tests/end2end/OpArrayLengthTests.cpp | 26 +++--- .../tests/end2end/PrimitiveStateTests.cpp | 12 +-- .../tests/end2end/RenderAttachmentTests.cpp | 10 +- src/dawn/tests/end2end/RenderBundleTests.cpp | 4 +- .../end2end/SamplerFilterAnisotropicTests.cpp | 22 ++--- src/dawn/tests/end2end/ShaderTests.cpp | 88 +++++++++--------- .../end2end/SwapChainValidationTests.cpp | 6 +- src/dawn/tests/end2end/TextureFormatTests.cpp | 4 +- src/dawn/tests/end2end/TextureViewTests.cpp | 6 +- .../tests/end2end/TextureZeroInitTests.cpp | 8 +- src/dawn/tests/end2end/VertexFormatTests.cpp | 12 +-- src/dawn/tests/end2end/VertexStateTests.cpp | 30 +++--- src/dawn/tests/end2end/VideoViewsTests.cpp | 6 +- src/dawn/tests/perf_tests/DrawCallPerf.cpp | 12 +-- .../tests/perf_tests/ShaderRobustnessPerf.cpp | 24 ++--- .../validation/BindGroupValidationTests.cpp | 18 ++-- .../GetBindGroupLayoutValidationTests.cpp | 92 +++++++++---------- .../MinimumBufferSizeValidationTests.cpp | 82 ++++++++--------- .../RenderBundleValidationTests.cpp | 12 +-- .../RenderPipelineValidationTests.cpp | 50 +++++----- .../validation/ResourceUsageTrackingTests.cpp | 4 +- .../ShaderModuleValidationTests.cpp | 4 +- .../white_box/D3D12DescriptorHeapTests.cpp | 16 ++-- .../tests/white_box/D3D12ResidencyTests.cpp | 4 +- .../InternalStorageBufferBindingTests.cpp | 4 +- 51 files changed, 571 insertions(+), 571 deletions(-) diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp index 648871abf1..30a45038a6 100644 --- a/src/dawn/tests/DawnTest.cpp +++ b/src/dawn/tests/DawnTest.cpp @@ -1166,8 +1166,8 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t shaderSource << "@group(0) @binding(0) var tex : " << wgslTextureType << ";\n"; shaderSource << R"( struct Result { - values : array; - }; + values : array + } @group(0) @binding(1) var result : Result; )"; shaderSource << "let componentCount : u32 = " << componentCount << "u;\n"; @@ -1352,9 +1352,9 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( @group(0) @binding(0) var texture0 : texture_2d; struct FragmentOut { - @location(0) result : u32; - @builtin(frag_depth) fragDepth : f32; - }; + @location(0) result : u32, + @builtin(frag_depth) fragDepth : f32, + } @stage(fragment) fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { diff --git a/src/dawn/tests/end2end/BindGroupTests.cpp b/src/dawn/tests/end2end/BindGroupTests.cpp index ddafa933c9..3c576a96b1 100644 --- a/src/dawn/tests/end2end/BindGroupTests.cpp +++ b/src/dawn/tests/end2end/BindGroupTests.cpp @@ -68,8 +68,8 @@ class BindGroupTests : public DawnTest { std::ostringstream fs; for (size_t i = 0; i < bindingTypes.size(); ++i) { fs << "struct Buffer" << i << R"( { - color : vec4; - };)"; + color : vec4 + })"; switch (bindingTypes[i]) { case wgpu::BufferBindingType::Uniform: @@ -130,8 +130,8 @@ class BindGroupTests : public DawnTest { TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Contents { - f : f32; - }; + f : f32 + } @group(0) @binding(0) var contents: Contents; @stage(compute) @workgroup_size(1) fn main() { @@ -165,8 +165,8 @@ TEST_P(BindGroupTests, ReusedUBO) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( // TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly. struct VertexUniformBuffer { - transform : vec4; - }; + transform : vec4 + } @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; @@ -183,8 +183,8 @@ TEST_P(BindGroupTests, ReusedUBO) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct FragmentUniformBuffer { - color : vec4; - }; + color : vec4 + } @group(0) @binding(1) var fragmentUbo : FragmentUniformBuffer; @stage(fragment) fn main() -> @location(0) vec4 { @@ -243,8 +243,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( // TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly. struct VertexUniformBuffer { - transform : vec4; - }; + transform : vec4 + } @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; @stage(vertex) @@ -346,8 +346,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( // TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly. struct VertexUniformBuffer { - transform : vec4; - }; + transform : vec4 + } @group(0) @binding(0) var vertexUbo1 : VertexUniformBuffer; @group(1) @binding(0) var vertexUbo2 : VertexUniformBuffer; @@ -367,8 +367,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct FragmentUniformBuffer { - color : vec4; - }; + color : vec4 + } @group(0) @binding(1) var fragmentUbo1 : FragmentUniformBuffer; @group(1) @binding(1) var fragmentUbo2 : FragmentUniformBuffer; @@ -436,8 +436,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Contents { - f : f32; - }; + f : f32 + } @group(0) @binding(0) var contents0: Contents; @group(1) @binding(0) var contents1: Contents; @group(2) @binding(0) var contents2: Contents; @@ -1036,12 +1036,12 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) { wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.compute.module = utils::CreateShaderModule(device, R"( struct Buffer { - value : u32; - }; + value : u32 + } struct OutputBuffer { - value : vec3; - }; + value : vec3 + } @group(0) @binding(2) var buffer2 : Buffer; @group(0) @binding(3) var buffer3 : Buffer; @@ -1119,12 +1119,12 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping) wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.compute.module = utils::CreateShaderModule(device, R"( struct Buffer { - value : u32; - }; + value : u32 + } struct OutputBuffer { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var buffer0 : Buffer; @group(0) @binding(1) var buffer1 : Buffer; @@ -1245,8 +1245,8 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Ubo { - color : vec4; - }; + color : vec4 + } @group(0) @binding(953) var ubo1 : Ubo; @group(0) @binding(47) var ubo2 : Ubo; @@ -1387,8 +1387,8 @@ TEST_P(BindGroupTests, ReadonlyStorage) { pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( struct Buffer0 { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var buffer0 : Buffer0; @stage(fragment) fn main() -> @location(0) vec4 { @@ -1502,8 +1502,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({nullptr, binding, buffer, 0, 4 * sizeof(uint32_t), nullptr, nullptr}); interface << "struct UniformBuffer" << i << R"({ - value : u32; - }; + value : u32 + } )"; interface << "@group(0) @binding(" << binding++ << ") " << "var ubuf" << i << " : UniformBuffer" << i << ";\n"; @@ -1519,8 +1519,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({nullptr, binding, buffer, 0, sizeof(uint32_t), nullptr, nullptr}); interface << "struct ReadOnlyStorageBuffer" << i << R"({ - value : u32; - }; + value : u32 + } )"; interface << "@group(0) @binding(" << binding++ << ") " << "var sbuf" << i << " : ReadOnlyStorageBuffer" << i << ";\n"; @@ -1535,8 +1535,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({nullptr, binding, result, 0, sizeof(uint32_t), nullptr, nullptr}); interface << R"(struct ReadWriteStorageBuffer{ - value : u32; - }; + value : u32 + } )"; interface << "@group(0) @binding(" << binding++ << ") " << "var result : ReadWriteStorageBuffer;\n"; diff --git a/src/dawn/tests/end2end/BufferZeroInitTests.cpp b/src/dawn/tests/end2end/BufferZeroInitTests.cpp index 378a2b42a7..515e1875d7 100644 --- a/src/dawn/tests/end2end/BufferZeroInitTests.cpp +++ b/src/dawn/tests/end2end/BufferZeroInitTests.cpp @@ -251,9 +251,9 @@ class BufferZeroInitTest : public DawnTest { wgpu::RenderPipeline renderPipeline = CreateRenderPipelineForTest(R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(@location(0) pos : vec4) -> VertexOut { var output : VertexOut; @@ -295,9 +295,9 @@ class BufferZeroInitTest : public DawnTest { wgpu::RenderPipeline renderPipeline = CreateRenderPipelineForTest(R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { @@ -345,9 +345,9 @@ class BufferZeroInitTest : public DawnTest { wgpu::RenderPipeline renderPipeline = CreateRenderPipelineForTest(R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main() -> VertexOut { var output : VertexOut; @@ -386,9 +386,9 @@ class BufferZeroInitTest : public DawnTest { wgpu::RenderPipeline renderPipeline = CreateRenderPipelineForTest(R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main() -> VertexOut { var output : VertexOut; @@ -998,8 +998,8 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) { constexpr uint32_t kBoundBufferSize = 16u; wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct UBO { - value : vec4; - }; + value : vec4 + } @group(0) @binding(0) var ubo : UBO; @group(0) @binding(1) var outImage : texture_storage_2d; @@ -1037,8 +1037,8 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) { constexpr uint32_t kBoundBufferSize = 16u; wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct SSBO { - value : vec4; - }; + value : vec4 + } @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; @@ -1076,8 +1076,8 @@ TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) { constexpr uint32_t kBoundBufferSize = 32u; wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct SSBO { - value : array, 2>; - }; + value : array, 2> + } @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; @@ -1150,9 +1150,9 @@ TEST_P(BufferZeroInitTest, PaddingInitialized) { wgpu::RenderPipeline renderPipeline = CreateRenderPipelineForTest(R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(@location(0) pos : vec2) -> VertexOut { var output : VertexOut; diff --git a/src/dawn/tests/end2end/ColorStateTests.cpp b/src/dawn/tests/end2end/ColorStateTests.cpp index 9560d91a33..1a9b1c6669 100644 --- a/src/dawn/tests/end2end/ColorStateTests.cpp +++ b/src/dawn/tests/end2end/ColorStateTests.cpp @@ -62,8 +62,8 @@ class ColorStateTest : public DawnTest { void SetupSingleSourcePipelines(wgpu::ColorTargetState colorTargetState) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct MyBlock { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var myUbo : MyBlock; @@ -792,20 +792,20 @@ TEST_P(ColorStateTest, IndependentColorState) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct MyBlock { - color0 : vec4; - color1 : vec4; - color2 : vec4; - color3 : vec4; - }; + color0 : vec4, + color1 : vec4, + color2 : vec4, + color3 : vec4, + } @group(0) @binding(0) var myUbo : MyBlock; struct FragmentOut { - @location(0) fragColor0 : vec4; - @location(1) fragColor1 : vec4; - @location(2) fragColor2 : vec4; - @location(3) fragColor3 : vec4; - }; + @location(0) fragColor0 : vec4, + @location(1) fragColor1 : vec4, + @location(2) fragColor2 : vec4, + @location(3) fragColor3 : vec4, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; @@ -916,8 +916,8 @@ TEST_P(ColorStateTest, IndependentColorState) { TEST_P(ColorStateTest, DefaultBlendColor) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct MyBlock { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var myUbo : MyBlock; @@ -1042,8 +1042,8 @@ TEST_P(ColorStateTest, DefaultBlendColor) { TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct MyBlock { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var myUbo : MyBlock; @@ -1100,8 +1100,8 @@ TEST_P(ColorStateTest, SparseAttachmentsDifferentColorMask) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Outputs { - @location(1) o1 : vec4; - @location(3) o3 : vec4; + @location(1) o1 : vec4, + @location(3) o3 : vec4, } @stage(fragment) fn main() -> Outputs { diff --git a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp index 6086f2d462..a8a998385a 100644 --- a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp @@ -165,9 +165,9 @@ class CompressedTextureFormatTest : public DawnTestWithParams; - @builtin(position) position : vec4; - }; + @location(0) texCoord : vec2 , + @builtin(position) position : vec4, + } @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { diff --git a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp index f6761eba08..0fbb8210f5 100644 --- a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -89,8 +89,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) { BasicTest(R"( struct Buf { - s : array, 4>; - }; + s : array, 4> + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -107,13 +107,13 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) { TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) { BasicTest(R"( struct S { - a : vec2; - b : vec2; - }; + a : vec2, + b : vec2, + } struct Buf { - s : array; - }; + s : array + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -130,8 +130,8 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) { TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) { BasicTest(R"( struct Buf { - s : array>; - }; + s : array> + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; diff --git a/src/dawn/tests/end2end/ComputeDispatchTests.cpp b/src/dawn/tests/end2end/ComputeDispatchTests.cpp index 89a76c4656..2d566195b0 100644 --- a/src/dawn/tests/end2end/ComputeDispatchTests.cpp +++ b/src/dawn/tests/end2end/ComputeDispatchTests.cpp @@ -29,8 +29,8 @@ class ComputeDispatchTests : public DawnTest { // To make sure the dispatch was not called, write maximum u32 value for 0 dispatches wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct OutputBuf { - workGroups : vec3; - }; + workGroups : vec3 + } @group(0) @binding(0) var output : OutputBuf; @@ -55,11 +55,11 @@ class ComputeDispatchTests : public DawnTest { // Test the use of the compute pipelines without using @num_workgroups wgpu::ShaderModule moduleWithoutNumWorkgroups = utils::CreateShaderModule(device, R"( struct InputBuf { - expectedDispatch : vec3; - }; + expectedDispatch : vec3 + } struct OutputBuf { - workGroups : vec3; - }; + workGroups : vec3 + } @group(0) @binding(0) var input : InputBuf; @group(0) @binding(1) var output : OutputBuf; diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp index e59d3faed2..cc2be7dbfb 100644 --- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp @@ -169,24 +169,24 @@ TEST_P(ComputeLayoutMemoryBufferTests, Fields) { std::string shader = R"( struct Data { - header : u32; - @align({field_align}) @size({field_size}) field : {field_type}; - footer : u32; -}; + header : u32, + @align({field_align}) @size({field_size}) field : {field_type}, + footer : u32, +} struct Input { - header : u32; - {data_align}data : Data; - {footer_align}footer : u32; -}; + header : u32, + {data_align}data : Data, + {footer_align}footer : u32, +} struct Output { - data : {field_type}; -}; + data : {field_type} +} struct Status { - code : u32; -}; + code : u32 +} @group(0) @binding(0) var<{input_qualifiers}> input : Input; @group(0) @binding(1) var output : Output; diff --git a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp index 951167ecec..5440544eda 100644 --- a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp @@ -75,8 +75,8 @@ TEST_P(ComputeSharedMemoryTests, Basic) { let kInstances : u32 = 11u; struct Dst { - x : u32; - }; + x : u32 + } @group(0) @binding(0) var dst : Dst; var tmp : u32; @@ -107,15 +107,15 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct StructValues { - m: mat2x2; - }; + m: mat2x2 + } struct Dst { - d_struct : StructValues; - d_matrix : mat2x2; - d_array : array; - d_vector : vec4; - }; + d_struct : StructValues, + d_matrix : mat2x2, + d_array : array, + d_vector : vec4, + } @group(0) @binding(0) var dst : Dst; diff --git a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp index 10f4035a50..17ed6fec45 100644 --- a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp +++ b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp @@ -33,8 +33,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var buf : Buf; @@ -83,8 +83,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -149,8 +149,8 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -217,8 +217,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array, 25>; - }; + data : array, 25> + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -285,8 +285,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array, 25>; - }; + data : array, 25> + } @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; @@ -343,8 +343,8 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { step2PipelineDesc.compute.entryPoint = "main"; step2PipelineDesc.compute.module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var buf : Buf; @stage(compute) @workgroup_size(1) fn main() { @@ -357,13 +357,13 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { step3PipelineDesc.compute.entryPoint = "main"; step3PipelineDesc.compute.module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var buf : Buf; struct Result { - data : u32; - }; + data : u32 + } @group(0) @binding(1) var result : Result; @stage(compute) @workgroup_size(1) fn main() { diff --git a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp index a1c52361b5..207eba3d7a 100644 --- a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp @@ -247,17 +247,17 @@ class CopyTextureForBrowserTests : public Parent { wgpu::ComputePipeline MakeTestPipeline() { wgpu::ShaderModule csModule = utils::CreateShaderModule(this->device, R"( struct Uniforms { - dstTextureFlipY : u32; - channelCount : u32; - srcCopyOrigin : vec2; - dstCopyOrigin : vec2; - copySize : vec2; - srcAlphaMode : u32; - dstAlphaMode : u32; - }; + dstTextureFlipY : u32, + channelCount : u32, + srcCopyOrigin : vec2, + dstCopyOrigin : vec2, + copySize : vec2, + srcAlphaMode : u32, + dstAlphaMode : u32, + } struct OutputBuf { - result : array; - }; + result : array + } @group(0) @binding(0) var src : texture_2d; @group(0) @binding(1) var dst : texture_2d; @group(0) @binding(2) var output : OutputBuf; diff --git a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp index 3a92e65141..4c6d7420a3 100644 --- a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp @@ -134,8 +134,8 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct SSBO { - value : u32; - }; + value : u32 + } @group(0) @binding(0) var ssbo : SSBO; @stage(compute) @workgroup_size(1) fn main() { @@ -164,8 +164,8 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointAfterCreatComputePipelineAsync) wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct SSBO { - value : u32; - }; + value : u32 + } @group(0) @binding(0) var ssbo : SSBO; @stage(compute) @workgroup_size(1) fn main() { @@ -203,8 +203,8 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct SSBO { - value : u32; - }; + value : u32 + } @group(0) @binding(0) var ssbo : SSBO; @stage(compute) @workgroup_size(1) fn main() { @@ -483,8 +483,8 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct SSBO { - value : u32; - }; + value : u32 + } @group(0) @binding(0) var ssbo : SSBO; @stage(compute) @workgroup_size(1) fn main() { @@ -542,8 +542,8 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwiceAtSameTime) { csDesc.layout = pipelineLayout; csDesc.compute.module = utils::CreateShaderModule(device, R"( struct SSBO { - value : u32; - }; + value : u32 + } @group(0) @binding(0) var ssbo : SSBO; @stage(compute) @workgroup_size(1) fn main() { @@ -635,14 +635,14 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( struct VertexInput { - @location(0) input0: u32; - @location(1) input1: u32; - }; + @location(0) input0: u32, + @location(1) input1: u32, + } struct VertexOutput { - @location(0) vertexColorOut: vec4; - @builtin(position) position: vec4; - }; + @location(0) vertexColorOut: vec4, + @builtin(position) position: vec4, + } @stage(vertex) fn main(vertexInput : VertexInput) -> VertexOutput { @@ -886,9 +886,9 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( struct FragmentOut { - @location(0) fragColor0 : vec4; - @location(1) fragColor1 : vec4; - }; + @location(0) fragColor0 : vec4, + @location(1) fragColor1 : vec4, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; diff --git a/src/dawn/tests/end2end/D3D12CachingTests.cpp b/src/dawn/tests/end2end/D3D12CachingTests.cpp index 72200b1423..8ba2a07374 100644 --- a/src/dawn/tests/end2end/D3D12CachingTests.cpp +++ b/src/dawn/tests/end2end/D3D12CachingTests.cpp @@ -209,8 +209,8 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) { TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Data { - data : u32; - }; + data : u32 + } @binding(0) @group(0) var data : Data; @stage(compute) @workgroup_size(1) fn write1() { diff --git a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp index 2a9ce3fe7b..3047aeb535 100644 --- a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp @@ -84,11 +84,11 @@ class DepthStencilSamplingTest : public DawnTestWithParams;\n"; shaderSource << R"( struct DepthResult { - value : f32; - }; + value : f32 + } struct StencilResult { - values : StencilValues; - };)"; + values : StencilValues + })"; shaderSource << "\n"; uint32_t index = 0; @@ -195,8 +195,8 @@ class DepthStencilSamplingTest : public DawnTestWithParams uniforms : Uniforms; @stage(fragment) fn main() -> @location(0) f32 { @@ -217,13 +217,13 @@ class DepthStencilSamplingTest : public DawnTestWithParams uniforms : Uniforms; struct SamplerResult { - value : f32; - }; + value : f32 + } @group(0) @binding(3) var samplerResult : SamplerResult; @stage(compute) @workgroup_size(1) fn main() { diff --git a/src/dawn/tests/end2end/DepthStencilStateTests.cpp b/src/dawn/tests/end2end/DepthStencilStateTests.cpp index d954e325e2..6c6acd0c48 100644 --- a/src/dawn/tests/end2end/DepthStencilStateTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilStateTests.cpp @@ -57,9 +57,9 @@ class DepthStencilStateTest : public DawnTest { vsModule = utils::CreateShaderModule(device, R"( struct UBO { - color : vec3; - depth : f32; - }; + color : vec3, + depth : f32, + } @group(0) @binding(0) var ubo : UBO; @stage(vertex) @@ -76,9 +76,9 @@ class DepthStencilStateTest : public DawnTest { fsModule = utils::CreateShaderModule(device, R"( struct UBO { - color : vec3; - depth : f32; - }; + color : vec3, + depth : f32, + } @group(0) @binding(0) var ubo : UBO; @stage(fragment) fn main() -> @location(0) vec4 { diff --git a/src/dawn/tests/end2end/DeviceLostTests.cpp b/src/dawn/tests/end2end/DeviceLostTests.cpp index 1116e028ed..e255a6d8ae 100644 --- a/src/dawn/tests/end2end/DeviceLostTests.cpp +++ b/src/dawn/tests/end2end/DeviceLostTests.cpp @@ -113,8 +113,8 @@ TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) { TEST_P(DeviceLostTest, GetBindGroupLayoutFails) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct UniformBuffer { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var ubo : UniformBuffer; @stage(compute) @workgroup_size(1) fn main() { })"); diff --git a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp index 01aaf7c6a0..7c6e511bec 100644 --- a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp @@ -647,12 +647,12 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) { wgpu::ShaderModule paramWriterModule = utils::CreateShaderModule(device, R"( - struct Input { firstIndex: u32; }; + struct Input { firstIndex: u32 } struct Params { - indexCount: u32; - instanceCount: u32; - firstIndex: u32; - }; + indexCount: u32, + instanceCount: u32, + firstIndex: u32, + } @group(0) @binding(0) var input: Input; @group(0) @binding(1) var params: Params; @stage(compute) @workgroup_size(1) fn main() { diff --git a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp index 5c80a5ea48..3c11b1715d 100644 --- a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp @@ -116,8 +116,8 @@ class DynamicBufferOffsetTests : public DawnTest { std::string multipleNumber = isInheritedPipeline ? "2" : "1"; fs << R"( struct Buf { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var uBufferNotDynamic : Buf; @group(0) @binding(1) var sBufferNotDynamic : Buf; @@ -166,8 +166,8 @@ class DynamicBufferOffsetTests : public DawnTest { std::string multipleNumber = isInheritedPipeline ? "2" : "1"; cs << R"( struct Buf { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var uBufferNotDynamic : Buf; @group(0) @binding(1) var sBufferNotDynamic : Buf; @@ -454,16 +454,16 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) { case wgpu::BufferUsage::Uniform: shader << R"( struct Src { - values : array, kArrayLength>; - }; + values : array, kArrayLength> + } @group(0) @binding(0) var src : Src; )"; break; case wgpu::BufferUsage::Storage: shader << R"( struct Src { - values : array>; - }; + values : array> + } @group(0) @binding(0) var src : Src; )"; break; @@ -473,8 +473,8 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) { shader << R"( struct Dst { - values : array>; - }; + values : array> + } @group(0) @binding(1) var dst : Dst; )"; shader << R"( diff --git a/src/dawn/tests/end2end/EntryPointTests.cpp b/src/dawn/tests/end2end/EntryPointTests.cpp index 9b241de70d..2503db2c96 100644 --- a/src/dawn/tests/end2end/EntryPointTests.cpp +++ b/src/dawn/tests/end2end/EntryPointTests.cpp @@ -79,8 +79,8 @@ TEST_P(EntryPointTests, TwoComputeInModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Data { - data : u32; - }; + data : u32 + } @binding(0) @group(0) var data : Data; @stage(compute) @workgroup_size(1) fn write1() { diff --git a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp index ceee660628..525cdaca38 100644 --- a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp +++ b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp @@ -92,33 +92,33 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode, std::stringstream fragmentInputs; std::stringstream fragmentBody; - vertexInputs << " @location(0) position : vec4;\n"; - vertexOutputs << " @builtin(position) position : vec4;\n"; + vertexInputs << " @location(0) position : vec4,\n"; + vertexOutputs << " @builtin(position) position : vec4,\n"; if ((checkIndex & CheckIndex::Vertex) != 0) { - vertexInputs << " @builtin(vertex_index) vertex_index : u32;\n"; - vertexOutputs << " @location(1) @interpolate(flat) vertex_index : u32;\n"; + vertexInputs << " @builtin(vertex_index) vertex_index : u32,\n"; + vertexOutputs << " @location(1) @interpolate(flat) vertex_index : u32,\n"; vertexBody << " output.vertex_index = input.vertex_index;\n"; - fragmentInputs << " @location(1) @interpolate(flat) vertex_index : u32;\n"; + fragmentInputs << " @location(1) @interpolate(flat) vertex_index : u32,\n"; fragmentBody << " _ = atomicMin(&idx_vals.vertex_index, input.vertex_index);\n"; } if ((checkIndex & CheckIndex::Instance) != 0) { - vertexInputs << " @builtin(instance_index) instance_index : u32;\n"; - vertexOutputs << " @location(2) @interpolate(flat) instance_index : u32;\n"; + vertexInputs << " @builtin(instance_index) instance_index : u32,\n"; + vertexOutputs << " @location(2) @interpolate(flat) instance_index : u32,\n"; vertexBody << " output.instance_index = input.instance_index;\n"; - fragmentInputs << " @location(2) @interpolate(flat) instance_index : u32;\n"; + fragmentInputs << " @location(2) @interpolate(flat) instance_index : u32,\n"; fragmentBody << " _ = atomicMin(&idx_vals.instance_index, input.instance_index);\n"; } std::string vertexShader = R"( struct VertexInputs { )" + vertexInputs.str() + R"( -}; +} struct VertexOutputs { )" + vertexOutputs.str() + R"( -}; +} @stage(vertex) fn main(input : VertexInputs) -> VertexOutputs { var output : VertexOutputs; )" + vertexBody.str() + R"( @@ -128,14 +128,14 @@ struct VertexOutputs { std::string fragmentShader = R"( struct IndexVals { - vertex_index : atomic; - instance_index : atomic; -}; + vertex_index : atomic, + instance_index : atomic, +} @group(0) @binding(0) var idx_vals : IndexVals; struct FragInputs { )" + fragmentInputs.str() + R"( -}; +} @stage(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 d5b19592b6..0dd0aec84f 100644 --- a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -37,8 +37,8 @@ class GpuMemorySyncTests : public DawnTest { const wgpu::Buffer& buffer) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct Data { - a : i32; - }; + a : i32 + } @group(0) @binding(0) var data : Data; @stage(compute) @workgroup_size(1) fn main() { data.a = data.a + 1; @@ -64,8 +64,8 @@ class GpuMemorySyncTests : public DawnTest { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Data { - i : i32; - }; + i : i32 + } @group(0) @binding(0) var data : Data; @stage(fragment) fn main() -> @location(0) vec4 { data.i = data.i + 1; @@ -229,8 +229,8 @@ class StorageToUniformSyncTests : public DawnTest { std::tuple CreatePipelineAndBindGroupForCompute() { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct Data { - a : f32; - }; + a : f32 + } @group(0) @binding(0) var data : Data; @stage(compute) @workgroup_size(1) fn main() { data.a = 1.0; @@ -255,8 +255,8 @@ class StorageToUniformSyncTests : public DawnTest { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Contents { - color : f32; - }; + color : f32 + } @group(0) @binding(0) var contents : Contents; @stage(fragment) fn main() -> @location(0) vec4 { @@ -414,18 +414,18 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { // Create pipeline, bind group, and different buffers for compute pass. wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct VBContents { - pos : array, 4>; - }; + pos : array, 4> + } @group(0) @binding(0) var vbContents : VBContents; struct IBContents { - indices : array, 2>; - }; + indices : array, 2> + } @group(0) @binding(1) var ibContents : IBContents; struct ColorContents { - color : f32; - }; + color : f32 + } @group(0) @binding(2) var uniformContents : ColorContents; @group(0) @binding(3) var storageContents : ColorContents; @@ -477,8 +477,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Buf { - color : f32; - }; + color : f32 + } @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; @@ -536,11 +536,11 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { // Create pipeline, bind group, and a complex buffer for compute pass. wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct Contents { - @align(256) pos : array, 4>; - @align(256) indices : array, 2>; - @align(256) color0 : f32; - @align(256) color1 : f32; - }; + @align(256) pos : array, 4>, + @align(256) indices : array, 2>, + @align(256) color0 : f32, + @align(256) color1 : f32, + } @group(0) @binding(0) var contents : Contents; @@ -594,8 +594,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Buf { - color : f32; - }; + color : f32 + } @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; diff --git a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp index cfef5f146c..a8aa59bf62 100644 --- a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp @@ -231,9 +231,9 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { { wgpu::ShaderModule vs = utils::CreateShaderModule(device, R"( struct VertexOut { - @location(0) texCoord : vec2; - @builtin(position) position : vec4; - }; + @location(0) texCoord : vec2, + @builtin(position) position : vec4, + } @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { diff --git a/src/dawn/tests/end2end/IndexFormatTests.cpp b/src/dawn/tests/end2end/IndexFormatTests.cpp index c2fe883100..b563c64921 100644 --- a/src/dawn/tests/end2end/IndexFormatTests.cpp +++ b/src/dawn/tests/end2end/IndexFormatTests.cpp @@ -35,9 +35,9 @@ class IndexFormatTest : public DawnTest { wgpu::PrimitiveTopology primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct VertexIn { - @location(0) pos : vec4; - @builtin(vertex_index) idx : u32; - }; + @location(0) pos : vec4, + @builtin(vertex_index) idx : u32, + } @stage(vertex) fn main(input : VertexIn) -> @builtin(position) vec4 { // 0xFFFFFFFE is a designated invalid index used by some tests. diff --git a/src/dawn/tests/end2end/MaxLimitTests.cpp b/src/dawn/tests/end2end/MaxLimitTests.cpp index ce01ca506c..2d43a75ec2 100644 --- a/src/dawn/tests/end2end/MaxLimitTests.cpp +++ b/src/dawn/tests/end2end/MaxLimitTests.cpp @@ -34,19 +34,19 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) { std::string shader = R"( struct Dst { - value0 : u32; - value1 : u32; - }; + value0 : u32, + value1 : u32, + } @group(0) @binding(0) var dst : Dst; struct WGData { - value0 : u32; + value0 : u32, // padding such that value0 and value1 are the first and last bytes of the memory. @size()" + std::to_string(maxComputeWorkgroupStorageSize / 4 - 2) + - R"() padding : u32; - value1 : u32; - }; + R"() padding : u32, + value1 : u32, + } var wg_data : WGData; @stage(compute) @workgroup_size(2,1,1) @@ -130,13 +130,13 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { } shader = R"( struct Buf { - values : array; - }; + values : array + } struct Result { - value0 : u32; - value1 : u32; - }; + value0 : u32, + value1 : u32, + } @group(0) @binding(0) var buf : Buf; @group(0) @binding(1) var result : Result; @@ -157,17 +157,17 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { shader = R"( struct Buf { - value0 : u32; + value0 : u32, // padding such that value0 and value1 are the first and last bytes of the memory. @size()" + - std::to_string(maxBufferBindingSize - 8) + R"() padding : u32; - value1 : u32; - }; + std::to_string(maxBufferBindingSize - 8) + R"() padding : u32, + value1 : u32, + } struct Result { - value0 : u32; - value1 : u32; - }; + value0 : u32, + value1 : u32, + } @group(0) @binding(0) var buf : Buf; @group(0) @binding(1) var result : Result; diff --git a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp index 5c00237be1..bc6bb40235 100644 --- a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp @@ -46,15 +46,15 @@ class MultisampledRenderingTest : public DawnTest { bool flipTriangle = false) { const char* kFsOneOutputWithDepth = R"( struct U { - color : vec4; - depth : f32; - }; + color : vec4, + depth : f32, + } @group(0) @binding(0) var uBuffer : U; struct FragmentOut { - @location(0) color : vec4; - @builtin(frag_depth) depth : f32; - }; + @location(0) color : vec4, + @builtin(frag_depth) depth : f32, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; @@ -65,8 +65,8 @@ class MultisampledRenderingTest : public DawnTest { const char* kFsOneOutputWithoutDepth = R"( struct U { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var uBuffer : U; @stage(fragment) fn main() -> @location(0) vec4 { @@ -84,15 +84,15 @@ class MultisampledRenderingTest : public DawnTest { bool alphaToCoverageEnabled = false) { const char* kFsTwoOutputs = R"( struct U { - color0 : vec4; - color1 : vec4; - }; + color0 : vec4, + color1 : vec4, + } @group(0) @binding(0) var uBuffer : U; struct FragmentOut { - @location(0) color0 : vec4; - @location(1) color1 : vec4; - }; + @location(0) color0 : vec4, + @location(1) color1 : vec4, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; @@ -751,14 +751,14 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut constexpr uint32_t kSampleMask = kFirstSampleMaskBit | kThirdSampleMaskBit; const char* fs = R"( struct U { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var uBuffer : U; struct FragmentOut { - @location(0) color : vec4; - @builtin(sample_mask) sampleMask : u32; - }; + @location(0) color : vec4, + @builtin(sample_mask) sampleMask : u32, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; @@ -812,16 +812,16 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut constexpr float kMSAACoverage = 0.25f; const char* fs = R"( struct U { - color0 : vec4; - color1 : vec4; - }; + color0 : vec4, + color1 : vec4, + } @group(0) @binding(0) var uBuffer : U; struct FragmentOut { - @location(0) color0 : vec4; - @location(1) color1 : vec4; - @builtin(sample_mask) sampleMask : u32; - }; + @location(0) color0 : vec4, + @location(1) color1 : vec4, + @builtin(sample_mask) sampleMask : u32, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; diff --git a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp index c6c6d6ca49..25ede947db 100644 --- a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp @@ -64,9 +64,9 @@ class MultisampledSamplingTest : public DawnTest { desc.cFragment.module = utils::CreateShaderModule(device, R"( struct FragmentOut { - @location(0) color : f32; - @builtin(frag_depth) depth : f32; - }; + @location(0) color : f32, + @builtin(frag_depth) depth : f32, + } @stage(fragment) fn main() -> FragmentOut { var output : FragmentOut; @@ -100,9 +100,9 @@ class MultisampledSamplingTest : public DawnTest { @group(0) @binding(1) var texture1 : texture_depth_multisampled_2d; struct Results { - colorSamples : array; - depthSamples : array; - }; + colorSamples : array, + depthSamples : array, + } @group(0) @binding(2) var results : Results; @stage(compute) @workgroup_size(1) fn main() { diff --git a/src/dawn/tests/end2end/OpArrayLengthTests.cpp b/src/dawn/tests/end2end/OpArrayLengthTests.cpp index b1fcb857c9..b115e467e3 100644 --- a/src/dawn/tests/end2end/OpArrayLengthTests.cpp +++ b/src/dawn/tests/end2end/OpArrayLengthTests.cpp @@ -54,8 +54,8 @@ class OpArrayLengthTest : public DawnTest { // 0. mShaderInterface = R"( struct DataBuffer { - data : array; - }; + data : array + } // The length should be 1 because the buffer is 4-byte long. @group(0) @binding(0) var buffer1 : DataBuffer; @@ -66,14 +66,14 @@ class OpArrayLengthTest : public DawnTest { // The length should be (512 - 16*4) / 8 = 56 because the buffer is 512 bytes long // and the structure is 8 bytes big. struct Buffer3Data { - a : f32; - b : i32; - }; + a : f32, + b : i32, + } struct Buffer3 { - @size(64) garbage : mat4x4; - data : array; - }; + @size(64) garbage : mat4x4, + data : array, + } @group(0) @binding(2) var buffer3 : Buffer3; )"; @@ -125,8 +125,8 @@ TEST_P(OpArrayLengthTest, Compute) { pipelineDesc.compute.entryPoint = "main"; pipelineDesc.compute.module = utils::CreateShaderModule(device, (R"( struct ResultBuffer { - data : array; - }; + data : array + } @group(1) @binding(0) var result : ResultBuffer; )" + mShaderInterface + R"( @stage(compute) @workgroup_size(1) fn main() { @@ -224,9 +224,9 @@ TEST_P(OpArrayLengthTest, Vertex) { // pass pixel. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (mShaderInterface + R"( struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main() -> VertexOut { var output : VertexOut; diff --git a/src/dawn/tests/end2end/PrimitiveStateTests.cpp b/src/dawn/tests/end2end/PrimitiveStateTests.cpp index 16b56d2837..d689c07318 100644 --- a/src/dawn/tests/end2end/PrimitiveStateTests.cpp +++ b/src/dawn/tests/end2end/PrimitiveStateTests.cpp @@ -46,9 +46,9 @@ class DepthClampingTest : public DawnTest { vsModule = utils::CreateShaderModule(device, R"( struct UBO { - color : vec3; - depth : f32; - }; + color : vec3, + depth : f32, + } @group(0) @binding(0) var ubo : UBO; @stage(vertex) fn main() -> @builtin(position) vec4 { @@ -57,9 +57,9 @@ class DepthClampingTest : public DawnTest { fsModule = utils::CreateShaderModule(device, R"( struct UBO { - color : vec3; - depth : f32; - }; + color : vec3, + depth : f32, + } @group(0) @binding(0) var ubo : UBO; @stage(fragment) fn main() -> @location(0) vec4 { diff --git a/src/dawn/tests/end2end/RenderAttachmentTests.cpp b/src/dawn/tests/end2end/RenderAttachmentTests.cpp index 75ea0fca3e..eacc6663ef 100644 --- a/src/dawn/tests/end2end/RenderAttachmentTests.cpp +++ b/src/dawn/tests/end2end/RenderAttachmentTests.cpp @@ -30,11 +30,11 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Output { - @location(0) color0 : vec4; - @location(1) color1 : vec4; - @location(2) color2 : vec4; - @location(3) color3 : vec4; - }; + @location(0) color0 : vec4, + @location(1) color1 : vec4, + @location(2) color2 : vec4, + @location(3) color3 : vec4, + } @stage(fragment) fn main() -> Output { diff --git a/src/dawn/tests/end2end/RenderBundleTests.cpp b/src/dawn/tests/end2end/RenderBundleTests.cpp index 38bf83b8b6..98ccce841d 100644 --- a/src/dawn/tests/end2end/RenderBundleTests.cpp +++ b/src/dawn/tests/end2end/RenderBundleTests.cpp @@ -39,8 +39,8 @@ class RenderBundleTest : public DawnTest { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct Ubo { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var fragmentUniformBuffer : Ubo; @stage(fragment) fn main() -> @location(0) vec4 { diff --git a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp index c5b6099800..86d94ca835 100644 --- a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp +++ b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp @@ -39,20 +39,20 @@ class SamplerFilterAnisotropicTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct Uniforms { - matrix : mat4x4; - }; + matrix : mat4x4 + } struct VertexIn { - @location(0) position : vec4; - @location(1) uv : vec2; - }; + @location(0) position : vec4, + @location(1) uv : vec2, + } @group(0) @binding(2) var uniforms : Uniforms; struct VertexOut { - @location(0) uv : vec2; - @builtin(position) position : vec4; - }; + @location(0) uv : vec2, + @builtin(position) position : vec4, + } @stage(vertex) fn main(input : VertexIn) -> VertexOut { @@ -67,9 +67,9 @@ class SamplerFilterAnisotropicTest : public DawnTest { @group(0) @binding(1) var texture0 : texture_2d; struct FragmentIn { - @location(0) uv: vec2; - @builtin(position) fragCoord : vec4; - }; + @location(0) uv: vec2, + @builtin(position) fragCoord : vec4, + } @stage(fragment) fn main(input : FragmentIn) -> @location(0) vec4 { diff --git a/src/dawn/tests/end2end/ShaderTests.cpp b/src/dawn/tests/end2end/ShaderTests.cpp index 5b7ff57c04..8951d9a8ce 100644 --- a/src/dawn/tests/end2end/ShaderTests.cpp +++ b/src/dawn/tests/end2end/ShaderTests.cpp @@ -51,8 +51,8 @@ TEST_P(ShaderTests, ComputeLog2) { std::string shader = R"( struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; @@ -143,14 +143,14 @@ fn main(@builtin(position) fragCoord : vec4) -> @location(0) vec4 { TEST_P(ShaderTests, WGSLMixedStructParamIO) { std::string vertexShader = R"( struct VertexIn { - @location(0) position : vec3; - @location(1) color : vec4; -}; + @location(0) position : vec3, + @location(1) color : vec4, +} struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; -}; + @location(0) color : vec4, + @builtin(position) position : vec4, +} @stage(vertex) fn main(input : VertexIn) -> VertexOut { @@ -186,14 +186,14 @@ fn main(@location(0) color : vec4) -> @location(0) vec4 { TEST_P(ShaderTests, WGSLStructIO) { std::string vertexShader = R"( struct VertexIn { - @location(0) position : vec3; - @location(1) color : vec4; -}; + @location(0) position : vec3, + @location(1) color : vec4, +} struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; -}; + @location(0) color : vec4, + @builtin(position) position : vec4, +} @stage(vertex) fn main(input : VertexIn) -> VertexOut { @@ -206,9 +206,9 @@ fn main(input : VertexIn) -> VertexOut { std::string fragmentShader = R"( struct FragmentIn { - @location(0) color : vec4; - @builtin(position) fragCoord : vec4; -}; + @location(0) color : vec4, + @builtin(position) fragCoord : vec4, +} @stage(fragment) fn main(input : FragmentIn) -> @location(0) vec4 { @@ -233,14 +233,14 @@ fn main(input : FragmentIn) -> @location(0) vec4 { TEST_P(ShaderTests, WGSLUnsortedStructIO) { std::string vertexShader = R"( struct VertexIn { - @location(0) position : vec3; - @location(1) color : vec4; -}; + @location(0) position : vec3, + @location(1) color : vec4, +} struct VertexOut { - @builtin(position) position : vec4; - @location(0) color : vec4; -}; + @builtin(position) position : vec4, + @location(0) color : vec4, +} @stage(vertex) fn main(input : VertexIn) -> VertexOut { @@ -253,9 +253,9 @@ fn main(input : VertexIn) -> VertexOut { std::string fragmentShader = R"( struct FragmentIn { - @location(0) color : vec4; - @builtin(position) fragCoord : vec4; -}; + @location(0) color : vec4, + @builtin(position) fragCoord : vec4, +} @stage(fragment) fn main(input : FragmentIn) -> @location(0) vec4 { @@ -280,14 +280,14 @@ fn main(input : FragmentIn) -> @location(0) vec4 { TEST_P(ShaderTests, WGSLSharedStructIO) { std::string shader = R"( struct VertexIn { - @location(0) position : vec3; - @location(1) color : vec4; -}; + @location(0) position : vec3, + @location(1) color : vec4, +} struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; -}; + @location(0) color : vec4, + @builtin(position) position : vec4, +} @stage(vertex) fn vertexMain(input : VertexIn) -> VertexOut { @@ -329,13 +329,13 @@ TEST_P(ShaderTests, FirstIndexOffsetRegisterConflictInHLSLTransforms) { // Dumped WGSL: struct Inputs { - @location(1) attrib1 : u32; + @location(1) attrib1 : u32, // The extra register added to handle base_vertex for vertex_index conflicts with [1] - @builtin(vertex_index) vertexIndex: u32; -}; + @builtin(vertex_index) vertexIndex: u32, +} // [1] a binding point that conflicts with the regitster -struct S1 { data : array, 20>; }; +struct S1 { data : array, 20> } @group(0) @binding(1) var providedData1 : S1; @stage(vertex) fn vsMain(input : Inputs) -> @builtin(position) vec4 { @@ -413,8 +413,8 @@ override c9: u32 = 0u; // default override override c10: u32 = 10u; // default struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; @@ -483,8 +483,8 @@ TEST_P(ShaderTests, OverridableConstantsNumericIdentifiers) { @id(1004) override c4: u32; // default unspecified struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; @@ -540,8 +540,8 @@ TEST_P(ShaderTests, OverridableConstantsPrecision) { @id(1002) override c2: f32; struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; @@ -594,8 +594,8 @@ TEST_P(ShaderTests, OverridableConstantsMultipleEntryPoints) { @id(1002) override c2: u32; struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; diff --git a/src/dawn/tests/end2end/SwapChainValidationTests.cpp b/src/dawn/tests/end2end/SwapChainValidationTests.cpp index d3449d9dfc..3af4c889fc 100644 --- a/src/dawn/tests/end2end/SwapChainValidationTests.cpp +++ b/src/dawn/tests/end2end/SwapChainValidationTests.cpp @@ -228,9 +228,9 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) { })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( struct FragmentOut { - @location(0) target0 : vec4; - @location(1) target1 : f32; - }; + @location(0) target0 : vec4, + @location(1) target1 : f32, + } @stage(fragment) fn main() -> FragmentOut { var out : FragmentOut; out.target0 = vec4(0.0, 1.0, 0.0, 1.0); diff --git a/src/dawn/tests/end2end/TextureFormatTests.cpp b/src/dawn/tests/end2end/TextureFormatTests.cpp index 7f3370d439..6f2299b2fe 100644 --- a/src/dawn/tests/end2end/TextureFormatTests.cpp +++ b/src/dawn/tests/end2end/TextureFormatTests.cpp @@ -159,8 +159,8 @@ class TextureFormatTest : public DawnTest { std::ostringstream fsSource; fsSource << "@group(0) @binding(0) var myTexture : texture_2d<" << type << ">;\n"; fsSource << "struct FragmentOut {\n"; - fsSource << " @location(0) color : vec4<" << type << ">;\n"; - fsSource << R"(}; + fsSource << " @location(0) color : vec4<" << type << ">\n"; + fsSource << R"(} @stage(fragment) fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; diff --git a/src/dawn/tests/end2end/TextureViewTests.cpp b/src/dawn/tests/end2end/TextureViewTests.cpp index dc20399b97..9c2a868bf3 100644 --- a/src/dawn/tests/end2end/TextureViewTests.cpp +++ b/src/dawn/tests/end2end/TextureViewTests.cpp @@ -62,9 +62,9 @@ namespace { wgpu::ShaderModule CreateDefaultVertexShaderModule(wgpu::Device device) { return utils::CreateShaderModule(device, R"( struct VertexOut { - @location(0) texCoord : vec2; - @builtin(position) position : vec4; - }; + @location(0) texCoord : vec2, + @builtin(position) position : vec4, + } @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { diff --git a/src/dawn/tests/end2end/TextureZeroInitTests.cpp b/src/dawn/tests/end2end/TextureZeroInitTests.cpp index 16aaa1d4ae..ed473cd34e 100644 --- a/src/dawn/tests/end2end/TextureZeroInitTests.cpp +++ b/src/dawn/tests/end2end/TextureZeroInitTests.cpp @@ -102,8 +102,8 @@ class TextureZeroInitTest : public DawnTest { return utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture0 : texture_2d; struct FragmentOut { - @location(0) color : vec4; - }; + @location(0) color : vec4 + } @stage(fragment) fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; @@ -981,8 +981,8 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) { const char* cs = R"( @group(0) @binding(0) var tex : texture_2d; struct Result { - value : vec4; - }; + value : vec4 + } @group(0) @binding(1) var result : Result; @stage(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 e6a665d37c..07c3763fda 100644 --- a/src/dawn/tests/end2end/VertexFormatTests.cpp +++ b/src/dawn/tests/end2end/VertexFormatTests.cpp @@ -236,9 +236,9 @@ class VertexFormatTest : public DawnTest { std::ostringstream vs; vs << "struct VertexIn {\n"; - vs << " @location(0) test : " << variableType << ";\n"; - vs << " @builtin(vertex_index) VertexIndex : u32;\n"; - vs << "};\n"; + vs << " @location(0) test : " << variableType << ",\n"; + vs << " @builtin(vertex_index) VertexIndex : u32,\n"; + vs << "}\n"; // Because x86 CPU using "extended // precision"(https://en.wikipedia.org/wiki/Extended_precision) during float @@ -270,9 +270,9 @@ class VertexFormatTest : public DawnTest { } struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(input : VertexIn) -> VertexOut { diff --git a/src/dawn/tests/end2end/VertexStateTests.cpp b/src/dawn/tests/end2end/VertexStateTests.cpp index d33315ea6f..874c7148a0 100644 --- a/src/dawn/tests/end2end/VertexStateTests.cpp +++ b/src/dawn/tests/end2end/VertexStateTests.cpp @@ -77,18 +77,18 @@ class VertexStateTest : public DawnTest { // @location(1) input1 : vec4; for (const auto& input : testSpec) { vs << "@location(" << input.location << ") input" << input.location - << " : vec4;\n"; + << " : vec4,\n"; } vs << R"( - @builtin(vertex_index) VertexIndex : u32; - @builtin(instance_index) InstanceIndex : u32; - }; + @builtin(vertex_index) VertexIndex : u32, + @builtin(instance_index) InstanceIndex : u32, + } struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(input : VertexIn) -> VertexOut { var output : VertexOut; @@ -586,16 +586,16 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( struct VertexIn { - @location(0) attr0 : vec4; - @location(1) attr1 : vec2; - @location(2) attr2 : vec4; - @location(3) attr3 : f32; - }; + @location(0) attr0 : vec4, + @location(1) attr1 : vec2, + @location(2) attr2 : vec4, + @location(3) attr3 : f32, + } struct VertexOut { - @location(0) color : vec4; - @builtin(position) position : vec4; - }; + @location(0) color : vec4, + @builtin(position) position : vec4, + } @stage(vertex) fn main(input : VertexIn) -> VertexOut { var output : VertexOut; diff --git a/src/dawn/tests/end2end/VideoViewsTests.cpp b/src/dawn/tests/end2end/VideoViewsTests.cpp index febfb5006f..a037f0ac9f 100644 --- a/src/dawn/tests/end2end/VideoViewsTests.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests.cpp @@ -173,9 +173,9 @@ std::vector VideoViewsTests::GetTestTextureDataWithPlaneIndex(size_t pl wgpu::ShaderModule VideoViewsTests::GetTestVertexShaderModule() const { return utils::CreateShaderModule(device, R"( struct VertexOut { - @location(0) texCoord : vec2 ; - @builtin(position) position : vec4; - }; + @location(0) texCoord : vec2 , + @builtin(position) position : vec4, + } @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { diff --git a/src/dawn/tests/perf_tests/DrawCallPerf.cpp b/src/dawn/tests/perf_tests/DrawCallPerf.cpp index 1adbe5ca1e..692c167d59 100644 --- a/src/dawn/tests/perf_tests/DrawCallPerf.cpp +++ b/src/dawn/tests/perf_tests/DrawCallPerf.cpp @@ -40,8 +40,8 @@ namespace { constexpr char kFragmentShaderA[] = R"( struct Uniforms { - color : vec3; - }; + color : vec3 + } @group(0) @binding(0) var uniforms : Uniforms; @stage(fragment) fn main() -> @location(0) vec4 { return vec4(uniforms.color * (1.0 / 5000.0), 1.0); @@ -49,11 +49,11 @@ namespace { constexpr char kFragmentShaderB[] = R"( struct Constants { - color : vec3; - }; + color : vec3 + } struct Uniforms { - color : vec3; - }; + color : vec3 + } @group(0) @binding(0) var constants : Constants; @group(1) @binding(0) var uniforms : Uniforms; diff --git a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp index 0a541ccea7..07896ad95e 100644 --- a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp +++ b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp @@ -21,13 +21,13 @@ namespace { const std::string& kMatMulFloatHeader = R"( struct Uniforms { - dimAOuter : u32; - dimInner : u32; - dimBOuter : u32; - }; + dimAOuter : u32, + dimInner : u32, + dimBOuter : u32, + } struct Matrix { - numbers: array; - }; + numbers: array + } @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; @@ -188,13 +188,13 @@ namespace { // The vec4 version requires that dimInner and dimBOuter are divisible by 4. const std::string& kMatMulVec4Header = R"( struct Uniforms { - dimAOuter : u32; - dimInner : u32; - dimBOuter : u32; - }; + dimAOuter : u32, + dimInner : u32, + dimBOuter : u32, + } struct Matrix { - numbers: array>; - }; + numbers: array> + } @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; diff --git a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp index 87a2c3c763..ef60ba4b60 100644 --- a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1448,8 +1448,8 @@ class SetBindGroupValidationTest : public ValidationTest { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct S { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var uBufferDynamic : S; @group(0) @binding(1) var uBuffer : S; @@ -1472,8 +1472,8 @@ class SetBindGroupValidationTest : public ValidationTest { wgpu::ComputePipeline CreateComputePipeline() { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct S { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var uBufferDynamic : S; @group(0) @binding(1) var uBuffer : S; @@ -1899,7 +1899,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest { device.CreatePipelineLayout(&pipelineLayoutDescriptor); std::stringstream ss; - ss << "struct S { value : vec2; };"; + ss << "struct S { value : vec2 }"; // Build a shader which has bindings that match the pipeline layout. for (uint32_t l = 0; l < layouts.size(); ++l) { @@ -2074,8 +2074,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { wgpu::RenderPipeline CreateRenderPipeline(std::vector bindGroupLayouts) { return CreateFSRenderPipeline(R"( struct S { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; @@ -2109,8 +2109,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { std::vector bindGroupLayouts) { return CreateComputePipeline(R"( struct S { - value : vec2; - }; + value : vec2 + } @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; diff --git a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index 68283638dd..b976ed18f6 100644 --- a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -47,8 +47,8 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; @@ -60,13 +60,13 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct S2 { - pos : vec4; - }; + pos : vec4 + } @group(2) @binding(0) var uniform2 : S2; struct S3 { - pos : mat4x4; - }; + pos : mat4x4 + } @group(3) @binding(0) var storage3 : S3; @stage(fragment) fn main() { @@ -99,8 +99,8 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { TEST_F(GetBindGroupLayoutTests, DefaultBindGroupLayoutPipelineCompatibility) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -121,8 +121,8 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -291,8 +291,8 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(compute) @workgroup_size(1) fn main() { @@ -344,8 +344,8 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { binding.buffer.type = wgpu::BufferBindingType::Storage; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var ssbo : S; @stage(fragment) fn main() { @@ -358,8 +358,8 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { binding.buffer.type = wgpu::BufferBindingType::Uniform; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -373,8 +373,8 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { binding.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var ssbo : S; @stage(fragment) fn main() { @@ -613,8 +613,8 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { binding.binding = 0; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -628,8 +628,8 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { binding.binding = 1; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(1) var uniforms : S; @stage(fragment) fn main() { @@ -643,8 +643,8 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { binding.binding = 2; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(1) var uniforms : S; @stage(fragment) fn main() { @@ -659,8 +659,8 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; @@ -672,8 +672,8 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(1) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -698,8 +698,8 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { wgpu::ShaderModule vsModule4 = utils::CreateShaderModule(device, R"( struct S { - pos : f32; - }; + pos : f32 + } @group(0) @binding(0) var uniforms : S; @stage(vertex) fn main() -> @builtin(position) vec4 { @@ -709,8 +709,8 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"( struct S { - pos : mat4x4; - }; + pos : mat4x4 + } @group(0) @binding(0) var uniforms : S; @stage(vertex) fn main() -> @builtin(position) vec4 { @@ -720,8 +720,8 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"( struct S { - pos : f32; - }; + pos : f32 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -730,8 +730,8 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { wgpu::ShaderModule fsModule64 = utils::CreateShaderModule(device, R"( struct S { - pos : mat4x4; - }; + pos : mat4x4 + } @group(0) @binding(0) var uniforms : S; @stage(fragment) fn main() { @@ -865,8 +865,8 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var ubo : S; @stage(vertex) fn main() -> @builtin(position) vec4 { @@ -876,8 +876,8 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var ssbo : S; @stage(fragment) fn main() { @@ -989,8 +989,8 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms0 : S; @group(2) @binding(0) var uniforms2 : S; @@ -1042,8 +1042,8 @@ TEST_F(GetBindGroupLayoutTests, Reflection) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( struct S { - pos : vec4; - }; + pos : vec4 + } @group(0) @binding(0) var uniforms : S; @stage(vertex) fn main() -> @builtin(position) vec4 { @@ -1083,8 +1083,8 @@ TEST_F(GetBindGroupLayoutTests, Reflection) { TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Data { - data : f32; - }; + data : f32 + } @group(0) @binding(0) var data0 : Data; @group(0) @binding(1) var data1 : Data; diff --git a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index e851f4ee4f..cb7044e456 100644 --- a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -73,7 +73,7 @@ namespace { std::ostringstream ostream; size_t index = 0; for (const BindingDescriptor& b : bindings) { - ostream << "struct S" << index << " { " << b.decl << "};\n"; + ostream << "struct S" << index << " { " << b.decl << "}\n"; ostream << "@group(" << b.group << ") @binding(" << b.binding << ") "; switch (b.type) { case wgpu::BufferBindingType::Uniform: @@ -110,7 +110,7 @@ namespace { } // Used for adding custom types available throughout the tests - static const std::string kStructs = "struct ThreeFloats {f1 : f32; f2 : f32; f3 : f32;};\n"; + static const std::string kStructs = "struct ThreeFloats {f1 : f32, f2 : f32, f3 : f32,}\n"; // Creates a compute shader with given bindings std::string CreateComputeShaderWithBindings(const std::vector& bindings) { @@ -323,8 +323,8 @@ class MinBufferSizePipelineCreationTests : public MinBufferSizeTestsBase {}; // Pipeline can be created if minimum buffer size in layout is specified as 0 TEST_F(MinBufferSizePipelineCreationTests, ZeroMinBufferSize) { - std::vector bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; std::string computeShader = CreateComputeShaderWithBindings(bindings); std::string vertexShader = CreateVertexShaderWithBindings({}); @@ -337,8 +337,8 @@ TEST_F(MinBufferSizePipelineCreationTests, ZeroMinBufferSize) { // Fail if layout given has non-zero minimum sizes smaller than shader requirements TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmall) { - std::vector bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; std::string computeShader = CreateComputeShaderWithBindings(bindings); std::string vertexShader = CreateVertexShaderWithBindings({}); @@ -358,11 +358,11 @@ TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmall) { // Fail if layout given has non-zero minimum sizes smaller than shader requirements TEST_F(MinBufferSizePipelineCreationTests, LayoutSizesTooSmallMultipleGroups) { - std::vector bg0Bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bg0Bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; std::vector bg1Bindings = { - {1, 0, "d : f32; e : f32; f : f32;", "f32", "e", 12}, - {1, 1, "g : mat2x2;", "mat2x2", "g", 16}}; + {1, 0, "d : f32, e : f32, f : f32,", "f32", "e", 12}, + {1, 1, "g : mat2x2,", "mat2x2", "g", 16}}; std::vector bindings = CombineBindings({bg0Bindings, bg1Bindings}); std::string computeShader = CreateComputeShaderWithBindings(bindings); @@ -387,8 +387,8 @@ class MinBufferSizeBindGroupCreationTests : public MinBufferSizeTestsBase {}; // Fail if a binding is smaller than minimum buffer size TEST_F(MinBufferSizeBindGroupCreationTests, BindingTooSmall) { - std::vector bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; wgpu::BindGroupLayout layout = CreateBindGroupLayout(bindings, {8, 4}); CheckSizeBounds({8, 4}, [&](const std::vector& sizes, bool expectation) { @@ -421,8 +421,8 @@ class MinBufferSizeDrawTimeValidationTests : public MinBufferSizeTestsBase {}; // Fail if binding sizes are too small at draw time TEST_F(MinBufferSizeDrawTimeValidationTests, ZeroMinSizeAndTooSmallBinding) { - std::vector bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; std::string computeShader = CreateComputeShaderWithBindings(bindings); std::string vertexShader = CreateVertexShaderWithBindings({}); @@ -443,9 +443,9 @@ TEST_F(MinBufferSizeDrawTimeValidationTests, ZeroMinSizeAndTooSmallBinding) { // Draw time validation works for non-contiguous bindings TEST_F(MinBufferSizeDrawTimeValidationTests, UnorderedBindings) { std::vector bindings = { - {0, 2, "a : f32; b : f32;", "f32", "a", 8}, - {0, 0, "c : f32;", "f32", "c", 4}, - {0, 4, "d : f32; e : f32; f : f32;", "f32", "e", 12}}; + {0, 2, "a : f32, b : f32,", "f32", "a", 8}, + {0, 0, "c : f32,", "f32", "c", 4}, + {0, 4, "d : f32, e : f32, f : f32,", "f32", "e", 12}}; std::string computeShader = CreateComputeShaderWithBindings(bindings); std::string vertexShader = CreateVertexShaderWithBindings({}); @@ -465,11 +465,11 @@ TEST_F(MinBufferSizeDrawTimeValidationTests, UnorderedBindings) { // Draw time validation works for multiple bind groups TEST_F(MinBufferSizeDrawTimeValidationTests, MultipleGroups) { - std::vector bg0Bindings = {{0, 0, "a : f32; b : f32;", "f32", "a", 8}, - {0, 1, "c : f32;", "f32", "c", 4}}; + std::vector bg0Bindings = {{0, 0, "a : f32, b : f32,", "f32", "a", 8}, + {0, 1, "c : f32,", "f32", "c", 4}}; std::vector bg1Bindings = { - {1, 0, "d : f32; e : f32; f : f32;", "f32", "e", 12}, - {1, 1, "g : mat2x2;", "mat2x2", "g", 16}}; + {1, 0, "d : f32, e : f32, f : f32,", "f32", "e", 12}, + {1, 1, "g : mat2x2,", "mat2x2", "g", 16}}; std::vector bindings = CombineBindings({bg0Bindings, bg1Bindings}); std::string computeShader = CreateComputeShaderWithBindings(bindings); @@ -537,52 +537,52 @@ class MinBufferSizeDefaultLayoutTests : public MinBufferSizeTestsBase { // Test the minimum size computations for various WGSL types. TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousWGSLTypes) { - CheckShaderBindingSizeReflection({{{0, 0, "a : f32;", "f32", "a", 4}, - {0, 1, "b : array;", "f32", "b[0]", 4}, - {0, 2, "c : mat2x2;", "mat2x2", "c", 16}}}); - CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array;", "u32", "d", 8}, - {0, 4, "f : ThreeFloats;", "f32", "f.f1", 12}, - {0, 5, "g : array;", "f32", "g[0].f1", 12}}}); + CheckShaderBindingSizeReflection({{{0, 0, "a : f32,", "f32", "a", 4}, + {0, 1, "b : array,", "f32", "b[0]", 4}, + {0, 2, "c : mat2x2,", "mat2x2", "c", 16}}}); + CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array,", "u32", "d", 8}, + {0, 4, "f : ThreeFloats,", "f32", "f.f1", 12}, + {0, 5, "g : array,", "f32", "g[0].f1", 12}}}); } // Test the minimum size computations for various buffer binding types. TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousBindingTypes) { CheckShaderBindingSizeReflection( - {{{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform}, - {0, 1, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Storage}, - {0, 2, "a : f32; b : f32; c: f32;", "f32", "a", 12, + {{{0, 0, "a : f32,", "f32", "a", 4, wgpu::BufferBindingType::Uniform}, + {0, 1, "a : f32, b : f32,", "f32", "a", 8, wgpu::BufferBindingType::Storage}, + {0, 2, "a : f32, b : f32, c: f32,", "f32", "a", 12, wgpu::BufferBindingType::ReadOnlyStorage}}}); } // Test the minimum size computations works with multiple bind groups. TEST_F(MinBufferSizeDefaultLayoutTests, MultipleBindGroups) { CheckShaderBindingSizeReflection( - {{{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform}}, - {{1, 0, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Storage}}, - {{2, 0, "a : f32; b : f32; c : f32;", "f32", "a", 12, + {{{0, 0, "a : f32,", "f32", "a", 4, wgpu::BufferBindingType::Uniform}}, + {{1, 0, "a : f32, b : f32,", "f32", "a", 8, wgpu::BufferBindingType::Storage}}, + {{2, 0, "a : f32, b : f32, c : f32,", "f32", "a", 12, wgpu::BufferBindingType::ReadOnlyStorage}}}); } // Test the minimum size computations with manual size/align attributes. TEST_F(MinBufferSizeDefaultLayoutTests, NonDefaultLayout) { CheckShaderBindingSizeReflection( - {{{0, 0, "@size(256) a : u32; b : u32;", "u32", "a", 260}, - {0, 1, "c : u32; @align(16) d : u32;", "u32", "c", 20}, - {0, 2, "d : array, 3>;", "u32", "d[0][0]", 120}, - {0, 3, "e : array>;", "u32", "e[0][0]", 40}}}); + {{{0, 0, "@size(256) a : u32, b : u32,", "u32", "a", 260}, + {0, 1, "c : u32, @align(16) d : u32,", "u32", "c", 20}, + {0, 2, "d : array, 3>,", "u32", "d[0][0]", 120}, + {0, 3, "e : array>,", "u32", "e[0][0]", 40}}}); } // Minimum size should be the max requirement of both vertex and fragment stages. TEST_F(MinBufferSizeDefaultLayoutTests, RenderPassConsidersBothStages) { std::string vertexShader = CreateVertexShaderWithBindings( - {{0, 0, "a : f32; b : f32;", "f32", "a", 8, wgpu::BufferBindingType::Uniform, + {{0, 0, "a : f32, b : f32,", "f32", "a", 8, wgpu::BufferBindingType::Uniform, wgpu::ShaderStage::Vertex}, - {0, 1, "c : vec4;", "vec4", "c", 16, wgpu::BufferBindingType::Uniform, + {0, 1, "c : vec4,", "vec4", "c", 16, wgpu::BufferBindingType::Uniform, wgpu::ShaderStage::Vertex}}); std::string fragShader = CreateFragmentShaderWithBindings( - {{0, 0, "a : f32;", "f32", "a", 4, wgpu::BufferBindingType::Uniform, + {{0, 0, "a : f32,", "f32", "a", 4, wgpu::BufferBindingType::Uniform, wgpu::ShaderStage::Fragment}, - {0, 1, "b : f32; c : f32;", "f32", "b", 8, wgpu::BufferBindingType::Uniform, + {0, 1, "b : f32, c : f32,", "f32", "b", 8, wgpu::BufferBindingType::Uniform, wgpu::ShaderStage::Fragment}}); wgpu::BindGroupLayout renderLayout = GetBGLFromRenderShaders(vertexShader, fragShader, 0); diff --git a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp index 6256e597ef..208bcb0399 100644 --- a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -29,8 +29,8 @@ namespace { vsModule = utils::CreateShaderModule(device, R"( struct S { - transform : mat2x2; - }; + transform : mat2x2 + } @group(0) @binding(0) var uniforms : S; @stage(vertex) fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { @@ -39,13 +39,13 @@ namespace { fsModule = utils::CreateShaderModule(device, R"( struct Uniforms { - color : vec4; - }; + color : vec4 + } @group(1) @binding(0) var uniforms : Uniforms; struct Storage { - dummy : array; - }; + dummy : array + } @group(1) @binding(1) var ssbo : Storage; @stage(fragment) fn main() { diff --git a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp index 9d279bfa72..8eddecccf8 100644 --- a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -856,8 +856,8 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) { TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) { wgpu::ShaderModule vsModuleWithStorageBuffer = utils::CreateShaderModule(device, R"( struct Dst { - data : array; - }; + data : array + } @group(0) @binding(0) var dst : Dst; @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { dst.data[VertexIndex] = 0x1234u; @@ -1105,9 +1105,9 @@ TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { wgpu::ShaderModule fsModuleWriteBoth = utils::CreateShaderModule(device, R"( struct FragmentOut { - @location(0) target0 : vec4; - @location(1) target1 : vec4; - }; + @location(0) target0 : vec4, + @location(1) target1 : vec4, + } @stage(fragment) fn main() -> FragmentOut { var out : FragmentOut; return out; @@ -1215,8 +1215,8 @@ TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { TEST_F(RenderPipelineValidationTest, BindingsFromCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Uniforms { - data : vec4; - }; + data : vec4 + } @group(0) @binding(0) var var0 : Uniforms; @group(0) @binding(1) var var1 : Uniforms; @@ -1314,9 +1314,9 @@ class InterStageVariableMatchingValidationTest : public RenderPipelineValidation TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocation) { wgpu::ShaderModule vertexModuleOutputAtLocation0 = utils::CreateShaderModule(device, R"( struct A { - @location(0) vout: f32; - @builtin(position) pos: vec4; - }; + @location(0) vout: f32, + @builtin(position) pos: vec4, + } @stage(vertex) fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); @@ -1324,23 +1324,23 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio })"); wgpu::ShaderModule fragmentModuleAtLocation0 = utils::CreateShaderModule(device, R"( struct B { - @location(0) fin: f32; - }; + @location(0) fin: f32 + } @stage(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; - }; + @location(1) vout: f32 + } @stage(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"( struct B { - @location(1) fin: f32; - @builtin(position) pos: vec4; - }; + @location(1) fin: f32, + @builtin(position) pos: vec4, + } @stage(vertex) fn main() -> B { var fragmentIn: B; fragmentIn.pos = vec4(0.0, 0.0, 0.0, 1.0); @@ -1376,15 +1376,15 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { std::string interfaceDeclaration; { std::ostringstream sstream; - sstream << "struct A { @location(0) @interpolate(flat) a: " << kTypes[i] << ";" + sstream << "struct A { @location(0) @interpolate(flat) a: " << kTypes[i] << "," << std::endl; interfaceDeclaration = sstream.str(); } { std::ostringstream vertexStream; vertexStream << interfaceDeclaration << R"( - @builtin(position) pos: vec4; - }; + @builtin(position) pos: vec4, + } @stage(vertex) fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); @@ -1395,7 +1395,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { { std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( - }; + } @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"; @@ -1475,14 +1475,14 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute } sstream << ")"; } - sstream << " a : vec4;" << std::endl; + sstream << " a : vec4," << std::endl; interfaceDeclaration = sstream.str(); } { std::ostringstream vertexStream; vertexStream << interfaceDeclaration << R"( - @builtin(position) pos: vec4; - }; + @builtin(position) pos: vec4, + } @stage(vertex) fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); @@ -1493,7 +1493,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute { std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( - }; + } @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { return fragmentIn.a; })"; diff --git a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 1f78492a12..b19e42364e 100644 --- a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -762,8 +762,8 @@ namespace { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( struct RBuffer { - value : f32; - }; + value : f32 + } @group(0) @binding(0) var rBuffer : RBuffer; @stage(fragment) fn main() { })"); diff --git a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp index 7f6f7927a6..2cf4497fc0 100644 --- a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -538,8 +538,8 @@ TEST_F(ShaderModuleValidationTest, OverridableConstantsNumericIDConflicts) { @id(1234) override c1: u32; struct Buf { - data : array; -}; + data : array +} @group(0) @binding(0) var buf : Buf; diff --git a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp index 59da06c9ba..05baa9d9f6 100644 --- a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp @@ -54,8 +54,8 @@ class D3D12DescriptorHeapTests : public DawnTest { mSimpleFSModule = utils::CreateShaderModule(device, R"( struct U { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var colorBuffer : U; @stage(fragment) fn main() -> @location(0) vec4 { @@ -445,8 +445,8 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) { pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( struct U { - heapSize : f32; - }; + heapSize : f32 + } @group(0) @binding(0) var buffer0 : U; @stage(fragment) fn main() -> @location(0) vec4 { @@ -778,8 +778,8 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( struct U { - transform : mat2x2; - }; + transform : mat2x2 + } @group(0) @binding(0) var buffer0 : U; @stage(vertex) fn main( @@ -794,8 +794,8 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { })"); pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( struct U { - color : vec4; - }; + color : vec4 + } @group(0) @binding(1) var sampler0 : sampler; @group(0) @binding(2) var texture0 : texture_2d; @group(0) @binding(3) var buffer0 : U; diff --git a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp index 8c454f2c32..d6008bde88 100644 --- a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp +++ b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp @@ -354,8 +354,8 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) { renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( struct U { - color : vec4; - }; + color : vec4 + } @group(0) @binding(0) var colorBuffer : U; @stage(fragment) fn main() -> @location(0) vec4 { diff --git a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp index c19ab5d156..259961407f 100644 --- a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp +++ b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp @@ -32,8 +32,8 @@ class InternalStorageBufferBindingTests : public DawnTest { wgpu::ComputePipeline CreateComputePipelineWithInternalStorage() { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( struct Buf { - data : array; - }; + data : array + } @group(0) @binding(0) var buf : Buf;