X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fcommands_backend.h;h=feb7d0778aaef40d4100445370402df92deee696;hp=994acca2df342cea6724c4812cd923f3ed34bd3f;hb=94cadd1618f93239b1cb0acbd4f958257c035c98;hpb=b0db98d71aeb32d9e57315b8a06ff4068aeccbca diff --git a/source/backends/vulkan/commands_backend.h b/source/backends/vulkan/commands_backend.h index 994acca2..feb7d077 100644 --- a/source/backends/vulkan/commands_backend.h +++ b/source/backends/vulkan/commands_backend.h @@ -4,6 +4,7 @@ #include #include "fence.h" #include "handles.h" +#include "rect.h" namespace Msp { namespace GL { @@ -14,19 +15,24 @@ class Device; class Framebuffer; class PipelineState; class QueryPool; -struct Rect; class Semaphore; class SwapChain; class VulkanCommands { protected: + struct CommandBuffers + { + std::vector buffers; + unsigned next_buffer = 0; + }; + struct CommandPool { Device &device; VkCommandPool pool = 0; - std::vector buffers; - unsigned next_buffer = 0; + CommandBuffers primary; + CommandBuffers secondary; Fence fence; bool in_use = false; @@ -37,17 +43,21 @@ protected: Device &device; std::vector 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; + const PipelineState *last_pipeline = 0; const Framebuffer *framebuffer = 0; - const Rect *viewport = 0; + Rect viewport = Rect::max(); bool fb_is_swapchain = false; + bool discard_fb_contents = false; + std::vector pass_begin_info; VulkanCommands(); ~VulkanCommands(); - void begin_buffer(); + void begin_buffer(VkRenderPass); void begin_render_pass(bool, const ClearValue *); void end_render_pass(); @@ -59,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);