1 #ifndef MSP_GL_PIPELINESTATE_BACKEND_H_
2 #define MSP_GL_PIPELINESTATE_BACKEND_H_
4 #include <msp/core/noncopyable.h>
11 class VulkanCommandRecorder;
13 class VulkanPipelineState: public NonCopyable
15 friend class DescriptorPool;
16 friend class PipelineCache;
17 friend class VulkanCommands;
21 mutable unsigned changes = 0;
22 mutable unsigned unapplied = 0;
23 mutable VkPipeline handle = 0;
24 mutable std::vector<unsigned> descriptor_set_slots;
25 mutable unsigned first_changed_desc_set = 0;
26 mutable std::uint32_t push_const_compat = 0;
28 VulkanPipelineState();
29 VulkanPipelineState(VulkanPipelineState &&);
31 static bool can_bind_tex_level(unsigned) { return true; }
34 void refresh() const { if(changes) update(); }
35 std::uint64_t compute_hash() const;
36 void fill_creation_info(std::vector<char> &) const;
37 std::uint64_t compute_descriptor_set_hash(unsigned) const;
38 bool is_descriptor_set_dynamic(unsigned) const;
39 VkDescriptorSetLayout get_descriptor_set_layout(unsigned) const;
40 unsigned fill_descriptor_writes(unsigned, unsigned, std::vector<char> &) const;
42 void apply(const VulkanCommandRecorder &, const VulkanPipelineState *, unsigned, bool) const;
45 using PipelineStateBackend = VulkanPipelineState;