Skip to content

Commit d4523ca

Browse files
committed
Merge remote-tracking branch 'b/main'
2 parents cbc8d5d + 9dd4e90 commit d4523ca

File tree

402 files changed

+4974
-4235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+4974
-4235
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,14 @@ else()
881881
set(WITH_LINUX_OFFICIAL_RELEASE_TESTS OFF)
882882
endif()
883883

884+
option(WITH_TESTS_EXPERIMENTAL "\
885+
Run tests marked as experimental. \
886+
These tests are labeled as such due to long runtime, flakey results, or other issues that make them unsuitable \
887+
for blocking a build on."
888+
OFF
889+
)
890+
mark_as_advanced(WITH_TESTS_EXPERIMENTAL)
891+
884892
# Enabled by default for typical use cases to speed up development cycles. However, when looking
885893
# into threading or memory related issues (in dependency graph, out-of-bounds, etc) forcing single
886894
# test per Blender instance could give much better clues about the root of the problem.

build_files/cmake/platform/platform_apple.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ endif()
374374
if(WITH_HARU)
375375
find_package(Haru REQUIRED)
376376
endif()
377-
377+
378378
if(WITH_MANIFOLD)
379379
find_package(manifold REQUIRED)
380380
endif()

extern/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_subdirectory(curve_fit_nd)
77
add_subdirectory(fmtlib)
88
if(WITH_IO_FBX)
99
add_subdirectory(ufbx)
10-
endif()
10+
endif()
1111

1212
# Otherwise we get warnings here that we cant fix in external projects
1313
remove_strict_flags()

intern/cycles/blender/object.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ Object *BlenderSync::sync_object(BL::ViewLayer &b_view_layer,
311311
/* object sync
312312
* transform comparison should not be needed, but duplis don't work perfect
313313
* in the depsgraph and may not signal changes, so this is a workaround */
314-
if (object->is_modified() || object_updated ||
315-
(object->get_geometry() && object->get_geometry()->is_modified()))
316-
{
314+
const bool do_sync = object->is_modified() || object_updated ||
315+
(object->get_geometry() && object->get_geometry()->is_modified());
316+
if (do_sync) {
317317
object->name = b_ob.name().c_str();
318318
object->set_pass_id(b_ob.pass_index());
319319
const BL::Array<float, 4> object_color = b_ob.color();
@@ -345,12 +345,14 @@ Object *BlenderSync::sync_object(BL::ViewLayer &b_view_layer,
345345
object->set_receiver_light_set(BlenderLightLink::get_receiver_light_set(b_parent, b_ob));
346346
object->set_shadow_set_membership(BlenderLightLink::get_shadow_set_membership(b_parent, b_ob));
347347
object->set_blocker_shadow_set(BlenderLightLink::get_blocker_shadow_set(b_parent, b_ob));
348-
349-
object->tag_update(scene);
350348
}
351349

352350
sync_object_motion_init(b_parent, b_ob, object);
353351

352+
if (do_sync || object->motion_is_modified()) {
353+
object->tag_update(scene);
354+
}
355+
354356
if (is_instance) {
355357
/* Sync possible particle data. */
356358
sync_dupli_particle(b_parent, b_instance, object);

intern/cycles/integrator/denoiser_gpu.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ bool DenoiserGPU::denoise_filter_color_postprocess(const DenoiseContext &context
259259
bool DenoiserGPU::denoise_filter_color_preprocess(const DenoiseContext &context,
260260
const DenoisePass &pass)
261261
{
262+
if (context.denoise_params.type != DENOISER_OPTIX) {
263+
/* Pass preprocessing is used to clamp values for the OptiX denoiser.
264+
* Clamping is not necceasry for other denoisers, so just skip this preprocess step. */
265+
return true;
266+
}
267+
262268
const BufferParams &buffer_params = context.buffer_params;
263269

264270
const int work_size = buffer_params.width * buffer_params.height;

intern/cycles/kernel/bvh/bvh.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg,
229229
IntegratorShadowState state,
230230
const ccl_private Ray *ray,
231231
const uint visibility,
232-
const uint max_hits,
232+
const uint max_transparent_hits,
233233
ccl_private uint *num_recorded_hits,
234234
ccl_private float *throughput)
235235
{
@@ -244,7 +244,7 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg,
244244
{
245245
if (kernel_data.device_bvh) {
246246
return kernel_embree_intersect_shadow_all(
247-
kg, state, ray, visibility, max_hits, num_recorded_hits, throughput);
247+
kg, state, ray, visibility, max_transparent_hits, num_recorded_hits, throughput);
248248
}
249249
}
250250
# endif
@@ -256,24 +256,24 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg,
256256
# ifdef __HAIR__
257257
if (kernel_data.bvh.have_curves) {
258258
return bvh_intersect_shadow_all_hair_motion(
259-
kg, ray, state, visibility, max_hits, num_recorded_hits, throughput);
259+
kg, ray, state, visibility, max_transparent_hits, num_recorded_hits, throughput);
260260
}
261261
# endif /* __HAIR__ */
262262

263263
return bvh_intersect_shadow_all_motion(
264-
kg, ray, state, visibility, max_hits, num_recorded_hits, throughput);
264+
kg, ray, state, visibility, max_transparent_hits, num_recorded_hits, throughput);
265265
}
266266
# endif /* __OBJECT_MOTION__ */
267267

268268
# ifdef __HAIR__
269269
if (kernel_data.bvh.have_curves) {
270270
return bvh_intersect_shadow_all_hair(
271-
kg, ray, state, visibility, max_hits, num_recorded_hits, throughput);
271+
kg, ray, state, visibility, max_transparent_hits, num_recorded_hits, throughput);
272272
}
273273
# endif /* __HAIR__ */
274274

275275
return bvh_intersect_shadow_all(
276-
kg, ray, state, visibility, max_hits, num_recorded_hits, throughput);
276+
kg, ray, state, visibility, max_transparent_hits, num_recorded_hits, throughput);
277277
}
278278

279279
kernel_assert(false);

intern/cycles/kernel/bvh/shadow_all.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ccl_device_inline
3131
const ccl_private Ray *ray,
3232
IntegratorShadowState state,
3333
const uint visibility,
34-
const uint max_hits,
34+
const uint max_transparent_hits,
3535
ccl_private uint *r_num_recorded_hits,
3636
ccl_private float *r_throughput)
3737
{
@@ -54,7 +54,7 @@ ccl_device_inline
5454
float3 idir = bvh_inverse_direction(dir);
5555
float tmin = ray->tmin;
5656
int object = OBJECT_NONE;
57-
uint num_hits = 0;
57+
uint num_transparent_hits = 0;
5858

5959
/* Max distance in world space. May be dynamically reduced when max number of
6060
* recorded hits is exceeded and we no longer need to find hits beyond the max
@@ -241,8 +241,9 @@ ccl_device_inline
241241
continue;
242242
}
243243

244-
num_hits++;
245-
if (num_hits > max_hits) {
244+
/* Only count transparent bounces, volume bounds bounces are counted when shading. */
245+
num_transparent_hits += !(flags & SD_HAS_ONLY_VOLUME);
246+
if (num_transparent_hits > max_transparent_hits) {
246247
return true;
247248
}
248249

@@ -268,7 +269,7 @@ ccl_device_inline
268269
* so that we can detect this and trace another ray if needed. */
269270
++(*r_num_recorded_hits);
270271

271-
const uint max_record_hits = min(max_hits, (uint)INTEGRATOR_SHADOW_ISECT_SIZE);
272+
const uint max_record_hits = (uint)INTEGRATOR_SHADOW_ISECT_SIZE;
272273
if (*r_num_recorded_hits <= max_record_hits || isect.t < tmax_hits) {
273274
integrator_state_write_shadow_isect(state, &isect, isect_index);
274275

@@ -331,12 +332,12 @@ ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals kg,
331332
const ccl_private Ray *ray,
332333
IntegratorShadowState state,
333334
const uint visibility,
334-
const uint max_hits,
335+
const uint max_transparent_hits,
335336
ccl_private uint *num_recorded_hits,
336337
ccl_private float *throughput)
337338
{
338339
return BVH_FUNCTION_FULL_NAME(BVH)(
339-
kg, ray, state, visibility, max_hits, num_recorded_hits, throughput);
340+
kg, ray, state, visibility, max_transparent_hits, num_recorded_hits, throughput);
340341
}
341342

342343
#undef BVH_FUNCTION_NAME

intern/cycles/kernel/device/cpu/bvh.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ struct CCLShadowContext
8080
float throughput;
8181
float max_t;
8282
bool opaque_hit;
83-
numhit_t max_hits;
84-
numhit_t num_hits;
83+
numhit_t max_transparent_hits;
84+
numhit_t num_transparent_hits;
8585
numhit_t num_recorded_hits;
8686
};
8787

@@ -343,22 +343,24 @@ ccl_device_forceinline void kernel_embree_filter_occluded_shadow_all_func_impl(
343343
}
344344
#endif
345345

346-
/* If no transparent shadows or max number of hits exceeded, all light is blocked. */
346+
/* If no transparent shadows, all light is blocked. */
347347
const int flags = intersection_get_shader_flags(kg, current_isect.prim, current_isect.type);
348348
if ((flags & SD_HAS_TRANSPARENT_SHADOW) == 0) {
349349
ctx->opaque_hit = true;
350350
return;
351351
}
352352

353353
if (intersection_skip_shadow_already_recoded(
354-
kg, ctx->isect_s, current_isect.object, current_isect.prim, ctx->num_hits))
354+
kg, ctx->isect_s, current_isect.object, current_isect.prim, ctx->num_recorded_hits))
355355
{
356356
*args->valid = 0;
357357
return;
358358
}
359359

360-
++ctx->num_hits;
361-
if (ctx->num_hits > ctx->max_hits) {
360+
/* Only count transparent bounces, volume bounds bounces are counted during shading. */
361+
ctx->num_transparent_hits += !(flags & SD_HAS_ONLY_VOLUME);
362+
if (ctx->num_transparent_hits > ctx->max_transparent_hits) {
363+
/* Max number of hits exceeded. */
362364
ctx->opaque_hit = true;
363365
return;
364366
}
@@ -390,7 +392,7 @@ ccl_device_forceinline void kernel_embree_filter_occluded_shadow_all_func_impl(
390392
/* This tells Embree to continue tracing. */
391393
*args->valid = 0;
392394

393-
const numhit_t max_record_hits = min(ctx->max_hits, numhit_t(INTEGRATOR_SHADOW_ISECT_SIZE));
395+
const numhit_t max_record_hits = numhit_t(INTEGRATOR_SHADOW_ISECT_SIZE);
394396
/* If the maximum number of hits was reached, replace the furthest intersection
395397
* with a closer one so we get the N closest intersections. */
396398
if (isect_index >= max_record_hits) {
@@ -862,7 +864,7 @@ ccl_device_intersect bool kernel_embree_intersect_shadow_all(KernelGlobals kg,
862864
IntegratorShadowState state,
863865
const ccl_private Ray *ray,
864866
const uint visibility,
865-
const uint max_hits,
867+
const uint max_transparent_hits,
866868
ccl_private uint *num_recorded_hits,
867869
ccl_private float *throughput)
868870
{
@@ -882,11 +884,11 @@ ccl_device_intersect bool kernel_embree_intersect_shadow_all(KernelGlobals kg,
882884
CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SHADOW_ALL);
883885
rtcInitIntersectContext(&ctx);
884886
# endif
885-
ctx.num_hits = ctx.num_recorded_hits = numhit_t(0);
887+
ctx.num_transparent_hits = ctx.num_recorded_hits = numhit_t(0);
886888
ctx.throughput = 1.0f;
887889
ctx.opaque_hit = false;
888890
ctx.isect_s = state;
889-
ctx.max_hits = numhit_t(max_hits);
891+
ctx.max_transparent_hits = numhit_t(max_transparent_hits);
890892
ctx.max_t = ray->tmax;
891893
ctx.ray = ray;
892894
RTCRay rtc_ray;

intern/cycles/kernel/device/hiprt/bvh.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg,
166166
IntegratorShadowState state,
167167
const ccl_private Ray *ray,
168168
const uint visibility,
169-
const uint max_hits,
169+
const uint max_transparent_hits,
170170
ccl_private uint *num_recorded_hits,
171171
ccl_private float *throughput)
172172
{
@@ -187,8 +187,8 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg,
187187
payload.prim_type = PRIMITIVE_NONE;
188188
payload.ray_time = ray->time;
189189
payload.in_state = state;
190-
payload.max_hits = max_hits;
191-
payload.num_hits = 0;
190+
payload.max_transparent_hits = max_transparent_hits;
191+
payload.num_transparent_hits = 0;
192192
payload.r_num_recorded_hits = num_recorded_hits;
193193
payload.r_throughput = throughput;
194194

intern/cycles/kernel/device/hiprt/common.h

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ struct RayPayload {
1919
* NOTE: This assumes that reinterpret_cast from void pointer to RayPayload works correctly. */
2020
struct ShadowPayload : RayPayload {
2121
int in_state;
22-
uint max_hits;
23-
uint num_hits;
22+
uint max_transparent_hits;
23+
uint num_transparent_hits;
2424
uint *r_num_recorded_hits;
2525
float *r_throughput;
2626
};
@@ -380,8 +380,8 @@ ccl_device_inline bool shadow_intersection_filter(const hiprtRay &ray,
380380
{
381381
KernelGlobals kg = payload->kg;
382382

383-
const uint num_hits = payload->num_hits;
384-
const uint max_hits = payload->max_hits;
383+
uint num_transparent_hits = payload->num_transparent_hits;
384+
const uint max_transparent_hits = payload->max_transparent_hits;
385385
const int state = payload->in_state;
386386
const RaySelfPrimitives &self = payload->self;
387387

@@ -407,7 +407,9 @@ ccl_device_inline bool shadow_intersection_filter(const hiprtRay &ray,
407407
return true; /* No hit -continue traversal. */
408408
}
409409

410-
if (intersection_skip_shadow_already_recoded(kg, state, object, prim, num_hits)) {
410+
if (intersection_skip_shadow_already_recoded(
411+
kg, state, object, prim, *payload->r_num_recorded_hits))
412+
{
411413
return true;
412414
}
413415

@@ -418,18 +420,22 @@ ccl_device_inline bool shadow_intersection_filter(const hiprtRay &ray,
418420
# ifndef __TRANSPARENT_SHADOWS__
419421
return false;
420422
# else
421-
if (num_hits >= max_hits ||
422-
!(intersection_get_shader_flags(kg, prim, primitive_type) & SD_HAS_TRANSPARENT_SHADOW))
423-
{
423+
const int flags = intersection_get_shader_flags(kg, prim, primitive_type);
424+
if (!(flags & SD_HAS_TRANSPARENT_SHADOW)) {
425+
return false;
426+
}
427+
428+
num_transparent_hits += !(flags & SD_HAS_ONLY_VOLUME);
429+
if (num_transparent_hits > max_transparent_hits) {
424430
return false;
425431
}
426432

427433
uint record_index = *payload->r_num_recorded_hits;
428434

429-
payload->num_hits = num_hits + 1;
435+
payload->num_transparent_hits = num_transparent_hits;
430436
*(payload->r_num_recorded_hits) += 1;
431437

432-
const uint max_record_hits = min(max_hits, INTEGRATOR_SHADOW_ISECT_SIZE);
438+
const uint max_record_hits = INTEGRATOR_SHADOW_ISECT_SIZE;
433439
if (record_index >= max_record_hits) {
434440
float max_recorded_t = INTEGRATOR_STATE_ARRAY(state, shadow_isect, 0, t);
435441
uint max_recorded_hit = 0;
@@ -467,9 +473,9 @@ ccl_device_inline bool shadow_intersection_filter_curves(const hiprtRay &ray,
467473
{
468474
KernelGlobals kg = payload->kg;
469475

470-
const uint num_hits = payload->num_hits;
476+
uint num_transparent_hits = payload->num_transparent_hits;
471477
const uint num_recorded_hits = *(payload->r_num_recorded_hits);
472-
const uint max_hits = payload->max_hits;
478+
const uint max_transparent_hits = payload->max_transparent_hits;
473479
const RaySelfPrimitives &self = payload->self;
474480

475481
const int object = kernel_data_fetch(user_instance_id, hit.instanceID);
@@ -494,7 +500,10 @@ ccl_device_inline bool shadow_intersection_filter_curves(const hiprtRay &ray,
494500
return true; /* No hit -continue traversal. */
495501
}
496502

497-
if (intersection_skip_shadow_already_recoded(kg, payload->in_state, object, prim, num_hits)) {
503+
/* FIXME: transparent curves are not recorded, this check doesn't work. */
504+
if (intersection_skip_shadow_already_recoded(
505+
kg, payload->in_state, object, prim, num_recorded_hits))
506+
{
498507
return true;
499508
}
500509

@@ -510,16 +519,20 @@ ccl_device_inline bool shadow_intersection_filter_curves(const hiprtRay &ray,
510519
# ifndef __TRANSPARENT_SHADOWS__
511520
return false;
512521
# else
513-
if (num_hits >= max_hits ||
514-
!(intersection_get_shader_flags(kg, prim, primitive_type) & SD_HAS_TRANSPARENT_SHADOW))
515-
{
522+
const int flags = intersection_get_shader_flags(kg, prim, primitive_type);
523+
if (!(flags & SD_HAS_TRANSPARENT_SHADOW)) {
524+
return false;
525+
}
526+
527+
num_transparent_hits += !(flags & SD_HAS_ONLY_VOLUME);
528+
if (num_transparent_hits > max_transparent_hits) {
516529
return false;
517530
}
518531

519532
float throughput = *payload->r_throughput;
520533
throughput *= intersection_curve_shadow_transparency(kg, object, prim, primitive_type, u);
521534
*payload->r_throughput = throughput;
522-
payload->num_hits += 1;
535+
payload->num_transparent_hits = num_transparent_hits;
523536

524537
if (throughput < CURVE_SHADOW_TRANSPARENCY_CUTOFF) {
525538
return false;

0 commit comments

Comments
 (0)