Deprecate sampling depth textures with float/unfilterable-float

Dawn currently allows sampling depth textures this way, but it is
not in the WebGPU spec, and the behavior is not guaranteed with the
Metal API.

This commit also updates the stencil sampling tests to expect
(s, s, s, s) or (s, 0, 0, 1).

Bug: dawn:1021
Change-Id: I9210a2a3ff1655747a202a51f46f38faa35c85d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59320
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2021-07-27 22:08:32 +00:00
committed by Dawn LUCI CQ
parent 0eff5987f0
commit d6af6bd7f3
7 changed files with 223 additions and 158 deletions

View File

@@ -470,9 +470,12 @@ TEST_F(BindGroupValidationTest, TextureSampleType) {
DoTest(false, wgpu::TextureFormat::R32Float, wgpu::TextureSampleType::Uint);
DoTest(false, wgpu::TextureFormat::R32Float, wgpu::TextureSampleType::Sint);
// Test that Depth32Float is only compatible with float/unfilterable-float/depth
DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Float);
DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::UnfilterableFloat);
// Test that Depth32Float is only compatible with depth. float/unfilterable-float is deprecated.
// TODO(crbug.com/dawn/1021): Disallow using float/unfilterable-float with depth textures.
EXPECT_DEPRECATION_WARNING(
DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Float));
EXPECT_DEPRECATION_WARNING(DoTest(true, wgpu::TextureFormat::Depth32Float,
wgpu::TextureSampleType::UnfilterableFloat));
DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Depth);
DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Uint);
DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Sint);
@@ -495,7 +498,7 @@ TEST_F(BindGroupValidationTest, TextureSampleType) {
// Test which depth-stencil formats are allowed to be sampled (all).
TEST_F(BindGroupValidationTest, SamplingDepthStencilTexture) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}});
device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Depth}});
wgpu::TextureDescriptor desc;
desc.size = {1, 1, 1};