From c9ee880196b75513dc43e34ccbdd5300f326af07 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 6 Jun 2019 18:56:34 +0200 Subject: [PATCH] - fix loadgame crash --- src/rendering/vulkan/textures/vk_hwtexture.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index 57928d2b13..28e51583a1 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -374,5 +374,16 @@ void VkHardwareTexture::CreateWipeTexture(int w, int h, const char *name) mImage.View = viewbuilder.create(fb->device); mImage.View->SetDebugName(name); - fb->GetPostprocess()->BlitCurrentToImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); + if (fb->GetBuffers()->GetWidth() > 0 && fb->GetBuffers()->GetHeight() > 0) + { + fb->GetPostprocess()->BlitCurrentToImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); + } + else + { + // hwrenderer asked image data from a frame buffer that was never written into. Let's give it that.. + // (ideally the hwrenderer wouldn't do this, but the calling code is too complex for me to fix) + VkImageTransition transition; + transition.addImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true); + transition.execute(fb->GetTransferCommands()); + } }