Implement a renderpass cache.

Technically we can generate every possible render-pass up-front based on
the possible combinations of ColorFmt and DepthFmt, but we should only
allocate what the game asks for. Save that pattern for pipelines.
This commit is contained in:
Wunkolo 2023-07-27 10:13:53 -07:00
parent bf8bb5d459
commit 37902cd9d6
2 changed files with 65 additions and 1 deletions

View file

@ -1,3 +1,6 @@
#include <map>
#include <optional>
#include "renderer.hpp"
#include "vk_api.hpp"
@ -49,6 +52,10 @@ class RendererVK final : public Renderer {
std::vector<vk::UniqueImage> topScreenImages = {};
std::vector<vk::UniqueImage> bottomScreenImages = {};
std::map<u32, vk::UniqueRenderPass> renderPassCache;
vk::RenderPass getRenderPass(PICA::ColorFmt colorFormat, std::optional<PICA::DepthFmt> depthFormat);
// Recreate the swapchain, possibly re-using the old one in the case of a resize
vk::Result recreateSwapchain(vk::SurfaceKHR surface, vk::Extent2D swapchainExtent);