mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
improving descriptor sets and pools management
This commit is contained in:
39
src/renderer/descriptors/descriptor_pool_manager.cpp
git.filemode.normal_file
39
src/renderer/descriptors/descriptor_pool_manager.cpp
git.filemode.normal_file
@@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* descriptor_pool_manager.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/20 06:51:47 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/20 08:18:27 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <renderer/core/render_core.h>
|
||||
#include <renderer/descriptors/descriptor_pool_manager.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
DescriptorPool& DescriptorPoolManager::getAvailablePool()
|
||||
{
|
||||
for(auto& pool : _pools)
|
||||
{
|
||||
if(pool.getNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
|
||||
return pool;
|
||||
}
|
||||
VkDescriptorPoolSize pool_sizes[] = {
|
||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, (MAX_FRAMES_IN_FLIGHT * NUMBER_OF_UNIFORM_BUFFERS) },
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MAX_SETS_PER_POOL - (MAX_FRAMES_IN_FLIGHT * NUMBER_OF_UNIFORM_BUFFERS) }
|
||||
};
|
||||
_pools.emplace_front().init((sizeof(pool_sizes) / sizeof(VkDescriptorPoolSize)), pool_sizes);
|
||||
return _pools.front();
|
||||
}
|
||||
|
||||
void DescriptorPoolManager::destroyAllPools()
|
||||
{
|
||||
for(auto& pool : _pools)
|
||||
pool.destroy();
|
||||
_pools.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user