Add getCurrentCommandBuffer for all frame workloads

Rather than allocating new command buffers for each small task, schedule
all work onto the frame's main command buffer to be dispatched at
display-time. Fixes all layout transition and synchronization issues.
This commit is contained in:
Wunkolo 2023-08-17 20:14:10 -07:00
parent cb8c53e0b8
commit 52ddaae221
2 changed files with 19 additions and 55 deletions

View file

@ -50,6 +50,8 @@ class RendererVK final : public Renderer {
std::vector<std::vector<vk::UniqueFramebuffer>> frameFramebuffers = {};
std::vector<vk::UniqueCommandBuffer> frameGraphicsCommandBuffers = {};
const vk::CommandBuffer& getCurrentCommandBuffer() const { return frameGraphicsCommandBuffers[frameBufferingIndex].get(); }
// Todo:
// Use `{colourBuffer,depthBuffer}Loc` to maintain an std::map-cache of framebuffers
struct Texture {