Fix fuzzer error when an error texture is used with implicit MSAA
Bug: 342255901
Change-Id: I1cc321bf98e97c0598ff9b5d1c69fcc8e502526b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/189481
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp
index f4e3bc6..b3c24cd 100644
--- a/src/dawn/native/CommandEncoder.cpp
+++ b/src/dawn/native/CommandEncoder.cpp
@@ -523,6 +523,10 @@
return {};
}
+ DAWN_TRY(device->ValidateObject(attachment));
+ DAWN_TRY(ValidateCanUseAs(attachment->GetTexture(), wgpu::TextureUsage::RenderAttachment,
+ usageValidationMode));
+
UnpackedPtr<RenderPassColorAttachment> unpacked;
DAWN_TRY_ASSIGN(unpacked, ValidateAndUnpack(&colorAttachment));
@@ -537,10 +541,6 @@
// ValidateOrSetColorAttachmentSampleCount.
}
- DAWN_TRY(device->ValidateObject(attachment));
- DAWN_TRY(ValidateCanUseAs(attachment->GetTexture(), wgpu::TextureUsage::RenderAttachment,
- usageValidationMode));
-
// Plane0, Plane1, and Plane2 aspects for multiplanar texture views should be allowed as color
// attachments.
Aspect kRenderableAspects = Aspect::Color | Aspect::Plane0 | Aspect::Plane1 | Aspect::Plane2;