From 7e80cce1a9065d60522d470d24526394d642e6d5 Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 10 Feb 2021 20:17:14 +0000 Subject: [PATCH] Remove explicit storage class from samplers/textures Tint automatically infers a storage class of `handle` for these types of variable, as per the WGSL spec. Explicitly specifying a storage class for them will soon become an error. Bug: tint:332 Change-Id: Ib67e44a5afcdd364470488fd4b456a2b42304daa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41402 Commit-Queue: Austin Eng Auto-Submit: James Price Reviewed-by: Austin Eng --- examples/CppHelloTriangle.cpp | 4 +- .../CopyTextureForBrowserHelper.cpp | 4 +- src/tests/end2end/BindGroupTests.cpp | 11 +++-- .../end2end/CompressedTextureFormatTests.cpp | 4 +- src/tests/end2end/D3D12VideoViewsTests.cpp | 14 +++---- src/tests/end2end/DepthStencilCopyTests.cpp | 2 +- .../end2end/DepthStencilSamplingTests.cpp | 20 ++++------ .../end2end/GpuMemorySynchronizationTests.cpp | 4 +- src/tests/end2end/IOSurfaceWrappingTests.cpp | 4 +- .../end2end/MultisampledSamplingTests.cpp | 4 +- .../end2end/SamplerFilterAnisotropicTests.cpp | 4 +- src/tests/end2end/SamplerTests.cpp | 4 +- src/tests/end2end/StorageTextureTests.cpp | 18 ++++----- src/tests/end2end/TextureFormatTests.cpp | 3 +- src/tests/end2end/TextureSubresourceTests.cpp | 4 +- .../perf_tests/SubresourceTrackingPerf.cpp | 2 +- .../validation/BindGroupValidationTests.cpp | 16 ++++---- .../GetBindGroupLayoutValidationTests.cpp | 40 +++++++++---------- .../RenderPipelineValidationTests.cpp | 4 +- .../validation/ResourceUsageTrackingTests.cpp | 4 +- .../StorageTextureValidationTests.cpp | 20 +++++----- 21 files changed, 92 insertions(+), 98 deletions(-) diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index bc1df72324..510f181ef7 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -104,8 +104,8 @@ void init() { wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( [[builtin(frag_coord)]] var FragCoord : vec4; - [[group(0), binding(0)]] var mySampler: sampler; - [[group(0), binding(1)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(1)]] var myTexture : texture_2d; [[location(0)]] var FragColor : vec4; [[stage(fragment)]] fn main() -> void { diff --git a/src/dawn_native/CopyTextureForBrowserHelper.cpp b/src/dawn_native/CopyTextureForBrowserHelper.cpp index 9df133c761..cd1fac673d 100644 --- a/src/dawn_native/CopyTextureForBrowserHelper.cpp +++ b/src/dawn_native/CopyTextureForBrowserHelper.cpp @@ -57,8 +57,8 @@ namespace dawn_native { )"; static const char sPassthrough2D4ChannelFrag[] = R"( - [[binding(1), group(0)]] var mySampler: sampler; - [[binding(2), group(0)]] var myTexture: texture_2d; + [[binding(1), group(0)]] var mySampler: sampler; + [[binding(2), group(0)]] var myTexture: texture_2d; [[location(0)]] var v_texcoord : vec2; [[location(0)]] var rgbaColor : vec4; [[stage(fragment)]] fn main() -> void { diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index 6136d20e45..2f5f3942b3 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -268,8 +268,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(1)]] var samp : sampler; - [[group(0), binding(2)]] var tex : texture_2d; + [[group(0), binding(1)]] var samp : sampler; + [[group(0), binding(2)]] var tex : texture_2d; [[builtin(frag_coord)]] var FragCoord : vec4; [[location(0)]] var fragColor : vec4; @@ -1218,12 +1218,12 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()}); interface << "[[group(0), binding(" << binding++ << ")]] " - << "var tex" << i << " : texture_2d;\n"; + << "var tex" << i << " : texture_2d;\n"; bgEntries.push_back({binding, nullptr, 0, 0, device.CreateSampler(), nullptr}); interface << "[[group(0), binding(" << binding++ << ")]]" - << "var samp" << i << " : sampler;\n"; + << "var samp" << i << " : sampler;\n"; body << "if (abs(textureSampleLevel(tex" << i << ", samp" << i << ", vec2(0.5, 0.5), 0.0).r - " << expectedValue++ @@ -1237,8 +1237,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()}); interface << "[[group(0), binding(" << binding++ << ")]] " - << "var image" << i - << " : [[access(read)]] texture_storage_2d;\n"; + << "var image" << i << " : [[access(read)]] texture_storage_2d;\n"; body << "if (textureLoad(image" << i << ", vec2(0, 0)).r != " << expectedValue++ << "u) {\n"; diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp index a9eb06f1c0..3e1ff37867 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp @@ -156,8 +156,8 @@ class CompressedTextureBCFormatTest : public DawnTest { return; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var sampler0 : sampler; - [[group(0), binding(1)]] var texture0 : texture_2d; + [[group(0), binding(0)]] var sampler0 : sampler; + [[group(0), binding(1)]] var texture0 : texture_2d; [[location(0)]] var texCoord : vec2; [[location(0)]] var fragColor : vec4; diff --git a/src/tests/end2end/D3D12VideoViewsTests.cpp b/src/tests/end2end/D3D12VideoViewsTests.cpp index 3ba3519561..a3f6551e81 100644 --- a/src/tests/end2end/D3D12VideoViewsTests.cpp +++ b/src/tests/end2end/D3D12VideoViewsTests.cpp @@ -270,8 +270,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) { renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule(); renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var sampler0 : sampler; - [[set(0), binding(1)]] var texture : texture_2d; + [[set(0), binding(0)]] var sampler0 : sampler; + [[set(0), binding(1)]] var texture : texture_2d; [[location(0)]] var texCoord : vec2; [[location(0)]] var fragColor : vec4; @@ -321,8 +321,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) { renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule(); renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var sampler0 : sampler; - [[set(0), binding(1)]] var texture : texture_2d; + [[set(0), binding(0)]] var sampler0 : sampler; + [[set(0), binding(1)]] var texture : texture_2d; [[location(0)]] var texCoord : vec2; [[location(0)]] var fragColor : vec4; @@ -377,9 +377,9 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) { renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule(); renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"( - [[set(0), binding(0)]] var sampler0 : sampler; - [[set(0), binding(1)]] var lumaTexture : texture_2d; - [[set(0), binding(2)]] var chromaTexture : texture_2d; + [[set(0), binding(0)]] var sampler0 : sampler; + [[set(0), binding(1)]] var lumaTexture : texture_2d; + [[set(0), binding(2)]] var chromaTexture : texture_2d; [[location(0)]] var texCoord : vec2; [[location(0)]] var fragColor : vec4; diff --git a/src/tests/end2end/DepthStencilCopyTests.cpp b/src/tests/end2end/DepthStencilCopyTests.cpp index 2fd7258289..e616423362 100644 --- a/src/tests/end2end/DepthStencilCopyTests.cpp +++ b/src/tests/end2end/DepthStencilCopyTests.cpp @@ -253,7 +253,7 @@ class DepthStencilCopyTests : public DawnTest { // Sample the input texture and write out depth. |result| will only be set to 1 if we // pass the depth test. pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var texture0 : texture_2d; + [[group(0), binding(0)]] var texture0 : texture_2d; [[builtin(frag_coord)]] var FragCoord : vec4; [[location(0)]] var result : u32; diff --git a/src/tests/end2end/DepthStencilSamplingTests.cpp b/src/tests/end2end/DepthStencilSamplingTests.cpp index 54ed2c80e5..d52c5cbbca 100644 --- a/src/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/tests/end2end/DepthStencilSamplingTests.cpp @@ -80,8 +80,7 @@ class DepthStencilSamplingTest : public DawnTest { for (TestAspect aspect : aspects) { switch (aspect) { case TestAspect::Depth: - shaderSource << "[[group(0), binding(" << index - << ")]] var tex" << index + shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index << " : texture_2d;\n"; shaderSource << "[[location(" << index << ")]] var result" << index @@ -92,8 +91,7 @@ class DepthStencilSamplingTest : public DawnTest { pipelineDescriptor.cColorStates[index].format = wgpu::TextureFormat::R32Float; break; case TestAspect::Stencil: - shaderSource << "[[group(0), binding(" << index - << ")]] var tex" << index + shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index << " : texture_2d;\n"; shaderSource << "[[location(" << index << ")]] var result" << index @@ -137,8 +135,7 @@ class DepthStencilSamplingTest : public DawnTest { for (TestAspect aspect : aspects) { switch (aspect) { case TestAspect::Depth: - shaderSource << "[[group(0), binding(" << 2 * index - << ")]] var tex" << index + shaderSource << "[[group(0), binding(" << 2 * index << ")]] var tex" << index << " : texture_2d;\n"; shaderSource << "[[group(0), binding(" << 2 * index + 1 @@ -149,8 +146,7 @@ class DepthStencilSamplingTest : public DawnTest { << ", vec2(0, 0), 0)[" << componentIndex << "];"; break; case TestAspect::Stencil: - shaderSource << "[[group(0), binding(" << 2 * index - << ")]] var tex" << index + shaderSource << "[[group(0), binding(" << 2 * index << ")]] var tex" << index << " : texture_2d;\n"; shaderSource << "[[group(0), binding(" << 2 * index + 1 @@ -185,8 +181,8 @@ class DepthStencilSamplingTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var samp : sampler_comparison; - [[group(0), binding(1)]] var tex : texture_depth_2d; + [[group(0), binding(0)]] var samp : sampler_comparison; + [[group(0), binding(1)]] var tex : texture_depth_2d; [[block]] struct Uniforms { [[offset(0)]] compareRef : f32; }; @@ -217,8 +213,8 @@ class DepthStencilSamplingTest : public DawnTest { wgpu::ComputePipeline CreateComparisonComputePipeline() { wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var samp : sampler_comparison; - [[group(0), binding(1)]] var tex : texture_depth_2d; + [[group(0), binding(0)]] var samp : sampler_comparison; + [[group(0), binding(1)]] var tex : texture_depth_2d; [[block]] struct Uniforms { [[offset(0)]] compareRef : f32; }; diff --git a/src/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/tests/end2end/GpuMemorySynchronizationTests.cpp index fb40b4d57f..522fb3e932 100644 --- a/src/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -258,8 +258,8 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) { [[offset(4)]] storageOut: u32; }; [[group(0), binding(0)]] var output : [[access(write)]] Output; - [[group(0), binding(1)]] var sampledTex : texture_2d; - [[group(0), binding(2)]] var storageTex : [[access(read)]] texture_storage_2d; + [[group(0), binding(1)]] var sampledTex : texture_2d; + [[group(0), binding(2)]] var storageTex : [[access(read)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { output.sampledOut = textureLoad(sampledTex, vec2(0, 0), 0).x; diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp index 58ebf6e177..e24be8c8c3 100644 --- a/src/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp @@ -274,8 +274,8 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { } )"); wgpu::ShaderModule fs = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var sampler0 : sampler; - [[group(0), binding(1)]] var texture0 : texture_2d; + [[group(0), binding(0)]] var sampler0 : sampler; + [[group(0), binding(1)]] var texture0 : texture_2d; [[location(0)]] var texCoord : vec2; [[location(0)]] var fragColor : vec4; diff --git a/src/tests/end2end/MultisampledSamplingTests.cpp b/src/tests/end2end/MultisampledSamplingTests.cpp index 0ab3dd4fe4..2191204265 100644 --- a/src/tests/end2end/MultisampledSamplingTests.cpp +++ b/src/tests/end2end/MultisampledSamplingTests.cpp @@ -90,8 +90,8 @@ class MultisampledSamplingTest : public DawnTest { wgpu::ComputePipelineDescriptor desc = {}; desc.computeStage.entryPoint = "main"; desc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var texture0 : texture_multisampled_2d; - [[group(0), binding(1)]] var texture1 : texture_multisampled_2d; + [[group(0), binding(0)]] var texture0 : texture_multisampled_2d; + [[group(0), binding(1)]] var texture1 : texture_multisampled_2d; [[block]] struct Results { [[offset(0)]] colorSamples : [[stride(4)]] array; diff --git a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp index aa5f946b3d..d6fdcd0d67 100644 --- a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp +++ b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp @@ -56,8 +56,8 @@ class SamplerFilterAnisotropicTest : public DawnTest { } )"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var sampler0 : sampler; - [[group(0), binding(1)]] var texture0 : texture_2d; + [[group(0), binding(0)]] var sampler0 : sampler; + [[group(0), binding(1)]] var texture0 : texture_2d; [[builtin(frag_coord)]] var FragCoord : vec4; diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 8b4919f24d..daea20c6ff 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -70,8 +70,8 @@ class SamplerTest : public DawnTest { } )"); auto fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var sampler0 : sampler; - [[group(0), binding(1)]] var texture0 : texture_2d; + [[group(0), binding(0)]] var sampler0 : sampler; + [[group(0), binding(1)]] var texture0 : texture_2d; [[builtin(frag_coord)]] var FragCoord : vec4; diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp index 662fde5ff5..850f086c21 100644 --- a/src/tests/end2end/StorageTextureTests.cpp +++ b/src/tests/end2end/StorageTextureTests.cpp @@ -166,7 +166,7 @@ class StorageTextureTests : public DawnTest { uint32_t binding) { std::ostringstream ostream; ostream << "[[group(0), binding(" << binding << ")]] " - << "var storageImage" << binding << " : " + << "var storageImage" << binding << " : " << "[[access(" << accessQualifier << ")]] " << "texture_storage_2d"; if (is2DArray) { @@ -983,8 +983,8 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) { kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( -[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; +[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d; +[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { var srcValue : vec4 = textureLoad(Src, vec2(0, 0)); srcValue.x = srcValue.x + 1u; @@ -1057,8 +1057,8 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) { wgpu::Texture storageTexture2 = CreateTexture( kTextureFormat, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage, 1u, 1u); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( -[[group(0), binding(0)]] var Src : texture_2d; -[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; +[[group(0), binding(0)]] var Src : texture_2d; +[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { var srcValue : vec4 = textureLoad(Src, vec2(0, 0)); srcValue.x = srcValue.x + 1u; @@ -1156,13 +1156,13 @@ fn doTest() -> bool { })"; const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"( -[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d; +[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d; [[stage(fragment)]] fn main() -> void { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); })"; const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"( -[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d; +[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); @@ -1179,7 +1179,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPa // green as the output color, otherwise uses red instead. const char* kVertexShader = kSimpleVertexShader; const std::string kFragmentShader = std::string(R"( -[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d; +[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d; [[location(0)]] var o_color : vec4; )") + kCommonReadOnlyZeroInitTestCode + R"( @@ -1206,7 +1206,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP [[offset(0)]] result : u32; }; -[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d; +[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d; [[group(0), binding(1)]] var dstBuffer : DstBuffer; )") + kCommonReadOnlyZeroInitTestCode + R"( [[stage(compute)]] fn main() -> void { diff --git a/src/tests/end2end/TextureFormatTests.cpp b/src/tests/end2end/TextureFormatTests.cpp index 8bbd5d071f..eda28d3185 100644 --- a/src/tests/end2end/TextureFormatTests.cpp +++ b/src/tests/end2end/TextureFormatTests.cpp @@ -163,8 +163,7 @@ class TextureFormatTest : public DawnTest { const char* type = utils::GetWGSLColorTextureComponentType(sampleFormatInfo.format); std::ostringstream fsSource; - fsSource << "[[group(0), binding(0)]] var myTexture : texture_2d<" << type - << ">;\n"; + fsSource << "[[group(0), binding(0)]] var myTexture : texture_2d<" << type << ">;\n"; fsSource << "[[builtin(frag_coord)]] var FragCoord : vec4;\n"; fsSource << "[[location(0)]] var fragColor : vec4<" << type << ">;\n"; fsSource << "[[stage(fragment)]] fn main() -> void {\n"; diff --git a/src/tests/end2end/TextureSubresourceTests.cpp b/src/tests/end2end/TextureSubresourceTests.cpp index 1a21b86d2d..c3bf6a526d 100644 --- a/src/tests/end2end/TextureSubresourceTests.cpp +++ b/src/tests/end2end/TextureSubresourceTests.cpp @@ -106,8 +106,8 @@ class TextureSubresourceTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var samp : sampler; - [[group(0), binding(1)]] var tex : texture_2d; + [[group(0), binding(0)]] var samp : sampler; + [[group(0), binding(1)]] var tex : texture_2d; [[builtin(frag_coord)]] var FragCoord : vec4; diff --git a/src/tests/perf_tests/SubresourceTrackingPerf.cpp b/src/tests/perf_tests/SubresourceTrackingPerf.cpp index 7db6754b13..3896147e39 100644 --- a/src/tests/perf_tests/SubresourceTrackingPerf.cpp +++ b/src/tests/perf_tests/SubresourceTrackingPerf.cpp @@ -78,7 +78,7 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams FragColor : vec4; - [[group(0), binding(0)]] var materials : texture_2d; + [[group(0), binding(0)]] var materials : texture_2d; [[stage(fragment)]] fn main() -> void { FragColor = vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 0f4a45466e..5b6430421d 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1787,11 +1787,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) { TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DShaderFS[] = R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"; constexpr char kTexture2DShaderCS[] = R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(compute)]] fn main() -> void { })"; @@ -1824,11 +1824,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { wgpu::TextureViewDimension::e2DArray}})})); constexpr char kTexture2DArrayShaderFS[] = R"( - [[group(0), binding(0)]] var myTexture : texture_2d_array; + [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(fragment)]] fn main() -> void { })"; constexpr char kTexture2DArrayShaderCS[] = R"( - [[group(0), binding(0)]] var myTexture : texture_2d_array; + [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(compute)]] fn main() -> void { })"; @@ -2077,7 +2077,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) { device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}}); CreateFragmentPipeline(&bindGroupLayout, R"( - [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() -> void { })"); } @@ -2088,7 +2088,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) { device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}}); CreateFragmentPipeline(&bindGroupLayout, R"( - [[group(0), binding(0)]] var mySampler: sampler_comparison; + [[group(0), binding(0)]] var mySampler: sampler_comparison; [[stage(fragment)]] fn main() -> void { })"); } @@ -2099,7 +2099,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) { device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}}); ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( - [[group(0), binding(0)]] var mySampler: sampler_comparison; + [[group(0), binding(0)]] var mySampler: sampler_comparison; [[stage(fragment)]] fn main() -> void { })")); } @@ -2110,7 +2110,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) { device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}}); ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( - [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() -> void { })")); } diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index 10ba010370..f79ef53850 100644 --- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -231,7 +231,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { { binding.texture.sampleType = wgpu::TextureSampleType::Float; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -241,7 +241,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { { binding.texture.multisampled = true; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; + [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -252,7 +252,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { { binding.sampler.type = wgpu::SamplerBindingType::Filtering; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() -> void { })"); @@ -279,7 +279,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::e1D; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_1d; + [[group(0), binding(0)]] var myTexture : texture_1d; [[stage(fragment)]] fn main() -> void { })"); @@ -289,7 +289,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::e2D; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -299,7 +299,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::e2DArray; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d_array; + [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(fragment)]] fn main() -> void { })"); @@ -309,7 +309,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::e3D; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_3d; + [[group(0), binding(0)]] var myTexture : texture_3d; [[stage(fragment)]] fn main() -> void { })"); @@ -319,7 +319,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::Cube; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_cube; + [[group(0), binding(0)]] var myTexture : texture_cube; [[stage(fragment)]] fn main() -> void { })"); @@ -329,7 +329,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { { binding.texture.viewDimension = wgpu::TextureViewDimension::CubeArray; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_cube_array; + [[group(0), binding(0)]] var myTexture : texture_cube_array; [[stage(fragment)]] fn main() -> void { })"); @@ -355,7 +355,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { { binding.texture.sampleType = wgpu::TextureSampleType::Float; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -365,7 +365,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { { binding.texture.sampleType = wgpu::TextureSampleType::Sint; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -375,7 +375,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { { binding.texture.sampleType = wgpu::TextureSampleType::Uint; wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -567,7 +567,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { })"); wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(0)]] var mySampler: sampler; [[stage(vertex)]] fn main() -> void { })"); @@ -576,7 +576,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { })"); wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var mySampler: sampler; + [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() -> void { })"); @@ -654,13 +654,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { // Test it is invalid to have conflicting binding texture multisampling in the shaders. TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> void { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; + [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; [[stage(fragment)]] fn main() -> void { })"); @@ -676,13 +676,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { // Test it is invalid to have conflicting binding texture dimension in the shaders. TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> void { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_3d; + [[group(0), binding(0)]] var myTexture : texture_3d; [[stage(fragment)]] fn main() -> void { })"); @@ -698,13 +698,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { // Test it is invalid to have conflicting binding texture component type in the shaders. TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> void { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var myTexture : texture_2d; + [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() -> void { })"); diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index 2aba3e09e7..6b4faa1e27 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -397,7 +397,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) { std::ostringstream stream; stream << R"( - [[group(0), binding(0)]] var myTexture : texture_2d<)" + [[group(0), binding(0)]] var myTexture : texture_2d<)" << kScalarTypes[i] << R"(>; [[stage(fragment)]] fn main() -> void { @@ -446,7 +446,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) { std::ostringstream stream; stream << R"( - [[group(0), binding(0)]] var myTexture : )" + [[group(0), binding(0)]] var myTexture : )" << kTextureKeywords[i] << R"(; [[stage(fragment)]] fn main() -> void { })"; diff --git a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 2a929ab739..865b70c91b 100644 --- a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -1554,7 +1554,7 @@ namespace { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; + [[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; [[stage(fragment)]] fn main() -> void { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor(device); @@ -1580,7 +1580,7 @@ namespace { { // Create a passthrough compute pipeline with a readonly storage texture wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; + [[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { })"); wgpu::ComputePipelineDescriptor pipelineDescriptor; diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index 81eec0d662..54dd23766f 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -84,7 +84,7 @@ class StorageTextureValidationTests : public ValidationTest { } std::ostringstream ostream; - ostream << "[[group(0), binding(0)]] var image0 : " + ostream << "[[group(0), binding(0)]] var image0 : " << "[[access(" << access << ")]] " << imageTypeDeclaration << "<" << imageFormatQualifier << ">;\n" @@ -121,7 +121,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { // Readonly storage texture can be declared in a vertex shader. { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(vertex_index)]] var VertexIndex : u32; [[builtin(position)]] var Position : vec4; [[stage(vertex)]] fn main() -> void { @@ -138,7 +138,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { // Read-only storage textures can be declared in a fragment shader. { wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(frag_coord)]] var FragCoord : vec4; [[location(0)]] var fragColor : vec4; [[stage(fragment)]] fn main() -> void { @@ -156,7 +156,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { if ((false) /* TODO(https://crbug.com/tint/449) */) { wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( [[builtin(vertex_index)]] var vertex_index : u32; - [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; [[stage(vertex)]] fn main() -> void { textureStore(image0, vec2(i32(vertex_index), 0), vec4(1.0, 0.0, 0.0, 1.0)); })"); @@ -172,7 +172,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { { wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( [[builtin(frag_coord)]] var frag_coord : vec4; - [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; [[stage(fragment)]] fn main() -> void { textureStore(image0, vec2(frag_coord.xy), vec4(1.0, 0.0, 0.0, 1.0)); })"); @@ -191,7 +191,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { // Read-only storage textures can be declared in a compute shader. { wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d; [[builtin(local_invocation_id)]] var LocalInvocationID : vec3; [[block]] struct Buf { @@ -214,7 +214,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { // Write-only storage textures can be declared in a compute shader. { wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d; [[builtin(local_invocation_id)]] var LocalInvocationID : vec3; [[stage(compute)]] fn main() -> void { @@ -235,7 +235,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { // Read-write storage textures cannot be declared in a vertex shader by default. { ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; [[stage(vertex)]] fn main() -> void { })")); } @@ -243,7 +243,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { // Read-write storage textures cannot be declared in a fragment shader by default. { ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; [[stage(fragment)]] fn main() -> void { })")); } @@ -251,7 +251,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { // Read-write storage textures cannot be declared in a compute shader by default. { ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"( - [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; + [[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d; [[stage(compute)]] fn main() -> void { })")); }