|
SDEngine
Game Engine
|
Creates and owns graphics pipelines. Handles cleanup on destruction. More...
#include <PipelineFactory.hpp>
Collaboration diagram for sd::PipelineFactory:Classes | |
| struct | Handle |
| struct | PipelineDesc |
| struct | PipelineEntry |
Public Member Functions | |
| PipelineFactory (VkDevice device, ShaderLibrary &shaders) | |
| ~PipelineFactory () | |
| Handle | create_graphics_pipeline (const PipelineDesc &desc, VkPipelineLayout layout) |
| VkPipeline | get_pipeline (Handle handle) const |
| bool | is_valid (Handle handle) const |
| Check if a handle is valid (exists and generation matches). | |
| void | destroy_pipeline (Handle handle) |
| VkPipelineLayout | create_push_constant_layout (VkShaderStageFlags stages, u32 size) |
| std::vector< std::pair< std::string, std::string > > | recreate_all_pipelines () |
| PipelineFactory (const PipelineFactory &)=delete | |
| PipelineFactory & | operator= (const PipelineFactory &)=delete |
Static Public Attributes | |
| static constexpr Handle | null_handle {0, 0} |
Private Member Functions | |
| VkResult | create_pipeline_instance (const PipelineDesc &desc, vk::PipelineLayout layout, vk::UniquePipeline *pipeline) |
Private Attributes | |
| vk::Device | m_device |
| ShaderLibrary & | m_shaders |
| vk::UniquePipelineCache | m_pipeline_cache |
| std::vector< PipelineEntry > | m_tracked_pipelines |
| std::vector< uint32_t > | m_free_slots |
| std::vector< vk::UniquePipelineLayout > | m_created_layouts |
Creates and owns graphics pipelines. Handles cleanup on destruction.
|
explicit |
|
default |
|
delete |
| PipelineFactory::Handle sd::PipelineFactory::create_graphics_pipeline | ( | const PipelineDesc & | desc, |
| VkPipelineLayout | layout | ||
| ) |
Create a graphics pipeline and return a stable handle. The handle remains valid even after RecreateAllPipelines() is called.
|
private |
| VkPipelineLayout sd::PipelineFactory::create_push_constant_layout | ( | VkShaderStageFlags | stages, |
| u32 | size | ||
| ) |
Destroy a pipeline and invalidate its handle. Subsequent GetPipeline() calls will return VK_NULL_HANDLE.
| VkPipeline sd::PipelineFactory::get_pipeline | ( | Handle | handle | ) | const |
Get the current VkPipeline for a handle. Returns VK_NULL_HANDLE if handle is invalid or pipeline was destroyed.
Check if a handle is valid (exists and generation matches).
|
delete |
| std::vector< std::pair< std::string, std::string > > sd::PipelineFactory::recreate_all_pipelines | ( | ) |
Recreates all tracked pipelines. Usually called after clearing ShaderLibrary cache. Handles remain valid - they resolve to the new pipeline instances.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |