This patch generalizes the OSL support in Cycles to include GPU device types and adds an implementation for that in the OptiX device. There are some caveats still, including simplified texturing due to lack of OIIO on the GPU and a few missing OSL intrinsics. Note that this is incomplete and missing an update to the OSL library before being enabled! The implementation is already committed now to simplify further development. Maniphest Tasks: T101222 Differential Revision: https://developer.blender.org/D15902
84 lines
3.5 KiB
Plaintext
84 lines
3.5 KiB
Plaintext
/* SPDX-License-Identifier: Apache-2.0
|
|
* Copyright 2011-2022 Blender Foundation */
|
|
|
|
#define WITH_OSL
|
|
|
|
/* Copy of the regular OptiX kernels with additional OSL support. */
|
|
|
|
#include "kernel/device/optix/kernel_shader_raytrace.cu"
|
|
|
|
#include "kernel/bake/bake.h"
|
|
#include "kernel/integrator/shade_background.h"
|
|
#include "kernel/integrator/shade_light.h"
|
|
#include "kernel/integrator/shade_shadow.h"
|
|
#include "kernel/integrator/shade_volume.h"
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_integrator_shade_background()
|
|
{
|
|
const int global_index = optixGetLaunchIndex().x;
|
|
const int path_index = (kernel_params.path_index_array) ?
|
|
kernel_params.path_index_array[global_index] :
|
|
global_index;
|
|
integrator_shade_background(nullptr, path_index, kernel_params.render_buffer);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_integrator_shade_light()
|
|
{
|
|
const int global_index = optixGetLaunchIndex().x;
|
|
const int path_index = (kernel_params.path_index_array) ?
|
|
kernel_params.path_index_array[global_index] :
|
|
global_index;
|
|
integrator_shade_light(nullptr, path_index, kernel_params.render_buffer);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_integrator_shade_surface()
|
|
{
|
|
const int global_index = optixGetLaunchIndex().x;
|
|
const int path_index = (kernel_params.path_index_array) ?
|
|
kernel_params.path_index_array[global_index] :
|
|
global_index;
|
|
integrator_shade_surface(nullptr, path_index, kernel_params.render_buffer);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_integrator_shade_volume()
|
|
{
|
|
const int global_index = optixGetLaunchIndex().x;
|
|
const int path_index = (kernel_params.path_index_array) ?
|
|
kernel_params.path_index_array[global_index] :
|
|
global_index;
|
|
integrator_shade_volume(nullptr, path_index, kernel_params.render_buffer);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_integrator_shade_shadow()
|
|
{
|
|
const int global_index = optixGetLaunchIndex().x;
|
|
const int path_index = (kernel_params.path_index_array) ?
|
|
kernel_params.path_index_array[global_index] :
|
|
global_index;
|
|
integrator_shade_shadow(nullptr, path_index, kernel_params.render_buffer);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_shader_eval_displace()
|
|
{
|
|
KernelShaderEvalInput *const input = (KernelShaderEvalInput *)kernel_params.path_index_array;
|
|
float *const output = kernel_params.render_buffer;
|
|
const int global_index = kernel_params.offset + optixGetLaunchIndex().x;
|
|
kernel_displace_evaluate(nullptr, input, output, global_index);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_shader_eval_background()
|
|
{
|
|
KernelShaderEvalInput *const input = (KernelShaderEvalInput *)kernel_params.path_index_array;
|
|
float *const output = kernel_params.render_buffer;
|
|
const int global_index = kernel_params.offset + optixGetLaunchIndex().x;
|
|
kernel_background_evaluate(nullptr, input, output, global_index);
|
|
}
|
|
|
|
extern "C" __global__ void __raygen__kernel_optix_shader_eval_curve_shadow_transparency()
|
|
{
|
|
KernelShaderEvalInput *const input = (KernelShaderEvalInput *)kernel_params.path_index_array;
|
|
float *const output = kernel_params.render_buffer;
|
|
const int global_index = kernel_params.offset + optixGetLaunchIndex().x;
|
|
kernel_curve_shadow_transparency_evaluate(nullptr, input, output, global_index);
|
|
}
|