Fix view index binding error

This commit is contained in:
Magnus Norddahl 2023-09-22 11:31:50 +02:00 committed by Christoph Oelckers
parent aec3c62d6a
commit f55d2675b9
2 changed files with 16 additions and 1 deletions

View file

@ -415,16 +415,27 @@ void VkLightmap::CopyResult()
// Create framebuffer object if it doesn't exist
if (i >= destTexture->LMFramebuffers.size())
{
destTexture->LMViews.resize(i + 1);
destTexture->LMFramebuffers.resize(i + 1);
}
auto& framebuffer = destTexture->LMFramebuffers[i];
if (!framebuffer)
{
auto& view = destTexture->LMViews[i];
if (!view)
{
view = ImageViewBuilder()
.Type(VK_IMAGE_VIEW_TYPE_2D)
.Image(destTexture->Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT, VK_IMAGE_ASPECT_COLOR_BIT, 0, i, 1, 1)
.DebugName("LMView")
.Create(fb->GetDevice());
}
framebuffer = FramebufferBuilder()
.RenderPass(copy.renderPass.get())
.Size(destSize, destSize)
.AddAttachment(destTexture->View.get())
.AddAttachment(view.get())
.DebugName("LMFramebuffer")
.Create(fb->GetDevice());
}

View file

@ -22,6 +22,9 @@ public:
for (auto& framebuffer : LMFramebuffers)
deletelist->Add(std::move(framebuffer));
LMFramebuffers.clear();
for (auto& view : LMViews)
deletelist->Add(std::move(view));
LMViews.clear();
deletelist->Add(std::move(DepthOnlyView));
deletelist->Add(std::move(View));
deletelist->Add(std::move(Image));
@ -36,6 +39,7 @@ public:
VkImageAspectFlags AspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
std::unique_ptr<VulkanFramebuffer> PPFramebuffer;
std::map<VkRenderPassKey, std::unique_ptr<VulkanFramebuffer>> RSFramebuffers;
std::vector<std::unique_ptr<VulkanImageView>> LMViews;
std::vector<std::unique_ptr<VulkanFramebuffer>> LMFramebuffers;
};