Wrap call stmts with non-void rets, with ignore()
We have a new validation rule that states that all calls to functions that return a value must use that value. ignore() is the escape hatch.
Bug: tint:886
Change-Id: I9ab8d288b3c54ad4b7e46feda129c36c9136c20b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54200
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp
index 0a0f220..69d890f 100644
--- a/src/tests/unittests/validation/BindGroupValidationTests.cpp
+++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -1978,12 +1978,12 @@
constexpr char kTexture2DShaderFS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
constexpr char kTexture2DShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(compute)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
// Render: Test that 2D texture with 2D view dimension works
@@ -2017,12 +2017,12 @@
constexpr char kTexture2DArrayShaderFS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
constexpr char kTexture2DArrayShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(compute)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
// Render: Test that 2D texture array with 2D array view dimension works
@@ -2071,7 +2071,7 @@
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(R"(
[[group(0), binding(0)]] var myTexture: texture_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})",
{bgl}));
}
diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
index a4a2bb1..987599e 100644
--- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
+++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
@@ -245,7 +245,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -256,7 +256,7 @@
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -323,7 +323,7 @@
[[group(0), binding(0)]] var myTexture : texture_1d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -334,7 +334,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -345,7 +345,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -356,7 +356,7 @@
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -367,7 +367,7 @@
[[group(0), binding(0)]] var myTexture : texture_cube<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -378,7 +378,7 @@
[[group(0), binding(0)]] var myTexture : texture_cube_array<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -405,7 +405,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -416,7 +416,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -427,7 +427,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<u32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@@ -727,7 +727,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
return vec4<f32>();
})");
@@ -735,7 +735,7 @@
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
utils::ComboRenderPipelineDescriptor descriptor;
@@ -752,7 +752,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
return vec4<f32>();
})");
@@ -760,7 +760,7 @@
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
utils::ComboRenderPipelineDescriptor descriptor;
@@ -777,7 +777,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
return vec4<f32>();
})");
@@ -785,7 +785,7 @@
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})");
utils::ComboRenderPipelineDescriptor descriptor;
diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
index 593a365..ab0e327 100644
--- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -387,7 +387,7 @@
<< kScalarTypes[i] << R"(>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
@@ -435,7 +435,7 @@
[[group(0), binding(0)]] var myTexture : )"
<< kTextureKeywords[i] << R"(<f32>;
[[stage(fragment)]] fn main() {
- textureDimensions(myTexture);
+ ignore(textureDimensions(myTexture));
})";
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
index 8222f9d..b532492 100644
--- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp
+++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp
@@ -86,7 +86,7 @@
<< imageFormatQualifier << ", " << access
<< ">;\n"
"[[stage(compute)]] fn main() {\n"
- " textureDimensions(image0);\n"
+ " ignore(textureDimensions(image0));\n"
"}\n";
return ostream.str();
@@ -231,7 +231,7 @@
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(vertex)]] fn main() {
- textureDimensions(image0);
+ ignore(textureDimensions(image0));
})"));
}
@@ -240,7 +240,7 @@
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(fragment)]] fn main() {
- textureDimensions(image0);
+ ignore(textureDimensions(image0));
})"));
}
@@ -249,7 +249,7 @@
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(compute)]] fn main() {
- textureDimensions(image0);
+ ignore(textureDimensions(image0));
})"));
}
}