]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/commands_backend.h
Rework multisample resolve to use resolve attachments
[libs/gl.git] / source / backends / vulkan / commands_backend.h
index 8632ca7c2648e355091faccd69c75cc3aa6c33dc..feb7d0778aaef40d4100445370402df92deee696 100644 (file)
@@ -4,6 +4,7 @@
 #include <vector>
 #include "fence.h"
 #include "handles.h"
+#include "rect.h"
 
 namespace Msp {
 namespace GL {
@@ -20,10 +21,18 @@ 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;
                
@@ -34,16 +43,22 @@ protected:
 
        Device &device;
        std::vector<CommandPool> command_pools;
-       CommandPool *current_pool = 0;
-       VkCommandBuffer current_buffer = 0;
+       unsigned frame_index = 0;
+       VkCommandBuffer primary_buffer = 0;
+       VkCommandBuffer pass_buffer = 0;
        const PipelineState *pipeline_state = 0;
-       VkRenderPass render_pass = 0;
+       const PipelineState *last_pipeline = 0;
+       const Framebuffer *framebuffer = 0;
+       Rect viewport = Rect::max();
+       bool fb_is_swapchain = false;
+       bool discard_fb_contents = false;
+       std::vector<char> pass_begin_info;
 
        VulkanCommands();
        ~VulkanCommands();
 
-       void begin_buffer();
-       void begin_render_pass(const ClearValue *);
+       void begin_buffer(VkRenderPass);
+       void begin_render_pass(bool, const ClearValue *);
        void end_render_pass();
 
        void begin_frame(unsigned);
@@ -54,7 +69,8 @@ protected:
        void clear(const ClearValue *);
        void draw(const Batch &);
        void draw_instanced(const Batch &, unsigned);
-       void resolve_multisample(Framebuffer &);
+       void dispatch(unsigned, unsigned, unsigned);
+       void resolve_multisample();
 
        void begin_query(const QueryPool &, unsigned);
        void end_query(const QueryPool &, unsigned);