fixing descriptor pools issue, adding unit tests shortcut to makefile

This commit is contained in:
2025-10-22 12:09:28 +02:00
parent 93014c1668
commit 72d8ddae64
3 changed files with 12 additions and 9 deletions

View File

@@ -38,6 +38,9 @@ GCH = runtime/Includes/PreCompiled.h.gch
CCH = runtime/Includes/PreCompiled.h.pch
PCH =
# Personal path, should be overriden with env var
UNIT_TESTS_PATH = ../UnitTester/build/Bin/linux_x86_64/MacroUnitTest
NZSLC ?= nzslc
ifeq ($(TOOLCHAIN), gcc)
@@ -161,6 +164,9 @@ clean-shaders:
shaders: clean-shaders $(SPVS)
tests: debug
@$(UNIT_TESTS_PATH) --headless --path="./$(NAME)"
clean:
@$(RM) $(OBJ_DIR)
@printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n"

View File

@@ -50,7 +50,7 @@ namespace mlx
~DescriptorPoolManager() = default;
private:
std::vector<DescriptorPool> m_pools;
std::vector<std::unique_ptr<DescriptorPool>> m_pools;
};
class DescriptorSet : public std::enable_shared_from_this<DescriptorSet>

View File

@@ -114,11 +114,8 @@ namespace mlx
void DescriptorPool::ReturnDescriptorSet(std::shared_ptr<DescriptorSet> set)
{
//std::size_t i = 0;
auto it = std::find_if(m_used_sets.begin(), m_used_sets.end(), [&](const std::shared_ptr<DescriptorSet>& rhs_set)
{
//i++;
//std::cout << m_used_sets.size() << " " << i << std::endl;
return set == rhs_set;
});
if(it == m_used_sets.end())
@@ -132,18 +129,18 @@ namespace mlx
MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools)
{
if(pool.GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
return pool;
if(pool->GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
return *pool;
}
m_pools.emplace_back().Init();
return m_pools.back();
m_pools.emplace_back(std::make_unique<DescriptorPool>())->Init();
return *m_pools.back();
}
void DescriptorPoolManager::Destroy()
{
MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools)
pool.Destroy();
pool->Destroy();
m_pools.clear();
}