mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Fix a bug about depth/stencil formats validation
Depth/stencil formats are invalid for 1D and 3D texture. This change adds this validation rule, and adds a validation test for it. Bug: dawn:730 Change-Id: Idac6d1bf7b8c7261eb7b4b59504de10e13d049cc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47200 Commit-Queue: Yunchao He <yunchao.he@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
e190045664
commit
71f3d58939
@@ -304,6 +304,7 @@ namespace dawn_native {
|
||||
// because its size isn't well defined, is it 4, 5 or 8?
|
||||
AddMultiAspectFormat(wgpu::TextureFormat::Depth24PlusStencil8,
|
||||
Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, true);
|
||||
// TODO(dawn:690): Implement Depth16Unorm, Depth24UnormStencil8, Depth32FloatStencil8.
|
||||
|
||||
// BC compressed formats
|
||||
bool isBCFormatSupported = device->IsExtensionEnabled(Extension::TextureCompressionBC);
|
||||
|
||||
@@ -301,6 +301,13 @@ namespace dawn_native {
|
||||
return DAWN_VALIDATION_ERROR("Compressed texture must be 2D");
|
||||
}
|
||||
|
||||
// Depth/stencil formats are valid for 2D textures only. Metal has this limit. And D3D12
|
||||
// doesn't support depth/stencil formats on 3D textures.
|
||||
if (descriptor->dimension != wgpu::TextureDimension::e2D &&
|
||||
(format->aspects & (Aspect::Depth | Aspect::Stencil)) != 0) {
|
||||
return DAWN_VALIDATION_ERROR("Depth/stencil formats are valid for 2D textures only");
|
||||
}
|
||||
|
||||
DAWN_TRY(ValidateTextureSize(descriptor, format));
|
||||
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user