]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/commands_backend.h
Use secondary command buffers to record render pass contents
[libs/gl.git] / source / backends / vulkan / commands_backend.h
index 4de712f57092947409fb554826139e9300ee4198..f96a441c434c5375cc8d0af4df25232ee39a128f 100644 (file)
@@ -14,16 +14,25 @@ class Device;
 class Framebuffer;
 class PipelineState;
 class QueryPool;
+struct Rect;
 class Semaphore;
 class SwapChain;
 
 class VulkanCommands
 {
 protected:
+       struct CommandBuffers
+       {
+               std::vector<VkCommandBuffer> buffers;
+               unsigned next_buffer = 0;
+       };
+
        struct CommandPool
        {
                Device &device;
                VkCommandPool pool = 0;
+               CommandBuffers primary;
+               CommandBuffers secondary;
                Fence fence;
                bool in_use = false;
                
@@ -35,14 +44,18 @@ protected:
        Device &device;
        std::vector<CommandPool> command_pools;
        CommandPool *current_pool = 0;
-       VkCommandBuffer current_buffer = 0;
+       VkCommandBuffer primary_buffer = 0;
+       VkCommandBuffer pass_buffer = 0;
        const PipelineState *pipeline_state = 0;
-       VkRenderPass render_pass = 0;
+       const Framebuffer *framebuffer = 0;
+       const Rect *viewport = 0;
+       bool fb_is_swapchain = false;
+       std::vector<char> pass_begin_info;
 
        VulkanCommands();
        ~VulkanCommands();
 
-       void begin_buffer();
+       void begin_buffer(VkRenderPass);
        void begin_render_pass(bool, const ClearValue *);
        void end_render_pass();