fixing descriptor pools issue, adding unit tests shortcut to makefile

This commit is contained in:
Kbz-8
2025-10-22 12:09:28 +02:00
parent d6a7450bdd
commit e5826b8a78
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 CCH = runtime/Includes/PreCompiled.h.pch
PCH = PCH =
# Personal path, should be overriden with env var
UNIT_TESTS_PATH = ../UnitTester/build/Bin/linux_x86_64/MacroUnitTest
NZSLC ?= nzslc NZSLC ?= nzslc
ifeq ($(TOOLCHAIN), gcc) ifeq ($(TOOLCHAIN), gcc)
@@ -161,6 +164,9 @@ clean-shaders:
shaders: clean-shaders $(SPVS) shaders: clean-shaders $(SPVS)
tests: debug
@$(UNIT_TESTS_PATH) --headless --path="./$(NAME)"
clean: clean:
@$(RM) $(OBJ_DIR) @$(RM) $(OBJ_DIR)
@printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n" @printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n"

View File

@@ -50,7 +50,7 @@ namespace mlx
~DescriptorPoolManager() = default; ~DescriptorPoolManager() = default;
private: private:
std::vector<DescriptorPool> m_pools; std::vector<std::unique_ptr<DescriptorPool>> m_pools;
}; };
class DescriptorSet : public std::enable_shared_from_this<DescriptorSet> 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) 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) 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; return set == rhs_set;
}); });
if(it == m_used_sets.end()) if(it == m_used_sets.end())
@@ -132,18 +129,18 @@ namespace mlx
MLX_PROFILE_FUNCTION(); MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools) for(auto& pool : m_pools)
{ {
if(pool.GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL) if(pool->GetNumberOfSetsAllocated() < MAX_SETS_PER_POOL)
return pool; return *pool;
} }
m_pools.emplace_back().Init(); m_pools.emplace_back(std::make_unique<DescriptorPool>())->Init();
return m_pools.back(); return *m_pools.back();
} }
void DescriptorPoolManager::Destroy() void DescriptorPoolManager::Destroy()
{ {
MLX_PROFILE_FUNCTION(); MLX_PROFILE_FUNCTION();
for(auto& pool : m_pools) for(auto& pool : m_pools)
pool.Destroy(); pool->Destroy();
m_pools.clear(); m_pools.clear();
} }