2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* 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)
|
2013-08-28 14:36:47 +00:00
|
|
|
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2013-08-30 23:49:38 +00:00
|
|
|
__kernel void kernel_ocl_convert_to_byte(
|
2011-04-27 11:58:34 +00:00
|
|
|
__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-08-30 23:49:38 +00:00
|
|
|
float sample_scale,
|
|
|
|
int sx, int sy, int sw, int sh, int offset, int stride)
|
|
|
|
{
|
|
|
|
KernelGlobals kglobals, *kg = &kglobals;
|
|
|
|
|
|
|
|
kg->data = data;
|
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
|
|
|
kg->name = name;
|
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
|
|
|
int x = sx + get_global_id(0);
|
|
|
|
int y = sy + get_global_id(1);
|
|
|
|
|
|
|
|
if(x < sx + sw && y < sy + sh)
|
|
|
|
kernel_film_convert_to_byte(kg, rgba, buffer, sample_scale, x, y, offset, stride);
|
|
|
|
}
|
|
|
|
|
|
|
|
__kernel void kernel_ocl_convert_to_half_float(
|
|
|
|
__constant KernelData *data,
|
|
|
|
__global uchar4 *rgba,
|
|
|
|
__global float *buffer,
|
|
|
|
|
|
|
|
#define KERNEL_TEX(type, ttype, name) \
|
|
|
|
__global type *name,
|
|
|
|
#include "kernel_textures.h"
|
|
|
|
|
|
|
|
float sample_scale,
|
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-08-30 23:49:38 +00:00
|
|
|
kernel_film_convert_to_half_float(kg, rgba, buffer, sample_scale, 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
|
|
|
|