mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Make RG11B10 non-renderable.
This also adds the extra validation needed to support non-renderable formats, as well as tests for it BUG=dawn:128 Change-Id: I3bc79b641aa0fd5e3358f89a87f2e457d0ecc58a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8760 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
ea2d558479
commit
002395300f
@@ -161,8 +161,9 @@ namespace dawn_native {
|
||||
case dawn::TextureFormat::BGRA8Unorm:
|
||||
case dawn::TextureFormat::BGRA8UnormSrgb:
|
||||
case dawn::TextureFormat::RGB10A2Unorm:
|
||||
case dawn::TextureFormat::RG11B10Float:
|
||||
return MakeColorFormat(format, true, 4);
|
||||
case dawn::TextureFormat::RG11B10Float:
|
||||
return MakeColorFormat(format, false, 4);
|
||||
|
||||
case dawn::TextureFormat::RG32Uint:
|
||||
case dawn::TextureFormat::RG32Sint:
|
||||
@@ -307,14 +308,19 @@ namespace dawn_native {
|
||||
|
||||
MaybeError ValidateTextureUsage(const TextureDescriptor* descriptor, const Format& format) {
|
||||
DAWN_TRY(ValidateTextureUsageBit(descriptor->usage));
|
||||
if (format.isCompressed) {
|
||||
constexpr dawn::TextureUsageBit kValidUsage = dawn::TextureUsageBit::Sampled |
|
||||
dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::CopyDst;
|
||||
if (descriptor->usage & (~kValidUsage)) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Compressed texture format is incompatible with the texture usage");
|
||||
}
|
||||
|
||||
constexpr dawn::TextureUsageBit kValidCompressedUsages =
|
||||
dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::CopyDst;
|
||||
if (format.isCompressed && (descriptor->usage & (~kValidCompressedUsages))) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Compressed texture format is incompatible with the texture usage");
|
||||
}
|
||||
|
||||
if (!format.isRenderable &&
|
||||
(descriptor->usage & dawn::TextureUsageBit::OutputAttachment)) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Non-renderable format used with OutputAttachment usage");
|
||||
}
|
||||
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user