Vulkan: Skip zero-size readback buffer barriers (#1929)

This commit is contained in:
oltolm 2026-05-28 13:04:46 +02:00 committed by GitHub
parent ca15637b63
commit a02ba9d82b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -21,6 +21,8 @@ void LatteTextureReadback_StartTransfer(LatteTextureView* textureView)
HRTick currentTick = HighResolutionTimer().now().getTick();
// create info entry and store in ordered linked list
LatteTextureReadbackInfo* readbackInfo = g_renderer->texture_createReadback(textureView);
if (!readbackInfo)
return;
sTextureActiveReadbackQueue.push(readbackInfo);
readbackInfo->StartTransfer();
readbackInfo->transferStartTime = currentTick;

View File

@ -3670,14 +3670,14 @@ void VulkanRenderer::texture_copyImageSubData(LatteTexture* src, sint32 srcMip,
LatteTextureReadbackInfo* VulkanRenderer::texture_createReadback(LatteTextureView* textureView)
{
auto* result = new LatteTextureReadbackInfoVk(m_logicalDevice, textureView);
LatteTextureVk* vkTex = (LatteTextureVk*)textureView->baseTexture;
VkMemoryRequirements memRequirements;
vkGetImageMemoryRequirements(m_logicalDevice, vkTex->GetImageObj()->m_image, &memRequirements);
const uint32 linearImageSize = result->GetImageSize();
const uint32 uploadSize = (linearImageSize == 0) ? memRequirements.size : linearImageSize;
if (linearImageSize == 0)
{
delete result;
return nullptr;
}
const uint32 uploadSize = linearImageSize;
const uint32 uploadAlignment = 256; // todo - use Vk optimalBufferCopyOffsetAlignment
m_textureReadbackBufferWriteIndex = (m_textureReadbackBufferWriteIndex + uploadAlignment - 1) & ~(uploadAlignment - 1);