Metal: Fix clearing of subresource mipmaps.
On Intel the lazy-clearing optimization that bundled multiple subresources at once to lazy-clear failed when multiple different mip-levels were bundled together. The rendering was "clipped" to the size of the smalled miplevel, resulting in some mip levels not being fully cleared. Bug: Change-Id: Icfafbeae25bd426119a0b499237052c87eafe93e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22341 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
454c699d47
commit
da6dccd7c5
|
@ -421,12 +421,13 @@ namespace dawn_native { namespace metal {
|
|||
}
|
||||
} else {
|
||||
ASSERT(GetFormat().IsColor());
|
||||
for (uint32_t level = baseMipLevel; level < baseMipLevel + levelCount; ++level) {
|
||||
// Create multiple render passes with each subresource as a color attachment to
|
||||
// clear them all. Only do this for array layers to ensure all attachments have
|
||||
// the same size.
|
||||
MTLRenderPassDescriptor* descriptor = nil;
|
||||
uint32_t attachment = 0;
|
||||
|
||||
// Create multiple render passes with each subresource as a color attachment to
|
||||
// clear them all.
|
||||
for (uint32_t level = baseMipLevel; level < baseMipLevel + levelCount; ++level) {
|
||||
for (uint32_t arrayLayer = baseArrayLayer;
|
||||
arrayLayer < baseArrayLayer + layerCount; arrayLayer++) {
|
||||
if (clearValue == TextureBase::ClearValue::Zero &&
|
||||
|
@ -456,13 +457,13 @@ namespace dawn_native { namespace metal {
|
|||
descriptor = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (descriptor != nil) {
|
||||
commandContext->BeginRender(descriptor);
|
||||
commandContext->EndRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Compute the buffer size big enough to fill the largest mip.
|
||||
Extent3D largestMipSize = GetMipLevelVirtualSize(baseMipLevel);
|
||||
|
|
Loading…
Reference in New Issue