Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/film/accumulate.h
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | ccl_device_inline int kernel_accum_sample(KernelGlobals kg, | ||||
| int sample_offset) | int sample_offset) | ||||
| { | { | ||||
| if (kernel_data.film.pass_sample_count == PASS_UNUSED) { | if (kernel_data.film.pass_sample_count == PASS_UNUSED) { | ||||
| return sample; | return sample; | ||||
| } | } | ||||
| ccl_global float *buffer = kernel_accum_pixel_render_buffer(kg, state, render_buffer); | ccl_global float *buffer = kernel_accum_pixel_render_buffer(kg, state, render_buffer); | ||||
| return atomic_fetch_and_add_uint32((uint *)(buffer) + kernel_data.film.pass_sample_count, 1) + | return atomic_fetch_and_add_uint32( | ||||
| (ccl_global uint *)(buffer) + kernel_data.film.pass_sample_count, 1) + | |||||
| sample_offset; | sample_offset; | ||||
| } | } | ||||
| ccl_device void kernel_accum_adaptive_buffer(KernelGlobals kg, | ccl_device void kernel_accum_adaptive_buffer(KernelGlobals kg, | ||||
| const int sample, | const int sample, | ||||
| const float3 contribution, | const float3 contribution, | ||||
| ccl_global float *ccl_restrict buffer) | ccl_global float *ccl_restrict buffer) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) { | ||||
| /* Single write call for GPU coherence. */ | /* Single write call for GPU coherence. */ | ||||
| if (pass_offset != PASS_UNUSED) { | if (pass_offset != PASS_UNUSED) { | ||||
| kernel_write_pass_float3(buffer + pass_offset, contribution); | kernel_write_pass_float3(buffer + pass_offset, contribution); | ||||
| } | } | ||||
| } | } | ||||
| /* Write shadow pass. */ | /* Write shadow pass. */ | ||||
| if (kernel_data.film.pass_shadow != PASS_UNUSED && (path_flag & PATH_RAY_SHADOW_FOR_LIGHT) && | if (kernel_data.film.pass_shadow != PASS_UNUSED && (path_flag & PATH_RAY_SHADOW_FOR_LIGHT) && | ||||
| (path_flag & PATH_RAY_CAMERA)) { | (path_flag & PATH_RAY_TRANSPARENT_BACKGROUND)) { | ||||
| const float3 unshadowed_throughput = INTEGRATOR_STATE( | const float3 unshadowed_throughput = INTEGRATOR_STATE( | ||||
| state, shadow_path, unshadowed_throughput); | state, shadow_path, unshadowed_throughput); | ||||
| const float3 shadowed_throughput = INTEGRATOR_STATE(state, shadow_path, throughput); | const float3 shadowed_throughput = INTEGRATOR_STATE(state, shadow_path, throughput); | ||||
| const float3 shadow = safe_divide_float3_float3(shadowed_throughput, unshadowed_throughput) * | const float3 shadow = safe_divide_float3_float3(shadowed_throughput, unshadowed_throughput) * | ||||
| kernel_data.film.pass_shadow_scale; | kernel_data.film.pass_shadow_scale; | ||||
| kernel_write_pass_float3(buffer + kernel_data.film.pass_shadow, shadow); | kernel_write_pass_float3(buffer + kernel_data.film.pass_shadow, shadow); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines | |||||