From 066ab14e349632d42bc50397f66d24e61c8b5d24 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 25 Oct 2021 15:27:52 +0000 Subject: [PATCH] wgsl: Remove unnecessary phony-assignments A call-statement can now be made on a function that returns a value. Bug: tint:1256 Change-Id: I9a3cc4e330f7441e09dc408bdc1cfa515adac392 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67382 Commit-Queue: Ben Clayton Auto-Submit: Ben Clayton Reviewed-by: Corentin Wallez --- .../validation/BindGroupValidationTests.cpp | 22 +++++----- .../GetBindGroupLayoutValidationTests.cpp | 42 +++++++++---------- .../RenderPipelineValidationTests.cpp | 4 +- .../StorageTextureValidationTests.cpp | 8 ++-- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 122cc933d2..a3adb9f0a2 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -2072,12 +2072,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DShaderFS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; constexpr char kTexture2DShaderCS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(compute), workgroup_size(1)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; // Render: Test that 2D texture with 2D view dimension works @@ -2111,12 +2111,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DArrayShaderFS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; constexpr char kTexture2DArrayShaderCS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(compute), workgroup_size(1)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; // Render: Test that 2D texture array with 2D array view dimension works @@ -2471,7 +2471,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2485,7 +2485,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2499,7 +2499,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_depth_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2513,7 +2513,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_depth_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2527,7 +2527,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler_comparison; [[group(0), binding(1)]] var myTexture: texture_depth_2d; [[stage(fragment)]] fn main() { - _ = textureSampleCompare(myTexture, mySampler, vec2(0.0, 0.0), 0.0); + textureSampleCompare(myTexture, mySampler, vec2(0.0, 0.0), 0.0); })"); } @@ -2541,7 +2541,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })")); } @@ -2555,7 +2555,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { [[group(0), binding(0)]] var mySampler: sampler; [[group(0), binding(1)]] var myTexture: texture_2d; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2(0.0, 0.0)); + textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } } diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index 9d9109143c..c332439e2c 100644 --- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -190,7 +190,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - _ = textureLoad(myTexture, vec2(), 0); + textureLoad(myTexture, vec2(), 0); _ = mySampler; return vec4(); })"); @@ -199,7 +199,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - _ = textureSampleLevel(myTexture, mySampler, vec2(), 0.0); + textureSampleLevel(myTexture, mySampler, vec2(), 0.0); return vec4(); })"); @@ -215,7 +215,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(fragment)]] fn main() { - _ = textureLoad(myTexture, vec2(), 0); + textureLoad(myTexture, vec2(), 0); _ = mySampler; })"); @@ -223,7 +223,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(fragment)]] fn main() { - _ = textureSample(myTexture, mySampler, vec2()); + textureSample(myTexture, mySampler, vec2()); })"); auto BGLFromModules = [this](wgpu::ShaderModule vertexModule, @@ -394,7 +394,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -406,7 +406,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -475,7 +475,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_1d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -487,7 +487,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -499,7 +499,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -511,7 +511,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_3d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -523,7 +523,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_cube; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -535,7 +535,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { [[group(0), binding(0)]] var myTexture : texture_cube_array; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -563,7 +563,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -575,7 +575,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -587,7 +587,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -900,7 +900,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); return vec4(); })"); @@ -908,7 +908,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { [[group(0), binding(0)]] var myTexture : texture_multisampled_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); utils::ComboRenderPipelineDescriptor descriptor; @@ -925,7 +925,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); return vec4(); })"); @@ -933,7 +933,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { [[group(0), binding(0)]] var myTexture : texture_3d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); utils::ComboRenderPipelineDescriptor descriptor; @@ -950,7 +950,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); return vec4(); })"); @@ -958,7 +958,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"); utils::ComboRenderPipelineDescriptor descriptor; diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index 2ccb9289e1..fc2046bb77 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -639,7 +639,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) { << kScalarTypes[i] << R"(>; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); descriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::None; @@ -688,7 +688,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) { [[group(0), binding(0)]] var myTexture : )" << kTextureKeywords[i] << R"(; [[stage(fragment)]] fn main() { - _ = textureDimensions(myTexture); + textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); descriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::None; diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index f193ab8682..c4d9eeef35 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -83,7 +83,7 @@ class StorageTextureValidationTests : public ValidationTest { << imageFormatQualifier << ", " << access << ">;\n" "[[stage(compute), workgroup_size(1)]] fn main() {\n" - " _ = textureDimensions(image0);\n" + " textureDimensions(image0);\n" "}\n"; return ostream.str(); @@ -176,7 +176,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var image0 : texture_storage_2d; [[stage(vertex)]] fn main() { - _ = textureDimensions(image0); + textureDimensions(image0); })")); } @@ -185,7 +185,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var image0 : texture_storage_2d; [[stage(fragment)]] fn main() { - _ = textureDimensions(image0); + textureDimensions(image0); })")); } @@ -194,7 +194,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var image0 : texture_storage_2d; [[stage(compute), workgroup_size(1)]] fn main() { - _ = textureDimensions(image0); + textureDimensions(image0); })")); } }