ClangFormat: apply to source, most of intern
[blender.git] / intern / cycles / kernel / kernels / opencl / kernel_split_function.h
1 /*
2  * Copyright 2011-2017 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 #define KERNEL_NAME_JOIN(a, b) a##_##b
18 #define KERNEL_NAME_EVAL(a, b) KERNEL_NAME_JOIN(a, b)
19
20 __kernel void KERNEL_NAME_EVAL(kernel_ocl_path_trace,
21                                KERNEL_NAME)(ccl_global char *kg_global,
22                                             ccl_constant KernelData *data,
23
24                                             ccl_global void *split_data_buffer,
25                                             ccl_global char *ray_state,
26
27                                             KERNEL_BUFFER_PARAMS,
28
29                                             ccl_global int *queue_index,
30                                             ccl_global char *use_queues_flag,
31                                             ccl_global unsigned int *work_pools,
32                                             ccl_global float *buffer)
33 {
34 #ifdef LOCALS_TYPE
35   ccl_local LOCALS_TYPE locals;
36 #endif
37
38   KernelGlobals *kg = (KernelGlobals *)kg_global;
39
40   if (ccl_local_id(0) + ccl_local_id(1) == 0) {
41     kg->data = data;
42
43     kernel_split_params.queue_index = queue_index;
44     kernel_split_params.use_queues_flag = use_queues_flag;
45     kernel_split_params.work_pools = work_pools;
46     kernel_split_params.tile.buffer = buffer;
47
48     split_data_init(kg,
49                     &kernel_split_state,
50                     ccl_global_size(0) * ccl_global_size(1),
51                     split_data_buffer,
52                     ray_state);
53   }
54
55   kernel_set_buffer_pointers(kg, KERNEL_BUFFER_ARGS);
56
57   KERNEL_NAME_EVAL(kernel, KERNEL_NAME)
58   (kg
59 #ifdef LOCALS_TYPE
60    ,
61    &locals
62 #endif
63   );
64 }
65
66 #undef KERNEL_NAME_JOIN
67 #undef KERNEL_NAME_EVAL