Fix Cycles kernel build without render passes support.
[blender.git] / intern / cycles / kernel / kernels / cpu / kernel_cpu_impl.h
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /* Templated common implementation part of all CPU kernels.
18  *
19  * The idea is that particular .cpp files sets needed optimization flags and
20  * simply includes this file without worry of copying actual implementation over.
21  */
22
23 #include "kernel_compat_cpu.h"
24 #include "kernel_math.h"
25 #include "kernel_types.h"
26 #include "kernel_globals.h"
27 #include "kernel_cpu_image.h"
28 #include "kernel_film.h"
29 #include "kernel_path.h"
30 #include "kernel_path_branched.h"
31 #include "kernel_bake.h"
32
33 CCL_NAMESPACE_BEGIN
34
35 /* Path Tracing */
36
37 void KERNEL_FUNCTION_FULL_NAME(path_trace)(KernelGlobals *kg,
38                                            float *buffer,
39                                            unsigned int *rng_state,
40                                            int sample,
41                                            int x, int y,
42                                            int offset,
43                                            int stride)
44 {
45 #ifdef __BRANCHED_PATH__
46         if(kernel_data.integrator.branched) {
47                 kernel_branched_path_trace(kg,
48                                            buffer,
49                                            rng_state,
50                                            sample,
51                                            x, y,
52                                            offset,
53                                            stride);
54         }
55         else
56 #endif
57         {
58                 kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
59         }
60 }
61
62 /* Film */
63
64 void KERNEL_FUNCTION_FULL_NAME(convert_to_byte)(KernelGlobals *kg,
65                                                 uchar4 *rgba,
66                                                 float *buffer,
67                                                 float sample_scale,
68                                                 int x, int y,
69                                                 int offset,
70                                                 int stride)
71 {
72         kernel_film_convert_to_byte(kg,
73                                     rgba,
74                                     buffer,
75                                     sample_scale,
76                                     x, y,
77                                     offset,
78                                     stride);
79 }
80
81 void KERNEL_FUNCTION_FULL_NAME(convert_to_half_float)(KernelGlobals *kg,
82                                                       uchar4 *rgba,
83                                                       float *buffer,
84                                                       float sample_scale,
85                                                       int x, int y,
86                                                       int offset,
87                                                       int stride)
88 {
89         kernel_film_convert_to_half_float(kg,
90                                           rgba,
91                                           buffer,
92                                           sample_scale,
93                                           x, y,
94                                           offset,
95                                           stride);
96 }
97
98 /* Shader Evaluate */
99
100 void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg,
101                                        uint4 *input,
102                                        float4 *output,
103                                        float *output_luma,
104                                        int type,
105                                        int filter,
106                                        int i,
107                                        int offset,
108                                        int sample)
109 {
110         if(type >= SHADER_EVAL_BAKE) {
111                 kernel_assert(output_luma == NULL);
112 #ifdef __BAKING__
113                 kernel_bake_evaluate(kg,
114                                      input,
115                                      output,
116                                      (ShaderEvalType)type,
117                                      filter,
118                                      i,
119                                      offset,
120                                      sample);
121 #endif
122         }
123         else {
124                 kernel_shader_evaluate(kg,
125                                        input,
126                                        output,
127                                        output_luma,
128                                        (ShaderEvalType)type,
129                                        i,
130                                        sample);
131         }
132 }
133
134 CCL_NAMESPACE_END