1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-23 19:54:16 +01:00

[dxvk] Don't transition image layout in clearImageViewCs unless necessary

This commit is contained in:
Philip Rebohle 2025-02-17 01:11:33 +01:00
parent 6d9e0baa27
commit 9389a0ca96

View File

@ -3879,10 +3879,14 @@ namespace dxvk {
str::format("Clear view (", dstName ? dstName : "unknown", ")").c_str()));
}
addImageLayoutTransition(*imageView->image(), imageView->imageSubresources(),
VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_WRITE_BIT,
imageView->image()->isFullSubresource(vk::pickSubresourceLayers(imageView->imageSubresources(), 0), extent));
flushImageLayoutTransitions(cmdBuffer);
// Avoid inserting useless barriers if the image is already in the correct layout
if (imageView->image()->info().layout != VK_IMAGE_LAYOUT_GENERAL
|| !imageView->image()->isInitialized(imageView->imageSubresources())) {
addImageLayoutTransition(*imageView->image(), imageView->imageSubresources(),
VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_WRITE_BIT,
imageView->image()->isFullSubresource(vk::pickSubresourceLayers(imageView->imageSubresources(), 0), extent));
flushImageLayoutTransitions(cmdBuffer);
}
// Query pipeline objects to use for this clear operation
DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearImagePipeline(