Disallow creating stencil textures with multiple mips on Metal

Various aspects with this appear to be broken.

Bug: dawn:838
Change-Id: If706508b90214f9b5f4b2884448f281945295827
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/55560
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Austin Eng 2021-06-23 00:52:09 +00:00 committed by Dawn LUCI CQ
parent 7eb9a189f9
commit 6e673b4b81
1 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "common/Assert.h"
#include "common/Constants.h"
#include "common/Math.h"
#include "dawn_native/Adapter.h"
#include "dawn_native/Device.h"
#include "dawn_native/EnumMaskIterator.h"
#include "dawn_native/PassResourceUsage.h"
@ -289,6 +290,17 @@ namespace dawn_native {
DAWN_TRY(ValidateTextureSize(descriptor, format));
if (device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs) && format->HasStencil() &&
descriptor->mipLevelCount > 1 &&
device->GetAdapter()->GetBackendType() == wgpu::BackendType::Metal) {
// TODO(crbug.com/dawn/838): Implement a workaround for this issue.
// Readbacks from the non-zero mip of a stencil texture may contain
// garbage data.
return DAWN_VALIDATION_ERROR(
"crbug.com/dawn/838: Stencil textures with more than one mip level are "
"disabled on Metal.");
}
return {};
}