From 7019e563d7ef5042016bde2f31350237f4dd5e65 Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Mon, 12 Oct 2026 12:28:09 +0200 Subject: [PATCH 1/9] [cleanup] Some code clean up --- openpgl/spatial/Region.h | 5 ----- tools/openpgl_debug/openpgl_debug.cpp | 1 - 2 files changed, 6 deletions(-) diff --git a/openpgl/spatial/Region.h b/openpgl/spatial/Region.h index c90e9c8b..819c1cfd 100644 --- a/openpgl/spatial/Region.h +++ b/openpgl/spatial/Region.h @@ -32,11 +32,6 @@ struct Region : public IRegion return regionBounds; } - inline const BBox &getSampleBounds() const - { - return sampleStatistics.sampleBounds; - } - #ifdef OPENPGL_RADIANCE_CACHES Vector3 getOutgoingRadiance(const Vector3 dir) const override { diff --git a/tools/openpgl_debug/openpgl_debug.cpp b/tools/openpgl_debug/openpgl_debug.cpp index 06d98abd..898009e8 100644 --- a/tools/openpgl_debug/openpgl_debug.cpp +++ b/tools/openpgl_debug/openpgl_debug.cpp @@ -36,7 +36,6 @@ struct DebugParams std::string field_file_name{""}; std::string field_file_name_comp{""}; std::string field_file_name_out{""}; - // std::string samples_file_name{""}; std::vector samples_file_names; std::string samples_file_name_comp{""}; std::string samples_out_file_name{""}; From 9c5330d88a95278e1063ecb478243d7e51752cb1 Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Mon, 12 Oct 2026 12:31:10 +0200 Subject: [PATCH 2/9] [common] Including the version.h in the openpgl.h header --- openpgl/include/openpgl/openpgl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/openpgl/include/openpgl/openpgl.h b/openpgl/include/openpgl/openpgl.h index 11ce5ab3..93ffd61e 100644 --- a/openpgl/include/openpgl/openpgl.h +++ b/openpgl/include/openpgl/openpgl.h @@ -18,6 +18,7 @@ #include "common.h" #include "defines.h" +#include "version.h" #if defined(OPENPGL_DIRECTION_COMPRESSION) || defined(OPENPGL_RADIANCE_COMPRESSION) #include "compression.h" #endif From 254776768fb7ce95009c1c29c0eae59911911f20 Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Mon, 12 Oct 2026 12:31:10 +0200 Subject: [PATCH 3/9] [dqt] Adding missing toString() function --- openpgl/directional/dqt/DQTFactory.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/openpgl/directional/dqt/DQTFactory.h b/openpgl/directional/dqt/DQTFactory.h index b8837e9d..4acac5cd 100644 --- a/openpgl/directional/dqt/DQTFactory.h +++ b/openpgl/directional/dqt/DQTFactory.h @@ -164,6 +164,11 @@ class DirectionalQuadtreeFactory { return true; } + + std::string toString() const + { + return ""; + } }; struct FittingStatistics @@ -184,7 +189,7 @@ class DirectionalQuadtreeFactory const size_t numZeroValueSamples, const bool varianceBased) const {} - void fit(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, FittingStatistics &fitStats) + void fit(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, FittingStatistics &fitStats) const { for (uint32_t i = 0; i < 5; i++) { @@ -194,7 +199,7 @@ class DirectionalQuadtreeFactory } } - void update(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, FittingStatistics &fitStats) + void update(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, FittingStatistics &fitStats) const { Context ctx = {&dist, &stats, &fitStats, samples, numSamples, &cfg}; @@ -237,7 +242,7 @@ class DirectionalQuadtreeFactory // Internal Update Routines template - void updateInternal(Context &ctx) + void updateInternal(Context &ctx) const { ctx.fitStats->numSamples = ctx.stats->numSamples += ctx.numSamples; @@ -327,7 +332,7 @@ class DirectionalQuadtreeFactory } } - void buildRecursive(Context &ctx, std::vector &old_nodes, Rect rect, uint32_t i, uint32_t j, uint32_t level = 0) + void buildRecursive(Context &ctx, std::vector &old_nodes, Rect rect, uint32_t i, uint32_t j, uint32_t level = 0) const { StatsNode &old_node = old_nodes[i]; ctx.stats->nodes[j] = old_node; @@ -368,7 +373,7 @@ class DirectionalQuadtreeFactory } } - void buildSplit(Context &ctx, Rect rect, uint32_t p, uint32_t i, uint32_t level) + void buildSplit(Context &ctx, Rect rect, uint32_t p, uint32_t i, uint32_t level) const { const auto &parent = ctx.stats->nodes[p]; auto &node = ctx.stats->nodes[i]; From 2f6d335e06b228f23230cc5217325ab66e22561e Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Mon, 12 Oct 2026 12:31:10 +0200 Subject: [PATCH 4/9] [field] Resetting the number of splits and setting initialized to true even when region fitting is disabled --- openpgl/field/Field.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpgl/field/Field.h b/openpgl/field/Field.h index ac2020f6..830d8f68 100644 --- a/openpgl/field/Field.h +++ b/openpgl/field/Field.h @@ -488,9 +488,9 @@ struct Field std::cout << "!!!! " << (m_isSurface ? "Surface" : "Volume") << " regionStorage.first.valid !!! " << regionStorage.first.distribution.toString() << std::endl; #endif - regionStorage.first.numSplits = 0; - regionStorage.first.initialized = true; } + regionStorage.first.numSplits = 0; + regionStorage.first.initialized = true; } else { From 7e5ffe10b4304b86613d495716b6c5657c7a32f0 Mon Sep 17 00:00:00 2001 From: Sebastian Herholz Date: Mon, 26 Oct 2026 11:29:09 +0100 Subject: [PATCH 5/9] [clang-format] Running clang-format --- openpgl/device/Device.h | 2 +- .../ISurfaceSamplingDistribution.h | 4 +- .../directional/IVolumeSamplingDistribution.h | 4 +- openpgl/directional/dqt/DQTFactory.h | 4 +- .../dqt/DQTSurfaceSamplingDistribution.h | 4 +- .../dqt/DQTVolumeSamplingDistribution.h | 4 +- .../vmm/VMMSurfaceSamplingDistribution.h | 2 +- .../vmm/VMMVolumeSamplingDistribution.h | 2 +- openpgl/field/ISurfaceVolumeField.h | 2 +- openpgl/imagespace/ImageSpaceGuidingBuffer.h | 224 +++++++++++------- .../openpgl/cpp/ImageSpaceGuidingBuffer.h | 40 ++-- openpgl/include/openpgl/data.h | 18 +- openpgl/spatial/IRegion.h | 4 +- 13 files changed, 190 insertions(+), 124 deletions(-) diff --git a/openpgl/device/Device.h b/openpgl/device/Device.h index a8c75bee..ff2d493f 100644 --- a/openpgl/device/Device.h +++ b/openpgl/device/Device.h @@ -32,7 +32,7 @@ static tbb::task_scheduler_init g_opgl_tbb_threads(tbb::task_scheduler_init::def struct IDevice { - virtual ~IDevice(){}; + virtual ~IDevice() {}; virtual ISurfaceVolumeField *newField(PGLFieldArguments args) const = 0; virtual ISurfaceVolumeField *newFieldFromFile(const std::string fieldFileName) const = 0; }; diff --git a/openpgl/directional/ISurfaceSamplingDistribution.h b/openpgl/directional/ISurfaceSamplingDistribution.h index 99773619..5c52331c 100644 --- a/openpgl/directional/ISurfaceSamplingDistribution.h +++ b/openpgl/directional/ISurfaceSamplingDistribution.h @@ -11,9 +11,9 @@ struct ISurfaceSamplingDistribution { // ISurfaceSamplingDistribution() = delete; - ISurfaceSamplingDistribution(){}; + ISurfaceSamplingDistribution() {}; - virtual ~ISurfaceSamplingDistribution(){}; + virtual ~ISurfaceSamplingDistribution() {}; virtual void init(const void *distribution, Point3 samplePosition) = 0; diff --git a/openpgl/directional/IVolumeSamplingDistribution.h b/openpgl/directional/IVolumeSamplingDistribution.h index 32785996..cb385ce0 100644 --- a/openpgl/directional/IVolumeSamplingDistribution.h +++ b/openpgl/directional/IVolumeSamplingDistribution.h @@ -11,9 +11,9 @@ struct IVolumeSamplingDistribution { // IVolumeSamplingDistribution() = delete; - IVolumeSamplingDistribution(){}; + IVolumeSamplingDistribution() {}; - virtual ~IVolumeSamplingDistribution(){}; + virtual ~IVolumeSamplingDistribution() {}; virtual void init(const void *distribution, Point3 samplePosition) = 0; diff --git a/openpgl/directional/dqt/DQTFactory.h b/openpgl/directional/dqt/DQTFactory.h index 4acac5cd..f55d8a6a 100644 --- a/openpgl/directional/dqt/DQTFactory.h +++ b/openpgl/directional/dqt/DQTFactory.h @@ -179,7 +179,9 @@ class DirectionalQuadtreeFactory uint32_t numMerges = 0; }; - void prepareSamples([[maybe_unused]] SampleData *samples, [[maybe_unused]] const size_t numSamples, [[maybe_unused]] const SampleStatistics &sampleStatistics, [[maybe_unused]] 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 diff --git a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h index 89e6e6c9..aea7ca46 100644 --- a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h @@ -9,9 +9,9 @@ namespace openpgl template struct DQTSurfaceSamplingDistribution : public ISurfaceSamplingDistribution { - DQTSurfaceSamplingDistribution(){}; + DQTSurfaceSamplingDistribution() {}; - virtual ~DQTSurfaceSamplingDistribution() override{}; + virtual ~DQTSurfaceSamplingDistribution() override {}; virtual void init(const void *distribution, [[maybe_unused]] Point3 samplePosition) override { diff --git a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h index 5be8128b..eb1a6fa6 100644 --- a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h @@ -9,9 +9,9 @@ namespace openpgl template struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution { - DQTVolumeSamplingDistribution(){}; + DQTVolumeSamplingDistribution() {}; - virtual ~DQTVolumeSamplingDistribution() override{}; + virtual ~DQTVolumeSamplingDistribution() override {}; virtual void init(const void *distribution, [[maybe_unused]] Point3 samplePosition) override { diff --git a/openpgl/directional/vmm/VMMSurfaceSamplingDistribution.h b/openpgl/directional/vmm/VMMSurfaceSamplingDistribution.h index 6aa38a9d..88583be0 100644 --- a/openpgl/directional/vmm/VMMSurfaceSamplingDistribution.h +++ b/openpgl/directional/vmm/VMMSurfaceSamplingDistribution.h @@ -15,7 +15,7 @@ struct __aligned(TVMMDistribution::VectorSize * 4) VMMSurfaceSamplingDistributio { OPENPGL_ALIGNED_STRUCT_(TVMMDistribution::VectorSize * 4) - VMMSurfaceSamplingDistribution(){}; + VMMSurfaceSamplingDistribution() {}; ~VMMSurfaceSamplingDistribution() override = default; typedef std::integral_constant MaxNumProductDistributions; diff --git a/openpgl/directional/vmm/VMMVolumeSamplingDistribution.h b/openpgl/directional/vmm/VMMVolumeSamplingDistribution.h index c66021b1..d902d767 100644 --- a/openpgl/directional/vmm/VMMVolumeSamplingDistribution.h +++ b/openpgl/directional/vmm/VMMVolumeSamplingDistribution.h @@ -13,7 +13,7 @@ template struct __aligned(TVMMDistribution::VectorSize * 4) VMMVolumeSamplingDistribution : public IVolumeSamplingDistribution { OPENPGL_ALIGNED_STRUCT_(TVMMDistribution::VectorSize * 4) - VMMVolumeSamplingDistribution() : IVolumeSamplingDistribution(){}; + VMMVolumeSamplingDistribution() : IVolumeSamplingDistribution() {}; ~VMMVolumeSamplingDistribution() override = default; typedef std::integral_constant MaxNumProductDistributions; diff --git a/openpgl/field/ISurfaceVolumeField.h b/openpgl/field/ISurfaceVolumeField.h index 2788099a..926848cd 100644 --- a/openpgl/field/ISurfaceVolumeField.h +++ b/openpgl/field/ISurfaceVolumeField.h @@ -16,7 +16,7 @@ struct ISurfaceVolumeField { using SampleContainer = SampleDataStorage::SampleContainer; - virtual ~ISurfaceVolumeField(){}; + virtual ~ISurfaceVolumeField() {}; virtual ISurfaceSamplingDistribution *newSurfaceSamplingDistribution() const = 0; diff --git a/openpgl/imagespace/ImageSpaceGuidingBuffer.h b/openpgl/imagespace/ImageSpaceGuidingBuffer.h index 58a4c86f..3833c0e9 100644 --- a/openpgl/imagespace/ImageSpaceGuidingBuffer.h +++ b/openpgl/imagespace/ImageSpaceGuidingBuffer.h @@ -96,11 +96,13 @@ struct ImageSpaceGuidingBuffer { m_resolution = cfg.resolution; m_denoiser = new Denoiser(cfg.resolution, false); - if(m_cfg.contributionEstimate) { + if (m_cfg.contributionEstimate) + { m_contributionEstimateBuffers = new Buffers(cfg.resolution); } #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { + if (m_cfg.vspEstimate) + { m_surfaceContributionEstimateBuffers = new Buffers(cfg.resolution); m_volumeContributionEstimateBuffers = new Buffers(cfg.resolution); m_pVolBuffer = new float[m_resolution.x * m_resolution.y]; @@ -150,12 +152,14 @@ struct ImageSpaceGuidingBuffer m_cfg.vspEstimate = false; m_cfg.vspType = PGLVSPTypes::EVSPContribution; #endif - for (int i = 0; i < layer_names.size(); i++) { + for (int i = 0; i < layer_names.size(); i++) + { std::string layerName = layer_names[i]; if (layerName == "Contrib" || layerName == "Contrib2nd") { m_cfg.contributionEstimate = true; - if(layerName == "Contrib2nd") { + if (layerName == "Contrib2nd") + { m_cfg.contributionType = PGLContributionTypes::EContribVariance; } } @@ -163,20 +167,23 @@ struct ImageSpaceGuidingBuffer if (layerName == "surfContrib" || layerName == "surfContrib2nd") { m_cfg.vspEstimate = true; - if(layerName == "surfContrib2nd") { + if (layerName == "surfContrib2nd") + { m_cfg.vspType = PGLVSPTypes::EVSPVariance; } } #endif } - if (m_cfg.contributionEstimate) { + if (m_cfg.contributionEstimate) + { m_contributionEstimateBuffers = new Buffers(m_resolution); } m_cfg.resolution = m_resolution; #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { + if (m_cfg.vspEstimate) + { m_surfaceContributionEstimateBuffers = new Buffers(m_resolution); m_volumeContributionEstimateBuffers = new Buffers(m_resolution); m_pVolBuffer = new float[m_resolution.x * m_resolution.y]; @@ -369,11 +376,15 @@ struct ImageSpaceGuidingBuffer std::vector layerChannels; std::vector channelValues; int cIdx = 0; - if(m_cfg.contributionEstimate) { + if (m_cfg.contributionEstimate) + { cIdx = layerChannels.size(); - if (m_cfg.contributionType == PGLContributionTypes::EContribContribution) { + if (m_cfg.contributionType == PGLContributionTypes::EContribContribution) + { layerChannels.emplace_back(cIdx, "Contrib"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "Contrib2nd"); } numChannels.emplace_back(3); @@ -385,9 +396,12 @@ struct ImageSpaceGuidingBuffer channelValues.emplace_back((const float *)m_contributionEstimateBuffers->spp); cIdx = layerChannels.size(); - if (m_cfg.contributionType == PGLContributionTypes::EContribContribution) { + if (m_cfg.contributionType == PGLContributionTypes::EContribContribution) + { layerChannels.emplace_back(cIdx, "ContribRaw"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "Contrib2ndRaw"); } numChannels.emplace_back(3); @@ -404,30 +418,37 @@ struct ImageSpaceGuidingBuffer channelValues.emplace_back((const float *)m_contributionEstimateBuffers->normal); } #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { + if (m_cfg.vspEstimate) + { cIdx = layerChannels.size(); - if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) { + if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) + { layerChannels.emplace_back(cIdx, "surfContrib"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "surfContrib2nd"); } numChannels.emplace_back(3); channelValues.emplace_back((const float *)m_surfaceContributionEstimateBuffers->filteredContribution); - + cIdx = layerChannels.size(); layerChannels.emplace_back(cIdx, "surfSpp"); numChannels.emplace_back(1); channelValues.emplace_back((const float *)m_surfaceContributionEstimateBuffers->spp); - + cIdx = layerChannels.size(); - if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) { + if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) + { layerChannels.emplace_back(cIdx, "surfContribRaw"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "surfContrib2ndRaw"); } numChannels.emplace_back(3); channelValues.emplace_back((const float *)m_surfaceContributionEstimateBuffers->contribution); - + cIdx = layerChannels.size(); layerChannels.emplace_back(cIdx, "surfAlbedo"); numChannels.emplace_back(3); @@ -437,25 +458,31 @@ struct ImageSpaceGuidingBuffer layerChannels.emplace_back(cIdx, "surfN"); numChannels.emplace_back(3); channelValues.emplace_back((const float *)m_surfaceContributionEstimateBuffers->normal); - + cIdx = layerChannels.size(); - if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) { + if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) + { layerChannels.emplace_back(cIdx, "volContrib"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "volContrib2nd"); } numChannels.emplace_back(3); channelValues.emplace_back((const float *)m_volumeContributionEstimateBuffers->filteredContribution); - + cIdx = layerChannels.size(); layerChannels.emplace_back(cIdx, "volSpp"); numChannels.emplace_back(1); channelValues.emplace_back((const float *)m_volumeContributionEstimateBuffers->spp); cIdx = layerChannels.size(); - if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) { + if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) + { layerChannels.emplace_back(cIdx, "volContribRaw"); - } else { + } + else + { layerChannels.emplace_back(cIdx, "volContrib2ndRaw"); } numChannels.emplace_back(3); @@ -470,7 +497,7 @@ struct ImageSpaceGuidingBuffer layerChannels.emplace_back(cIdx, "volN"); numChannels.emplace_back(3); channelValues.emplace_back((const float *)m_volumeContributionEstimateBuffers->normal); - + cIdx = layerChannels.size(); layerChannels.emplace_back(cIdx, "VSP"); numChannels.emplace_back(1); @@ -484,7 +511,7 @@ struct ImageSpaceGuidingBuffer cIdx = layerChannels.size(); layerChannels.emplace_back(cIdx, "PVol"); numChannels.emplace_back(1); - channelValues.emplace_back((const float *)m_filteredPVolBuffer); + channelValues.emplace_back((const float *)m_filteredPVolBuffer); } #endif @@ -628,14 +655,16 @@ struct ImageSpaceGuidingBuffer void update() { - if(m_cfg.contributionEstimate) { + if (m_cfg.contributionEstimate) + { m_denoiser->denoise(m_contributionEstimateBuffers->contribution, m_contributionEstimateBuffers->normal, m_contributionEstimateBuffers->albedo, m_contributionEstimateBuffers->filteredContribution); } #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { + if (m_cfg.vspEstimate) + { const int numPixels = m_resolution.x * m_resolution.y; - + #ifdef USE_EMBREE_PARALLEL embree::parallel_for(0, (int)numPixels, 1, [&](const embree::range &r) { for (size_t pIdx = r.begin(); pIdx < r.end(); pIdx++) @@ -650,56 +679,73 @@ struct ImageSpaceGuidingBuffer m_pVolBuffer[pIdx] = pVolEst; } }); - + m_denoiser->denoise(m_pVolBuffer, m_filteredPVolBuffer); - m_denoiser->denoise(m_surfaceContributionEstimateBuffers->contribution, m_surfaceContributionEstimateBuffers->normal, m_surfaceContributionEstimateBuffers->albedo, m_surfaceContributionEstimateBuffers->filteredContribution); - m_denoiser->denoise(m_volumeContributionEstimateBuffers->contribution, m_volumeContributionEstimateBuffers->normal, m_volumeContributionEstimateBuffers->albedo, m_volumeContributionEstimateBuffers->filteredContribution); + m_denoiser->denoise(m_surfaceContributionEstimateBuffers->contribution, m_surfaceContributionEstimateBuffers->normal, m_surfaceContributionEstimateBuffers->albedo, + m_surfaceContributionEstimateBuffers->filteredContribution); + m_denoiser->denoise(m_volumeContributionEstimateBuffers->contribution, m_volumeContributionEstimateBuffers->normal, m_volumeContributionEstimateBuffers->albedo, + m_volumeContributionEstimateBuffers->filteredContribution); #ifdef USE_EMBREE_PARALLEL embree::parallel_for(0, (int)numPixels, 1, [&](const embree::range &r) { - for (size_t pIdx = r.begin(); pIdx < r.end(); pIdx++) { + for (size_t pIdx = r.begin(); pIdx < r.end(); pIdx++) + { #else tbb::parallel_for(tbb::blocked_range(0, numPixels), [&](tbb::blocked_range r) { - for (int pIdx = r.begin(); pIdx < r.end(); ++pIdx) { + for (int pIdx = r.begin(); pIdx < r.end(); ++pIdx) + { #endif - - float pVolEst = m_filteredPVolBuffer[pIdx]; - pVolEst = std::max(0.f, std::min(1.f, pVolEst)); + float pVolEst = m_filteredPVolBuffer[pIdx]; + pVolEst = std::max(0.f, std::min(1.f, pVolEst)); #ifndef VSP_USE_PVOL_EST - // If we add zero samples to the other buffers (e.g., to the volume buffer when we have a surface sample) - // Then we do not need to multiply with (1.f -pVolEst) or pVolEst. - // Note for the second moment look for the USE_PVOL_CORRECTION earlier whne calcualting the sqrt of the second moment. - pgl_vec3f surfaceContribution = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx]; - pgl_vec3f volumeContribution = m_volumeContributionEstimateBuffers->filteredContribution[pIdx]; + // If we add zero samples to the other buffers (e.g., to the volume buffer when we have a surface sample) + // Then we do not need to multiply with (1.f -pVolEst) or pVolEst. + // Note for the second moment look for the USE_PVOL_CORRECTION earlier whne calcualting the sqrt of the second moment. + pgl_vec3f surfaceContribution = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx]; + pgl_vec3f volumeContribution = m_volumeContributionEstimateBuffers->filteredContribution[pIdx]; #else - // If the surface/volume buffers only include volume or surface samples we have - // to correct with (1.f -pVolEst) and pVolEst. - // Not since we already use the sqrt of the second moment we only need to multiply - // with pVolEst and not pVolEst°2 - - pgl_vec3f surfaceContribution, volumeContribution; - if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) { - surfaceContribution = (1.f - pVolEst) * m_surfaceContributionEstimateBuffers->filteredContribution[pIdx]; - volumeContribution = pVolEst * m_volumeContributionEstimateBuffers->filteredContribution[pIdx]; - } - else { - surfaceContribution.x = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].x > 0.f ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].x) : 0.f; - surfaceContribution.y = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].y > 0.f ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].y) : 0.f; - surfaceContribution.z = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].z > 0.f ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].z) : 0.f; - - volumeContribution.x = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].x > 0.f ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].x) : 0.f; - volumeContribution.y = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].y > 0.f ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].y) : 0.f; - volumeContribution.z = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].z > 0.f ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].z) : 0.f; - } + // If the surface/volume buffers only include volume or surface samples we have + // to correct with (1.f -pVolEst) and pVolEst. + // Not since we already use the sqrt of the second moment we only need to multiply + // with pVolEst and not pVolEst°2 + + pgl_vec3f surfaceContribution, volumeContribution; + if (m_cfg.vspType == PGLVSPTypes::EVSPContribution) + { + surfaceContribution = (1.f - pVolEst) * m_surfaceContributionEstimateBuffers->filteredContribution[pIdx]; + volumeContribution = pVolEst * m_volumeContributionEstimateBuffers->filteredContribution[pIdx]; + } + else + { + surfaceContribution.x = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].x > 0.f + ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].x) + : 0.f; + surfaceContribution.y = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].y > 0.f + ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].y) + : 0.f; + surfaceContribution.z = m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].z > 0.f + ? (1.f - pVolEst) * std::sqrt(m_surfaceContributionEstimateBuffers->filteredContribution[pIdx].z) + : 0.f; + + volumeContribution.x = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].x > 0.f + ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].x) + : 0.f; + volumeContribution.y = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].y > 0.f + ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].y) + : 0.f; + volumeContribution.z = m_volumeContributionEstimateBuffers->filteredContribution[pIdx].z > 0.f + ? pVolEst * std::sqrt(m_volumeContributionEstimateBuffers->filteredContribution[pIdx].z) + : 0.f; + } #endif - pgl_vec3f contribution = surfaceContribution + volumeContribution; - float contributionScalar = pglVec3fMax(contribution); - float volumeContributionScalar = pglVec3fMax(volumeContribution); + pgl_vec3f contribution = surfaceContribution + volumeContribution; + float contributionScalar = pglVec3fMax(contribution); + float volumeContributionScalar = pglVec3fMax(volumeContribution); - m_vspContributionBuffer[pIdx] = contributionScalar > 0.f ? volumeContributionScalar / (contributionScalar) : -1.f; - } - }); + m_vspContributionBuffer[pIdx] = contributionScalar > 0.f ? volumeContributionScalar / (contributionScalar) : -1.f; + } + }); } #endif m_ready = true; @@ -708,24 +754,27 @@ struct ImageSpaceGuidingBuffer void addSample(const pgl_point2i pixel, const PGLImageSpaceSample &sample) { std::size_t pixelIdx = pixel.y * m_resolution.x + pixel.x; - if(m_cfg.contributionEstimate) { + if (m_cfg.contributionEstimate) + { m_contributionEstimateBuffers->spp[pixelIdx] += 1; float alpha = 1.f / m_contributionEstimateBuffers->spp[pixelIdx]; - const pgl_vec3f quantity = m_cfg.contributionType == PGLContributionTypes::EContribContribution ? sample.contribution : sample.contribution*sample.contribution; + const pgl_vec3f quantity = m_cfg.contributionType == PGLContributionTypes::EContribContribution ? sample.contribution : sample.contribution * sample.contribution; m_contributionEstimateBuffers->contribution[pixelIdx] = (1.f - alpha) * m_contributionEstimateBuffers->contribution[pixelIdx] + alpha * sample.contribution; m_contributionEstimateBuffers->albedo[pixelIdx] = (1.f - alpha) * m_contributionEstimateBuffers->albedo[pixelIdx] + alpha * sample.albedo; m_contributionEstimateBuffers->normal[pixelIdx] = (1.f - alpha) * m_contributionEstimateBuffers->normal[pixelIdx] + alpha * sample.normal; } #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { - if (sample.IsSurfaceEvent()) { - m_surfaceContributionEstimateBuffers->spp[pixelIdx] += 1; + if (m_cfg.vspEstimate) + { + if (sample.IsSurfaceEvent()) + { + m_surfaceContributionEstimateBuffers->spp[pixelIdx] += 1; #ifdef VSP_USE_PVOL_EST // calculating the alpha using only the number of surface samples float alpha = 1.f / m_surfaceContributionEstimateBuffers->spp[pixelIdx]; #else - // calculating the alpha simulating we added zero samples for each volume sample as well + // calculating the alpha simulating we added zero samples for each volume sample as well float alpha = 1.f / (m_surfaceContributionEstimateBuffers->spp[pixelIdx] + m_volumeContributionEstimateBuffers->spp[pixelIdx]); #endif pgl_vec3f quantity = m_cfg.vspType == EVSPVariance ? sample.contribution * sample.contribution : sample.contribution; @@ -736,13 +785,15 @@ struct ImageSpaceGuidingBuffer // adding zero value samples to the volume buffer m_volumeContributionEstimateBuffers->contribution[pixelIdx] = (1.f - alpha) * m_volumeContributionEstimateBuffers->contribution[pixelIdx]; #endif - } else { + } + else + { m_volumeContributionEstimateBuffers->spp[pixelIdx] += 1; #ifdef VSP_USE_PVOL_EST // calculating the alpha using only the number of volume samples float alpha = 1.f / m_volumeContributionEstimateBuffers->spp[pixelIdx]; #else - // calculating the alpha simulating we added zero samples for each surface sample as well + // calculating the alpha simulating we added zero samples for each surface sample as well float alpha = 1.f / (m_surfaceContributionEstimateBuffers->spp[pixelIdx] + m_volumeContributionEstimateBuffers->spp[pixelIdx]); #endif pgl_vec3f quantity = m_cfg.vspType == EVSPVariance ? sample.contribution * sample.contribution : sample.contribution; @@ -760,7 +811,8 @@ struct ImageSpaceGuidingBuffer pgl_vec3f getContributionEstimate(const pgl_point2i pixel) const { - if(!m_ready || !m_cfg.contributionEstimate) { + if (!m_ready || !m_cfg.contributionEstimate) + { return {0.f, 0.f, 0.f}; } @@ -772,7 +824,8 @@ struct ImageSpaceGuidingBuffer #if defined(OPENPGL_VSP_GUIDING) float getVolumeScatterProbabilityEstimate(const pgl_point2i pixel) const { - if (!m_ready || !m_cfg.vspEstimate) { + if (!m_ready || !m_cfg.vspEstimate) + { return 0.5f; } std::size_t pixelIdx = pixel.y * m_resolution.x + pixel.x; @@ -791,7 +844,8 @@ struct ImageSpaceGuidingBuffer m_contributionEstimateBuffers->reset(); } #if defined(OPENPGL_VSP_GUIDING) - if(m_cfg.vspEstimate) { + if (m_cfg.vspEstimate) + { if (m_surfaceContributionEstimateBuffers) { m_surfaceContributionEstimateBuffers->reset(); @@ -801,7 +855,7 @@ struct ImageSpaceGuidingBuffer m_volumeContributionEstimateBuffers->reset(); } const int numPixels = m_resolution.x * m_resolution.y; - + #ifdef USE_EMBREE_PARALLEL embree::parallel_for(0, (int)numPixels, 1, [&](const embree::range &r) { for (size_t pIdx = r.begin(); pIdx < r.end(); pIdx++) @@ -814,7 +868,7 @@ struct ImageSpaceGuidingBuffer m_filteredPVolBuffer[pIdx] = 0.f; m_vspContributionBuffer[pIdx] = 0.f; } - }); + }); } #endif m_ready = false; @@ -832,9 +886,9 @@ struct ImageSpaceGuidingBuffer Buffers *m_surfaceContributionEstimateBuffers{nullptr}; Buffers *m_volumeContributionEstimateBuffers{nullptr}; - float *m_pVolBuffer {nullptr}; - float *m_filteredPVolBuffer {nullptr}; - float *m_vspContributionBuffer {nullptr}; + float *m_pVolBuffer{nullptr}; + float *m_filteredPVolBuffer{nullptr}; + float *m_vspContributionBuffer{nullptr}; #endif }; diff --git a/openpgl/include/openpgl/cpp/ImageSpaceGuidingBuffer.h b/openpgl/include/openpgl/cpp/ImageSpaceGuidingBuffer.h index 1c90d05b..b9bcbfc6 100644 --- a/openpgl/include/openpgl/cpp/ImageSpaceGuidingBuffer.h +++ b/openpgl/include/openpgl/cpp/ImageSpaceGuidingBuffer.h @@ -25,9 +25,10 @@ namespace util */ struct ImageSpaceGuidingBuffer { - struct Config { - - Config(Point2i resolution) { + struct Config + { + Config(Point2i resolution) + { data.resolution = {resolution.x, resolution.y}; } @@ -35,20 +36,24 @@ struct ImageSpaceGuidingBuffer { data.contributionEstimate = contributionEstimate; } - - bool ContributionEstimate() const { + + bool ContributionEstimate() const + { return data.contributionEstimate; } - Point2i GetResolution() const { + Point2i GetResolution() const + { return {data.resolution.x, data.resolution.y}; } - void SetContributionType(PGLContributionTypes type) { + void SetContributionType(PGLContributionTypes type) + { data.contributionType = type; } - PGLContributionTypes GetContributionType() { + PGLContributionTypes GetContributionType() + { return data.contributionType; } @@ -57,25 +62,28 @@ struct ImageSpaceGuidingBuffer { data.vspEstimate = vspEstimate; } - - bool VolumeScatterProbabilityEstimate() const { + + bool VolumeScatterProbabilityEstimate() const + { return data.vspEstimate; } - void SetVolumeScatterProbabilityType(PGLVSPTypes type) { + void SetVolumeScatterProbabilityType(PGLVSPTypes type) + { data.vspType = type; } - PGLVSPTypes GetVolumeScatterProbabilityType() { + PGLVSPTypes GetVolumeScatterProbabilityType() + { return data.vspType; } #endif - friend struct ImageSpaceGuidingBuffer; - private: + friend struct ImageSpaceGuidingBuffer; + + private: PGLImageSpaceGuidingBufferConfig data; }; - - + typedef PGLImageSpaceSample Sample; /** diff --git a/openpgl/include/openpgl/data.h b/openpgl/include/openpgl/data.h index 14bddd04..dc1b4a4a 100644 --- a/openpgl/include/openpgl/data.h +++ b/openpgl/include/openpgl/data.h @@ -178,7 +178,8 @@ struct PGLImageSpaceSample #endif }; -enum PGLContributionTypes { +enum PGLContributionTypes +{ EContribContribution = 0, EContribVariance, }; @@ -189,14 +190,15 @@ enum PGLVSPTypes EVSPVariance, }; -struct PGLImageSpaceGuidingBufferConfig { - pgl_point2i resolution {0, 0}; - bool contributionEstimate {true}; - PGLContributionTypes contributionType {PGLContributionTypes::EContribContribution}; - //float maxContributionValue {FLT_MAX}; //TODO +struct PGLImageSpaceGuidingBufferConfig +{ + pgl_point2i resolution{0, 0}; + bool contributionEstimate{true}; + PGLContributionTypes contributionType{PGLContributionTypes::EContribContribution}; + // float maxContributionValue {FLT_MAX}; //TODO #if defined(OPENPGL_VSP_GUIDING) - bool vspEstimate {false}; - PGLVSPTypes vspType {PGLVSPTypes::EVSPContribution}; + bool vspEstimate{false}; + PGLVSPTypes vspType{PGLVSPTypes::EVSPContribution}; #endif }; diff --git a/openpgl/spatial/IRegion.h b/openpgl/spatial/IRegion.h index 1549fbcc..0be58a7d 100644 --- a/openpgl/spatial/IRegion.h +++ b/openpgl/spatial/IRegion.h @@ -3,15 +3,15 @@ #pragma once -#include "../openpgl_common.h" #include "../data/SampleData.h" +#include "../openpgl_common.h" namespace openpgl { struct IRegion { - virtual ~IRegion(){}; + virtual ~IRegion() {}; #ifdef OPENPGL_RADIANCE_CACHES virtual Vector3 getOutgoingRadiance(const Vector3 dir) const = 0; From 56c49110d27db4487164558e6e0641e249b9aeef Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Nov 2026 17:15:06 +0100 Subject: [PATCH 6/9] [superbuild] Adding option to enable VSP guiding --- superbuild/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/superbuild/CMakeLists.txt b/superbuild/CMakeLists.txt index f9f55050..49d153ce 100644 --- a/superbuild/CMakeLists.txt +++ b/superbuild/CMakeLists.txt @@ -199,6 +199,12 @@ if (NOT BUILD_DEPENDENCIES_ONLY) ) endif() + if(OPENPGL_EF_VSP_GUIDING) + set(OPENPGL_ARGS ${OPENPGL_ARGS} + -DOPENPGL_EF_VSP_GUIDING=${OPENPGL_EF_VSP_GUIDING} + ) + endif() + if(OPENPGL_EF_IMAGE_SPACE_GUIDING_BUFFER) set(OPENPGL_ARGS ${OPENPGL_ARGS} -DOPENPGL_EF_IMAGE_SPACE_GUIDING_BUFFER=${OPENPGL_EF_IMAGE_SPACE_GUIDING_BUFFER} From 0a7c1360543af5195cab9e2c63589ca8d62e2eb1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Nov 2026 17:15:26 +0100 Subject: [PATCH 7/9] [embree] Adding additional maybe_unused flags to avoid unused variable warnings --- third-party/embreeSrc/common/algorithms/parallel_reduce.h | 6 +++--- third-party/embreeSrc/common/simd/arm/avx2neon.h | 2 +- third-party/embreeSrc/common/sys/alloc.h | 6 +++--- third-party/embreeSrc/common/sys/thread.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/third-party/embreeSrc/common/algorithms/parallel_reduce.h b/third-party/embreeSrc/common/algorithms/parallel_reduce.h index b52b1e2e..67b55912 100644 --- a/third-party/embreeSrc/common/algorithms/parallel_reduce.h +++ b/third-party/embreeSrc/common/algorithms/parallel_reduce.h @@ -8,19 +8,19 @@ namespace embree { template - __forceinline Value sequential_reduce( const Index first, const Index last, const Value& identity, const Func& func, const Reduction& reduction ) + __forceinline Value sequential_reduce( const Index first, const Index last, [[maybe_unused]] const Value& identity, const Func& func, [[maybe_unused]] const Reduction& reduction ) { return func(range(first,last)); } template - __forceinline Value sequential_reduce( const Index first, const Index last, const Index minStepSize, const Value& identity, const Func& func, const Reduction& reduction ) + __forceinline Value sequential_reduce( const Index first, const Index last, [[maybe_unused]] const Index minStepSize, [[maybe_unused]] const Value& identity, const Func& func, [[maybe_unused]] const Reduction& reduction ) { return func(range(first,last)); } template - __noinline Value parallel_reduce_internal( Index taskCount, const Index first, const Index last, const Index minStepSize, const Value& identity, const Func& func, const Reduction& reduction ) + __noinline Value parallel_reduce_internal( Index taskCount, const Index first, const Index last, [[maybe_unused]] const Index minStepSize, const Value& identity, const Func& func, const Reduction& reduction ) { const Index maxTasks = 512; const Index threadCount = (Index) TaskScheduler::threadCount(); diff --git a/third-party/embreeSrc/common/simd/arm/avx2neon.h b/third-party/embreeSrc/common/simd/arm/avx2neon.h index dd321d3d..bea8ca0f 100644 --- a/third-party/embreeSrc/common/simd/arm/avx2neon.h +++ b/third-party/embreeSrc/common/simd/arm/avx2neon.h @@ -1176,7 +1176,7 @@ __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int AVX2NEON_ABI -__m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale) +__m256i _mm256_mask_i32gather_epi32 ([[maybe_unused]] __m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale) { uint32x4_t mask_lo = mask.lo; uint32x4_t mask_hi = mask.hi; diff --git a/third-party/embreeSrc/common/sys/alloc.h b/third-party/embreeSrc/common/sys/alloc.h index e19c2c22..03f3adc0 100644 --- a/third-party/embreeSrc/common/sys/alloc.h +++ b/third-party/embreeSrc/common/sys/alloc.h @@ -92,7 +92,7 @@ namespace embree return (pointer) alignedMalloc(n*sizeof(value_type),alignment); } - __forceinline void deallocate( pointer p, size_type n ) { + __forceinline void deallocate( pointer p, [[maybe_unused]] size_type n ) { return alignedFree(p); } @@ -159,11 +159,11 @@ namespace embree typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - __forceinline pointer allocate( size_type n ) { + __forceinline pointer allocate( [[maybe_unused]] size_type n ) { throw std::runtime_error("no allocation supported"); } - __forceinline void deallocate( pointer p, size_type n ) { + __forceinline void deallocate( [[maybe_unused]] pointer p, [[maybe_unused]] size_type n ) { } __forceinline void construct( pointer p, const_reference val ) { diff --git a/third-party/embreeSrc/common/sys/thread.cpp b/third-party/embreeSrc/common/sys/thread.cpp index 8b072067..9400d193 100644 --- a/third-party/embreeSrc/common/sys/thread.cpp +++ b/third-party/embreeSrc/common/sys/thread.cpp @@ -323,7 +323,7 @@ namespace embree namespace embree { /*! set affinity of the calling thread */ - void setAffinity(ssize_t affinity) + void setAffinity([[maybe_unused]] ssize_t affinity) { #if !defined(__ARM_NEON) // affinity seems not supported on M1 chip From 7d59a935be08615340313682f0553bd353963246 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Nov 2026 17:15:50 +0100 Subject: [PATCH 8/9] [cleanup] Adding more maybe_unused flags to avoid unused variable warnings --- openpgl/directional/dqt/DQTFactory.h | 9 +++++---- openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h | 6 +++--- openpgl/directional/dqt/DQTVolumeSamplingDistribution.h | 8 ++++---- third-party/tinyexr/tinyexr.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/openpgl/directional/dqt/DQTFactory.h b/openpgl/directional/dqt/DQTFactory.h index f55d8a6a..aa545ee3 100644 --- a/openpgl/directional/dqt/DQTFactory.h +++ b/openpgl/directional/dqt/DQTFactory.h @@ -183,12 +183,13 @@ class DirectionalQuadtreeFactory [[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 + void updateFluenceEstimate([[maybe_unused]] Distribution &dist, [[maybe_unused]] const SampleData *samples, [[maybe_unused]] const size_t numSamples, + [[maybe_unused]] const size_t numZeroValueSamples, [[maybe_unused]] const SampleStatistics &sampleStatistics) const {} - void updateVolumeScatterProbability(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const ZeroValueSampleData *zeroValueSamples, - const size_t numZeroValueSamples, const bool varianceBased) const + void updateVolumeScatterProbability([[maybe_unused]] Distribution &dist, [[maybe_unused]] Statistics &stats, [[maybe_unused]] const SampleData *samples, + [[maybe_unused]] const size_t numSamples, [[maybe_unused]] const ZeroValueSampleData *zeroValueSamples, + [[maybe_unused]] const size_t numZeroValueSamples, [[maybe_unused]] const bool varianceBased) const {} void fit(Distribution &dist, Statistics &stats, const SampleData *samples, const size_t numSamples, const Configuration &cfg, FittingStatistics &fitStats) const diff --git a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h index aea7ca46..905b4a75 100644 --- a/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTSurfaceSamplingDistribution.h @@ -49,12 +49,12 @@ struct DQTSurfaceSamplingDistribution : public ISurfaceSamplingDistribution return distribution.pdf(dir); }; #ifdef OPENPGL_RADIANCE_CACHES - inline Vector3 incomingRadiance(const Vector3 dir, const bool directLightMIS) const override + inline Vector3 incomingRadiance([[maybe_unused]] const Vector3 dir, [[maybe_unused]] const bool directLightMIS) const override { return Vector3(0.f, 0.f, 0.f); } - inline Vector3 irradiance(const Vector3 normal, const bool directLightMIS) const override + inline Vector3 irradiance([[maybe_unused]] const Vector3 normal, [[maybe_unused]] const bool directLightMIS) const override { return Vector3(0.f, 0.f, 0.f); } @@ -88,7 +88,7 @@ struct DQTSurfaceSamplingDistribution : public ISurfaceSamplingDistribution } #ifdef OPENPGL_VSP_GUIDING - float volumeScatterProbability(Vector3 dir) const override + float volumeScatterProbability([[maybe_unused]] Vector3 dir) const override { return 0.f; } diff --git a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h index eb1a6fa6..aa7fa46c 100644 --- a/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h +++ b/openpgl/directional/dqt/DQTVolumeSamplingDistribution.h @@ -39,7 +39,7 @@ struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution }; #ifdef OPENPGL_RADIANCE_CACHES - inline Vector3 incomingRadiance(const Vector3 dir, const bool directLightMIS) const override + inline Vector3 incomingRadiance([[maybe_unused]] const Vector3 dir, [[maybe_unused]] const bool directLightMIS) const override { return Vector3(0.f, 0.f, 0.f); } @@ -49,12 +49,12 @@ struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution return m_region->getOutgoingRadiance(dir); } - inline Vector3 inScatteredRadiance(const Vector3 dir, const float g, const bool directLightMIS) const override + inline Vector3 inScatteredRadiance([[maybe_unused]] const Vector3 dir, [[maybe_unused]] const float g, [[maybe_unused]] const bool directLightMIS) const override { return Vector3(0.f, 0.f, 0.f); } - inline Vector3 fluence(const bool directLightMIS) const override + inline Vector3 fluence([[maybe_unused]] const bool directLightMIS) const override { return Vector3(0.f, 0.f, 0.f); } @@ -94,7 +94,7 @@ struct DQTVolumeSamplingDistribution : public IVolumeSamplingDistribution } #ifdef OPENPGL_VSP_GUIDING - float volumeScatterProbability(Vector3 dir) const override + float volumeScatterProbability([[maybe_unused]] Vector3 dir) const override { return 0.f; } diff --git a/third-party/tinyexr/tinyexr.h b/third-party/tinyexr/tinyexr.h index 10926377..3fd4214c 100644 --- a/third-party/tinyexr/tinyexr.h +++ b/third-party/tinyexr/tinyexr.h @@ -1382,7 +1382,7 @@ static bool CompressZip(unsigned char *dst, compressedSize = outSize; #elif defined(TINYEXR_USE_NANOZLIB) && (TINYEXR_USE_NANOZLIB==1) - uint64_t dstSize = nanoz_compressBound(static_cast(src_size)); + [[maybe_unused]] uint64_t dstSize = nanoz_compressBound(static_cast(src_size)); int outSize{0}; unsigned char *ret = nanoz_compress(&tmpBuf.at(0), src_size, &outSize, /* quality */8); if (!ret) { From 8fa101bed02827b09c22e084e1fb835a3538c881 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Nov 2026 17:16:16 +0100 Subject: [PATCH 9/9] [cleanup] Fixing double define warnings by not including defines.h during build time --- openpgl/include/openpgl/openpgl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openpgl/include/openpgl/openpgl.h b/openpgl/include/openpgl/openpgl.h index 93ffd61e..5ee0266b 100644 --- a/openpgl/include/openpgl/openpgl.h +++ b/openpgl/include/openpgl/openpgl.h @@ -17,7 +17,10 @@ #endif #include "common.h" +// The defines.h header is generated after building so we do not include it during the build process +#if !defined(OPENPGL_BUILD) #include "defines.h" +#endif #include "version.h" #if defined(OPENPGL_DIRECTION_COMPRESSION) || defined(OPENPGL_RADIANCE_COMPRESSION) #include "compression.h"