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 <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ben Clayton 2021-10-25 15:14:23 +00:00 committed by Dawn LUCI CQ
parent e0b5664f98
commit 5c4ce7bd9b
9 changed files with 64 additions and 64 deletions

View File

@ -1496,7 +1496,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
interface << "[[group(0), binding(" << binding++ << ")]] "
<< "var image" << i << " : texture_storage_2d<r32uint, write>;\n";
body << "ignore(image" << i << ");";
body << "_ = image" << i << ";";
}
for (uint32_t i = 0; i < kMaxUniformBuffersPerShaderStage; ++i) {

View File

@ -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"(

View File

@ -342,7 +342,7 @@ struct Inputs {
[[group(0), binding(1)]] var<uniform> providedData1 : S1;
[[stage(vertex)]] fn vsMain(input : Inputs) -> [[builtin(position)]] vec4<f32> {
ignore(providedData1.data[input.vertexIndex][0]);
_ = providedData1.data[input.vertexIndex][0];
return vec4<f32>();
}

View File

@ -2072,12 +2072,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
constexpr char kTexture2DShaderFS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
})";
constexpr char kTexture2DShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[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<f32>;
[[stage(fragment)]] fn main() {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
})";
constexpr char kTexture2DArrayShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[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<f32>;
[[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<f32>;
[[stage(fragment)]] fn main() {
ignore(textureSample(myTexture, mySampler, vec2<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(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<f32>;
[[stage(fragment)]] fn main() {
ignore(textureSample(myTexture, mySampler, vec2<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(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<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(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<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(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<f32>(0.0, 0.0), 0.0));
_ = textureSampleCompare(myTexture, mySampler, vec2<f32>(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<f32>;
[[stage(fragment)]] fn main() {
ignore(textureSample(myTexture, mySampler, vec2<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(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<f32>;
[[stage(fragment)]] fn main() {
ignore(textureSample(myTexture, mySampler, vec2<f32>(0.0, 0.0)));
_ = textureSample(myTexture, mySampler, vec2<f32>(0.0, 0.0));
})");
}
}

View File

@ -181,8 +181,8 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) {
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[group(0), binding(1)]] var mySampler : sampler;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(myTexture);
ignore(mySampler);
_ = myTexture;
_ = mySampler;
return vec4<f32>();
})");
@ -190,8 +190,8 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) {
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[group(0), binding(1)]] var mySampler : sampler;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(textureLoad(myTexture, vec2<i32>(), 0));
ignore(mySampler);
_ = textureLoad(myTexture, vec2<i32>(), 0);
_ = mySampler;
return vec4<f32>();
})");
@ -199,7 +199,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) {
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[group(0), binding(1)]] var mySampler : sampler;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(textureSampleLevel(myTexture, mySampler, vec2<f32>(), 0.0));
_ = textureSampleLevel(myTexture, mySampler, vec2<f32>(), 0.0);
return vec4<f32>();
})");
@ -207,23 +207,23 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) {
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[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<f32>;
[[group(0), binding(1)]] var mySampler : sampler;
[[stage(fragment)]] fn main() {
ignore(textureLoad(myTexture, vec2<i32>(), 0));
ignore(mySampler);
_ = textureLoad(myTexture, vec2<i32>(), 0);
_ = mySampler;
})");
wgpu::ShaderModule textureSampleFragmentModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[group(0), binding(1)]] var mySampler : sampler;
[[stage(fragment)]] fn main() {
ignore(textureSample(myTexture, mySampler, vec2<f32>()));
_ = textureSample(myTexture, mySampler, vec2<f32>());
})");
auto BGLFromModules = [this](wgpu::ShaderModule vertexModule,
@ -394,7 +394,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<f32>;
[[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<i32>;
[[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<u32>;
[[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<f32> {
ignore(mySampler);
_ = mySampler;
return vec4<f32>();
})");
@ -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<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
return vec4<f32>();
})");
@ -908,7 +908,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
[[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<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
return vec4<f32>();
})");
@ -933,7 +933,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
[[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<f32>;
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
return vec4<f32>();
})");
@ -958,7 +958,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() {
ignore(textureDimensions(myTexture));
_ = textureDimensions(myTexture);
})");
utils::ComboRenderPipelineDescriptor descriptor;

View File

@ -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"(<f32>;
[[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;

View File

@ -481,11 +481,11 @@ TEST_F(ShaderModuleValidationTest, ComputeWorkgroupStorageSizeLimits) {
std::ostringstream body;
if (vec4_count > 0) {
ss << "var<workgroup> vec4_data: array<vec4<f32>, " << vec4_count << ">;";
body << "ignore(vec4_data);";
body << "_ = vec4_data;";
}
if (mat4_count > 0) {
ss << "var<workgroup> mat4_data: array<mat4x4<f32>, " << 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;
})"));
}
}

View File

@ -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<rgba8unorm, read_write>;
[[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<rgba8unorm, read_write>;
[[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<rgba8unorm, read_write>;
[[stage(compute), workgroup_size(1)]] fn main() {
ignore(textureDimensions(image0));
_ = textureDimensions(image0);
})"));
}
}

View File

@ -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<f32> {
ignore(sampler0);
_ = sampler0;
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");