#pragma once #include #include #include "dxvk_hash.h" #include "dxvk_shader.h" #include "dxvk_resource.h" namespace dxvk { /** * \brief Graphics pipeline state info * * */ struct DxvkGraphicsPipelineStateInfo { VkRenderPass renderPass; size_t hash() const; bool operator == (const DxvkGraphicsPipelineStateInfo& other) const; bool operator != (const DxvkGraphicsPipelineStateInfo& other) const; }; /** * \brief Graphics pipeline * * Stores the pipeline layout as well as methods to * recompile the graphics pipeline against a given * pipeline state vector. */ class DxvkGraphicsPipeline : public DxvkResource { public: DxvkGraphicsPipeline( const Rc& vkd, const Rc& vs, const Rc& tcs, const Rc& tes, const Rc& gs, const Rc& fs); ~DxvkGraphicsPipeline(); VkDescriptorSetLayout descriptorSetLayout() const { return m_descriptorSetLayout; } VkPipeline getPipelineHandle( const DxvkGraphicsPipelineStateInfo& state); private: Rc m_vkd; Rc m_vs; Rc m_tcs; Rc m_tes; Rc m_gs; Rc m_fs; VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE; VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE; std::mutex m_mutex; std::unordered_map< DxvkGraphicsPipelineStateInfo, VkPipeline, DxvkHash> m_pipelines; VkPipeline compilePipeline( const DxvkGraphicsPipelineStateInfo& state) const; }; }