Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/device/cpu/kernel_arch_impl.h
| Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| # define KERNEL_INVOKE(name, ...) (STUB_ASSERT(KERNEL_ARCH, name), 0) | # define KERNEL_INVOKE(name, ...) (STUB_ASSERT(KERNEL_ARCH, name), 0) | ||||
| #else | #else | ||||
| # define KERNEL_INVOKE(name, ...) integrator_##name(__VA_ARGS__) | # define KERNEL_INVOKE(name, ...) integrator_##name(__VA_ARGS__) | ||||
| #endif | #endif | ||||
| #define DEFINE_INTEGRATOR_KERNEL(name) \ | #define DEFINE_INTEGRATOR_KERNEL(name) \ | ||||
| void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *kg, \ | void KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobalsCPU *kg, \ | ||||
| IntegratorStateCPU *state) \ | IntegratorStateCPU *state) \ | ||||
| { \ | { \ | ||||
| KERNEL_INVOKE(name, kg, state); \ | KERNEL_INVOKE(name, kg, state); \ | ||||
| } | } | ||||
| #define DEFINE_INTEGRATOR_SHADE_KERNEL(name) \ | #define DEFINE_INTEGRATOR_SHADE_KERNEL(name) \ | ||||
| void KERNEL_FUNCTION_FULL_NAME(integrator_##name)( \ | void KERNEL_FUNCTION_FULL_NAME(integrator_##name)( \ | ||||
| const KernelGlobals *kg, IntegratorStateCPU *state, ccl_global float *render_buffer) \ | const KernelGlobalsCPU *kg, IntegratorStateCPU *state, ccl_global float *render_buffer) \ | ||||
| { \ | { \ | ||||
| KERNEL_INVOKE(name, kg, state, render_buffer); \ | KERNEL_INVOKE(name, kg, state, render_buffer); \ | ||||
| } | } | ||||
| /* TODO: Either use something like get_work_pixel(), or simplify tile which is passed here, so | /* TODO: Either use something like get_work_pixel(), or simplify tile which is passed here, so | ||||
| * that it does not contain unused fields. */ | * that it does not contain unused fields. */ | ||||
| #define DEFINE_INTEGRATOR_INIT_KERNEL(name) \ | #define DEFINE_INTEGRATOR_INIT_KERNEL(name) \ | ||||
| bool KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobals *kg, \ | bool KERNEL_FUNCTION_FULL_NAME(integrator_##name)(const KernelGlobalsCPU *kg, \ | ||||
| IntegratorStateCPU *state, \ | IntegratorStateCPU *state, \ | ||||
| KernelWorkTile *tile, \ | KernelWorkTile *tile, \ | ||||
| ccl_global float *render_buffer) \ | ccl_global float *render_buffer) \ | ||||
| { \ | { \ | ||||
| return KERNEL_INVOKE( \ | return KERNEL_INVOKE( \ | ||||
| name, kg, state, tile, render_buffer, tile->x, tile->y, tile->start_sample); \ | name, kg, state, tile, render_buffer, tile->x, tile->y, tile->start_sample); \ | ||||
| } | } | ||||
| Show All 9 Lines | |||||
| DEFINE_INTEGRATOR_SHADE_KERNEL(shade_surface) | DEFINE_INTEGRATOR_SHADE_KERNEL(shade_surface) | ||||
| DEFINE_INTEGRATOR_SHADE_KERNEL(shade_volume) | DEFINE_INTEGRATOR_SHADE_KERNEL(shade_volume) | ||||
| DEFINE_INTEGRATOR_SHADE_KERNEL(megakernel) | DEFINE_INTEGRATOR_SHADE_KERNEL(megakernel) | ||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| * Shader evaluation. | * Shader evaluation. | ||||
| */ | */ | ||||
| void KERNEL_FUNCTION_FULL_NAME(shader_eval_displace)(const KernelGlobals *kg, | void KERNEL_FUNCTION_FULL_NAME(shader_eval_displace)(const KernelGlobalsCPU *kg, | ||||
| const KernelShaderEvalInput *input, | const KernelShaderEvalInput *input, | ||||
| float *output, | float *output, | ||||
| const int offset) | const int offset) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, shader_eval_displace); | STUB_ASSERT(KERNEL_ARCH, shader_eval_displace); | ||||
| #else | #else | ||||
| kernel_displace_evaluate(kg, input, output, offset); | kernel_displace_evaluate(kg, input, output, offset); | ||||
| #endif | #endif | ||||
| } | } | ||||
| void KERNEL_FUNCTION_FULL_NAME(shader_eval_background)(const KernelGlobals *kg, | void KERNEL_FUNCTION_FULL_NAME(shader_eval_background)(const KernelGlobalsCPU *kg, | ||||
| const KernelShaderEvalInput *input, | const KernelShaderEvalInput *input, | ||||
| float *output, | float *output, | ||||
| const int offset) | const int offset) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, shader_eval_background); | STUB_ASSERT(KERNEL_ARCH, shader_eval_background); | ||||
| #else | #else | ||||
| kernel_background_evaluate(kg, input, output, offset); | kernel_background_evaluate(kg, input, output, offset); | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| * Adaptive sampling. | * Adaptive sampling. | ||||
| */ | */ | ||||
| bool KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_convergence_check)( | bool KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_convergence_check)( | ||||
| const KernelGlobals *kg, | const KernelGlobalsCPU *kg, | ||||
| ccl_global float *render_buffer, | ccl_global float *render_buffer, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| float threshold, | float threshold, | ||||
| bool reset, | bool reset, | ||||
| int offset, | int offset, | ||||
| int stride) | int stride) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_convergence_check); | STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_convergence_check); | ||||
| return false; | return false; | ||||
| #else | #else | ||||
| return kernel_adaptive_sampling_convergence_check( | return kernel_adaptive_sampling_convergence_check( | ||||
| kg, render_buffer, x, y, threshold, reset, offset, stride); | kg, render_buffer, x, y, threshold, reset, offset, stride); | ||||
| #endif | #endif | ||||
| } | } | ||||
| void KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_filter_x)(const KernelGlobals *kg, | void KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_filter_x)(const KernelGlobalsCPU *kg, | ||||
| ccl_global float *render_buffer, | ccl_global float *render_buffer, | ||||
| int y, | int y, | ||||
| int start_x, | int start_x, | ||||
| int width, | int width, | ||||
| int offset, | int offset, | ||||
| int stride) | int stride) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_filter_x); | STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_filter_x); | ||||
| #else | #else | ||||
| kernel_adaptive_sampling_filter_x(kg, render_buffer, y, start_x, width, offset, stride); | kernel_adaptive_sampling_filter_x(kg, render_buffer, y, start_x, width, offset, stride); | ||||
| #endif | #endif | ||||
| } | } | ||||
| void KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_filter_y)(const KernelGlobals *kg, | void KERNEL_FUNCTION_FULL_NAME(adaptive_sampling_filter_y)(const KernelGlobalsCPU *kg, | ||||
| ccl_global float *render_buffer, | ccl_global float *render_buffer, | ||||
| int x, | int x, | ||||
| int start_y, | int start_y, | ||||
| int height, | int height, | ||||
| int offset, | int offset, | ||||
| int stride) | int stride) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_filter_y); | STUB_ASSERT(KERNEL_ARCH, adaptive_sampling_filter_y); | ||||
| #else | #else | ||||
| kernel_adaptive_sampling_filter_y(kg, render_buffer, x, start_y, height, offset, stride); | kernel_adaptive_sampling_filter_y(kg, render_buffer, x, start_y, height, offset, stride); | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| * Cryptomatte. | * Cryptomatte. | ||||
| */ | */ | ||||
| void KERNEL_FUNCTION_FULL_NAME(cryptomatte_postprocess)(const KernelGlobals *kg, | void KERNEL_FUNCTION_FULL_NAME(cryptomatte_postprocess)(const KernelGlobalsCPU *kg, | ||||
| ccl_global float *render_buffer, | ccl_global float *render_buffer, | ||||
| int pixel_index) | int pixel_index) | ||||
| { | { | ||||
| #ifdef KERNEL_STUB | #ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, cryptomatte_postprocess); | STUB_ASSERT(KERNEL_ARCH, cryptomatte_postprocess); | ||||
| #else | #else | ||||
| kernel_cryptomatte_post(kg, render_buffer, pixel_index); | kernel_cryptomatte_post(kg, render_buffer, pixel_index); | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| * Bake. | * Bake. | ||||
| */ | */ | ||||
| /* TODO(sergey): Needs to be re-implemented. Or not? Brecht did it already :) */ | /* TODO(sergey): Needs to be re-implemented. Or not? Brecht did it already :) */ | ||||
| void KERNEL_FUNCTION_FULL_NAME(bake)( | void KERNEL_FUNCTION_FULL_NAME(bake)( | ||||
| const KernelGlobals *kg, float *buffer, int sample, int x, int y, int offset, int stride) | const KernelGlobalsCPU *kg, float *buffer, int sample, int x, int y, int offset, int stride) | ||||
| { | { | ||||
| #if 0 | #if 0 | ||||
| # ifdef KERNEL_STUB | # ifdef KERNEL_STUB | ||||
| STUB_ASSERT(KERNEL_ARCH, bake); | STUB_ASSERT(KERNEL_ARCH, bake); | ||||
| # else | # else | ||||
| # ifdef __BAKING__ | # ifdef __BAKING__ | ||||
| kernel_bake_evaluate(kg, buffer, sample, x, y, offset, stride); | kernel_bake_evaluate(kg, buffer, sample, x, y, offset, stride); | ||||
| # endif | # endif | ||||
| Show All 14 Lines | |||||