Ensure clearing attachments is done via renderpass loadop

Clear through loadop instead of standalone clear operation to optimize
efficiency on modern desktop GPUs and mobile GPUs.

Removed clear calls in TransitionForPass for render pass
to help optimize clearing using loadop instead.
Compute pass textures and sampled textures are still cleared in transition.

Bug: dawn:145
Change-Id: I84082bdea3ed7be75683389132d8b296051731b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8641
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
Natasha Lee
2019-08-09 17:56:30 +00:00
committed by Commit Bot service account
parent ebb05399c0
commit 8cb23933b1
6 changed files with 71 additions and 32 deletions

View File

@@ -221,20 +221,24 @@ namespace dawn_native { namespace opengl {
nullptr);
}
}
SetIsSubresourceContentInitialized(baseMipLevel, levelCount, baseArrayLayer, layerCount);
GetDevice()->IncrementLazyClearCountForTesting();
}
void Texture::EnsureSubresourceContentInitialized(uint32_t baseMipLevel,
uint32_t levelCount,
uint32_t baseArrayLayer,
uint32_t layerCount) {
uint32_t layerCount,
bool isLazyClear) {
if (!GetDevice()->IsToggleEnabled(Toggle::LazyClearResourceOnFirstUse)) {
return;
}
if (!IsSubresourceContentInitialized(baseMipLevel, levelCount, baseArrayLayer,
layerCount)) {
ClearTexture(baseMipLevel, levelCount, baseArrayLayer, layerCount);
if (isLazyClear) {
GetDevice()->IncrementLazyClearCountForTesting();
}
SetIsSubresourceContentInitialized(baseMipLevel, levelCount, baseArrayLayer,
layerCount);
}
}