diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 29a13cc89d..ceffc976cc 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -716,11 +716,12 @@ void VulkanFrameBuffer::UpdatePalette() FTexture *VulkanFrameBuffer::WipeStartScreen() { - const auto &viewport = screen->mScreenViewport; - auto tex = new FWrapperTexture(viewport.width, viewport.height, 1); + SetViewportRects(nullptr); + + auto tex = new FWrapperTexture(mScreenViewport.width, mScreenViewport.height, 1); auto systex = static_cast(tex->GetSystemTexture()); - systex->CreateWipeTexture(viewport.width, viewport.height, "WipeStartScreen"); + systex->CreateWipeTexture(mScreenViewport.width, mScreenViewport.height, "WipeStartScreen"); return tex; } @@ -731,11 +732,10 @@ FTexture *VulkanFrameBuffer::WipeEndScreen() Draw2D(); Clear2D(); - const auto &viewport = screen->mScreenViewport; - auto tex = new FWrapperTexture(viewport.width, viewport.height, 1); + auto tex = new FWrapperTexture(mScreenViewport.width, mScreenViewport.height, 1); auto systex = static_cast(tex->GetSystemTexture()); - systex->CreateWipeTexture(viewport.width, viewport.height, "WipeEndScreen"); + systex->CreateWipeTexture(mScreenViewport.width, mScreenViewport.height, "WipeEndScreen"); return tex; } diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index 28e51583a1..b8d4986770 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -382,8 +382,25 @@ void VkHardwareTexture::CreateWipeTexture(int w, int h, const char *name) { // 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()); + + VkImageTransition transition0; + transition0.addImage(&mImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true); + transition0.execute(fb->GetTransferCommands()); + + VkImageSubresourceRange range = {}; + range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + range.layerCount = 1; + range.levelCount = 1; + + VkClearColorValue value = {}; + value.float32[0] = 0.0f; + value.float32[1] = 0.0f; + value.float32[2] = 0.0f; + value.float32[3] = 1.0f; + fb->GetTransferCommands()->clearColorImage(mImage.Image->image, mImage.Layout, &value, 1, &range); + + VkImageTransition transition1; + transition1.addImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, false); + transition1.execute(fb->GetTransferCommands()); } }