GPUOpen-Archive / Anvil

Anvil is a cross-platform framework for Vulkan
MIT License
594 stars 62 forks source link

record_bind_pipeline(..., PipelineID) is a O(logn) function, n count of pipelines. A faster alternative might should be added. #147

Open thesmallcreeper opened 5 years ago

thesmallcreeper commented 5 years ago

Under CommandBufferBase class the bellow method binds a pipeline for both Primary and Secondary Command Buffer

bool record_bind_pipeline(Anvil::PipelineBindPoint in_pipeline_bind_point,
                                        Anvil::PipelineID        in_pipeline_id);

This method it calls VkPipeline Anvil::BasePipelineManager::get_pipeline(PipelineID in_pipeline_id) which after a search at a map with all PipelineIDs returns a VkPipeline

Searching at a map is a O(logn) operation and if someone wants to re-record commands every frame (in my case for CPU culling) this might become a bottleneck if many Pipelines have been created.

So maybe giving the option (without "hacking" the library) to bind the pipeline by avoiding using PipelineID might be a good addition.

Please feel free to express your opinion. Thank you in advance and have a nice day.