mirror of https://github.com/PCSX2/pcsx2.git
GS/Vulkan: Prevent transition back to Undefined layout
This commit is contained in:
parent
b15102d45a
commit
0678bb03d7
|
@ -342,7 +342,9 @@ void GSTextureVK::UpdateFromBuffer(VkCommandBuffer cmdbuf, int level, u32 x, u32
|
|||
u32 buffer_height, u32 row_length, VkBuffer buffer, u32 buffer_offset)
|
||||
{
|
||||
const Layout old_layout = m_layout;
|
||||
if (old_layout != Layout::TransferDst)
|
||||
if (old_layout == Layout::Undefined)
|
||||
TransitionToLayout(cmdbuf, Layout::TransferDst);
|
||||
else if (old_layout != Layout::TransferDst)
|
||||
TransitionSubresourcesToLayout(cmdbuf, level, 1, old_layout, Layout::TransferDst);
|
||||
|
||||
const VkBufferImageCopy bic = {static_cast<VkDeviceSize>(buffer_offset), row_length, buffer_height,
|
||||
|
@ -351,7 +353,7 @@ void GSTextureVK::UpdateFromBuffer(VkCommandBuffer cmdbuf, int level, u32 x, u32
|
|||
|
||||
vkCmdCopyBufferToImage(cmdbuf, buffer, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &bic);
|
||||
|
||||
if (old_layout != Layout::TransferDst)
|
||||
if (old_layout != Layout::TransferDst && old_layout != Layout::Undefined)
|
||||
TransitionSubresourcesToLayout(cmdbuf, level, 1, Layout::TransferDst, old_layout);
|
||||
}
|
||||
|
||||
|
@ -499,6 +501,9 @@ void GSTextureVK::GenerateMipmap()
|
|||
{
|
||||
const VkCommandBuffer cmdbuf = GetCommandBufferForUpdate();
|
||||
|
||||
if (m_layout == Layout::Undefined)
|
||||
TransitionToLayout(cmdbuf, Layout::TransferSrc);
|
||||
|
||||
for (int dst_level = 1; dst_level < m_mipmap_levels; dst_level++)
|
||||
{
|
||||
const int src_level = dst_level - 1;
|
||||
|
@ -885,7 +890,9 @@ void GSDownloadTextureVK::CopyFromTexture(
|
|||
GL_INS("GSDownloadTextureVK::CopyFromTexture: {%d,%d} %ux%u", src.left, src.top, src.width(), src.height());
|
||||
|
||||
GSTextureVK::Layout old_layout = vkTex->GetLayout();
|
||||
if (old_layout != GSTextureVK::Layout::TransferSrc)
|
||||
if (old_layout == GSTextureVK::Layout::Undefined)
|
||||
vkTex->TransitionToLayout(cmdbuf, GSTextureVK::Layout::TransferSrc);
|
||||
else if (old_layout != GSTextureVK::Layout::TransferSrc)
|
||||
vkTex->TransitionSubresourcesToLayout(cmdbuf, src_level, 1, old_layout, GSTextureVK::Layout::TransferSrc);
|
||||
|
||||
VkBufferImageCopy image_copy = {};
|
||||
|
@ -915,7 +922,7 @@ void GSDownloadTextureVK::CopyFromTexture(
|
|||
vkCmdPipelineBarrier(
|
||||
cmdbuf, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0, 0, nullptr, 1, &buffer_info, 0, nullptr);
|
||||
|
||||
if (old_layout != GSTextureVK::Layout::TransferSrc)
|
||||
if (old_layout != GSTextureVK::Layout::TransferSrc && old_layout != GSTextureVK::Layout::Undefined)
|
||||
vkTex->TransitionSubresourcesToLayout(cmdbuf, src_level, 1, GSTextureVK::Layout::TransferSrc, old_layout);
|
||||
|
||||
m_copy_fence_counter = GSDeviceVK::GetInstance()->GetCurrentFenceCounter();
|
||||
|
|
Loading…
Reference in New Issue