30#ifdef __LIGHT_LINKING__
43#ifdef __LIGHT_LINKING__
55 const int object_receiver,
56 const int light_emitter)
58#ifdef __LIGHT_LINKING__
74 const int object_receiver,
75 const int object_emitter)
77#ifdef __LIGHT_LINKING__
101template<
bool in_volume_segment>
107 const int shader_flags,
120 ls->shader = klight->shader_id;
173 return in_volume_segment || (ls->pdf > 0.0f);
178template<
bool in_volume_segment>
184 const int object_receiver,
185 const int shader_flags,
200 prim = kemitter->light.id;
201 mesh_light.shader_flag = kemitter->mesh_light.shader_flag;
202 mesh_light.object_id = ls->object;
208 light_distribution, ls->emitter_id);
209 prim = kdistribution->prim;
210 mesh_light = kdistribution->mesh_light;
215 const int object = mesh_light.object_id;
228 const int shader_flag = mesh_light.shader_flag;
232 ls->shader |= shader_flag;
235 const int light = ~prim;
250 ls->pdf *= ls->pdf_selection;
251 return in_volume_segment || (ls->pdf > 0.0f);
258template<
bool is_main_path>
263 const int last_object,
267 const int receiver_forward,
271#ifdef __SHADOW_LINKING__
303#ifdef __SHADOW_LINKING__
310 if (is_indirect_ray &&
322#ifdef __LIGHT_LINKING__
330 float t = 0.0f, u = 0.0f,
v = 0.0f;
348 if (is_main_path || ray->tmax !=
FLT_MAX) {
366#ifdef __SHADOW_LINKING__
401 const int last_object,
432 const int last_object,
435 const int receiver_forward,
462 const int lamp = isect->prim;
466 ls->shader = klight->shader_id;
467 ls->object = isect->object;
468 ls->prim = isect->prim;
471 ls->P = ray_P + ray_D * ls->t;
491 kernel_assert(!
"Invalid lamp type in light_sample_from_intersection");
ccl_device_inline bool area_light_sample(const ccl_global KernelLight *klight, const float2 rand, const float3 P, ccl_private LightSample *ls)
ccl_device_inline bool area_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t, ccl_private float *u, ccl_private float *v)
ccl_device_inline bool area_light_sample_from_intersection(const ccl_global KernelLight *klight, ccl_private const Intersection *ccl_restrict isect, const float3 ray_P, const float3 ray_D, ccl_private LightSample *ccl_restrict ls)
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define kernel_assert(cond)
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define kernel_data_fetch(name, index)
#define ccl_device_forceinline
#define ccl_device_inline
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device_inline bool distant_light_sample(const ccl_global KernelLight *klight, const float2 rand, ccl_private LightSample *ls)
ccl_device bool distant_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t, ccl_private float *u, ccl_private float *v)
ccl_device_inline int lamp_lightgroup(KernelGlobals kg, int lamp)
ccl_device_inline float3 background_light_sample(KernelGlobals kg, float3 P, float2 rand, ccl_private float *pdf)
ccl_device int lights_intersect_shadow_linked(KernelGlobals kg, ccl_private const Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag, const int receiver_forward, ccl_private uint *lcg_state, const int num_hits)
CCL_NAMESPACE_BEGIN ccl_device_inline bool light_select_reached_max_bounces(KernelGlobals kg, int index, int bounce)
ccl_device_inline bool light_link_object_match(KernelGlobals kg, const int object_receiver, const int object_emitter)
ccl_device bool lights_intersect(KernelGlobals kg, IntegratorState state, ccl_private const Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag)
ccl_device bool light_sample_from_intersection(KernelGlobals kg, ccl_private const Intersection *ccl_restrict isect, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag, ccl_private LightSample *ccl_restrict ls)
ccl_device_inline bool light_link_light_match(KernelGlobals kg, const int object_receiver, const int light_emitter)
ccl_device_forceinline int lights_intersect_impl(KernelGlobals kg, ccl_private const Ray *ccl_restrict ray, ccl_private Intersection *ccl_restrict isect, const int last_prim, const int last_object, const int last_type, const uint32_t path_flag, const uint8_t path_mnee, const int receiver_forward, ccl_private uint *lcg_state, int num_hits)
ccl_device_inline bool light_sample(KernelGlobals kg, const int lamp, const float2 rand, const float3 P, const float3 N, const int shader_flags, const uint32_t path_flag, ccl_private LightSample *ls)
ccl_device_inline int light_link_receiver_nee(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device_inline int light_link_receiver_forward(KernelGlobals kg, IntegratorState state)
@ PATH_MNEE_CULL_LIGHT_CONNECTION
@ PATH_RAY_SHADOW_CATCHER_PASS
@ SHADER_EXCLUDE_SHADOW_CATCHER
@ SD_OBJECT_SHADOW_CATCHER
struct MeshLight { int shader_flag; int object_id;} MeshLight
#define KERNEL_FEATURE_SHADOW_LINKING
#define LIGHT_LINK_MASK_ALL
#define KERNEL_FEATURE_LIGHT_LINKING
ccl_device float lcg_step_float(T rng)
ccl_device_inline bool point_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t)
CCL_NAMESPACE_BEGIN ccl_device_inline bool point_light_sample(const ccl_global KernelLight *klight, const float2 rand, const float3 P, const float3 N, const int shader_flags, ccl_private LightSample *ls)
ccl_device_inline bool point_light_sample_from_intersection(const ccl_global KernelLight *klight, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag, ccl_private LightSample *ccl_restrict ls)
ccl_device_forceinline bool triangle_light_sample(KernelGlobals kg, int prim, int object, const float2 rand, float time, ccl_private LightSample *ls, const float3 P)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
ccl_device_inline bool spot_light_sample(const ccl_global KernelLight *klight, const float2 rand, const float3 P, const float3 N, const int shader_flags, ccl_private LightSample *ls)
ccl_device_inline bool spot_light_intersect(const ccl_global KernelLight *klight, const ccl_private Ray *ccl_restrict ray, ccl_private float *t)
ccl_device_inline bool spot_light_sample_from_intersection(const ccl_global KernelLight *klight, const float3 ray_P, const float3 ray_D, const float3 N, const uint32_t path_flag, ccl_private LightSample *ccl_restrict ls)
IntegratorStateCPU *ccl_restrict IntegratorState
#define INTEGRATOR_STATE(state, nested_struct, member)
unsigned __int64 uint64_t
ccl_device_inline float2 float3_to_float2(const float3 a)