add depth stencil target to createFramebuffer

pull/8/head
cosmonaut 2020-12-18 16:42:54 -08:00
parent ba9447ae4c
commit faf536377f
1 changed files with 13 additions and 3 deletions

View File

@ -2161,23 +2161,33 @@ static REFRESH_Framebuffer* VULKAN_CreateFramebuffer(
VkImageView *imageViews; VkImageView *imageViews;
uint32_t colorAttachmentCount = framebufferCreateInfo->colorTargetCount; uint32_t colorAttachmentCount = framebufferCreateInfo->colorTargetCount;
uint32_t attachmentCount = colorAttachmentCount;
uint32_t i; uint32_t i;
VulkanRenderer *renderer = (VulkanRenderer*) driverData; VulkanRenderer *renderer = (VulkanRenderer*) driverData;
imageViews = SDL_stack_alloc(VkImageView, colorAttachmentCount); if (framebufferCreateInfo->pDepthTarget != NULL)
{
attachmentCount += 1;
}
imageViews = SDL_stack_alloc(VkImageView, attachmentCount);
for (i = 0; i < colorAttachmentCount; i += 1) for (i = 0; i < colorAttachmentCount; i += 1)
{ {
imageViews[i] = ((VulkanColorTarget*)framebufferCreateInfo->pColorTargets[i])->view; imageViews[i] = ((VulkanColorTarget*)framebufferCreateInfo->pColorTargets[i])->view;
} }
if (framebufferCreateInfo->pDepthTarget != NULL)
{
imageViews[colorAttachmentCount] = ((VulkanDepthStencilTarget*)framebufferCreateInfo->pDepthTarget)->view;
}
vkFramebufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; vkFramebufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
vkFramebufferCreateInfo.pNext = NULL; vkFramebufferCreateInfo.pNext = NULL;
vkFramebufferCreateInfo.flags = 0; vkFramebufferCreateInfo.flags = 0;
vkFramebufferCreateInfo.renderPass = (VkRenderPass) framebufferCreateInfo->renderPass; vkFramebufferCreateInfo.renderPass = (VkRenderPass) framebufferCreateInfo->renderPass;
vkFramebufferCreateInfo.attachmentCount = framebufferCreateInfo->colorTargetCount; vkFramebufferCreateInfo.attachmentCount = attachmentCount;
vkFramebufferCreateInfo.pAttachments = imageViews; vkFramebufferCreateInfo.pAttachments = imageViews;
vkFramebufferCreateInfo.width = framebufferCreateInfo->width; vkFramebufferCreateInfo.width = framebufferCreateInfo->width;
vkFramebufferCreateInfo.height = framebufferCreateInfo->height; vkFramebufferCreateInfo.height = framebufferCreateInfo->height;