- store the vulkan framebuffer with the image (this ensures the framebuffer object is destroyed along with the image)

This commit is contained in:
Magnus Norddahl 2019-06-10 22:14:02 +02:00
commit a093f686a7
11 changed files with 27 additions and 13 deletions

View file

@ -72,8 +72,10 @@ void VkHardwareTexture::Reset()
auto &deleteList = fb->FrameDeleteList;
if (mImage.Image) deleteList.Images.push_back(std::move(mImage.Image));
if (mImage.View) deleteList.ImageViews.push_back(std::move(mImage.View));
for (auto &it : mImage.RSFramebuffers) deleteList.Framebuffers.push_back(std::move(it.second));
if (mDepthStencil.Image) deleteList.Images.push_back(std::move(mDepthStencil.Image));
if (mDepthStencil.View) deleteList.ImageViews.push_back(std::move(mDepthStencil.View));
for (auto &it : mDepthStencil.RSFramebuffers) deleteList.Framebuffers.push_back(std::move(it.second));
mImage.reset();
mDepthStencil.reset();
}

View file

@ -3,6 +3,7 @@
#include "vulkan/system/vk_objects.h"
#include "vulkan/system/vk_builders.h"
#include "vulkan/renderer/vk_renderpass.h"
class VkTextureImage
{
@ -23,6 +24,8 @@ public:
std::unique_ptr<VulkanImageView> DepthOnlyView;
VkImageLayout Layout = VK_IMAGE_LAYOUT_UNDEFINED;
VkImageAspectFlags AspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
std::unique_ptr<VulkanFramebuffer> PPFramebuffer;
std::map<VkRenderPassKey, std::unique_ptr<VulkanFramebuffer>> RSFramebuffers;
};
class VkImageTransition