25# define SHADOW_HIT_COUNT_BITS_GPU 12
26# define SHADOW_HIT_COUNT_MASK_GPU ((1 << SHADOW_HIT_COUNT_BITS_GPU) - 1)
27# define SHADOW_RESUME_BITS_GPU 3
28# define SHADOW_RESUME_MASK_GPU ((1 << SHADOW_RESUME_BITS_GPU) - 1)
32 "INTEGRATOR_SHADOW_ISECT_SIZE_GPU too large for resume_hit bits");
38 return packed_num_hits & SHADOW_HIT_COUNT_MASK_GPU;
40 return packed_num_hits;
47 return (packed_num_hits >> SHADOW_HIT_COUNT_BITS_GPU) & SHADOW_RESUME_MASK_GPU;
49 (void)packed_num_hits;
57 return (packed_num_hits >> (SHADOW_HIT_COUNT_BITS_GPU + SHADOW_RESUME_BITS_GPU)) & 1;
59 (void)packed_num_hits;
65 const uint resume_hit,
66 const bool surface_hit)
69 return (num_hits & SHADOW_HIT_COUNT_MASK_GPU) |
70 ((resume_hit & SHADOW_RESUME_MASK_GPU) << SHADOW_HIT_COUNT_BITS_GPU) |
71 ((surface_hit ? 1u : 0u) << (SHADOW_HIT_COUNT_BITS_GPU + SHADOW_RESUME_BITS_GPU));
86#ifdef __TRANSPARENT_SHADOWS__
116 num_hits, hit,
true);
129 volume_stack_enter_exit<true>(kg,
state, shadow_sd);
158 const int num_recorded_hits,
180 shader_setup_from_volume(shadow_sd, &ray,
OBJECT_NONE);
183 const float step_size = volume_stack_step_size<true>(kg,
state);
184 volume_shadow_ray_marching(kg,
state, &ray, shadow_sd, throughput, step_size);
187 volume_shadow_null_scattering(kg,
state, &ray, shadow_sd, throughput);
197 num_hits, hit,
false);
217 for (uint hit = resume_hit; hit < num_recorded_hits + 1; hit++) {
219 const bool skip_volume = (hit == resume_hit) && cache_miss_surface;
226 if (!integrator_state_shadow_volume_stack_is_empty(kg,
state)) {
229 kg,
state, num_hits, hit, num_recorded_hits, &throughput);
240 if (hit < num_recorded_hits) {
242 kg,
state, num_hits, hit);
270#ifdef __TRANSPARENT_SHADOWS__
273 kg,
state, packed_num_hits);
ccl_device_forceinline float intersection_t_offset(const float t)
#define kernel_assert(cond)
#define VOLUME_BOUNDS_MAX
#define ccl_optional_struct_init
#define AS_SHADER_DATA(shader_data_tiny_storage)
#define INTEGRATOR_SHADOW_ISECT_SIZE
#define INTEGRATOR_SHADOW_ISECT_SIZE_GPU
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int ccl_global float * render_buffer
ccl_device_forceinline void guiding_record_direct_light(ccl_attr_maybe_unused KernelGlobals kg, ccl_attr_maybe_unused IntegratorShadowState state)
ShaderData ShaderDataTinyStorage
@ PATH_RAY_VISIBILITY_SHADOW
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW
ccl_device_inline void film_write_direct_light(KernelGlobals kg, ConstIntegratorShadowState state, ccl_global float *ccl_restrict render_buffer)
#define PROFILING_INIT(kg, event)
@ PROFILING_SHADE_SHADOW_SURFACE
@ PROFILING_SHADE_SHADOW_VOLUME
@ PROFILING_SHADE_SHADOW_SETUP
ccl_device_inline bool shadow_intersections_has_remaining(const uint packed_num_hits)
ccl_device void integrator_shade_shadow(KernelGlobals kg, IntegratorShadowState state, ccl_global float *ccl_restrict render_buffer)
ccl_device_inline uint shadow_num_hits_pack(const uint num_hits, const uint resume_hit, const bool surface_hit)
ccl_device_inline uint shadow_num_hits_get(const uint packed_num_hits)
TransparentShadowEvalResult
@ TRANSPARENT_SHADOW_EVAL_OPAQUE
@ TRANSPARENT_SHADOW_EVAL_CACHE_MISS
@ TRANSPARENT_SHADOW_EVAL_CONTINUE
ccl_device_inline bool shadow_surface_cache_miss_get(const uint packed_num_hits)
ccl_device_inline uint shadow_resume_hit_get(const uint packed_num_hits)
ccl_device_inline void shader_setup_from_ray(KernelGlobals kg, ccl_private ShaderData *ccl_restrict sd, const ccl_private Ray *ccl_restrict ray, const ccl_private Intersection *ccl_restrict isect)
IntegratorShadowStateCPU * IntegratorShadowState
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
#define INTEGRATOR_STATE(state, nested_struct, member)
#define INTEGRATOR_STATE_ARRAY(state, nested_struct, array_index, member)
ccl_device_forceinline void integrator_shadow_path_terminate(IntegratorShadowState state, const DeviceKernel current_kernel)
ccl_device_forceinline void integrator_shadow_path_next(IntegratorShadowState state, const DeviceKernel current_kernel, const DeviceKernel next_kernel)
ccl_device_forceinline void integrator_shadow_path_cache_miss(IntegratorShadowState, const DeviceKernel)
ccl_device_forceinline void integrator_state_read_shadow_ray(ConstIntegratorShadowState state, ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_read_shadow_isect(ConstIntegratorShadowState state, ccl_private Intersection *ccl_restrict isect, const int index)
ccl_device void surface_shader_eval(KernelGlobals kg, ConstIntegratorGenericState state, ccl_private ShaderData *ccl_restrict sd, ccl_global float *ccl_restrict buffer, const PathRayVisibility path_visibility, const uint32_t path_flag, bool use_caustics_storage=false)
ccl_device Spectrum surface_shader_transparency(const ccl_private ShaderData *sd)