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
*/
/* CUDA kernel entry points */
#include "kernel_compat_cuda.h"
#include "kernel_math.h"
#include "kernel_types.h"
#include "kernel_globals.h"
#include "kernel_film.h"
#include "kernel_path.h"
#include "kernel_displace.h"
2013-08-23 14:34:34 +00:00
extern "C" __global__ void kernel_cuda_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
2011-04-27 11:58:34 +00:00
{
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
if(x < sx + sw && y < sy + sh)
2013-08-23 14:34:34 +00:00
kernel_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
2013-08-09 18:47:25 +00:00
}
2013-08-23 14:34:34 +00:00
#ifdef __BRANCHED_PATH__
extern "C" __global__ void kernel_cuda_branched_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
2013-08-09 18:47:25 +00:00
{
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
if(x < sx + sw && y < sy + sh)
2013-08-23 14:34:34 +00:00
kernel_branched_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
2011-04-27 11:58:34 +00:00
}
2013-08-09 20:03:49 +00:00
#endif
2011-04-27 11:58:34 +00:00
2013-08-30 23:49:38 +00:00
extern "C" __global__ void kernel_cuda_convert_to_byte(uchar4 *rgba, float *buffer, float sample_scale, int sx, int sy, int sw, int sh, int offset, int stride)
2011-04-27 11:58:34 +00:00
{
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
if(x < sx + sw && y < sy + sh)
2013-08-30 23:49:38 +00:00
kernel_film_convert_to_byte(NULL, rgba, buffer, sample_scale, x, y, offset, stride);
}
extern "C" __global__ void kernel_cuda_convert_to_half_float(uchar4 *rgba, float *buffer, float sample_scale, int sx, int sy, int sw, int sh, int offset, int stride)
{
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
if(x < sx + sw && y < sy + sh)
kernel_film_convert_to_half_float(NULL, rgba, buffer, sample_scale, x, y, offset, stride);
2011-04-27 11:58:34 +00:00
}
2012-01-20 17:49:17 +00:00
extern "C" __global__ void kernel_cuda_shader(uint4 *input, float4 *output, int type, int sx)
2011-04-27 11:58:34 +00:00
{
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
2011-12-31 15:18:13 +00:00
kernel_shader_evaluate(NULL, input, output, (ShaderEvalType)type, x);
2011-04-27 11:58:34 +00:00
}