From 6d48f573af6004ce4243c97745562a270de9c0e4 Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Tue, 14 Jun 2022 22:48:31 +0000 Subject: [PATCH] Remove support for depth24unorm-stencil8 It was removed from the spec after determining it didn't provide any additional capabilities beyond depth24plus-stencil8. Bug: dawn:1454 Change-Id: Ifba62f22cd38bea88866c849c8d1754a2aa683e2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92963 Reviewed-by: Austin Eng Commit-Queue: Brandon Jones --- dawn.json | 126 +++++++++--------- src/dawn/native/CommandEncoder.cpp | 1 - src/dawn/native/Features.cpp | 7 - src/dawn/native/Features.h | 1 - src/dawn/native/Format.cpp | 6 +- src/dawn/native/Format.h | 2 +- src/dawn/native/d3d12/AdapterD3D12.cpp | 1 - src/dawn/native/d3d12/TextureD3D12.cpp | 11 +- src/dawn/native/metal/BackendMTL.mm | 7 - src/dawn/native/metal/TextureMTL.mm | 10 -- src/dawn/native/opengl/AdapterGL.cpp | 1 - src/dawn/native/opengl/GLFormat.cpp | 1 - src/dawn/native/opengl/UtilsGL.cpp | 1 - src/dawn/native/vulkan/AdapterVk.cpp | 4 - src/dawn/native/vulkan/TextureVk.cpp | 2 - .../tests/end2end/DepthStencilCopyTests.cpp | 6 - .../tests/end2end/DepthStencilLoadOpTests.cpp | 10 +- .../end2end/DepthStencilSamplingTests.cpp | 29 +--- .../ReadOnlyDepthStencilAttachmentTests.cpp | 7 - .../CopyCommandsValidationTests.cpp | 37 +++-- .../validation/TextureValidationTests.cpp | 30 ----- .../validation/TextureViewValidationTests.cpp | 55 -------- .../unittests/wire/WireInstanceTests.cpp | 4 +- src/dawn/utils/TextureUtils.cpp | 3 - src/dawn/utils/TextureUtils.h | 11 +- src/dawn/wire/SupportedFeatures.cpp | 1 - 26 files changed, 97 insertions(+), 277 deletions(-) diff --git a/dawn.json b/dawn.json index d3eac41e20..0c51df3f37 100644 --- a/dawn.json +++ b/dawn.json @@ -1345,14 +1345,13 @@ "values": [ {"value": 0, "name": "undefined", "jsrepr": "undefined"}, {"value": 1, "name": "depth clip control"}, - {"value": 2, "name": "depth24 unorm stencil8"}, - {"value": 3, "name": "depth32 float stencil8"}, - {"value": 4, "name": "timestamp query"}, - {"value": 5, "name": "pipeline statistics query"}, - {"value": 6, "name": "texture compression BC"}, - {"value": 7, "name": "texture compression ETC2"}, - {"value": 8, "name": "texture compression ASTC"}, - {"value": 9, "name": "indirect first instance"}, + {"value": 2, "name": "depth32 float stencil8"}, + {"value": 3, "name": "timestamp query"}, + {"value": 4, "name": "pipeline statistics query"}, + {"value": 5, "name": "texture compression BC"}, + {"value": 6, "name": "texture compression ETC2"}, + {"value": 7, "name": "texture compression ASTC"}, + {"value": 8, "name": "indirect first instance"}, {"value": 1000, "name": "depth clamping", "tags": ["emscripten", "dawn"]}, {"value": 1001, "name": "dawn shader float 16", "tags": ["dawn"]}, {"value": 1002, "name": "dawn internal usages", "tags": ["dawn"]}, @@ -2639,66 +2638,65 @@ {"value": 38, "name": "depth16 unorm"}, {"value": 39, "name": "depth24 plus"}, {"value": 40, "name": "depth24 plus stencil8"}, - {"value": 41, "name": "depth24 unorm stencil8"}, - {"value": 42, "name": "depth32 float"}, - {"value": 43, "name": "depth32 float stencil8"}, + {"value": 41, "name": "depth32 float"}, + {"value": 42, "name": "depth32 float stencil8"}, - {"value": 44, "name": "BC1 RGBA unorm", "jsrepr": "'bc1-rgba-unorm'"}, - {"value": 45, "name": "BC1 RGBA unorm srgb", "jsrepr": "'bc1-rgba-unorm-srgb'"}, - {"value": 46, "name": "BC2 RGBA unorm", "jsrepr": "'bc2-rgba-unorm'"}, - {"value": 47, "name": "BC2 RGBA unorm srgb", "jsrepr": "'bc2-rgba-unorm-srgb'"}, - {"value": 48, "name": "BC3 RGBA unorm", "jsrepr": "'bc3-rgba-unorm'"}, - {"value": 49, "name": "BC3 RGBA unorm srgb", "jsrepr": "'bc3-rgba-unorm-srgb'"}, - {"value": 50, "name": "BC4 R unorm", "jsrepr": "'bc4-r-unorm'"}, - {"value": 51, "name": "BC4 R snorm", "jsrepr": "'bc4-r-snorm'"}, - {"value": 52, "name": "BC5 RG unorm", "jsrepr": "'bc5-rg-unorm'"}, - {"value": 53, "name": "BC5 RG snorm", "jsrepr": "'bc5-rg-snorm'"}, - {"value": 54, "name": "BC6H RGB ufloat", "jsrepr": "'bc6h-rgb-ufloat'"}, - {"value": 55, "name": "BC6H RGB float", "jsrepr": "'bc6h-rgb-float'"}, - {"value": 56, "name": "BC7 RGBA unorm", "jsrepr": "'bc7-rgba-unorm'"}, - {"value": 57, "name": "BC7 RGBA unorm srgb", "jsrepr": "'bc7-rgba-unorm-srgb'"}, + {"value": 43, "name": "BC1 RGBA unorm", "jsrepr": "'bc1-rgba-unorm'"}, + {"value": 44, "name": "BC1 RGBA unorm srgb", "jsrepr": "'bc1-rgba-unorm-srgb'"}, + {"value": 45, "name": "BC2 RGBA unorm", "jsrepr": "'bc2-rgba-unorm'"}, + {"value": 46, "name": "BC2 RGBA unorm srgb", "jsrepr": "'bc2-rgba-unorm-srgb'"}, + {"value": 47, "name": "BC3 RGBA unorm", "jsrepr": "'bc3-rgba-unorm'"}, + {"value": 48, "name": "BC3 RGBA unorm srgb", "jsrepr": "'bc3-rgba-unorm-srgb'"}, + {"value": 49, "name": "BC4 R unorm", "jsrepr": "'bc4-r-unorm'"}, + {"value": 50, "name": "BC4 R snorm", "jsrepr": "'bc4-r-snorm'"}, + {"value": 51, "name": "BC5 RG unorm", "jsrepr": "'bc5-rg-unorm'"}, + {"value": 52, "name": "BC5 RG snorm", "jsrepr": "'bc5-rg-snorm'"}, + {"value": 53, "name": "BC6H RGB ufloat", "jsrepr": "'bc6h-rgb-ufloat'"}, + {"value": 54, "name": "BC6H RGB float", "jsrepr": "'bc6h-rgb-float'"}, + {"value": 55, "name": "BC7 RGBA unorm", "jsrepr": "'bc7-rgba-unorm'"}, + {"value": 56, "name": "BC7 RGBA unorm srgb", "jsrepr": "'bc7-rgba-unorm-srgb'"}, - {"value": 58, "name": "ETC2 RGB8 unorm", "jsrepr": "'etc2-rgb8unorm'"}, - {"value": 59, "name": "ETC2 RGB8 unorm srgb", "jsrepr": "'etc2-rgb8unorm-srgb'"}, - {"value": 60, "name": "ETC2 RGB8A1 unorm", "jsrepr": "'etc2-rgb8a1unorm'"}, - {"value": 61, "name": "ETC2 RGB8A1 unorm srgb", "jsrepr": "'etc2-rgb8a1unorm-srgb'"}, - {"value": 62, "name": "ETC2 RGBA8 unorm", "jsrepr": "'etc2-rgba8unorm'"}, - {"value": 63, "name": "ETC2 RGBA8 unorm srgb", "jsrepr": "'etc2-rgba8unorm-srgb'"}, - {"value": 64, "name": "EAC R11 unorm", "jsrepr": "'eac-r11unorm'"}, - {"value": 65, "name": "EAC R11 snorm", "jsrepr": "'eac-r11snorm'"}, - {"value": 66, "name": "EAC RG11 unorm", "jsrepr": "'eac-rg11unorm'"}, - {"value": 67, "name": "EAC RG11 snorm", "jsrepr": "'eac-rg11snorm'"}, + {"value": 57, "name": "ETC2 RGB8 unorm", "jsrepr": "'etc2-rgb8unorm'"}, + {"value": 58, "name": "ETC2 RGB8 unorm srgb", "jsrepr": "'etc2-rgb8unorm-srgb'"}, + {"value": 59, "name": "ETC2 RGB8A1 unorm", "jsrepr": "'etc2-rgb8a1unorm'"}, + {"value": 60, "name": "ETC2 RGB8A1 unorm srgb", "jsrepr": "'etc2-rgb8a1unorm-srgb'"}, + {"value": 61, "name": "ETC2 RGBA8 unorm", "jsrepr": "'etc2-rgba8unorm'"}, + {"value": 62, "name": "ETC2 RGBA8 unorm srgb", "jsrepr": "'etc2-rgba8unorm-srgb'"}, + {"value": 63, "name": "EAC R11 unorm", "jsrepr": "'eac-r11unorm'"}, + {"value": 64, "name": "EAC R11 snorm", "jsrepr": "'eac-r11snorm'"}, + {"value": 65, "name": "EAC RG11 unorm", "jsrepr": "'eac-rg11unorm'"}, + {"value": 66, "name": "EAC RG11 snorm", "jsrepr": "'eac-rg11snorm'"}, - {"value": 68, "name": "ASTC 4x4 unorm", "jsrepr": "'astc-4x4-unorm'"}, - {"value": 69, "name": "ASTC 4x4 unorm srgb", "jsrepr": "'astc-4x4-unorm-srgb'"}, - {"value": 70, "name": "ASTC 5x4 unorm", "jsrepr": "'astc-5x4-unorm'"}, - {"value": 71, "name": "ASTC 5x4 unorm srgb", "jsrepr": "'astc-5x4-unorm-srgb'"}, - {"value": 72, "name": "ASTC 5x5 unorm", "jsrepr": "'astc-5x5-unorm'"}, - {"value": 73, "name": "ASTC 5x5 unorm srgb", "jsrepr": "'astc-5x5-unorm-srgb'"}, - {"value": 74, "name": "ASTC 6x5 unorm", "jsrepr": "'astc-6x5-unorm'"}, - {"value": 75, "name": "ASTC 6x5 unorm srgb", "jsrepr": "'astc-6x5-unorm-srgb'"}, - {"value": 76, "name": "ASTC 6x6 unorm", "jsrepr": "'astc-6x6-unorm'"}, - {"value": 77, "name": "ASTC 6x6 unorm srgb", "jsrepr": "'astc-6x6-unorm-srgb'"}, - {"value": 78, "name": "ASTC 8x5 unorm", "jsrepr": "'astc-8x5-unorm'"}, - {"value": 79, "name": "ASTC 8x5 unorm srgb", "jsrepr": "'astc-8x5-unorm-srgb'"}, - {"value": 80, "name": "ASTC 8x6 unorm", "jsrepr": "'astc-8x6-unorm'"}, - {"value": 81, "name": "ASTC 8x6 unorm srgb", "jsrepr": "'astc-8x6-unorm-srgb'"}, - {"value": 82, "name": "ASTC 8x8 unorm", "jsrepr": "'astc-8x8-unorm'"}, - {"value": 83, "name": "ASTC 8x8 unorm srgb", "jsrepr": "'astc-8x8-unorm-srgb'"}, - {"value": 84, "name": "ASTC 10x5 unorm", "jsrepr": "'astc-10x5-unorm'"}, - {"value": 85, "name": "ASTC 10x5 unorm srgb", "jsrepr": "'astc-10x5-unorm-srgb'"}, - {"value": 86, "name": "ASTC 10x6 unorm", "jsrepr": "'astc-10x6-unorm'"}, - {"value": 87, "name": "ASTC 10x6 unorm srgb", "jsrepr": "'astc-10x6-unorm-srgb'"}, - {"value": 88, "name": "ASTC 10x8 unorm", "jsrepr": "'astc-10x8-unorm'"}, - {"value": 89, "name": "ASTC 10x8 unorm srgb", "jsrepr": "'astc-10x8-unorm-srgb'"}, - {"value": 90, "name": "ASTC 10x10 unorm", "jsrepr": "'astc-10x10-unorm'"}, - {"value": 91, "name": "ASTC 10x10 unorm srgb", "jsrepr": "'astc-10x10-unorm-srgb'"}, - {"value": 92, "name": "ASTC 12x10 unorm", "jsrepr": "'astc-12x10-unorm'"}, - {"value": 93, "name": "ASTC 12x10 unorm srgb", "jsrepr": "'astc-12x10-unorm-srgb'"}, - {"value": 94, "name": "ASTC 12x12 unorm", "jsrepr": "'astc-12x12-unorm'"}, - {"value": 95, "name": "ASTC 12x12 unorm srgb", "jsrepr": "'astc-12x12-unorm-srgb'"}, + {"value": 67, "name": "ASTC 4x4 unorm", "jsrepr": "'astc-4x4-unorm'"}, + {"value": 68, "name": "ASTC 4x4 unorm srgb", "jsrepr": "'astc-4x4-unorm-srgb'"}, + {"value": 69, "name": "ASTC 5x4 unorm", "jsrepr": "'astc-5x4-unorm'"}, + {"value": 70, "name": "ASTC 5x4 unorm srgb", "jsrepr": "'astc-5x4-unorm-srgb'"}, + {"value": 71, "name": "ASTC 5x5 unorm", "jsrepr": "'astc-5x5-unorm'"}, + {"value": 72, "name": "ASTC 5x5 unorm srgb", "jsrepr": "'astc-5x5-unorm-srgb'"}, + {"value": 73, "name": "ASTC 6x5 unorm", "jsrepr": "'astc-6x5-unorm'"}, + {"value": 74, "name": "ASTC 6x5 unorm srgb", "jsrepr": "'astc-6x5-unorm-srgb'"}, + {"value": 75, "name": "ASTC 6x6 unorm", "jsrepr": "'astc-6x6-unorm'"}, + {"value": 76, "name": "ASTC 6x6 unorm srgb", "jsrepr": "'astc-6x6-unorm-srgb'"}, + {"value": 77, "name": "ASTC 8x5 unorm", "jsrepr": "'astc-8x5-unorm'"}, + {"value": 78, "name": "ASTC 8x5 unorm srgb", "jsrepr": "'astc-8x5-unorm-srgb'"}, + {"value": 79, "name": "ASTC 8x6 unorm", "jsrepr": "'astc-8x6-unorm'"}, + {"value": 80, "name": "ASTC 8x6 unorm srgb", "jsrepr": "'astc-8x6-unorm-srgb'"}, + {"value": 81, "name": "ASTC 8x8 unorm", "jsrepr": "'astc-8x8-unorm'"}, + {"value": 82, "name": "ASTC 8x8 unorm srgb", "jsrepr": "'astc-8x8-unorm-srgb'"}, + {"value": 83, "name": "ASTC 10x5 unorm", "jsrepr": "'astc-10x5-unorm'"}, + {"value": 84, "name": "ASTC 10x5 unorm srgb", "jsrepr": "'astc-10x5-unorm-srgb'"}, + {"value": 85, "name": "ASTC 10x6 unorm", "jsrepr": "'astc-10x6-unorm'"}, + {"value": 86, "name": "ASTC 10x6 unorm srgb", "jsrepr": "'astc-10x6-unorm-srgb'"}, + {"value": 87, "name": "ASTC 10x8 unorm", "jsrepr": "'astc-10x8-unorm'"}, + {"value": 88, "name": "ASTC 10x8 unorm srgb", "jsrepr": "'astc-10x8-unorm-srgb'"}, + {"value": 89, "name": "ASTC 10x10 unorm", "jsrepr": "'astc-10x10-unorm'"}, + {"value": 90, "name": "ASTC 10x10 unorm srgb", "jsrepr": "'astc-10x10-unorm-srgb'"}, + {"value": 91, "name": "ASTC 12x10 unorm", "jsrepr": "'astc-12x10-unorm'"}, + {"value": 92, "name": "ASTC 12x10 unorm srgb", "jsrepr": "'astc-12x10-unorm-srgb'"}, + {"value": 93, "name": "ASTC 12x12 unorm", "jsrepr": "'astc-12x12-unorm'"}, + {"value": 94, "name": "ASTC 12x12 unorm srgb", "jsrepr": "'astc-12x12-unorm-srgb'"}, - {"value": 96, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]} + {"value": 95, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]} ] }, "texture usage": { diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp index 20d0a649b4..03aafc55a8 100644 --- a/src/dawn/native/CommandEncoder.cpp +++ b/src/dawn/native/CommandEncoder.cpp @@ -92,7 +92,6 @@ MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(const ImageCopyTe switch (src.texture->GetFormat().format) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DAWN_FORMAT_VALIDATION_ERROR( "The depth aspect of %s format %s cannot be selected in a texture to " "buffer copy.", diff --git a/src/dawn/native/Features.cpp b/src/dawn/native/Features.cpp index 7a8b2e91be..16b845dfa0 100644 --- a/src/dawn/native/Features.cpp +++ b/src/dawn/native/Features.cpp @@ -61,9 +61,6 @@ static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {{ {Feature::DepthClamping, {"depth-clamping", "Clamp depth to [0, 1] in NDC space instead of clipping", "https://bugs.chromium.org/p/dawn/issues/detail?id=716"}}, - {Feature::Depth24UnormStencil8, - {"depth24unorm-stencil8", "Support depth24unorm-stencil8 texture format", - "https://bugs.chromium.org/p/dawn/issues/detail?id=690"}}, {Feature::Depth32FloatStencil8, {"depth32float-stencil8", "Support depth32float-stencil8 texture format", "https://bugs.chromium.org/p/dawn/issues/detail?id=690"}}, @@ -107,8 +104,6 @@ Feature FromAPIFeature(wgpu::FeatureName feature) { return Feature::DepthClipControl; case wgpu::FeatureName::DepthClamping: return Feature::DepthClamping; - case wgpu::FeatureName::Depth24UnormStencil8: - return Feature::Depth24UnormStencil8; case wgpu::FeatureName::Depth32FloatStencil8: return Feature::Depth32FloatStencil8; case wgpu::FeatureName::IndirectFirstInstance: @@ -143,8 +138,6 @@ wgpu::FeatureName ToAPIFeature(Feature feature) { return wgpu::FeatureName::DepthClipControl; case Feature::DepthClamping: return wgpu::FeatureName::DepthClamping; - case Feature::Depth24UnormStencil8: - return wgpu::FeatureName::Depth24UnormStencil8; case Feature::Depth32FloatStencil8: return wgpu::FeatureName::Depth32FloatStencil8; case Feature::IndirectFirstInstance: diff --git a/src/dawn/native/Features.h b/src/dawn/native/Features.h index 4846b03e9c..e3913f1b07 100644 --- a/src/dawn/native/Features.h +++ b/src/dawn/native/Features.h @@ -35,7 +35,6 @@ enum class Feature { TimestampQuery, DepthClipControl, DepthClamping, - Depth24UnormStencil8, Depth32FloatStencil8, ChromiumExperimentalDp4a, IndirectFirstInstance, diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp index f1b4cb87ce..b6553df885 100644 --- a/src/dawn/native/Format.cpp +++ b/src/dawn/native/Format.cpp @@ -403,9 +403,6 @@ FormatTable BuildFormatTable(const DeviceBase* device) { AddDepthFormat(wgpu::TextureFormat::Depth24Plus, 4, true); AddMultiAspectFormat(wgpu::TextureFormat::Depth24PlusStencil8, Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, true, true, 2); - bool isD24S8Supported = device->IsFeatureEnabled(Feature::Depth24UnormStencil8); - AddMultiAspectFormat(wgpu::TextureFormat::Depth24UnormStencil8, - Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, isD24S8Supported, true, 2); AddDepthFormat(wgpu::TextureFormat::Depth32Float, 4, true); bool isD32S8Supported = device->IsFeatureEnabled(Feature::Depth32FloatStencil8); AddMultiAspectFormat(wgpu::TextureFormat::Depth32FloatStencil8, @@ -480,7 +477,8 @@ FormatTable BuildFormatTable(const DeviceBase* device) { // clang-format on // This checks that each format is set at least once, the second part of checking that all - // formats are checked exactly once. + // formats are checked exactly once. If this assertion is failing and texture formats have been + // added or removed recently, check that kKnownFormatCount has been updated. ASSERT(formatsSet.all()); return table; diff --git a/src/dawn/native/Format.h b/src/dawn/native/Format.h index 8f750da25b..e192a2ce83 100644 --- a/src/dawn/native/Format.h +++ b/src/dawn/native/Format.h @@ -79,7 +79,7 @@ struct AspectInfo { // The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the // exact number of known format. -static constexpr uint32_t kKnownFormatCount = 96; +static constexpr uint32_t kKnownFormatCount = 95; using FormatIndex = TypedInteger; diff --git a/src/dawn/native/d3d12/AdapterD3D12.cpp b/src/dawn/native/d3d12/AdapterD3D12.cpp index fdcfd13ac1..6d79d21498 100644 --- a/src/dawn/native/d3d12/AdapterD3D12.cpp +++ b/src/dawn/native/d3d12/AdapterD3D12.cpp @@ -135,7 +135,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() { mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC); mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery); mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats); - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8); mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp index 0cc6e3d753..06518b8808 100644 --- a/src/dawn/native/d3d12/TextureD3D12.cpp +++ b/src/dawn/native/d3d12/TextureD3D12.cpp @@ -176,9 +176,9 @@ DXGI_FORMAT D3D12TypelessTextureFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::Depth24Plus: return DXGI_FORMAT_R32_TYPELESS; - // Depth24UnormStencil8 is the smallest format supported on D3D12 that has stencil. + // DXGI_FORMAT_D24_UNORM_S8_UINT is the smallest format supported on D3D12 that has stencil, + // for which the typeless equivalent is DXGI_FORMAT_R24G8_TYPELESS. case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DXGI_FORMAT_R24G8_TYPELESS; case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: @@ -344,9 +344,8 @@ DXGI_FORMAT D3D12TextureFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::Depth32Float: case wgpu::TextureFormat::Depth24Plus: return DXGI_FORMAT_D32_FLOAT; - // Depth24UnormStencil8 is the smallest format supported on D3D12 that has stencil. + // DXGI_FORMAT_D24_UNORM_S8_UINT is the smallest format supported on D3D12 that has stencil. case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DXGI_FORMAT_D24_UNORM_S8_UINT; case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: @@ -689,7 +688,6 @@ DXGI_FORMAT Texture::GetD3D12CopyableSubresourceFormat(Aspect aspect) const { ASSERT(GetFormat().aspects & aspect); switch (GetFormat().format) { - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: @@ -1210,8 +1208,7 @@ TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* desc case wgpu::TextureFormat::Depth16Unorm: mSrvDesc.Format = DXGI_FORMAT_R16_UNORM; break; - case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: { + case wgpu::TextureFormat::Stencil8: { Aspect aspects = SelectFormatAspects(textureFormat, descriptor->aspect); ASSERT(aspects != Aspect::None); if (!HasZeroOrOneBits(aspects)) { diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index 58d37ea87d..e2ee07fbfb 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm @@ -384,13 +384,6 @@ class Adapter : public AdapterBase { mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats); } -#if DAWN_PLATFORM_IS(MACOS) - // MTLPixelFormatDepth24Unorm_Stencil8 is only available on macOS 10.11+ - if ([*mDevice isDepth24Stencil8PixelFormatSupported]) { - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); - } -#endif - mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); return {}; diff --git a/src/dawn/native/metal/TextureMTL.mm b/src/dawn/native/metal/TextureMTL.mm index 06e525b1f5..a508b656bf 100644 --- a/src/dawn/native/metal/TextureMTL.mm +++ b/src/dawn/native/metal/TextureMTL.mm @@ -318,9 +318,6 @@ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format) { return MTLPixelFormatStencil8; #if DAWN_PLATFORM_IS(MACOS) - case wgpu::TextureFormat::Depth24UnormStencil8: - return MTLPixelFormatDepth24Unorm_Stencil8; - case wgpu::TextureFormat::BC1RGBAUnorm: return MTLPixelFormatBC1_RGBA; case wgpu::TextureFormat::BC1RGBAUnormSrgb: @@ -350,8 +347,6 @@ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::BC7RGBAUnormSrgb: return MTLPixelFormatBC7_RGBAUnorm_sRGB; #else - case wgpu::TextureFormat::Depth24UnormStencil8: - case wgpu::TextureFormat::BC1RGBAUnorm: case wgpu::TextureFormat::BC1RGBAUnormSrgb: case wgpu::TextureFormat::BC2RGBAUnorm: @@ -1066,11 +1061,6 @@ MaybeError TextureView::Initialize(const TextureViewDescriptor* descriptor) { if (textureFormat == MTLPixelFormatDepth32Float_Stencil8) { viewFormat = MTLPixelFormatX32_Stencil8; } -#if DAWN_PLATFORM_IS(MACOS) - else if (textureFormat == MTLPixelFormatDepth24Unorm_Stencil8) { - viewFormat = MTLPixelFormatX24_Stencil8; - } -#endif else { UNREACHABLE(); } diff --git a/src/dawn/native/opengl/AdapterGL.cpp b/src/dawn/native/opengl/AdapterGL.cpp index b3be547286..eca46c1ed5 100644 --- a/src/dawn/native/opengl/AdapterGL.cpp +++ b/src/dawn/native/opengl/AdapterGL.cpp @@ -231,7 +231,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() { supportsBPTC) { mSupportedFeatures.EnableFeature(dawn::native::Feature::TextureCompressionBC); } - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); } // Non-zero baseInstance requires at least desktop OpenGL 4.2, and it is not supported in diff --git a/src/dawn/native/opengl/GLFormat.cpp b/src/dawn/native/opengl/GLFormat.cpp index 6fbca79728..529cc35add 100644 --- a/src/dawn/native/opengl/GLFormat.cpp +++ b/src/dawn/native/opengl/GLFormat.cpp @@ -92,7 +92,6 @@ GLFormatTable BuildGLFormatTable(GLenum internalFormatForBGRA) { // Depth stencil formats AddFormat(wgpu::TextureFormat::Depth32Float, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth24Plus, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, Type::DepthStencil); - AddFormat(wgpu::TextureFormat::Depth24UnormStencil8, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth24PlusStencil8, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth16Unorm, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Stencil8, GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE, Type::DepthStencil); diff --git a/src/dawn/native/opengl/UtilsGL.cpp b/src/dawn/native/opengl/UtilsGL.cpp index e35b9a14aa..d5dd34d5e4 100644 --- a/src/dawn/native/opengl/UtilsGL.cpp +++ b/src/dawn/native/opengl/UtilsGL.cpp @@ -48,7 +48,6 @@ GLuint ToOpenGLCompareFunction(wgpu::CompareFunction compareFunction) { GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) { switch (depthStencilFormat) { case wgpu::TextureFormat::Depth24PlusStencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 0xFF; diff --git a/src/dawn/native/vulkan/AdapterVk.cpp b/src/dawn/native/vulkan/AdapterVk.cpp index 820325d949..39abd6a7cd 100644 --- a/src/dawn/native/vulkan/AdapterVk.cpp +++ b/src/dawn/native/vulkan/AdapterVk.cpp @@ -155,10 +155,6 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() { mSupportedFeatures.EnableFeature(Feature::TimestampQuery); } - if (IsDepthStencilFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT)) { - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); - } - if (IsDepthStencilFormatSupported(VK_FORMAT_D32_SFLOAT_S8_UINT)) { mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8); } diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index 404815dca5..da74315d5d 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -314,8 +314,6 @@ VkFormat VulkanImageFormat(const Device* device, wgpu::TextureFormat format) { } else { return VK_FORMAT_D24_UNORM_S8_UINT; } - case wgpu::TextureFormat::Depth24UnormStencil8: - return VK_FORMAT_D24_UNORM_S8_UINT; case wgpu::TextureFormat::Depth32FloatStencil8: return VK_FORMAT_D32_SFLOAT_S8_UINT; case wgpu::TextureFormat::Stencil8: diff --git a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp index d22d0ff0c4..413cb08ce3 100644 --- a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp @@ -63,12 +63,6 @@ class DepthStencilCopyTests : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; diff --git a/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp b/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp index 0c61f20b25..2e8af0353b 100644 --- a/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp @@ -98,12 +98,6 @@ class DepthStencilLoadOpTests : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -267,8 +261,7 @@ auto GenerateParam() { auto params2 = MakeParamGenerator( {D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, - {wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureFormat::Depth32FloatStencil8}, + {wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth32FloatStencil8}, {Check::CopyStencil, Check::StencilTest, Check::DepthTest, Check::SampleDepth}); std::vector allParams; @@ -322,7 +315,6 @@ DAWN_INSTANTIATE_TEST_P(StencilClearValueOverflowTest, {D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, {wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8}, {Check::CopyStencil, Check::StencilTest}); diff --git a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp index 02d80ee545..7f13f16f85 100644 --- a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp @@ -62,12 +62,6 @@ class DepthStencilSamplingTest : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -610,10 +604,6 @@ TEST_P(DepthStencilSamplingTest, SampleExtraComponents) { wgpu::TextureFormat format = GetParam().mTextureFormat; - // TODO(crbug.com/dawn/1239): depth24unorm-stencil8 fails on D3D12 Nvidia old driver version. - DAWN_SUPPRESS_TEST_IF(format == wgpu::TextureFormat::Depth24UnormStencil8 && IsD3D12() && - IsNvidia()); - DoSamplingExtraStencilComponentsRenderTest(TestAspect::Stencil, format, {uint8_t(42), uint8_t(37)}); @@ -636,8 +626,6 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) { wgpu::TextureViewDescriptor stencilViewDesc = {}; stencilViewDesc.aspect = wgpu::TextureAspect::StencilOnly; - float tolerance = format == wgpu::TextureFormat::Depth24UnormStencil8 ? 0.001f : 0.0f; - // With render pipeline { wgpu::RenderPipeline pipeline = @@ -683,8 +671,7 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) { float expectedDepth = 0.0f; memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.depthClearValue, sizeof(float)); - EXPECT_BUFFER(depthOutput, 0, sizeof(float), - new ::detail::ExpectEq(expectedDepth, tolerance)); + EXPECT_BUFFER(depthOutput, 0, sizeof(float), new ::detail::ExpectEq(expectedDepth)); uint8_t expectedStencil = 0; memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue, @@ -731,8 +718,7 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) { float expectedDepth = 0.0f; memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.depthClearValue, sizeof(float)); - EXPECT_BUFFER(depthOutput, 0, sizeof(float), - new ::detail::ExpectEq(expectedDepth, tolerance)); + EXPECT_BUFFER(depthOutput, 0, sizeof(float), new ::detail::ExpectEq(expectedDepth)); uint8_t expectedStencil = 0; memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue, @@ -746,10 +732,7 @@ class DepthSamplingTest : public DepthStencilSamplingTest {}; // Test that sampling a depth texture with a render/compute pipeline works TEST_P(DepthSamplingTest, SampleDepthOnly) { wgpu::TextureFormat format = GetParam().mTextureFormat; - float tolerance = format == wgpu::TextureFormat::Depth16Unorm || - format == wgpu::TextureFormat::Depth24UnormStencil8 - ? 0.001f - : 0.0f; + float tolerance = format == wgpu::TextureFormat::Depth16Unorm ? 0.001f : 0.0f; // Test 0, between [0, 1], and 1. DoSamplingTest(TestAspect::Depth, CreateSamplingRenderPipeline({TestAspect::Depth}, 0), format, @@ -765,10 +748,8 @@ TEST_P(DepthSamplingTest, CompareFunctionsRender) { DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); wgpu::TextureFormat format = GetParam().mTextureFormat; - // Test does not account for precision issues when comparison testing Depth16Unorm and - // Depth24UnormStencil8. - DAWN_TEST_UNSUPPORTED_IF(format == wgpu::TextureFormat::Depth16Unorm || - format == wgpu::TextureFormat::Depth24UnormStencil8); + // Test does not account for precision issues when comparison testing Depth16Unorm. + DAWN_TEST_UNSUPPORTED_IF(format == wgpu::TextureFormat::Depth16Unorm); wgpu::RenderPipeline pipeline = CreateComparisonRenderPipeline(); diff --git a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp index 2c2ec6558d..25b00e01ce 100644 --- a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp +++ b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp @@ -37,13 +37,6 @@ class ReadOnlyDepthStencilAttachmentTests std::vector GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; diff --git a/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp index a6403d1103..7aedf2fc1a 100644 --- a/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp @@ -422,10 +422,9 @@ class CopyCommandTest_B2T : public CopyCommandTest { protected: WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; + descriptor.requiredFeaturesCount = 1; return dawnAdapter.CreateDevice(&descriptor); } }; @@ -718,12 +717,10 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffsetForColorTexture) { TEST_F(CopyCommandTest_B2T, IncorrectBufferOffsetForDepthStencilTexture) { // TODO(dawn:570, dawn:666): List other valid parameters after missing texture formats // are implemented, e.g. Stencil8. - std::array, 5> params = { + std::array, 4> params = { std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::All), std::make_tuple(wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureAspect::StencilOnly), - std::make_tuple(wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::StencilOnly), }; @@ -893,9 +890,10 @@ TEST_F(CopyCommandTest_B2T, CopyToDepthAspect) { } } - constexpr std::array kDisallowBufferToDepthCopyFormats = { - wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, - wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth24UnormStencil8, + constexpr std::array kDisallowBufferToDepthCopyFormats = { + wgpu::TextureFormat::Depth32Float, + wgpu::TextureFormat::Depth24Plus, + wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth32FloatStencil8, }; @@ -1032,10 +1030,9 @@ class CopyCommandTest_T2B : public CopyCommandTest { protected: WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; + descriptor.requiredFeaturesCount = 1; return dawnAdapter.CreateDevice(&descriptor); } }; @@ -1354,14 +1351,12 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffsetForColorTexture) { TEST_F(CopyCommandTest_T2B, IncorrectBufferOffsetForDepthStencilTexture) { // TODO(dawn:570, dawn:666): List other valid parameters after missing texture formats // are implemented, e.g. Stencil8. - std::array, 8> params = { + std::array, 7> params = { std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::All), std::make_tuple(wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32Float, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth32Float, wgpu::TextureAspect::All), - std::make_tuple(wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::StencilOnly), @@ -1538,9 +1533,10 @@ TEST_F(CopyCommandTest_T2B, CopyFromDepthAspect) { } } - constexpr std::array kDisallowDepthCopyFormats = { - wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8}; + constexpr std::array kDisallowDepthCopyFormats = { + wgpu::TextureFormat::Depth24Plus, + wgpu::TextureFormat::Depth24PlusStencil8, + }; for (wgpu::TextureFormat format : kDisallowDepthCopyFormats) { { wgpu::Texture source = @@ -1671,10 +1667,9 @@ class CopyCommandTest_T2T : public CopyCommandTest { protected: WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; + descriptor.requiredFeaturesCount = 1; return dawnAdapter.CreateDevice(&descriptor); } diff --git a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp index a4da293325..56594239f6 100644 --- a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp @@ -663,14 +663,6 @@ TEST_F(TextureValidationTest, TextureFormatUndefined) { ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); } -// Test that the creation of a texture with depth24unorm-stencil8 will fail when the feature -// Depth24UnormStencil8 is not enabled. -TEST_F(TextureValidationTest, UseD24S8FormatWithoutEnablingFeature) { - wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); - descriptor.format = wgpu::TextureFormat::Depth24UnormStencil8; - ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); -} - // Test that the creation of a texture with depth32float-stencil8 will fail when the feature // Depth32FloatStencil8 is not enabled. TEST_F(TextureValidationTest, UseD32S8FormatWithoutEnablingFeature) { @@ -709,28 +701,6 @@ TEST_F(TextureValidationTest, UseASTCFormatWithoutEnablingFeature) { } } -class D24S8TextureFormatsValidationTests : public TextureValidationTest { - protected: - WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { - wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth24UnormStencil8}; - descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 1; - return dawnAdapter.CreateDevice(&descriptor); - } -}; - -// Test that depth24unorm-stencil8 format is invalid for 3D texture -TEST_F(D24S8TextureFormatsValidationTests, DepthStencilFormatsFor3D) { - wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); - - for (wgpu::TextureDimension dimension : kDimensions) { - descriptor.format = wgpu::TextureFormat::Depth24UnormStencil8; - descriptor.dimension = dimension; - ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); - } -} - class D32S8TextureFormatsValidationTests : public TextureValidationTest { protected: WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { diff --git a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp index dd2eeae604..244e615065 100644 --- a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp @@ -746,15 +746,6 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) { ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc)); } - // Regression test for crbug.com/1312780. - // viewFormat is not supported (Null backend does not support any optional features). - { - textureDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; - viewDesc.format = wgpu::TextureFormat::Depth24UnormStencil8; - wgpu::Texture texture = device.CreateTexture(&textureDesc); - ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc), testing::HasSubstr("Unsupported")); - } - // It is valid to create a texture view with a depth format of a depth-stencil texture // if the depth only aspect is selected. { @@ -923,52 +914,6 @@ TEST_F(TextureViewValidationTest, AspectMustExist) { } } -class D24S8TextureViewValidationTests : public ValidationTest { - protected: - WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { - wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth24UnormStencil8}; - descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 1; - return dawnAdapter.CreateDevice(&descriptor); - } -}; - -// Test that the selected TextureAspects must exist in the Depth24UnormStencil8 texture format -TEST_F(D24S8TextureViewValidationTests, AspectMustExist) { - wgpu::Texture texture = - CreateDepthStencilTexture(device, wgpu::TextureFormat::Depth24UnormStencil8); - - // Can select: All, DepthOnly, and StencilOnly from Depth24UnormStencil8 - { - wgpu::TextureViewDescriptor viewDescriptor = {}; - viewDescriptor.aspect = wgpu::TextureAspect::All; - texture.CreateView(&viewDescriptor); - - viewDescriptor.aspect = wgpu::TextureAspect::DepthOnly; - texture.CreateView(&viewDescriptor); - - viewDescriptor.aspect = wgpu::TextureAspect::StencilOnly; - texture.CreateView(&viewDescriptor); - } -} - -// Test the format compatibility rules when creating a texture view. -TEST_F(D24S8TextureViewValidationTests, TextureViewFormatCompatibility) { - wgpu::Texture texture = - CreateDepthStencilTexture(device, wgpu::TextureFormat::Depth24UnormStencil8); - - wgpu::TextureViewDescriptor base2DTextureViewDescriptor = - CreateDefaultViewDescriptor(wgpu::TextureViewDimension::e2D); - - // It is an error to create a texture view in color format on a depth-stencil texture. - { - wgpu::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; - descriptor.format = wgpu::TextureFormat::RGBA8Unorm; - ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor)); - } -} - class D32S8TextureViewValidationTests : public ValidationTest { protected: WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { diff --git a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp index a39fe4dee7..029348b997 100644 --- a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp +++ b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp @@ -198,7 +198,7 @@ TEST_F(WireInstanceTests, RequestAdapterWireLacksFeatureSupport) { instance.RequestAdapter(&options, cb.Callback(), userdata); std::initializer_list fakeFeatures = { - wgpu::FeatureName::Depth24UnormStencil8, + wgpu::FeatureName::Depth32FloatStencil8, // Some value that is not a valid feature static_cast(-2), }; @@ -246,7 +246,7 @@ TEST_F(WireInstanceTests, RequestAdapterWireLacksFeatureSupport) { ASSERT_EQ(adapter.EnumerateFeatures(nullptr), 1u); adapter.EnumerateFeatures(&feature); - EXPECT_EQ(feature, wgpu::FeatureName::Depth24UnormStencil8); + EXPECT_EQ(feature, wgpu::FeatureName::Depth32FloatStencil8); }))); FlushServer(); } diff --git a/src/dawn/utils/TextureUtils.cpp b/src/dawn/utils/TextureUtils.cpp index f0c4505e6c..f11d724ff7 100644 --- a/src/dawn/utils/TextureUtils.cpp +++ b/src/dawn/utils/TextureUtils.cpp @@ -272,7 +272,6 @@ uint32_t GetTexelBlockSizeInBytes(wgpu::TextureFormat textureFormat) { return 2u; case wgpu::TextureFormat::Depth24Plus: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32Float: return 4u; @@ -392,7 +391,6 @@ uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth16Unorm: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 1u; @@ -509,7 +507,6 @@ uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth16Unorm: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 1u; diff --git a/src/dawn/utils/TextureUtils.h b/src/dawn/utils/TextureUtils.h index f92b19b518..80fecabfdb 100644 --- a/src/dawn/utils/TextureUtils.h +++ b/src/dawn/utils/TextureUtils.h @@ -63,7 +63,6 @@ static constexpr std::array kAllTextureFormats = { wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8, wgpu::TextureFormat::BC1RGBAUnorm, @@ -206,20 +205,18 @@ static_assert(kCompressedFormats.size() == kBCFormats.size() + kETC2Formats.size() + kASTCFormats.size(), "Number of compressed format must equal number of BC, ETC2, and ASTC formats."); -static constexpr std::array kDepthFormats = { +static constexpr std::array kDepthFormats = { wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, + wgpu::TextureFormat::Depth32FloatStencil8, }; -static constexpr std::array kStencilFormats = { +static constexpr std::array kStencilFormats = { wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8, }; -static constexpr std::array kDepthAndStencilFormats = { +static constexpr std::array kDepthAndStencilFormats = { wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, }; diff --git a/src/dawn/wire/SupportedFeatures.cpp b/src/dawn/wire/SupportedFeatures.cpp index 352ed0f043..3deb1a7c05 100644 --- a/src/dawn/wire/SupportedFeatures.cpp +++ b/src/dawn/wire/SupportedFeatures.cpp @@ -24,7 +24,6 @@ bool IsFeatureSupported(WGPUFeatureName feature) { case WGPUFeatureName_Force32: case WGPUFeatureName_DawnNative: return false; - case WGPUFeatureName_Depth24UnormStencil8: case WGPUFeatureName_Depth32FloatStencil8: case WGPUFeatureName_TimestampQuery: case WGPUFeatureName_PipelineStatisticsQuery: