2 * Copyright 2011, Blender Foundation.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 /* OpenCL kernel entry points - unfinished */
21 #include "kernel_compat_opencl.h"
22 #include "kernel_math.h"
23 #include "kernel_types.h"
24 #include "kernel_globals.h"
26 #include "kernel_film.h"
27 #include "kernel_path.h"
28 //#include "kernel_displace.h"
30 __kernel void kernel_ocl_path_trace(
31 __constant KernelData *data,
32 __global float4 *buffer,
33 __global uint *rng_state,
35 #define KERNEL_TEX(type, ttype, name) \
36 __global type *name, \
38 #include "kernel_textures.h"
41 int sx, int sy, int sw, int sh)
43 KernelGlobals kglobals, *kg = &kglobals;
47 #define KERNEL_TEX(type, ttype, name) \
49 kg->name##_width = name##_width;
50 #include "kernel_textures.h"
52 int x = sx + get_global_id(0);
53 int y = sy + get_global_id(1);
55 if(x < sx + sw && y < sy + sh)
56 kernel_path_trace(kg, buffer, rng_state, sample, x, y);
59 __kernel void kernel_ocl_tonemap(
60 __constant KernelData *data,
61 __global uchar4 *rgba,
62 __global float4 *buffer,
64 #define KERNEL_TEX(type, ttype, name) \
65 __global type *name, \
67 #include "kernel_textures.h"
69 int sample, int resolution,
70 int sx, int sy, int sw, int sh)
72 KernelGlobals kglobals, *kg = &kglobals;
76 #define KERNEL_TEX(type, ttype, name) \
78 kg->name##_width = name##_width;
79 #include "kernel_textures.h"
81 int x = sx + get_global_id(0);
82 int y = sy + get_global_id(1);
84 if(x < sx + sw && y < sy + sh)
85 kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y);
88 /*__kernel void kernel_ocl_displace(__global uint4 *input, __global float3 *offset, int sx)
90 int x = sx + get_global_id(0);
92 kernel_displace(input, offset, x);