]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/commands_backend.h
Initial implementation of Vulkan backend
[libs/gl.git] / source / backends / vulkan / commands_backend.h
diff --git a/source/backends/vulkan/commands_backend.h b/source/backends/vulkan/commands_backend.h
new file mode 100644 (file)
index 0000000..8632ca7
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef MSP_GL_COMMANDS_BACKEND_H_
+#define MSP_GL_COMMANDS_BACKEND_H_
+
+#include <vector>
+#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<CommandPool> 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
+