Use clear loadop to lazy clear depth stencil attachments

Bug: dawn:210, dawn:145
Change-Id: I1eb990266ccd7b51b4a336b0d4d37e0195c6fe69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11020
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Natasha Lee
2019-09-11 22:04:42 +00:00
committed by Commit Bot service account
parent fad96f6e59
commit 01600dfb3d
4 changed files with 71 additions and 39 deletions

View File

@@ -391,12 +391,10 @@ namespace dawn_native { namespace opengl {
auto TransitionForPass = [](const PassResourceUsage& usages) {
for (size_t i = 0; i < usages.textures.size(); i++) {
Texture* texture = ToBackend(usages.textures[i]);
// We count the lazy clears for non output attachment textures and depth stencil
// textures in order to match the backdoor lazy clear counts in Vulkan and D3D12.
// We count the lazy clears for non output attachment textures in order to match the
// backdoor lazy clear counts in Vulkan and D3D12.
bool isLazyClear =
((!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment) &&
texture->GetFormat().IsColor()) ||
texture->GetFormat().HasDepthOrStencil());
!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment);
texture->EnsureSubresourceContentInitialized(
0, texture->GetNumMipLevels(), 0, texture->GetArrayLayers(), isLazyClear);
}