From cb19f22ee4f66a2fca19704d67503b86d31e683b Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 4 Jun 2026 18:20:37 +1000 Subject: [PATCH] BufferPool: drop Qt log dependency Replace qInfo() growth-event logging with fprintf(stderr,...) so BufferPool.cpp has no Qt touchpoints. Lets the test target drop its Qt6::Core link too. Prerequisite for the IfcViewerCore library boundary the web target will link against. --- src/ifcviewer/BufferPool.cpp | 23 ++++++++++++----------- src/ifcviewer/tests/CMakeLists.txt | 7 ++----- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/ifcviewer/BufferPool.cpp b/src/ifcviewer/BufferPool.cpp index 4ba9ec7072..8c1643d714 100644 --- a/src/ifcviewer/BufferPool.cpp +++ b/src/ifcviewer/BufferPool.cpp @@ -19,9 +19,8 @@ #include "BufferPool.h" -#include - #include +#include #include BufferPool::~BufferPool() { @@ -113,21 +112,23 @@ bool BufferPool::addSubBuffer() { sp.free_ranges.push_back({0, try_size}); sub_pools_.push_back(std::move(sp)); last_growth_size_ = try_size; - qInfo().noquote().nospace() - << "[wgpu pool] added sub-buffer " << (sub_pools_.size() - 1) - << " (" << (try_size / (1024 * 1024)) << " MB); pool total now " - << (total_capacity_bytes() / (1024 * 1024)) << " MB"; + std::fprintf(stderr, + "[wgpu pool] added sub-buffer %zu (%llu MB); pool total now %llu MB\n", + sub_pools_.size() - 1, + (unsigned long long)(try_size / (1024 * 1024)), + (unsigned long long)(total_capacity_bytes() / (1024 * 1024))); return true; } if (buf) wgpuBufferRelease(buf); try_size /= 2; } - qInfo().noquote().nospace() - << "[wgpu pool] driver refused growth even at " - << (MIN_SUB_BUFFER_BYTES / (1024 * 1024)) << " MB; pool capped at " - << (total_capacity_bytes() / (1024 * 1024)) - << " MB across " << sub_pools_.size() << " sub-buffer(s) — growth disabled"; + std::fprintf(stderr, + "[wgpu pool] driver refused growth even at %llu MB; " + "pool capped at %llu MB across %zu sub-buffer(s) — growth disabled\n", + (unsigned long long)(MIN_SUB_BUFFER_BYTES / (1024 * 1024)), + (unsigned long long)(total_capacity_bytes() / (1024 * 1024)), + sub_pools_.size()); growth_disabled_ = true; return false; } diff --git a/src/ifcviewer/tests/CMakeLists.txt b/src/ifcviewer/tests/CMakeLists.txt index 0755d0a2fc..3e6b5dff84 100644 --- a/src/ifcviewer/tests/CMakeLists.txt +++ b/src/ifcviewer/tests/CMakeLists.txt @@ -82,13 +82,10 @@ add_ifcviewer_unit_test(test_visibility) # the linker needs is the production destructor's wgpuBufferRelease — which # is never reached for fake handles because we don't call destroy() / let # the pool go out of scope holding any. Linking wgpu_native satisfies the -# symbol regardless. Qt6::Core comes along for qInfo() inside -# addSubBuffer's diagnostic log — also never reached at test runtime, but -# the unresolved symbol would fail link. -find_package(Qt${QT_VERSION} COMPONENTS Core REQUIRED PATHS ${QT_DIR}) +# symbol regardless. add_ifcviewer_unit_test(test_buffer_pool SOURCES ${IFCVIEWER_SRC}/BufferPool.cpp - LIBS wgpu_native Qt${QT_VERSION}::Core + LIBS wgpu_native ) if(UNIX AND NOT APPLE AND WGPU_NATIVE_LIB_DIR) set_target_properties(test_buffer_pool PROPERTIES