Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/integrator_shade_shadow.h
| Show All 17 Lines | |||||
| #include "kernel/integrator/integrator_shade_volume.h" | #include "kernel/integrator/integrator_shade_volume.h" | ||||
| #include "kernel/integrator/integrator_volume_stack.h" | #include "kernel/integrator/integrator_volume_stack.h" | ||||
| #include "kernel/kernel_shader.h" | #include "kernel/kernel_shader.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ccl_device_inline bool shadow_intersections_has_remaining(const int num_hits) | ccl_device_inline bool shadow_intersections_has_remaining(const uint num_hits) | ||||
| { | { | ||||
| return num_hits >= INTEGRATOR_SHADOW_ISECT_SIZE; | return num_hits >= INTEGRATOR_SHADOW_ISECT_SIZE; | ||||
| } | } | ||||
| #ifdef __TRANSPARENT_SHADOWS__ | #ifdef __TRANSPARENT_SHADOWS__ | ||||
| ccl_device_inline float3 integrate_transparent_surface_shadow(INTEGRATOR_STATE_ARGS, const int hit) | ccl_device_inline float3 integrate_transparent_surface_shadow(INTEGRATOR_STATE_ARGS, const int hit) | ||||
| { | { | ||||
| PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SURFACE); | PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SURFACE); | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | ccl_device_inline void integrate_transparent_volume_shadow(INTEGRATOR_STATE_ARGS, | ||||
| const float step_size = volume_stack_step_size(INTEGRATOR_STATE_PASS, [=](const int i) { | const float step_size = volume_stack_step_size(INTEGRATOR_STATE_PASS, [=](const int i) { | ||||
| return integrator_state_read_shadow_volume_stack(INTEGRATOR_STATE_PASS, i); | return integrator_state_read_shadow_volume_stack(INTEGRATOR_STATE_PASS, i); | ||||
| }); | }); | ||||
| volume_shadow_heterogeneous(INTEGRATOR_STATE_PASS, &ray, shadow_sd, throughput, step_size); | volume_shadow_heterogeneous(INTEGRATOR_STATE_PASS, &ray, shadow_sd, throughput, step_size); | ||||
| } | } | ||||
| # endif | # endif | ||||
| ccl_device_inline bool integrate_transparent_shadow(INTEGRATOR_STATE_ARGS, const int num_hits) | ccl_device_inline bool integrate_transparent_shadow(INTEGRATOR_STATE_ARGS, const uint num_hits) | ||||
| { | { | ||||
| /* Accumulate shadow for transparent surfaces. */ | /* Accumulate shadow for transparent surfaces. */ | ||||
| const int num_recorded_hits = min(num_hits, INTEGRATOR_SHADOW_ISECT_SIZE); | const uint num_recorded_hits = min(num_hits, INTEGRATOR_SHADOW_ISECT_SIZE); | ||||
| for (int hit = 0; hit < num_recorded_hits + 1; hit++) { | for (uint hit = 0; hit < num_recorded_hits + 1; hit++) { | ||||
| /* Volume shaders. */ | /* Volume shaders. */ | ||||
| if (hit < num_recorded_hits || !shadow_intersections_has_remaining(num_hits)) { | if (hit < num_recorded_hits || !shadow_intersections_has_remaining(num_hits)) { | ||||
| # ifdef __VOLUME__ | # ifdef __VOLUME__ | ||||
| if (!integrator_state_shadow_volume_stack_is_empty(INTEGRATOR_STATE_PASS)) { | if (!integrator_state_shadow_volume_stack_is_empty(INTEGRATOR_STATE_PASS)) { | ||||
| float3 throughput = INTEGRATOR_STATE(shadow_path, throughput); | float3 throughput = INTEGRATOR_STATE(shadow_path, throughput); | ||||
| integrate_transparent_volume_shadow( | integrate_transparent_volume_shadow( | ||||
| INTEGRATOR_STATE_PASS, hit, num_recorded_hits, &throughput); | INTEGRATOR_STATE_PASS, hit, num_recorded_hits, &throughput); | ||||
| if (is_zero(throughput)) { | if (is_zero(throughput)) { | ||||
| Show All 35 Lines | # endif | ||||
| return false; | return false; | ||||
| } | } | ||||
| #endif /* __TRANSPARENT_SHADOWS__ */ | #endif /* __TRANSPARENT_SHADOWS__ */ | ||||
| ccl_device void integrator_shade_shadow(INTEGRATOR_STATE_ARGS, | ccl_device void integrator_shade_shadow(INTEGRATOR_STATE_ARGS, | ||||
| ccl_global float *ccl_restrict render_buffer) | ccl_global float *ccl_restrict render_buffer) | ||||
| { | { | ||||
| PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SETUP); | PROFILING_INIT(kg, PROFILING_SHADE_SHADOW_SETUP); | ||||
| const int num_hits = INTEGRATOR_STATE(shadow_path, num_hits); | const uint num_hits = INTEGRATOR_STATE(shadow_path, num_hits); | ||||
| #ifdef __TRANSPARENT_SHADOWS__ | #ifdef __TRANSPARENT_SHADOWS__ | ||||
| /* Evaluate transparent shadows. */ | /* Evaluate transparent shadows. */ | ||||
| const bool opaque = integrate_transparent_shadow(INTEGRATOR_STATE_PASS, num_hits); | const bool opaque = integrate_transparent_shadow(INTEGRATOR_STATE_PASS, num_hits); | ||||
| if (opaque) { | if (opaque) { | ||||
| INTEGRATOR_SHADOW_PATH_TERMINATE(DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW); | INTEGRATOR_SHADOW_PATH_TERMINATE(DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW); | ||||
| return; | return; | ||||
| } | } | ||||
| Show All 16 Lines | |||||