2011-04-27 11:58:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Blender Foundation.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* OpenCL kernel entry points - unfinished */
|
|
|
|
|
|
|
|
#include "kernel_compat_opencl.h"
|
|
|
|
#include "kernel_math.h"
|
|
|
|
#include "kernel_types.h"
|
|
|
|
#include "kernel_globals.h"
|
|
|
|
|
|
|
|
#include "kernel_film.h"
|
2011-05-20 12:26:01 +00:00
|
|
|
#include "kernel_path.h"
|
2013-06-21 13:05:08 +00:00
|
|
|
#include "kernel_displace.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-05-20 12:26:01 +00:00
|
|
|
__kernel void kernel_ocl_path_trace(
|
|
|
|
__constant KernelData *data,
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
__global float *buffer,
|
2011-05-20 12:26:01 +00:00
|
|
|
__global uint *rng_state,
|
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
2011-11-22 13:15:19 +00:00
|
|
|
__global type *name,
|
2011-05-20 12:26:01 +00:00
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
2011-09-16 13:14:02 +00:00
|
|
|
int sample,
|
2011-12-20 12:25:37 +00:00
|
|
|
int sx, int sy, int sw, int sh, int offset, int stride)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
KernelGlobals kglobals, *kg = &kglobals;
|
2011-05-20 12:26:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
kg->data = data;
|
|
|
|
|
2011-05-20 12:26:01 +00:00
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
2011-11-22 13:15:19 +00:00
|
|
|
kg->name = name;
|
2011-05-20 12:26:01 +00:00
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
|
|
|
int x = sx + get_global_id(0);
|
|
|
|
int y = sy + get_global_id(1);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-05-20 12:26:01 +00:00
|
|
|
if(x < sx + sw && y < sy + sh)
|
2011-12-20 12:25:37 +00:00
|
|
|
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
__kernel void kernel_ocl_tonemap(
|
|
|
|
__constant KernelData *data,
|
|
|
|
__global uchar4 *rgba,
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
__global float *buffer,
|
2011-05-20 12:26:01 +00:00
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
2011-11-22 13:15:19 +00:00
|
|
|
__global type *name,
|
2011-05-20 12:26:01 +00:00
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
2013-05-14 21:18:20 +00:00
|
|
|
int sample,
|
2011-12-20 12:25:37 +00:00
|
|
|
int sx, int sy, int sw, int sh, int offset, int stride)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
KernelGlobals kglobals, *kg = &kglobals;
|
|
|
|
|
|
|
|
kg->data = data;
|
2011-05-20 12:26:01 +00:00
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
2011-11-22 13:15:19 +00:00
|
|
|
kg->name = name;
|
2011-05-20 12:26:01 +00:00
|
|
|
#include "kernel_textures.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
int x = sx + get_global_id(0);
|
|
|
|
int y = sy + get_global_id(1);
|
|
|
|
|
|
|
|
if(x < sx + sw && y < sy + sh)
|
2013-05-14 21:18:20 +00:00
|
|
|
kernel_film_tonemap(kg, rgba, buffer, sample, x, y, offset, stride);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2013-06-21 13:05:08 +00:00
|
|
|
__kernel void kernel_ocl_shader(
|
|
|
|
__constant KernelData *data,
|
|
|
|
__global uint4 *input,
|
|
|
|
__global float4 *output,
|
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
|
|
|
__global type *name,
|
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
|
|
|
int type, int sx, int sw)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2013-06-21 13:05:08 +00:00
|
|
|
KernelGlobals kglobals, *kg = &kglobals;
|
|
|
|
|
|
|
|
kg->data = data;
|
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
|
|
|
kg->name = name;
|
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
int x = sx + get_global_id(0);
|
|
|
|
|
2013-06-21 13:05:08 +00:00
|
|
|
if(x < sx + sw)
|
|
|
|
kernel_shader_evaluate(kg, input, output, (ShaderEvalType)type, x);
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
|