1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Optimize ClearView for render target and depth-only views

We should use clearRenderTarget whenever we clear the entire view.
The Talos Principle uses ClearView to clear its render targets for
some reason, and we were hitting a slow path there.
This commit is contained in:
Philip Rebohle 2020-04-22 21:01:19 +02:00
parent 6b6347ea2c
commit b3c19ba5e8
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1082,14 +1082,25 @@ namespace dxvk {
cClearAspect = clearAspect,
cClearValue = clearValue
] (DxvkContext* ctx) {
const VkImageUsageFlags rtUsage =
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
VkOffset3D offset = { 0, 0, 0 };
VkExtent3D extent = cImageView->mipLevelExtent(0);
if (cImageView->info().usage & rtUsage) {
ctx->clearRenderTarget(
cImageView,
cClearAspect,
cClearValue);
} else {
ctx->clearImageView(
cImageView,
offset, extent,
cClearAspect,
cClearValue);
}
});
}
}