From e5826b8a782ca8558d76f0bdc31260f1ebf8b7f6 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Wed, 22 Oct 2025 12:09:28 +0200 Subject: [PATCH] fixing descriptor pools issue, adding unit tests shortcut to makefile --- Makefile | 6 ++++++ runtime/Includes/Renderer/Descriptor.h | 2 +- runtime/Sources/Renderer/Descriptor.cpp | 13 +++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 81930c5..4d974cc 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/runtime/Includes/Renderer/Descriptor.h b/runtime/Includes/Renderer/Descriptor.h index 0a3b9e9..9a839da 100644 --- a/runtime/Includes/Renderer/Descriptor.h +++ b/runtime/Includes/Renderer/Descriptor.h @@ -50,7 +50,7 @@ namespace mlx ~DescriptorPoolManager() = default; private: - std::vector m_pools; + std::vector> m_pools; }; class DescriptorSet : public std::enable_shared_from_this diff --git a/runtime/Sources/Renderer/Descriptor.cpp b/runtime/Sources/Renderer/Descriptor.cpp index b0ebd30..8be61e0 100644 --- a/runtime/Sources/Renderer/Descriptor.cpp +++ b/runtime/Sources/Renderer/Descriptor.cpp @@ -114,11 +114,8 @@ namespace mlx void DescriptorPool::ReturnDescriptorSet(std::shared_ptr set) { - //std::size_t i = 0; auto it = std::find_if(m_used_sets.begin(), m_used_sets.end(), [&](const std::shared_ptr& 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())->Init(); + return *m_pools.back(); } void DescriptorPoolManager::Destroy() { MLX_PROFILE_FUNCTION(); for(auto& pool : m_pools) - pool.Destroy(); + pool->Destroy(); m_pools.clear(); }