From 9f989ee8a71cdcd19fc8572103a24b71221d385c Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Wed, 21 Oct 2026 11:53:19 +0200 Subject: [PATCH 1/3] [compile] Adding more strict warnings and fixing some unused variable warnings --- openpgl/CMakeLists.txt | 4 ++++ openpgl/directional/dqt/DQT.h | 6 +++--- openpgl/directional/dqt/DQTFactory.h | 14 +++++++------- .../dqt/DQTSurfaceSamplingDistribution.h | 4 ++-- .../dqt/DQTVolumeSamplingDistribution.h | 4 ++-- openpgl/directional/dqt/SphereToSquare.h | 2 +- openpgl/directional/dqt/Traversal.h | 2 +- .../directional/vmm/AdaptiveSplitandMergeFactory.h | 2 +- .../vmm/ParallaxAwareVonMisesFisherMixture.h | 2 +- .../ParallaxAwareVonMisesFisherWeightedEMFactory.h | 2 +- .../vmm/VMMChiSquareComponentSplitter.h | 2 -- openpgl/field/Field.h | 5 +++-- openpgl/field/SurfaceVolumeField.h | 2 +- openpgl/spatial/Region.h | 2 +- openpgl/spatial/kdtree/KDTreeBuilder.h | 2 -- .../common/algorithms/parallel_partition.h | 8 ++++---- 16 files changed, 32 insertions(+), 31 deletions(-) diff --git a/openpgl/CMakeLists.txt b/openpgl/CMakeLists.txt index fc2582b0..b297b718 100644 --- a/openpgl/CMakeLists.txt +++ b/openpgl/CMakeLists.txt @@ -138,6 +138,10 @@ else() list(APPEND OPENPGL_COMMON_OPTIONS -fno-strict-aliasing) # disables strict aliasing rules list(APPEND OPENPGL_COMMON_OPTIONS -fno-tree-vectorize) # disable auto vectorizer + list(APPEND OPENPGL_COMMON_OPTIONS -Wunused-parameter) + list(APPEND OPENPGL_COMMON_OPTIONS -Wsign-compare) + #list(APPEND OPENPGL_COMMON_OPTIONS -Wdeprecated-copy-with-user-provided-copy) + if (OPENPGL_ARM) list(APPEND OPENPGL_COMMON_OPTIONS -fsigned-char) # treat 'char' as 'signed char' list(APPEND OPENPGL_COMMON_OPTIONS -flax-vector-conversions) # allow lax vector type conversions diff --git a/openpgl/directional/dqt/DQT.h b/openpgl/directional/dqt/DQT.h index 5b1430dd..9355d589 100644 --- a/openpgl/directional/dqt/DQT.h +++ b/openpgl/directional/dqt/DQT.h @@ -79,7 +79,7 @@ struct DirectionalQuadtree return pdf; } - void performRelativeParallaxShift(const Vector3 &shiftDirection) {}; + void performRelativeParallaxShift([[maybe_unused]] const Vector3 &shiftDirection) {}; const std::string toString() const { @@ -110,7 +110,7 @@ struct DirectionalQuadtree is.read(reinterpret_cast(nodes.data()), size * sizeof(nodes[0])); }; - void decay(const float alpha) {}; + void decay([[maybe_unused]] const float alpha) {}; size_t getNumComponents() const { @@ -118,7 +118,7 @@ struct DirectionalQuadtree } // TODO: Needs to be implmented - bool operator==(const DirectionalQuadtree &b) const + bool operator==([[maybe_unused]] const DirectionalQuadtree &b) const { return true; } diff --git a/openpgl/directional/dqt/DQTFactory.h b/openpgl/directional/dqt/DQTFactory.h index 70ee32a2..b8837e9d 100644 --- a/openpgl/directional/dqt/DQTFactory.h +++ b/openpgl/directional/dqt/DQTFactory.h @@ -72,7 +72,7 @@ class DirectionalQuadtreeFactory stream.read(reinterpret_cast(this), sizeof(*this)); }; - bool operator==(const Configuration &b) const + bool operator==([[maybe_unused]] const Configuration &b) const { return true; } @@ -95,7 +95,7 @@ class DirectionalQuadtreeFactory // TODO this is very ugly struct SufficientStatistics { - void applyParallaxShift(const Distribution &dist, const Vector3 shift) {} + void applyParallaxShift([[maybe_unused]] const Distribution &dist, [[maybe_unused]] const Vector3 shift) {} bool isValid() const { return true; @@ -160,7 +160,7 @@ class DirectionalQuadtreeFactory }; // TODO: Needs to be implmented - bool operator==(const Statistics &b) const + bool operator==([[maybe_unused]] const Statistics &b) const { return true; } @@ -174,7 +174,7 @@ class DirectionalQuadtreeFactory uint32_t numMerges = 0; }; - void prepareSamples(SampleData *samples, const size_t numSamples, const SampleStatistics &sampleStatistics, const Configuration &cfg) const {} + void prepareSamples([[maybe_unused]] SampleData *samples, [[maybe_unused]] const size_t numSamples, [[maybe_unused]] const SampleStatistics &sampleStatistics, [[maybe_unused]] const Configuration &cfg) const {} void updateFluenceEstimate(Distribution &dist, const SampleData *samples, const size_t numSamples, const size_t numZeroValueSamples, const SampleStatistics &sampleStatistics) const @@ -274,7 +274,7 @@ class DirectionalQuadtreeFactory // Compute sampling and split weights traverse( ctx.stats->nodes.data(), - [&](uint32_t i, Rect &rect) { + [&]([[maybe_unused]] uint32_t i, [[maybe_unused]] Rect &rect) { return true; // We want to traverse all nodes }, [&](uint32_t i, Rect &rect) { @@ -357,12 +357,12 @@ class DirectionalQuadtreeFactory // TODO switch to disable this traverse( old_nodes.data(), - [&](uint32_t i, Rect &rect) { + [&](uint32_t i, [[maybe_unused]] Rect &rect) { if (old_nodes[i].offsetChildren > 0) ctx.fitStats->numMerges++; return true; }, - [&](uint32_t i, Rect &rect) { + [&]([[maybe_unused]] uint32_t i, [[maybe_unused]] Rect &rect) { }, i, rect); } diff --git a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h index 390da1ea..89e6e6c9 100644 --- a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h @@ -13,12 +13,12 @@ struct DQTSurfaceSamplingDistribution : public ISurfaceSamplingDistribution virtual ~DQTSurfaceSamplingDistribution() override{}; - virtual void init(const void *distribution, Point3 samplePosition) override + virtual void init(const void *distribution, [[maybe_unused]] Point3 samplePosition) override { this->distribution = *(TDirectionalQuadtree *)distribution; }; - inline void applyCosineProduct(const Vector3 &normal) override + inline void applyCosineProduct([[maybe_unused]] const Vector3 &normal) override { // not supported by quadtree return; diff --git a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h index c0cc5bf8..5be8128b 100644 --- a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h @@ -13,7 +13,7 @@ struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution virtual ~DQTVolumeSamplingDistribution() override{}; - virtual void init(const void *distribution, Point3 samplePosition) override + virtual void init(const void *distribution, [[maybe_unused]] Point3 samplePosition) override { this->distribution = *(TDirectionalQuadtree *)distribution; }; @@ -67,7 +67,7 @@ struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution inline void clear() override {}; - inline void applySingleLobeHenyeyGreensteinProduct(const Vector3 &dir, const float meanCosine) override + inline void applySingleLobeHenyeyGreensteinProduct([[maybe_unused]] const Vector3 &dir, [[maybe_unused]] const float meanCosine) override { // not supported by quadtree return; diff --git a/openpgl/directional/dqt/SphereToSquare.h b/openpgl/directional/dqt/SphereToSquare.h index d7318c7d..fad0c416 100644 --- a/openpgl/directional/dqt/SphereToSquare.h +++ b/openpgl/directional/dqt/SphereToSquare.h @@ -57,7 +57,7 @@ class SphereToSquareCylindrical return embree::clamp(Vector3(sinTheta * std::cos(phi), sinTheta * std::sin(phi), cosTheta), Vector3(-1), Vector3(1)); } - static float jacobian(const Vector2 &point_) + static float jacobian([[maybe_unused]] const Vector2 &point_) { return 4.0f * M_PI_F; } diff --git a/openpgl/directional/dqt/Traversal.h b/openpgl/directional/dqt/Traversal.h index fd708d8e..077e3195 100644 --- a/openpgl/directional/dqt/Traversal.h +++ b/openpgl/directional/dqt/Traversal.h @@ -99,7 +99,7 @@ void splat(TNode *nodes, float footprintFactor, Vector2 point, F apply) apply(node, nodeArea / filterArea); return true; }, - [&](uint32_t i, Rect rect) { + [&]([[maybe_unused]] uint32_t i, [[maybe_unused]] Rect rect) { }); } else diff --git a/openpgl/directional/vmm/AdaptiveSplitandMergeFactory.h b/openpgl/directional/vmm/AdaptiveSplitandMergeFactory.h index 0bea6916..c676ff62 100644 --- a/openpgl/directional/vmm/AdaptiveSplitandMergeFactory.h +++ b/openpgl/directional/vmm/AdaptiveSplitandMergeFactory.h @@ -304,7 +304,7 @@ void AdaptiveSplitAndMergeFactory::prepareSamples(SampleData * template void AdaptiveSplitAndMergeFactory::fit(VMM &vmm, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, - FittingStatistics &fitStats) const + [[maybe_unused]] FittingStatistics &fitStats) const { const size_t numComponents = cfg.weightedEMCfg.initK; stats.clear(numComponents); diff --git a/openpgl/directional/vmm/ParallaxAwareVonMisesFisherMixture.h b/openpgl/directional/vmm/ParallaxAwareVonMisesFisherMixture.h index 3c781ea8..55951fc2 100644 --- a/openpgl/directional/vmm/ParallaxAwareVonMisesFisherMixture.h +++ b/openpgl/directional/vmm/ParallaxAwareVonMisesFisherMixture.h @@ -1180,7 +1180,7 @@ void ParallaxAwareVonMisesFisherMixture -void ParallaxAwareVonMisesFisherMixture::decay(float alpha) +void ParallaxAwareVonMisesFisherMixture::decay([[maybe_unused]] float alpha) { #ifdef OPENPGL_RADIANCE_CACHES _numFluenceSamples *= alpha; diff --git a/openpgl/directional/vmm/ParallaxAwareVonMisesFisherWeightedEMFactory.h b/openpgl/directional/vmm/ParallaxAwareVonMisesFisherWeightedEMFactory.h index 25f74d06..033c67b2 100644 --- a/openpgl/directional/vmm/ParallaxAwareVonMisesFisherWeightedEMFactory.h +++ b/openpgl/directional/vmm/ParallaxAwareVonMisesFisherWeightedEMFactory.h @@ -1257,7 +1257,7 @@ void ParallaxAwareVonMisesFisherWeightedEMFactory::reprojectSa template void ParallaxAwareVonMisesFisherWeightedEMFactory::prepareSamples(SampleData *samples, const size_t numSamples, const SampleStatistics &sampleStatistics, - const Configuration &cfg) const + [[maybe_unused]] const Configuration &cfg) const { if (TVMMDistribution::ParallaxCompensation) { diff --git a/openpgl/directional/vmm/VMMChiSquareComponentSplitter.h b/openpgl/directional/vmm/VMMChiSquareComponentSplitter.h index 100f2bae..ef12ddb8 100644 --- a/openpgl/directional/vmm/VMMChiSquareComponentSplitter.h +++ b/openpgl/directional/vmm/VMMChiSquareComponentSplitter.h @@ -556,8 +556,6 @@ bool VonMisesFisherChiSquareComponentSplitter::SplitComponent(VMM & ComponentSplitinfo splitInfo; const div_t tmpK = div(idx, static_cast(VMM::VectorSize)); - float numAssignedSamples = splitStats.sumAssignedSamples[tmpK.quot][tmpK.rem]; - float inv_sumWeights = embree::rcp(splitStats.sumWeights[tmpK.quot][tmpK.rem]); OPENPGL_ASSERT(embree::isvalid(inv_sumWeights)); splitInfo.mean = Vector2(splitStats.splitMeans[tmpK.quot].x[tmpK.rem], splitStats.splitMeans[tmpK.quot].y[tmpK.rem]); diff --git a/openpgl/field/Field.h b/openpgl/field/Field.h index a6928a39..ac2020f6 100644 --- a/openpgl/field/Field.h +++ b/openpgl/field/Field.h @@ -390,6 +390,7 @@ struct Field { OPENPGL_ASSERT(knnTree.isBuild()); const uint32_t regionIdx = knnTree.sampleClosestRegionIdx(p, sample); + id = regionIdx; return regionIdx; } @@ -433,7 +434,7 @@ struct Field } } - inline void fitRegions(SampleContainerInternal &samples, ZeroValueSampleContainerInternal &zeroValueSamples) + inline void fitRegions(SampleContainerInternal &samples, [[maybe_unused]] ZeroValueSampleContainerInternal &zeroValueSamples) { size_t nGuidingRegions = m_regionStorageContainer.size(); #if defined(OPENPGL_SHOW_PRINT_OUTS) @@ -505,7 +506,7 @@ struct Field OPENPGL_ASSERT(this->isValid()); } - void updateRegions(SampleContainerInternal &samples, ZeroValueSampleContainerInternal &zeroValueSamples) + void updateRegions(SampleContainerInternal &samples, [[maybe_unused]] ZeroValueSampleContainerInternal &zeroValueSamples) { size_t nGuidingRegions = m_regionStorageContainer.size(); #if defined(OPENPGL_SHOW_PRINT_OUTS) diff --git a/openpgl/field/SurfaceVolumeField.h b/openpgl/field/SurfaceVolumeField.h index 47a9a003..6dcbfef6 100644 --- a/openpgl/field/SurfaceVolumeField.h +++ b/openpgl/field/SurfaceVolumeField.h @@ -196,7 +196,7 @@ struct SurfaceVolumeField : public ISurfaceVolumeField m_volumeField.deserialize(is); } - virtual bool validate(const bool checkSurface, const bool checkVolume) const override + virtual bool validate([[maybe_unused]] const bool checkSurface, [[maybe_unused]] const bool checkVolume) const override { bool valid = true; if (m_surfaceField.isInitialized()) diff --git a/openpgl/spatial/Region.h b/openpgl/spatial/Region.h index 2547eeab..c90e9c8b 100644 --- a/openpgl/spatial/Region.h +++ b/openpgl/spatial/Region.h @@ -56,7 +56,7 @@ struct Region : public IRegion } */ - const TDistribution *getDistribution(Point3 samplePosition) const + const TDistribution *getDistribution([[maybe_unused]] Point3 samplePosition) const { return &distribution; } diff --git a/openpgl/spatial/kdtree/KDTreeBuilder.h b/openpgl/spatial/kdtree/KDTreeBuilder.h index 0d4b9415..c0a7eba7 100644 --- a/openpgl/spatial/kdtree/KDTreeBuilder.h +++ b/openpgl/spatial/kdtree/KDTreeBuilder.h @@ -336,7 +336,6 @@ struct KDTreePartitionBuilder BBox bondsLeftRight[2]; // sample bounds for the splitting of a leaf node BBox tmpBounds = bounds; - bool nodeSplit = false; if (node.isLeaf()) { @@ -347,7 +346,6 @@ struct KDTreePartitionBuilder bool validBoundRange = mergedSampleStats.hasValidBoundRange(); if (validBoundRange && depth < buildSettings.maxDepth && regionAndRangeData.first.sampleStatistics.getNumSamples() + sampleRange.size() > buildSettings.maxSamples) { - nodeSplit = true; splitDim = parentSplitDim; getSplitDimensionAndPosition(mergedSampleStats, splitDim, splitPos); // update the sample bound to the measured sampled bound of the current and previous leaf node samples diff --git a/third-party/embreeSrc/common/algorithms/parallel_partition.h b/third-party/embreeSrc/common/algorithms/parallel_partition.h index fd044d6b..e3ba7f34 100644 --- a/third-party/embreeSrc/common/algorithms/parallel_partition.h +++ b/third-party/embreeSrc/common/algorithms/parallel_partition.h @@ -84,7 +84,7 @@ namespace embree : array(array), N(N), is_left(is_left), reduction_t(reduction_t), reduction_v(reduction_v), identity(identity), numTasks(min((N+BLOCK_SIZE-1)/BLOCK_SIZE,min(TaskScheduler::threadCount(),MAX_TASKS))) {} - __forceinline const range* findStartRange(size_t& index, const range* const r, const size_t numRanges) + __forceinline const range* findStartRange(size_t& index, const range* const r, [[maybe_unused]] const size_t numRanges) { size_t i = 0; while(index >= (size_t)r[i].size()) @@ -274,7 +274,7 @@ namespace embree size_t rightReduction = 0; return serial_partitioning( array,begin,end,leftReduction,rightReduction,is_left, - [] (size_t& t,const T& ref) { }); + [] ([[maybe_unused]] size_t& t, [[maybe_unused]] const T& ref) { }); } template @@ -288,8 +288,8 @@ namespace embree size_t rightReduction = 0; return parallel_partitioning( array,begin,end,0,leftReduction,rightReduction,is_left, - [] (size_t& t,const T& ref) { }, - [] (size_t& t0,size_t& t1) { }, + [] ([[maybe_unused]] size_t& t,[[maybe_unused]] const T& ref) { }, + [] ([[maybe_unused]] size_t& t0, [[maybe_unused]] size_t& t1) { }, BLOCK_SIZE); } From a0b0fa4d06a9a9e90e6ff78e49aa3aff1b8ffd4f Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Sun, 31 May 2026 17:52:24 +0200 Subject: [PATCH 2/3] [cmake] Removing some CMake warnings --- CMakeLists.txt | 3 +-- superbuild/dependencies/dep_ispc.cmake | 1 + superbuild/dependencies/dep_oidn.cmake | 1 + superbuild/dependencies/dep_tbb.cmake | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7062441..e1cff827 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,13 +17,12 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -enable_language(CXX) include(GNUInstallDirs) ## Establish project ## project(openpgl VERSION 0.8.0 LANGUAGES C CXX) - +enable_language(CXX) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) include(openpgl_macros) diff --git a/superbuild/dependencies/dep_ispc.cmake b/superbuild/dependencies/dep_ispc.cmake index a7b3d3e8..27b914cb 100644 --- a/superbuild/dependencies/dep_ispc.cmake +++ b/superbuild/dependencies/dep_ispc.cmake @@ -30,6 +30,7 @@ ExternalProject_Add(${COMPONENT_NAME} STAMP_DIR ${COMPONENT_NAME}/stamp SOURCE_DIR ${COMPONENT_NAME}/src BINARY_DIR ${COMPONENT_NAME} + DOWNLOAD_EXTRACT_TIMESTAMP TRUE URL ${ISPC_URL} ${ISPC_URL_HASH} CONFIGURE_COMMAND "" diff --git a/superbuild/dependencies/dep_oidn.cmake b/superbuild/dependencies/dep_oidn.cmake index 1f6d63b5..4e4bf829 100644 --- a/superbuild/dependencies/dep_oidn.cmake +++ b/superbuild/dependencies/dep_oidn.cmake @@ -32,6 +32,7 @@ if (BUILD_OIDN_FROM_SOURCE) STAMP_DIR ${COMPONENT_NAME}/stamp SOURCE_DIR ${COMPONENT_NAME}/src BINARY_DIR ${COMPONENT_NAME}/build + DOWNLOAD_EXTRACT_TIMESTAMP TRUE LIST_SEPARATOR | # Use the alternate list separator ${OIDN_CLONE_URL} ${OIDN_URL_HASH} diff --git a/superbuild/dependencies/dep_tbb.cmake b/superbuild/dependencies/dep_tbb.cmake index 59aecf2d..a2ffe2ae 100644 --- a/superbuild/dependencies/dep_tbb.cmake +++ b/superbuild/dependencies/dep_tbb.cmake @@ -56,6 +56,7 @@ else() STAMP_DIR ${COMPONENT_NAME}/stamp SOURCE_DIR ${COMPONENT_NAME}/src BINARY_DIR ${COMPONENT_NAME} + DOWNLOAD_EXTRACT_TIMESTAMP TRUE URL ${TBB_URL} ${TBB_HASH_ARGS} CONFIGURE_COMMAND "" From 1e203bf12794898666891146fb849811bfc47664 Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Wed, 21 Oct 2026 11:27:17 +0200 Subject: [PATCH 3/3] [cmake] Bumping the minimum CMake version requirement to 3.10 --- CMakeLists.txt | 6 +++--- cmake/FindTBB.cmake | 2 +- superbuild/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1cff827..5935e963 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ ## Global CMake options ## -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -17,8 +17,6 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -include(GNUInstallDirs) - ## Establish project ## project(openpgl VERSION 0.8.0 LANGUAGES C CXX) @@ -26,6 +24,7 @@ enable_language(CXX) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) include(openpgl_macros) +include(GNUInstallDirs) ############################################################## # Platform detection and defaults @@ -80,6 +79,7 @@ SET(OPENPGL_TBB_COMPONENT "tbb" CACHE STRING "The TBB component/library name.") if (NOT ${OPENPGL_TBB_ROOT} STREQUAL "") + cmake_policy(SET CMP0074 OLD) set(TBB_FIND_PACKAGE_OPTION "NO_DEFAULT_PATH") set(TBB_ROOT ${OPENPGL_TBB_ROOT}) list(APPEND CMAKE_PREFIX_PATH ${OPENPGL_TBB_ROOT}) diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake index 3ee8c27f..c8220582 100644 --- a/cmake/FindTBB.cmake +++ b/cmake/FindTBB.cmake @@ -37,7 +37,7 @@ #=============================================================================== # We use INTERFACE libraries, which are only supported in 3.x -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) # These two are used to automatically find the root and include directories. set(_TBB_INCLUDE_SUBDIR "include") diff --git a/superbuild/CMakeLists.txt b/superbuild/CMakeLists.txt index 3afedb3b..f9f55050 100644 --- a/superbuild/CMakeLists.txt +++ b/superbuild/CMakeLists.txt @@ -3,7 +3,7 @@ ## Global settings ## -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}