forked from MoonsideGames/Refresh
vulkan: Fix framebuffer creation with mip levels (#36)
Before this change, framebuffers were created based on the attachments' full dimensions, instead of the dimensions of the requested mip level. This fixes validation errors in the RenderTextureMipmaps test program. Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com> Reviewed-on: MoonsideGames/Refresh#36 Co-authored-by: TheSpydog <thespydog@noreply.example.org> Co-committed-by: TheSpydog <thespydog@noreply.example.org>samplecount
parent
e3ab5fadf8
commit
89ba9c52ff
|
@ -8299,6 +8299,7 @@ static void VULKAN_BeginRenderPass(
|
||||||
VulkanFramebuffer *framebuffer;
|
VulkanFramebuffer *framebuffer;
|
||||||
|
|
||||||
VulkanTexture *texture;
|
VulkanTexture *texture;
|
||||||
|
uint32_t w, h;
|
||||||
VkClearValue *clearValues;
|
VkClearValue *clearValues;
|
||||||
uint32_t clearCount = colorAttachmentCount;
|
uint32_t clearCount = colorAttachmentCount;
|
||||||
uint32_t multisampleAttachmentCount = 0;
|
uint32_t multisampleAttachmentCount = 0;
|
||||||
|
@ -8314,30 +8315,34 @@ static void VULKAN_BeginRenderPass(
|
||||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||||
{
|
{
|
||||||
texture = (VulkanTexture*) colorAttachmentInfos[i].texture;
|
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)
|
if (depthStencilAttachmentInfo != NULL)
|
||||||
{
|
{
|
||||||
texture = (VulkanTexture*) depthStencilAttachmentInfo->texture;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue