OpenGL: Simplify lazy clear of render pass attachments

Bug: dawn:145
Change-Id: Ia175ebc5a74f7cc15584b9132e00f9089d5dc5b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Austin Eng
2020-01-16 01:30:30 +00:00
committed by Commit Bot service account
parent 3d97384e16
commit 9652add688
3 changed files with 18 additions and 46 deletions

View File

@@ -299,14 +299,18 @@ namespace dawn_native { namespace opengl {
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
}
if (clearValue == TextureBase::ClearValue::Zero) {
SetIsSubresourceContentInitialized(true, baseMipLevel, levelCount, baseArrayLayer,
layerCount);
device->IncrementLazyClearCountForTesting();
}
return {};
}
void Texture::EnsureSubresourceContentInitialized(uint32_t baseMipLevel,
uint32_t levelCount,
uint32_t baseArrayLayer,
uint32_t layerCount,
bool isLazyClear) {
uint32_t layerCount) {
if (!GetDevice()->IsToggleEnabled(Toggle::LazyClearResourceOnFirstUse)) {
return;
}
@@ -314,11 +318,6 @@ namespace dawn_native { namespace opengl {
layerCount)) {
GetDevice()->ConsumedError(ClearTexture(baseMipLevel, levelCount, baseArrayLayer,
layerCount, TextureBase::ClearValue::Zero));
if (isLazyClear) {
GetDevice()->IncrementLazyClearCountForTesting();
}
SetIsSubresourceContentInitialized(true, baseMipLevel, levelCount, baseArrayLayer,
layerCount);
}
}