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

[dxvk] Use new layout transition helper in generateMipmaps

This commit is contained in:
Philip Rebohle 2024-10-10 17:54:11 +02:00 committed by Philip Rebohle
parent ef79f8a617
commit c24be65f2a

View File

@ -1292,28 +1292,17 @@ namespace dxvk {
VkImageLayout srcLayout = imageView->pickLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); VkImageLayout srcLayout = imageView->pickLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
// If necessary, transition first mip level to the read-only layout // If necessary, transition first mip level to the read-only layout
if (imageView->image()->info().layout != srcLayout) { addImageLayoutTransition(*imageView->image(),
m_execAcquires.accessImage(imageView->image(), mipGenerator.getTopSubresource(), srcLayout,
mipGenerator.getTopSubresource(), VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT,
imageView->image()->info().layout, VK_ACCESS_2_SHADER_READ_BIT, false);
imageView->image()->info().stages, 0,
srcLayout,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT);
}
// If necessary, initialize all levels that are written to addImageLayoutTransition(*imageView->image(),
if (imageView->image()->info().layout != dstLayout) { mipGenerator.getAllTargetSubresources(), dstLayout,
m_execAcquires.accessImage(imageView->image(), VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT,
mipGenerator.getAllTargetSubresources(), VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT, true);
VK_IMAGE_LAYOUT_UNDEFINED,
imageView->image()->info().stages, 0,
dstLayout,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
}
m_execAcquires.recordCommands(m_cmd); flushImageLayoutTransitions(DxvkCmdBuffer::ExecBuffer);
// Common descriptor set properties that we use to // Common descriptor set properties that we use to
// bind the source image view to the fragment shader // bind the source image view to the fragment shader
@ -1378,15 +1367,14 @@ namespace dxvk {
pushConstants.layerCount = passExtent.depth; pushConstants.layerCount = passExtent.depth;
if (i) { if (i) {
m_execAcquires.accessImage(imageView->image(), addImageLayoutTransition(*imageView->image(),
mipGenerator.getSourceSubresource(i), mipGenerator.getSourceSubresource(i), dstLayout,
dstLayout, VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT, srcLayout,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT,
srcLayout, VK_ACCESS_2_SHADER_READ_BIT);
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT); flushImageLayoutTransitions(DxvkCmdBuffer::ExecBuffer);
m_execAcquires.recordCommands(m_cmd);
} }
m_cmd->cmdBeginRendering(&renderingInfo); m_cmd->cmdBeginRendering(&renderingInfo);