17#ifdef __SHADOW_LINKING__
27 const int lamp = isect.prim;
55ccl_device void shadow_linking_setup_ray_from_intersection(
75 ray->self.light = isect->prim;
78 ray->self.light_object = isect->object;
79 ray->self.light_prim = isect->prim;
96 const bool use_light_sample = shadow_linking_light_sample_from_intersection(
97 kg, isect, ray,
N, path_flag, &ls);
98 if (!use_light_sample) {
113 mis_weight = shadow_linking_light_sample_mis_weight(kg,
state, path_flag, &ls, ray.P);
115 bsdf_spectrum = light_eval * mis_weight *
117 light_group = ls.group;
174 float mis_weight = 1.0f;
178 if (!shadow_linking_shade_light(
179 kg,
state, ray, isect, emission_sd, bsdf_spectrum, mis_weight, light_group))
185 if (!shadow_linking_shade_surface_emission(
196 shadow_linking_setup_ray_from_intersection(
state, &ray, &isect);
200 kg,
state, &ray, bsdf_spectrum, light_group, 0);
206 shadow_state, shadow_path, bounce) =
INTEGRATOR_STATE(shadow_state, shadow_path, bounce) - 1;
217 state, path, pass_diffuse_weight);
219 state, path, pass_glossy_weight);
224# ifdef __PATH_GUIDING__
227 INTEGRATOR_STATE(shadow_state, shadow_path, guiding_mis_weight) = mis_weight;
240#ifdef __SHADOW_LINKING__
245 shadow_linking_restore_last_primitives(
state);
247 kernel_assert(!
"integrator_intersect_dedicated_light is not supposed to be scheduled");
CCL_NAMESPACE_BEGIN ccl_device_noinline_cpu Spectrum light_sample_shader_eval(KernelGlobals kg, IntegratorState state, ccl_private ShaderData *ccl_restrict emission_sd, ccl_private LightSample *ccl_restrict ls, float time)
ccl_device_inline float light_sample_mis_weight_forward_distant(KernelGlobals kg, IntegratorState state, const uint32_t path_flag, const ccl_private LightSample *ls)
ccl_device_inline float light_sample_mis_weight_forward_lamp(KernelGlobals kg, IntegratorState state, const uint32_t path_flag, const ccl_private LightSample *ls, const float3 P)
ccl_device_inline float light_sample_mis_weight_forward_surface(KernelGlobals kg, IntegratorState state, const uint32_t path_flag, const ccl_private ShaderData *sd)
#define kernel_assert(cond)
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define kernel_data_fetch(name, index)
#define ccl_optional_struct_init
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_device bool distant_light_sample_from_intersection(KernelGlobals kg, const float3 ray_D, const int lamp, ccl_private LightSample *ccl_restrict ls)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int ccl_global float * render_buffer
ccl_device_inline int object_lightgroup(KernelGlobals kg, int object)
ccl_device_forceinline void guiding_record_light_surface_segment(KernelGlobals kg, IntegratorState state, ccl_private const Intersection *ccl_restrict isect)
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)
#define AS_SHADER_DATA(shader_data_tiny_storage)
#define KERNEL_FEATURE_LIGHT_PASSES
#define PROFILING_INIT(kg, event)
ccl_device_inline bool is_light_shader_visible_to_path(const int shader, const uint32_t path_flag)
ccl_device_inline bool is_zero(const float2 a)
CCL_NAMESPACE_BEGIN ccl_device void integrator_shade_dedicated_light(KernelGlobals kg, IntegratorState state, ccl_global float *ccl_restrict render_buffer)
ccl_device_inline IntegratorShadowState integrate_direct_light_shadow_init_common(KernelGlobals kg, IntegratorState state, ccl_private const Ray *ccl_restrict ray, const Spectrum bsdf_spectrum, const int light_group, const int mnee_vertex_count)
ccl_device_forceinline void integrator_shade_surface_next_kernel(KernelGlobals kg, IntegratorState state)
CCL_NAMESPACE_BEGIN ccl_device_forceinline void integrate_surface_shader_setup(KernelGlobals kg, ConstIntegratorState state, ccl_private ShaderData *sd)
IntegratorStateCPU *ccl_restrict IntegratorState
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
#define INTEGRATOR_STATE(state, nested_struct, member)
IntegratorShadowStateCPU *ccl_restrict IntegratorShadowState
ccl_device_forceinline void integrator_state_read_ray(ConstIntegratorState state, ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_read_isect(ConstIntegratorState state, ccl_private Intersection *ccl_restrict isect)
ccl_device Spectrum surface_shader_emission(ccl_private const ShaderData *sd)
ccl_device void surface_shader_eval(KernelGlobals kg, ConstIntegratorGenericState state, ccl_private ShaderData *ccl_restrict sd, ccl_global float *ccl_restrict buffer, uint32_t path_flag, bool use_caustics_storage=false)
SPECTRUM_DATA_TYPE Spectrum
@ PROFILING_SHADE_DEDICATED_LIGHT