Cycles: Remove few function arguments needed only for the split kernel
[blender.git] / intern / cycles / kernel / kernels / opencl / kernel_data_init.cl
1 /*
2  * Copyright 2011-2015 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 #include "split/kernel_data_init.h"
18
19 __kernel void kernel_ocl_path_trace_data_init(
20         ccl_global char *kg,
21         ccl_global char *sd,
22         ccl_global char *sd_DL_shadow,
23
24         ccl_global float3 *P_sd,
25         ccl_global float3 *P_sd_DL_shadow,
26
27         ccl_global float3 *N_sd,
28         ccl_global float3 *N_sd_DL_shadow,
29
30         ccl_global float3 *Ng_sd,
31         ccl_global float3 *Ng_sd_DL_shadow,
32
33         ccl_global float3 *I_sd,
34         ccl_global float3 *I_sd_DL_shadow,
35
36         ccl_global int *shader_sd,
37         ccl_global int *shader_sd_DL_shadow,
38
39         ccl_global int *flag_sd,
40         ccl_global int *flag_sd_DL_shadow,
41
42         ccl_global int *prim_sd,
43         ccl_global int *prim_sd_DL_shadow,
44
45         ccl_global int *type_sd,
46         ccl_global int *type_sd_DL_shadow,
47
48         ccl_global float *u_sd,
49         ccl_global float *u_sd_DL_shadow,
50
51         ccl_global float *v_sd,
52         ccl_global float *v_sd_DL_shadow,
53
54         ccl_global int *object_sd,
55         ccl_global int *object_sd_DL_shadow,
56
57         ccl_global float *time_sd,
58         ccl_global float *time_sd_DL_shadow,
59
60         ccl_global float *ray_length_sd,
61         ccl_global float *ray_length_sd_DL_shadow,
62
63         /* Ray differentials. */
64         ccl_global differential3 *dP_sd,
65         ccl_global differential3 *dP_sd_DL_shadow,
66
67         ccl_global differential3 *dI_sd,
68         ccl_global differential3 *dI_sd_DL_shadow,
69
70         ccl_global differential *du_sd,
71         ccl_global differential *du_sd_DL_shadow,
72
73         ccl_global differential *dv_sd,
74         ccl_global differential *dv_sd_DL_shadow,
75
76         /* Dp/Du */
77         ccl_global float3 *dPdu_sd,
78         ccl_global float3 *dPdu_sd_DL_shadow,
79
80         ccl_global float3 *dPdv_sd,
81         ccl_global float3 *dPdv_sd_DL_shadow,
82
83         /* Object motion. */
84         ccl_global Transform *ob_tfm_sd,
85         ccl_global Transform *ob_tfm_sd_DL_shadow,
86
87         ccl_global Transform *ob_itfm_sd,
88         ccl_global Transform *ob_itfm_sd_DL_shadow,
89
90         ShaderClosure *closure_sd,
91         ShaderClosure *closure_sd_DL_shadow,
92
93         ccl_global int *num_closure_sd,
94         ccl_global int *num_closure_sd_DL_shadow,
95
96         ccl_global float *randb_closure_sd,
97         ccl_global float *randb_closure_sd_DL_shadow,
98
99         ccl_global float3 *ray_P_sd,
100         ccl_global float3 *ray_P_sd_DL_shadow,
101
102         ccl_global differential3 *ray_dP_sd,
103         ccl_global differential3 *ray_dP_sd_DL_shadow,
104
105         ccl_constant KernelData *data,
106         ccl_global float *per_sample_output_buffers,
107         ccl_global uint *rng_state,
108         ccl_global uint *rng_coop,                   /* rng array to store rng values for all rays */
109         ccl_global float3 *throughput_coop,          /* throughput array to store throughput values for all rays */
110         ccl_global float *L_transparent_coop,        /* L_transparent array to store L_transparent values for all rays */
111         PathRadiance *PathRadiance_coop,             /* PathRadiance array to store PathRadiance values for all rays */
112         ccl_global Ray *Ray_coop,                    /* Ray array to store Ray information for all rays */
113         ccl_global PathState *PathState_coop,        /* PathState array to store PathState information for all rays */
114         Intersection *Intersection_coop_shadow,
115         ccl_global char *ray_state,                  /* Stores information on current state of a ray */
116
117 #define KERNEL_TEX(type, ttype, name)                                   \
118         ccl_global type *name,
119 #include "../../kernel_textures.h"
120
121         int start_sample, int sx, int sy, int sw, int sh, int offset, int stride,
122         int rng_state_offset_x,
123         int rng_state_offset_y,
124         int rng_state_stride,
125         ccl_global int *Queue_data,                  /* Memory for queues */
126         ccl_global int *Queue_index,                 /* Tracks the number of elements in queues */
127         int queuesize,                               /* size (capacity) of the queue */
128         ccl_global char *use_queues_flag,            /* flag to decide if scene-intersect kernel should use queues to fetch ray index */
129         ccl_global unsigned int *work_array,         /* work array to store which work each ray belongs to */
130 #ifdef __WORK_STEALING__
131         ccl_global unsigned int *work_pool_wgs,      /* Work pool for each work group */
132         unsigned int num_samples,                    /* Total number of samples per pixel */
133 #endif
134 #ifdef __KERNEL_DEBUG__
135         DebugData *debugdata_coop,
136 #endif
137         int parallel_samples)                        /* Number of samples to be processed in parallel */
138 {
139         kernel_data_init((KernelGlobals *)kg,
140                          (ShaderData *)sd,
141                          (ShaderData *)sd_DL_shadow,
142                          P_sd,
143                          P_sd_DL_shadow,
144                          N_sd,
145                          N_sd_DL_shadow,
146                          Ng_sd,
147                          Ng_sd_DL_shadow,
148                          I_sd,
149                          I_sd_DL_shadow,
150                          shader_sd,
151                          shader_sd_DL_shadow,
152                          flag_sd,
153                          flag_sd_DL_shadow,
154                          prim_sd,
155                          prim_sd_DL_shadow,
156                          type_sd,
157                          type_sd_DL_shadow,
158                          u_sd,
159                          u_sd_DL_shadow,
160                          v_sd,
161                          v_sd_DL_shadow,
162                          object_sd,
163                          object_sd_DL_shadow,
164                          time_sd,
165                          time_sd_DL_shadow,
166                          ray_length_sd,
167                          ray_length_sd_DL_shadow,
168
169                          /* Ray differentials. */
170                          dP_sd,
171                          dP_sd_DL_shadow,
172                          dI_sd,
173                          dI_sd_DL_shadow,
174                          du_sd,
175                          du_sd_DL_shadow,
176                          dv_sd,
177                          dv_sd_DL_shadow,
178
179                          /* Dp/Du */
180                          dPdu_sd,
181                          dPdu_sd_DL_shadow,
182                          dPdv_sd,
183                          dPdv_sd_DL_shadow,
184
185                          /* Object motion. */
186                          ob_tfm_sd,
187                          ob_tfm_sd_DL_shadow,
188                          ob_itfm_sd,
189                          ob_itfm_sd_DL_shadow,
190
191                          closure_sd,
192                          closure_sd_DL_shadow,
193                          num_closure_sd,
194                          num_closure_sd_DL_shadow,
195                          randb_closure_sd,
196                          randb_closure_sd_DL_shadow,
197                          ray_P_sd,
198                          ray_P_sd_DL_shadow,
199                          ray_dP_sd,
200                          ray_dP_sd_DL_shadow,
201                          data,
202                          per_sample_output_buffers,
203                          rng_state,
204                          rng_coop,
205                          throughput_coop,
206                          L_transparent_coop,
207                          PathRadiance_coop,
208                          Ray_coop,
209                          PathState_coop,
210                          Intersection_coop_shadow,
211                          ray_state,
212
213 #define KERNEL_TEX(type, ttype, name) name,
214 #include "../../kernel_textures.h"
215
216                          start_sample, sx, sy, sw, sh, offset, stride,
217                          rng_state_offset_x,
218                          rng_state_offset_y,
219                          rng_state_stride,
220                          Queue_data,
221                          Queue_index,
222                          queuesize,
223                          use_queues_flag,
224                          work_array,
225 #ifdef __WORK_STEALING__
226                          work_pool_wgs,
227                          num_samples,
228 #endif
229 #ifdef __KERNEL_DEBUG__
230                          debugdata_coop,
231 #endif
232                          parallel_samples);
233 }