17#if defined(__KERNEL_GPU__)
28#if defined(__INTEGRATOR_GPU_PACKED_STATE__) && defined(__KERNEL_GPU__)
34 packed.tmin = ray->tmin;
35 packed.tmax = ray->tmax;
36 packed.time = ray->time;
52#if defined(__INTEGRATOR_GPU_PACKED_STATE__) && defined(__KERNEL_GPU__)
58 ray->tmin = packed.tmin;
59 ray->tmax = packed.tmax;
60 ray->time = packed.time;
152#if defined(__INTEGRATOR_GPU_PACKED_STATE__) && defined(__KERNEL_GPU__)
158 "Generated packed_isect struct is misaligned with Intersection struct");
160 "Generated packed_isect struct is misaligned with Intersection struct");
162 "Generated packed_isect struct is misaligned with Intersection struct");
164 "Generated packed_isect struct is misaligned with Intersection struct");
166 "Generated packed_isect struct is misaligned with Intersection struct");
168 "Generated packed_isect struct is misaligned with Intersection struct");
182#if defined(__INTEGRATOR_GPU_PACKED_STATE__) && defined(__KERNEL_GPU__)
310#ifdef __SHADOW_LINKING__
340# ifdef __KERNEL_GPU__
347# ifdef __KERNEL_GPU__
369 const int mnee_vertex_count,
375# ifdef __KERNEL_GPU__
377 integrator_state_write_mnee_shadow_owner(shadow_state,
state);
434 ls->pdf_selection = 0.0f;
456 ray->D = ls->P - ray->P;
465 ray->self.light_object = ls->object;
466 ray->self.light_prim = ls->prim;
477#if defined(__KERNEL_GPU__)
486# define KERNEL_STRUCT_BEGIN(name) \
490# define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature) \
491 if (kernel_integrator_state.parent_struct.name != nullptr) { \
492 kernel_integrator_state.parent_struct.name[to_state] = \
493 kernel_integrator_state.parent_struct.name[state]; \
496# ifdef __INTEGRATOR_GPU_PACKED_STATE__
497# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) \
498 KERNEL_STRUCT_BEGIN(parent_struct) \
499 KERNEL_STRUCT_MEMBER(parent_struct, packed_##parent_struct, packed, feature)
500# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature)
502# define KERNEL_STRUCT_MEMBER_PACKED KERNEL_STRUCT_MEMBER
503# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) KERNEL_STRUCT_BEGIN(parent_struct)
506# define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) \
507 if (kernel_integrator_state.parent_struct[index].name != nullptr) { \
508 kernel_integrator_state.parent_struct[index].name[to_state] = \
509 kernel_integrator_state.parent_struct[index].name[state]; \
512# define KERNEL_STRUCT_END(name) \
517# define KERNEL_STRUCT_END_ARRAY(name, cpu_array_size, gpu_array_size) \
520 while (index < gpu_array_size) \
523# define KERNEL_STRUCT_VOLUME_STACK_SIZE kernel_data.volume_stack_size
527# undef KERNEL_STRUCT_BEGIN
528# undef KERNEL_STRUCT_BEGIN_PACKED
529# undef KERNEL_STRUCT_MEMBER
530# undef KERNEL_STRUCT_MEMBER_PACKED
531# undef KERNEL_STRUCT_ARRAY_MEMBER
532# undef KERNEL_STRUCT_END
533# undef KERNEL_STRUCT_END_ARRAY
534# undef KERNEL_STRUCT_VOLUME_STACK_SIZE
541 integrator_state_copy_only(kg, to_state,
state);
548 integrator_state_write_mnee_shadow_owner(slot, to_state);
561# define KERNEL_STRUCT_BEGIN(name) \
565# define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature) \
566 if (kernel_integrator_state.parent_struct.name != nullptr) { \
567 kernel_integrator_state.parent_struct.name[to_state] = \
568 kernel_integrator_state.parent_struct.name[state]; \
571# ifdef __INTEGRATOR_GPU_PACKED_STATE__
572# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) \
573 KERNEL_STRUCT_BEGIN(parent_struct) \
574 KERNEL_STRUCT_MEMBER(parent_struct, type, packed, feature)
575# define KERNEL_STRUCT_MEMBER_PACKED(parent_struct, type, name, feature)
577# define KERNEL_STRUCT_MEMBER_PACKED KERNEL_STRUCT_MEMBER
578# define KERNEL_STRUCT_BEGIN_PACKED(parent_struct, feature) KERNEL_STRUCT_BEGIN(parent_struct)
581# define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) \
582 if (kernel_integrator_state.parent_struct[index].name != nullptr) { \
583 kernel_integrator_state.parent_struct[index].name[to_state] = \
584 kernel_integrator_state.parent_struct[index].name[state]; \
587# define KERNEL_STRUCT_END(name) \
592# define KERNEL_STRUCT_END_ARRAY(name, cpu_array_size, gpu_array_size) \
595 while (index < gpu_array_size) \
598# define KERNEL_STRUCT_VOLUME_STACK_SIZE kernel_data.volume_stack_size
602# undef KERNEL_STRUCT_BEGIN
603# undef KERNEL_STRUCT_BEGIN_PACKED
604# undef KERNEL_STRUCT_MEMBER
605# undef KERNEL_STRUCT_MEMBER_PACKED
606# undef KERNEL_STRUCT_ARRAY_MEMBER
607# undef KERNEL_STRUCT_END
608# undef KERNEL_STRUCT_END_ARRAY
609# undef KERNEL_STRUCT_VOLUME_STACK_SIZE
616 integrator_shadow_state_copy_only(kg, to_state,
state);
624 const IntegratorState main_state = integrator_state_read_mnee_shadow_owner(to_state);
637#if defined(__KERNEL_GPU__)
641 integrator_state_copy_only(kg, to_state,
state);
646 to_state->path =
state->path;
647 to_state->ray =
state->ray;
648 to_state->isect =
state->isect;
650 integrator_state_copy_volume_stack(kg, to_state,
state);
ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x)
#define KERNEL_FEATURE_VOLUME
#define KERNEL_FEATURE_NODE_PORTAL
#define ccl_device_forceinline
#define INTEGRATOR_SHADOW_ISECT_SIZE
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define kernel_integrator_state
@ DEVICE_KERNEL_INTEGRATOR_SHADOW_PATH_MNEE_PENDING
ccl_device_inline uint lcg_state_init(const uint rng_hash, const uint rng_offset, const uint sample, const uint scramble)
ccl_device_inline float3 safe_normalize_len(const float3 a, ccl_private float *t)
IntegratorShadowStateCPU * IntegratorShadowState
IntegratorBakeState ConstIntegratorBakeState
#define INTEGRATOR_STATE_ARRAY_WRITE(state, nested_struct, array_index, member)
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
#define INTEGRATOR_STATE(state, nested_struct, member)
const IntegratorShadowStateCPU * ConstIntegratorShadowState
#define INTEGRATOR_STATE_ARRAY(state, nested_struct, array_index, member)
IntegratorStateCPU * IntegratorState
const IntegratorStateCPU * ConstIntegratorState
ccl_device_inline int integrator_state_transmission_bounce(ConstIntegratorState state, const uint32_t)
ccl_device_forceinline void integrator_state_read_shadow_ray(ConstIntegratorShadowState state, ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_write_shadow_ray_self(IntegratorShadowState state, const ccl_private Ray *ccl_restrict ray)
ccl_device_inline int integrator_state_diffuse_bounce(ConstIntegratorState state, const uint32_t)
ccl_device_forceinline void integrator_state_write_shadow_isect(IntegratorShadowState state, const ccl_private Intersection *ccl_restrict isect, const int index)
ccl_device_inline int integrator_state_bounce(ConstIntegratorState state, const uint32_t)
ccl_device_forceinline void integrator_state_read_ray(ConstIntegratorState state, ccl_private Ray *ccl_restrict ray)
ccl_device_inline int integrator_state_portal_bounce(KernelGlobals kg, ConstIntegratorState state, const uint32_t)
ccl_device_forceinline void integrator_state_write_shadow_ray(IntegratorShadowState state, const ccl_private Ray *ccl_restrict ray)
ccl_device_inline IntegratorState integrator_state_shadow_catcher_split(KernelGlobals kg, IntegratorState state)
ccl_device_forceinline void integrator_state_read_shadow_isect(ConstIntegratorShadowState state, ccl_private Intersection *ccl_restrict isect, const int index)
ccl_device_forceinline void integrator_state_read_isect(ConstIntegratorState state, ccl_private Intersection *ccl_restrict isect)
ccl_device_inline uint integrator_state_lcg_init(ConstIntegratorShadowState state, const uint hash)
ccl_device_inline int integrator_state_glossy_bounce(ConstIntegratorState state, const uint32_t)
ccl_device_inline int integrator_state_transparent_bounce(ConstIntegratorState state, const uint32_t)
CCL_NAMESPACE_BEGIN ccl_device_forceinline void integrator_state_write_ray(IntegratorState state, const ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_write_isect(IntegratorState state, const ccl_private Intersection *ccl_restrict isect)
ccl_device_forceinline void integrator_state_read_shadow_ray_self(ConstIntegratorShadowState state, ccl_private Ray *ccl_restrict ray)