]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/pipelinestate_backend.h
Initial implementation of Vulkan backend
[libs/gl.git] / source / backends / vulkan / pipelinestate_backend.h
diff --git a/source/backends/vulkan/pipelinestate_backend.h b/source/backends/vulkan/pipelinestate_backend.h
new file mode 100644 (file)
index 0000000..d7ef4a2
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef MSP_GL_PIPELINESTATE_BACKEND_H_
+#define MSP_GL_PIPELINESTATE_BACKEND_H_
+
+#include <msp/core/noncopyable.h>
+#include "handles.h"
+
+namespace Msp {
+namespace GL {
+
+class Device;
+
+class VulkanPipelineState: public NonCopyable
+{
+       friend class PipelineCache;
+       friend class VulkanCommands;
+
+protected:
+       Device &device;
+       mutable unsigned changes = 0;
+       mutable VkPipeline handle;
+       mutable std::vector<VkDescriptorSet> descriptor_set_handles;
+
+       VulkanPipelineState();
+       VulkanPipelineState(VulkanPipelineState &&);
+
+       void update() const;
+       void refresh() const { if(changes) update(); }
+       std::uint64_t compute_hash() const;
+       void fill_creation_info(std::vector<char> &) const;
+       std::uint64_t compute_descriptor_set_hash(unsigned) const;
+       VkDescriptorSetLayout get_descriptor_set_layout(unsigned) const;
+       unsigned fill_descriptor_writes(unsigned, std::vector<char> &) const;
+
+       void apply(VkCommandBuffer) const;
+};
+
+using PipelineStateBackend = VulkanPipelineState;
+
+} // namespace GL
+} // namespace Msp
+
+#endif