Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_film.h
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | ccl_device void kernel_film_convert_to_half_float(KernelGlobals *kg, | ||||
| float sample_scale, | float sample_scale, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| int offset, | int offset, | ||||
| int stride) | int stride) | ||||
| { | { | ||||
| /* buffer offset */ | /* buffer offset */ | ||||
| int index = offset + x + y * stride; | int index = offset + x + y * stride; | ||||
| int display_pass = kernel_data.film.display_pass; | |||||
| int pass_offset = display_pass == PASS_COMBINED ? 0 : 4; | |||||
| ccl_global float4 *in = (ccl_global float4 *)(buffer + index * kernel_data.film.pass_stride); | float4 rgba_in; | ||||
| ccl_global half *out = (ccl_global half *)rgba + index * 4; | if (display_pass == PASS_COMBINED) { | ||||
| ccl_global float4 *in = (ccl_global float4 *)(buffer + pass_offset + | |||||
| index * kernel_data.film.pass_stride); | |||||
| float exposure = kernel_data.film.exposure; | float exposure = kernel_data.film.exposure; | ||||
| float4 rgba_in = *in; | rgba_in.x = in->x * exposure; | ||||
| rgba_in.y = in->y * exposure; | |||||
| if (exposure != 1.0f) { | rgba_in.z = in->z * exposure; | ||||
| rgba_in.x *= exposure; | rgba_in.w = in->w; | ||||
| rgba_in.y *= exposure; | } | ||||
| rgba_in.z *= exposure; | else if (display_pass == PASS_MIST) { | ||||
| const float sample_scale_inv = 1.0f / sample_scale; | |||||
| ccl_global float *in = (ccl_global float *)(buffer + pass_offset + | |||||
| index * kernel_data.film.pass_stride); | |||||
| rgba_in = make_float4(*in, *in, *in, sample_scale_inv); | |||||
| } | } | ||||
| else { | |||||
| const float sample_scale_inv = 1.0f / sample_scale; | |||||
| ccl_global float4 *in = (ccl_global float4 *)(buffer + pass_offset + | |||||
| index * kernel_data.film.pass_stride); | |||||
| rgba_in.x = in->x; | |||||
| rgba_in.y = in->y; | |||||
| rgba_in.z = in->z; | |||||
| rgba_in.w = sample_scale_inv; | |||||
| } | |||||
| ccl_global half *out = (ccl_global half *)rgba + index * 4; | |||||
| float4_store_half(out, rgba_in, sample_scale); | float4_store_half(out, rgba_in, sample_scale); | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||