X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fcommands_backend.h;fp=source%2Fbackends%2Fvulkan%2Fcommands_backend.h;h=8632ca7c2648e355091faccd69c75cc3aa6c33dc;hb=99ca354f18119f82f1adeca100cd665a8f640317;hp=0000000000000000000000000000000000000000;hpb=4cd245dafe6a7ee5c93edca5aee2d146f1155309;p=libs%2Fgl.git diff --git a/source/backends/vulkan/commands_backend.h b/source/backends/vulkan/commands_backend.h new file mode 100644 index 00000000..8632ca7c --- /dev/null +++ b/source/backends/vulkan/commands_backend.h @@ -0,0 +1,69 @@ +#ifndef MSP_GL_COMMANDS_BACKEND_H_ +#define MSP_GL_COMMANDS_BACKEND_H_ + +#include +#include "fence.h" +#include "handles.h" + +namespace Msp { +namespace GL { + +class Batch; +union ClearValue; +class Device; +class Framebuffer; +class PipelineState; +class QueryPool; +class Semaphore; +class SwapChain; + +class VulkanCommands +{ +protected: + struct CommandPool + { + Device &device; + VkCommandPool pool = 0; + Fence fence; + bool in_use = false; + + CommandPool(Device &); + CommandPool(CommandPool &&); + ~CommandPool(); + }; + + Device &device; + std::vector command_pools; + CommandPool *current_pool = 0; + VkCommandBuffer current_buffer = 0; + const PipelineState *pipeline_state = 0; + VkRenderPass render_pass = 0; + + VulkanCommands(); + ~VulkanCommands(); + + void begin_buffer(); + void begin_render_pass(const ClearValue *); + void end_render_pass(); + + void begin_frame(unsigned); + void submit_frame(); + void submit_frame(Semaphore *, Semaphore *); + + void use_pipeline(const PipelineState *); + void clear(const ClearValue *); + void draw(const Batch &); + void draw_instanced(const Batch &, unsigned); + void resolve_multisample(Framebuffer &); + + void begin_query(const QueryPool &, unsigned); + void end_query(const QueryPool &, unsigned); +}; + +using CommandsBackend = VulkanCommands; + +} // namespace GL +} // namespace Msp + +#endif +