Deprecate sampleType "float" with multisampled textures

Bug: dawn:1540
Change-Id: I27608cc88c677205a2a41a5b041d2360f43d14f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102620
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
This commit is contained in:
Austin Eng 2022-09-16 16:33:28 +00:00 committed by Dawn LUCI CQ
parent a9a36e0641
commit d41981b5cc
2 changed files with 37 additions and 22 deletions

View File

@ -113,6 +113,14 @@ MaybeError ValidateBindGroupLayoutEntry(DeviceBase* device,
DAWN_INVALID_IF(texture.multisampled && viewDimension != wgpu::TextureViewDimension::e2D, DAWN_INVALID_IF(texture.multisampled && viewDimension != wgpu::TextureViewDimension::e2D,
"View dimension (%s) for a multisampled texture bindings was not %s.", "View dimension (%s) for a multisampled texture bindings was not %s.",
viewDimension, wgpu::TextureViewDimension::e2D); viewDimension, wgpu::TextureViewDimension::e2D);
if (texture.multisampled && texture.sampleType == wgpu::TextureSampleType::Float) {
std::string warning = absl::StrFormat(
"Sample type %s for multisampled texture bindings is deprecated "
"and will be invalid in a future version.",
wgpu::TextureSampleType::Float);
device->EmitDeprecationWarning(warning.c_str());
}
} }
if (entry.storageTexture.access != wgpu::StorageTextureAccess::Undefined) { if (entry.storageTexture.access != wgpu::StorageTextureAccess::Undefined) {

View File

@ -781,7 +781,7 @@ TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
// Tests constraints on the texture for MultisampledTexture bindings // Tests constraints on the texture for MultisampledTexture bindings
TEST_F(BindGroupValidationTest, MultisampledTexture) { TEST_F(BindGroupValidationTest, MultisampledTexture) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float, device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e2D, true}}); wgpu::TextureViewDimension::e2D, true}});
wgpu::BindGroupEntry binding; wgpu::BindGroupEntry binding;
@ -1420,63 +1420,70 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
// Test that multisampled textures must be 2D sampled textures // Test that multisampled textures must be 2D sampled textures
TEST_F(BindGroupLayoutValidationTest, MultisampledTextureViewDimension) { TEST_F(BindGroupLayoutValidationTest, MultisampledTextureViewDimension) {
// Multisampled 2D texture works. // Multisampled 2D texture works.
utils::MakeBindGroupLayout(device, utils::MakeBindGroupLayout(
{ device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e2D, true}, wgpu::TextureViewDimension::e2D, true},
}); });
// Multisampled 2D (defaulted) texture works. // Multisampled 2D (defaulted) texture works.
utils::MakeBindGroupLayout(device, utils::MakeBindGroupLayout(
{ device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::Undefined, true}, wgpu::TextureViewDimension::Undefined, true},
}); });
// Multisampled 2D array texture is invalid. // Multisampled 2D array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e2DArray, true}, wgpu::TextureViewDimension::e2DArray, true},
})); }));
// Multisampled cube texture is invalid. // Multisampled cube texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::Cube, true}, wgpu::TextureViewDimension::Cube, true},
})); }));
// Multisampled cube array texture is invalid. // Multisampled cube array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::CubeArray, true}, wgpu::TextureViewDimension::CubeArray, true},
})); }));
// Multisampled 3D texture is invalid. // Multisampled 3D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e3D, true}, wgpu::TextureViewDimension::e3D, true},
})); }));
// Multisampled 1D texture is invalid. // Multisampled 1D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e1D, true}, wgpu::TextureViewDimension::e1D, true},
})); }));
} }
// Test that multisampled texture bindings are valid // Test that multisampled texture bindings are valid
TEST_F(BindGroupLayoutValidationTest, MultisampledTextureSampleType) { TEST_F(BindGroupLayoutValidationTest, MultisampledTextureSampleType) {
// Multisampled float sample type works. // Multisampled float sample type deprecated.
utils::MakeBindGroupLayout(device, EXPECT_DEPRECATION_WARNING(utils::MakeBindGroupLayout(
{ device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float, {0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::Float,
wgpu::TextureViewDimension::e2D, true}, wgpu::TextureViewDimension::e2D, true},
}); }));
// Multisampled unfilterable float sample type works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::TextureSampleType::UnfilterableFloat,
wgpu::TextureViewDimension::e2D, true},
});
// Multisampled uint sample type works. // Multisampled uint sample type works.
utils::MakeBindGroupLayout(device, utils::MakeBindGroupLayout(device,