@@ -363,6 +363,7 @@ void *render_thread_interactive(void *arg) {
363
363
long total_us = 0 ;
364
364
365
365
timer_start (& timer );
366
+ thread_rwlock_rdlock (r -> scene -> bvh_lock );
366
367
for (int y = tile -> end .y - 1 ; y > tile -> begin .y - 1 ; -- y ) {
367
368
for (int x = tile -> begin .x ; x < tile -> end .x ; ++ x ) {
368
369
if (r -> state .s != r_rendering ) goto exit ;
@@ -373,9 +374,7 @@ void *render_thread_interactive(void *arg) {
373
374
sampler_init (sampler , SAMPLING_STRATEGY , r -> state .finishedPasses , r -> prefs .sampleCount , pixIdx );
374
375
375
376
struct color output = tex_get_px (* buf , x , y , false);
376
- thread_rwlock_rdlock (r -> scene -> bvh_lock );
377
377
struct color sample = path_trace (cam_get_ray (cam , x , y , sampler ), r -> scene , r -> prefs .bounces , sampler );
378
- thread_rwlock_unlock (r -> scene -> bvh_lock );
379
378
380
379
nan_clamp (& sample , & output );
381
380
@@ -389,6 +388,7 @@ void *render_thread_interactive(void *arg) {
389
388
tex_set_px (* buf , output , x , y );
390
389
}
391
390
}
391
+ thread_rwlock_unlock (r -> scene -> bvh_lock );
392
392
//For performance metrics
393
393
total_us += timer_get_us (timer );
394
394
threadState -> totalSamples ++ ;
0 commit comments