![]() |
Lysa
0.0
Lysa 3D Engine
|
Per-pipeline data for instances, draw command arrays and culling.
Stores instance data, staging/copy buffers and the compute pipeline used to perform frustum culling and produce culled indirect draws.
Public Member Functions | |
| GraphicPipelineData (uint32 pipelineId, const DeviceMemoryArray &meshInstancesDataArray, uint32 maxMeshSurfacePerPipeline) | |
| void | addInstance (const MeshInstance *meshInstance, const std::unordered_map< const MeshInstance *, MemoryBlock > &meshInstancesDataMemoryBlocks) |
| void | removeInstance (const MeshInstance *meshInstance) |
| void | addInstance (const MeshInstance *meshInstance, const MemoryBlock &instanceMemoryBlock, const MemoryBlock &meshInstanceMemoryBlock) |
| void | updateData (const vireo::CommandList &commandList, std::unordered_set< std::shared_ptr< vireo::Buffer >> &drawCommandsStagingBufferRecycleBin, const std::unordered_map< const MeshInstance *, MemoryBlock > &meshInstancesDataMemoryBlocks) |
Static Public Member Functions | |
| static void | createDescriptorLayouts (const std::shared_ptr< vireo::Vireo > &vireo) |
| static void | destroyDescriptorLayouts () |
Public Attributes | |
| pipeline_id | pipelineId |
| std::shared_ptr< vireo::DescriptorSet > | descriptorSet |
| FrustumCulling | frustumCullingPipeline |
| MaterialManager & | materialManager |
| std::shared_ptr< vireo::Vireo > | vireo |
| bool | instancesUpdated {false} |
| std::unordered_set< const MeshInstance * > | instancesToRemove |
| DeviceMemoryArray | instancesArray |
| std::unordered_map< const MeshInstance *, MemoryBlock > | instancesMemoryBlocks |
| uint32 | drawCommandsCount {0} |
| std::vector< DrawCommand > | drawCommands |
| std::shared_ptr< vireo::Buffer > | drawCommandsBuffer |
| std::shared_ptr< vireo::Buffer > | culledDrawCommandsCountBuffer |
| std::shared_ptr< vireo::Buffer > | culledDrawCommandsBuffer |
| std::shared_ptr< vireo::Buffer > | drawCommandsStagingBuffer |
| uint32 | drawCommandsStagingBufferCount {0} |
Static Public Attributes | |
| static constexpr vireo::DescriptorIndex | BINDING_INSTANCES {0} |
| static std::shared_ptr< vireo::DescriptorLayout > | pipelineDescriptorLayout {nullptr} |
| GraphicPipelineData | ( | uint32 | pipelineId, |
| const DeviceMemoryArray & | meshInstancesDataArray, | ||
| uint32 | maxMeshSurfacePerPipeline | ||
| ) |
Create a pipeline data object for a specific material/pipeline ID.
| pipelineId | Identifier of the pipeline. |
| meshInstancesDataArray | Array storing per-mesh-instance data. |
| maxMeshSurfacePerPipeline | Maximum number of mesh surfaces supported by this pipeline. |
| void addInstance | ( | const MeshInstance * | meshInstance, |
| const MemoryBlock & | instanceMemoryBlock, | ||
| const MemoryBlock & | meshInstanceMemoryBlock | ||
| ) |
Adds a single draw instance and wires memory blocks.
| meshInstance | Pointer to the mesh instance. |
| instanceMemoryBlock | Memory block for the instance data. |
| meshInstanceMemoryBlock | Memory block for the mesh instance data. |
| void addInstance | ( | const MeshInstance * | meshInstance, |
| const std::unordered_map< const MeshInstance *, MemoryBlock > & | meshInstancesDataMemoryBlocks | ||
| ) |
Registers a mesh instance into this pipeline data object.
| meshInstance | Pointer to the mesh instance to add. |
| meshInstancesDataMemoryBlocks | Map of memory blocks for mesh instance data. |
|
static |
Create the shared descriptor layout.
| vireo | Shared pointer to the Vireo instance. |
|
static |
Destroy the shared descriptor layout.
| void removeInstance | ( | const MeshInstance * | meshInstance | ) |
Removes a previously registered mesh instance.
| meshInstance | Pointer to the mesh instance to remove. |
| void updateData | ( | const vireo::CommandList & | commandList, |
| std::unordered_set< std::shared_ptr< vireo::Buffer >> & | drawCommandsStagingBufferRecycleBin, | ||
| const std::unordered_map< const MeshInstance *, MemoryBlock > & | meshInstancesDataMemoryBlocks | ||
| ) |
Uploads/refreshes GPU buffers and prepares culled draw arrays.
| commandList | Command buffer for GPU operations. |
| drawCommandsStagingBufferRecycleBin | Set for recycling staging buffers. |
| meshInstancesDataMemoryBlocks | Map of memory blocks for mesh instance data. |
|
staticconstexpr |
Descriptor binding for per-instance buffer used by pipelines.
| std::shared_ptr<vireo::Buffer> culledDrawCommandsBuffer |
GPU buffer storing culled indirect draw commands.
| std::shared_ptr<vireo::Buffer> culledDrawCommandsCountBuffer |
GPU buffer storing the count of culled draw commands.
| std::shared_ptr<vireo::DescriptorSet> descriptorSet |
Descriptor set bound when drawing with this pipeline.
| std::vector<DrawCommand> drawCommands |
CPU-side list of draw commands to upload.
| std::shared_ptr<vireo::Buffer> drawCommandsBuffer |
GPU buffer storing indirect draw commands.
| uint32 drawCommandsCount {0} |
Number of indirect draw commands before culling.
| std::shared_ptr<vireo::Buffer> drawCommandsStagingBuffer |
Staging buffer used to copy draw commands to the GPU.
| uint32 drawCommandsStagingBufferCount {0} |
Number of draw commands stored in the current staging buffer.
| FrustumCulling frustumCullingPipeline |
Compute pipeline used to cull draw commands against the frustum.
| DeviceMemoryArray instancesArray |
Device memory array that stores InstanceData blocks.
| std::unordered_map<const MeshInstance*, MemoryBlock> instancesMemoryBlocks |
Mapping of mesh instance to its memory block within instancesArray.
| std::unordered_set<const MeshInstance*> instancesToRemove |
Set of mesh instances scheduled for removal.
| bool instancesUpdated {false} |
Flag tracking if the instances set has been updated.
| MaterialManager& materialManager |
Reference to the material manager.
|
inlinestatic |
Shared descriptor layout for pipeline-local resources.
| pipeline_id pipelineId |
Identifier of the material/pipeline family.
| std::shared_ptr<vireo::Vireo> vireo |
Reference to Vireo.