From 5c4ce7bd9b5526fcb9dc1097918df737092d033e Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 25 Oct 2021 15:14:23 +0000 Subject: [PATCH] wgsl: Migrate from ignore() to phony-assignment The rules have been relaxed about function values always needing to be consumed, so a bunch of these phony-assignments can be replaced with the RHS, but this will be done as a follow-up. Bug: tint:1213 Change-Id: Ie7c4280f87b4ad7e5a429994b0b88ac22c2f3a9f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/67300 Commit-Queue: Ben Clayton Commit-Queue: Corentin Wallez Auto-Submit: Ben Clayton Reviewed-by: Corentin Wallez --- src/tests/end2end/BindGroupTests.cpp | 2 +- src/tests/end2end/FirstIndexOffsetTests.cpp | 4 +- src/tests/end2end/ShaderTests.cpp | 2 +- .../validation/BindGroupValidationTests.cpp | 38 ++++++------ .../GetBindGroupLayoutValidationTests.cpp | 62 +++++++++---------- .../RenderPipelineValidationTests.cpp | 4 +- .../ShaderModuleValidationTests.cpp | 6 +- .../StorageTextureValidationTests.cpp | 8 +-- .../white_box/D3D12DescriptorHeapTests.cpp | 2 +- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index cac7a8c7fb..7460ba1a31 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -1496,7 +1496,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { interface << "[[group(0), binding(" << binding++ << ")]] " << "var image" << i << " : texture_storage_2d;\n"; - body << "ignore(image" << i << ");"; + body << "_ = image" << i << ";"; } for (uint32_t i = 0; i < kMaxUniformBuffersPerShaderStage; ++i) { diff --git a/src/tests/end2end/FirstIndexOffsetTests.cpp b/src/tests/end2end/FirstIndexOffsetTests.cpp index 7558e33b05..c716f2ad52 100644 --- a/src/tests/end2end/FirstIndexOffsetTests.cpp +++ b/src/tests/end2end/FirstIndexOffsetTests.cpp @@ -105,7 +105,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode, vertexBody << " output.vertex_index = input.vertex_index;\n"; fragmentInputs << " [[location(1)]] vertex_index : u32;\n"; - fragmentBody << " ignore(atomicMin(&idx_vals.vertex_index, input.vertex_index));\n"; + fragmentBody << " _ = atomicMin(&idx_vals.vertex_index, input.vertex_index);\n"; } if ((checkIndex & CheckIndex::Instance) != 0) { vertexInputs << " [[builtin(instance_index)]] instance_index : u32;\n"; @@ -113,7 +113,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode, vertexBody << " output.instance_index = input.instance_index;\n"; fragmentInputs << " [[location(2)]] instance_index : u32;\n"; - fragmentBody << " ignore(atomicMin(&idx_vals.instance_index, input.instance_index));\n"; + fragmentBody << " _ = atomicMin(&idx_vals.instance_index, input.instance_index);\n"; } std::string vertexShader = R"( diff --git a/src/tests/end2end/ShaderTests.cpp b/src/tests/end2end/ShaderTests.cpp index bbb4791f84..7c32ad6d4b 100644 --- a/src/tests/end2end/ShaderTests.cpp +++ b/src/tests/end2end/ShaderTests.cpp @@ -342,7 +342,7 @@ struct Inputs { [[group(0), binding(1)]] var providedData1 : S1; [[stage(vertex)]] fn vsMain(input : Inputs) -> [[builtin(position)]] vec4 { - ignore(providedData1.data[input.vertexIndex][0]); + _ = providedData1.data[input.vertexIndex][0]; return vec4(); } diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index ab547915fc..122cc933d2 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() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"; constexpr char kTexture2DShaderCS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(compute), workgroup_size(1)]] fn main() { - ignore(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() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"; constexpr char kTexture2DArrayShaderCS[] = R"( [[group(0), binding(0)]] var myTexture : texture_2d_array; [[stage(compute), workgroup_size(1)]] fn main() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"; // Render: Test that 2D texture array with 2D array view dimension works @@ -2158,7 +2158,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi CreateFSRenderPipeline(R"( [[group(0), binding(0)]] var myExternalTexture: texture_external; [[stage(fragment)]] fn main() { - ignore(myExternalTexture); + _ = myExternalTexture; })", {bgl}); @@ -2166,7 +2166,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(R"( [[group(0), binding(0)]] var myTexture: texture_2d; [[stage(fragment)]] fn main() { - ignore(myTexture); + _ = myTexture; })", {bgl})); } @@ -2397,7 +2397,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })"); } @@ -2409,7 +2409,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })"); } @@ -2421,7 +2421,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler_comparison; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })"); } @@ -2433,7 +2433,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler_comparison; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })")); } @@ -2445,7 +2445,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler_comparison; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })")); } @@ -2457,7 +2457,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })")); } @@ -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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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 45ef7c8edb..9d9109143c 100644 --- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -181,8 +181,8 @@ 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 { - ignore(myTexture); - ignore(mySampler); + _ = myTexture; + _ = mySampler; return vec4(); })"); @@ -190,8 +190,8 @@ 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 { - ignore(textureLoad(myTexture, vec2(), 0)); - ignore(mySampler); + _ = 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 { - ignore(textureSampleLevel(myTexture, mySampler, vec2(), 0.0)); + _ = textureSampleLevel(myTexture, mySampler, vec2(), 0.0); return vec4(); })"); @@ -207,23 +207,23 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(fragment)]] fn main() { - ignore(myTexture); - ignore(mySampler); + _ = myTexture; + _ = mySampler; })"); wgpu::ShaderModule textureLoadFragmentModule = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(fragment)]] fn main() { - ignore(textureLoad(myTexture, vec2(), 0)); - ignore(mySampler); + _ = textureLoad(myTexture, vec2(), 0); + _ = mySampler; })"); wgpu::ShaderModule textureSampleFragmentModule = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var myTexture : texture_2d; [[group(0), binding(1)]] var mySampler : sampler; [[stage(fragment)]] fn main() { - ignore(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() { - ignore(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() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -419,7 +419,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -447,7 +447,7 @@ TEST_F(GetBindGroupLayoutTests, ExternalTextureBindingType) { [[group(0), binding(0)]] var myExternalTexture: texture_external; [[stage(fragment)]] fn main() { - ignore(myExternalTexture); + _ = myExternalTexture; })"); 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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(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() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"); EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); @@ -802,7 +802,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var mySampler: sampler; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - ignore(mySampler); + _ = mySampler; return vec4(); })"); @@ -813,7 +813,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var mySampler: sampler; [[stage(fragment)]] fn main() { - ignore(mySampler); + _ = mySampler; })"); // Create BGLs with minBufferBindingSize 4 and 64. @@ -900,7 +900,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { [[group(0), binding(0)]] var myTexture : texture_2d; [[stage(vertex)]] fn main() -> [[builtin(position)]] vec4 { - ignore(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() { - ignore(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 { - ignore(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() { - ignore(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 { - ignore(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() { - ignore(textureDimensions(myTexture)); + _ = textureDimensions(myTexture); })"); utils::ComboRenderPipelineDescriptor descriptor; diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index da8f66cee5..2ccb9289e1 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() { - ignore(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() { - ignore(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/ShaderModuleValidationTests.cpp b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp index 36eb4b5b54..eebc5d2689 100644 --- a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -481,11 +481,11 @@ TEST_F(ShaderModuleValidationTest, ComputeWorkgroupStorageSizeLimits) { std::ostringstream body; if (vec4_count > 0) { ss << "var vec4_data: array, " << vec4_count << ">;"; - body << "ignore(vec4_data);"; + body << "_ = vec4_data;"; } if (mat4_count > 0) { ss << "var mat4_data: array, " << mat4_count << ">;"; - body << "ignore(mat4_data);"; + body << "_ = mat4_data;"; } ss << "[[stage(compute), workgroup_size(1)]] fn main() { " << body.str() << " }"; utils::CreateShaderModule(device, ss.str().c_str()); @@ -519,4 +519,4 @@ TEST_F(ShaderModuleValidationTest, OverridableConstantsNumericIDConflicts) { buf.data[0] = c0; buf.data[1] = c1; })")); -} \ No newline at end of file +} diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index 65287712b1..f193ab8682 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" - " ignore(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() { - ignore(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() { - ignore(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() { - ignore(textureDimensions(image0)); + _ = textureDimensions(image0); })")); } } diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp index b38eb5f0b9..4050667e12 100644 --- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp @@ -183,7 +183,7 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) { renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var sampler0 : sampler; [[stage(fragment)]] fn main() -> [[location(0)]] vec4 { - ignore(sampler0); + _ = sampler0; return vec4(0.0, 0.0, 0.0, 0.0); })");