Skip to content

Commit 50e1ea2

Browse files
committed
Fix CMJ
1 parent 1a829f0 commit 50e1ea2

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

App/CL/integrator_pt.cl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -368,30 +368,25 @@ __kernel void ShadeSurface(
368368
#elif (CMJ == 1)
369369
Rng rng;
370370
InitRng(rngseed + (globalid << 2) * 157 + 13, &rng);
371-
float2 sample0 = UniformSampler_Sample2D(&rng);
372-
float2 sample1 = UniformSampler_Sample2D(&rng);
373-
float2 sample2 = UniformSampler_Sample2D(&rng);
374-
float2 sample3 = UniformSampler_Sample2D(&rng);
375-
float sample4 = UniformSampler_Sample2D(&rng).x;
376371

377372
int pass = frame / (CMJ_DIM * CMJ_DIM);
378-
int subsample0 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pixelidx + bounce) * 0xc517e953);
379-
int subsample1 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pixelidx + bounce + 1) * 0xc517e953);
380-
int subsample2 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pixelidx + bounce + 2) * 0xc517e953);
381-
int subsample3 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pixelidx + bounce + 3) * 0xc517e953);
382-
int subsample4 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pixelidx + bounce + 4) * 0xc517e953);
373+
int subsample0 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pass + pixelidx + bounce) * 0xc517e953);
374+
int subsample1 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pass + pixelidx + bounce + 1) * 0xc517e953);
375+
int subsample2 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pass + pixelidx + bounce + 2) * 0xc517e953);
376+
int subsample3 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pass + pixelidx + bounce + 3) * 0xc517e953);
377+
int subsample4 = permute(frame % (CMJ_DIM * CMJ_DIM), CMJ_DIM * CMJ_DIM, (pass + pixelidx + bounce + 4) * 0xc517e953);
383378

384379
int pattern0 = (pass + bounce + pixelidx) % 13331;
385380
int pattern1 = (pass + bounce + pixelidx + 1) % 13331;
386381
int pattern2 = (pass + bounce + pixelidx + 2) % 13331;
387382
int pattern3 = (pass + bounce + pixelidx + 3) % 13331;
388383
int pattern4 = (pass + bounce + pixelidx + 4) % 13331;
389384

390-
sample0 = cmj(subsample0, CMJ_DIM, pattern0);
391-
sample1 = cmj(subsample1, CMJ_DIM, pattern1);
392-
sample2 = cmj(subsample2, CMJ_DIM, pattern2);
393-
sample3 = cmj(subsample3, CMJ_DIM, pattern2);
394-
sample4 = cmj(subsample4, CMJ_DIM, pattern2).x;
385+
float2 sample0 = cmj(subsample0, CMJ_DIM, pattern0);
386+
float2 sample1 = cmj(subsample1, CMJ_DIM, pattern1);
387+
float2 sample2 = cmj(subsample2, CMJ_DIM, pattern2);
388+
float2 sample3 = cmj(subsample3, CMJ_DIM, pattern3);
389+
float sample4 = cmj(subsample4, CMJ_DIM, pattern4).x;
395390
#else
396391

397392
#endif

0 commit comments

Comments
 (0)