Skip to content

Commit 3a97aea

Browse files
committed
Fix path+light bug
1 parent f4d39e5 commit 3a97aea

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/slg/engines/pathtracer.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -977,10 +977,19 @@ void PathTracer::ApplyVarianceClamp(const PathTracerThreadState &state,
977977

978978
void PathTracer::RenderSample(PathTracerThreadState &state) const {
979979
// Check if I have to trace an eye or light path
980-
auto& sampler = HasToRenderEyeSample(state) ? state.eyeSampler : state.lightSampler;
981-
auto& sampleResults = HasToRenderEyeSample(state) ? state.GetEyeSampleResults() : state.GetLightSampleResults();
980+
Sampler *sampler;
981+
vector<SampleResult> *sampleResults;
982+
if (HasToRenderEyeSample(state)) {
983+
// Trace an eye path
984+
sampler = state.eyeSampler.get();
985+
sampleResults = &state.GetEyeSampleResults();
986+
} else {
987+
// Trace a light path
988+
sampler = state.lightSampler.get();
989+
sampleResults = &state.GetLightSampleResults();
990+
}
982991

983-
if (sampler == state.eyeSampler)
992+
if (sampler == state.eyeSampler.get())
984993
RenderEyeSample(
985994
state.device,
986995
state.scene,
@@ -998,9 +1007,9 @@ void PathTracer::RenderSample(PathTracerThreadState &state) const {
9981007
);
9991008

10001009
// Variance clamping
1001-
ApplyVarianceClamp(state, sampleResults);
1010+
ApplyVarianceClamp(state, *sampleResults);
10021011

1003-
sampler->NextSample(sampleResults);
1012+
sampler->NextSample(*sampleResults);
10041013
}
10051014

10061015
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)