From 7e23ce97cec2809854f44f77e0776f3dd40074ae Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Sun, 22 Jan 2023 23:14:45 -0500 Subject: [PATCH] fix framebuffer creation with mip levels --- src/Refresh_Driver_Vulkan.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 96f7fc1..fac3482 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -8306,6 +8306,7 @@ static void VULKAN_BeginRenderPass( VulkanFramebuffer *framebuffer; VulkanTexture *texture; + uint32_t w, h; VkClearValue *clearValues; uint32_t clearCount = colorAttachmentCount; uint32_t multisampleAttachmentCount = 0; @@ -8321,30 +8322,34 @@ static void VULKAN_BeginRenderPass( for (i = 0; i < colorAttachmentCount; i += 1) { texture = (VulkanTexture*) colorAttachmentInfos[i].texture; + w = texture->dimensions.width >> colorAttachmentInfos[i].level; + h = texture->dimensions.height >> colorAttachmentInfos[i].level; - if (texture->dimensions.width < framebufferWidth) + if (w < framebufferWidth) { - framebufferWidth = texture->dimensions.width; + framebufferWidth = w; } - if (texture->dimensions.height < framebufferHeight) + if (h < framebufferHeight) { - framebufferHeight = texture->dimensions.height; + framebufferHeight = h; } } if (depthStencilAttachmentInfo != NULL) { texture = (VulkanTexture*) depthStencilAttachmentInfo->texture; + w = texture->dimensions.width >> depthStencilAttachmentInfo->level; + h = texture->dimensions.height >> depthStencilAttachmentInfo->level; - if (texture->dimensions.width < framebufferWidth) + if (w < framebufferWidth) { - framebufferWidth = texture->dimensions.width; + framebufferWidth = w; } - if (texture->dimensions.height < framebufferHeight) + if (h < framebufferHeight) { - framebufferHeight = texture->dimensions.height; + framebufferHeight = h; } }