Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/device/gpu/kernel.h
| Show First 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | ccl_device_inline void kernel_gpu_film_convert_common(const KernelFilmConvert *kfilm_convert, | ||||
| int dst_stride, | int dst_stride, | ||||
| const Processor &processor) | const Processor &processor) | ||||
| { | { | ||||
| const int render_pixel_index = ccl_gpu_global_id_x(); | const int render_pixel_index = ccl_gpu_global_id_x(); | ||||
| if (render_pixel_index >= num_pixels) { | if (render_pixel_index >= num_pixels) { | ||||
| return; | return; | ||||
| } | } | ||||
| const uint64_t render_buffer_offset = (uint64_t)render_pixel_index * kfilm_convert->pass_stride; | const int x = render_pixel_index % width; | ||||
| ccl_global const float *buffer = render_buffer + render_buffer_offset; | const int y = render_pixel_index / width; | ||||
| ccl_global const float *buffer = render_buffer + offset + x * kfilm_convert->pass_stride + | |||||
| y * stride * kfilm_convert->pass_stride; | |||||
| ccl_global float *pixel = pixels + | ccl_global float *pixel = pixels + | ||||
| (render_pixel_index + dst_offset) * kfilm_convert->pixel_stride; | (render_pixel_index + dst_offset) * kfilm_convert->pixel_stride; | ||||
| processor(kfilm_convert, buffer, pixel); | processor(kfilm_convert, buffer, pixel); | ||||
| } | } | ||||
| /* Common implementation for half4 destination and 4-channel input pass. */ | /* Common implementation for half4 destination and 4-channel input pass. */ | ||||
| template<typename Processor> | template<typename Processor> | ||||
| Show All 9 Lines | ccl_device_inline void kernel_gpu_film_convert_half_rgba_common_rgba( | ||||
| int rgba_stride, | int rgba_stride, | ||||
| const Processor &processor) | const Processor &processor) | ||||
| { | { | ||||
| const int render_pixel_index = ccl_gpu_global_id_x(); | const int render_pixel_index = ccl_gpu_global_id_x(); | ||||
| if (render_pixel_index >= num_pixels) { | if (render_pixel_index >= num_pixels) { | ||||
| return; | return; | ||||
| } | } | ||||
| const uint64_t render_buffer_offset = (uint64_t)render_pixel_index * kfilm_convert->pass_stride; | const int x = render_pixel_index % width; | ||||
| ccl_global const float *buffer = render_buffer + render_buffer_offset; | const int y = render_pixel_index / width; | ||||
| ccl_global const float *buffer = render_buffer + offset + x * kfilm_convert->pass_stride + | |||||
| y * stride * kfilm_convert->pass_stride; | |||||
| float pixel[4]; | float pixel[4]; | ||||
| processor(kfilm_convert, buffer, pixel); | processor(kfilm_convert, buffer, pixel); | ||||
| film_apply_pass_pixel_overlays_rgba(kfilm_convert, buffer, pixel); | film_apply_pass_pixel_overlays_rgba(kfilm_convert, buffer, pixel); | ||||
| const int x = render_pixel_index % width; | |||||
| const int y = render_pixel_index / width; | |||||
| ccl_global half4 *out = ((ccl_global half4 *)rgba) + rgba_offset + y * rgba_stride + x; | ccl_global half4 *out = ((ccl_global half4 *)rgba) + rgba_offset + y * rgba_stride + x; | ||||
| float4_store_half((ccl_global half *)out, make_float4(pixel[0], pixel[1], pixel[2], pixel[3])); | float4_store_half((ccl_global half *)out, make_float4(pixel[0], pixel[1], pixel[2], pixel[3])); | ||||
| } | } | ||||
| /* Common implementation for half4 destination and 3-channel input pass. */ | /* Common implementation for half4 destination and 3-channel input pass. */ | ||||
| template<typename Processor> | template<typename Processor> | ||||
| ccl_device_inline void kernel_gpu_film_convert_half_rgba_common_rgb( | ccl_device_inline void kernel_gpu_film_convert_half_rgba_common_rgb( | ||||
| const KernelFilmConvert *kfilm_convert, | const KernelFilmConvert *kfilm_convert, | ||||
| ▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines | |||||