forked from bartvdbraak/blender
Cycles: opencl 1.1 compatibility tweaks.
This commit is contained in:
parent
40886b6965
commit
abc601d10e
@ -24,13 +24,14 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
|
/* in opencl all functions are device functions, so leave this empty */
|
||||||
|
|
||||||
#define __device
|
#define __device
|
||||||
#define __device_inline
|
#define __device_inline
|
||||||
|
|
||||||
|
/* no assert in opencl */
|
||||||
#define kernel_assert(cond)
|
#define kernel_assert(cond)
|
||||||
|
|
||||||
|
/* manual implementation of interpolated 1D lookup */
|
||||||
__device float kernel_tex_interp_(__global float *data, int width, float x)
|
__device float kernel_tex_interp_(__global float *data, int width, float x)
|
||||||
{
|
{
|
||||||
x = clamp(x, 0.0f, 1.0f)*width;
|
x = clamp(x, 0.0f, 1.0f)*width;
|
||||||
@ -42,6 +43,7 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
|
|||||||
return (1.0f - t)*data[index] + t*data[nindex];
|
return (1.0f - t)*data[index] + t*data[nindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make_type definitions with opencl style element initializers */
|
||||||
#ifdef make_float2
|
#ifdef make_float2
|
||||||
#undef make_float2
|
#undef make_float2
|
||||||
#endif
|
#endif
|
||||||
@ -62,22 +64,13 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define make_float2(x, y) ((float2)(x, y))
|
#define make_float2(x, y) ((float2)(x, y))
|
||||||
#define make_float3(x, y, z) ((float3)(x, y, z, 0.0f))
|
#define make_float3(x, y, z) ((float3)(x, y, z))
|
||||||
#define make_float4(x, y, z, w) ((float4)(x, y, z, w))
|
#define make_float4(x, y, z, w) ((float4)(x, y, z, w))
|
||||||
#define make_int2(x, y) ((int2)(x, y))
|
#define make_int2(x, y) ((int2)(x, y))
|
||||||
#define make_int3(x, y, z) ((int3)(x, y, z, 0))
|
#define make_int3(x, y, z) ((int3)(x, y, z))
|
||||||
#define make_int4(x, y, z, w) ((int4)(x, y, z, w))
|
#define make_int4(x, y, z, w) ((int4)(x, y, z, w))
|
||||||
|
|
||||||
#ifdef float3
|
/* math functions */
|
||||||
#undef float3
|
|
||||||
#endif
|
|
||||||
#ifdef int3
|
|
||||||
#undef int3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef float4 float3;
|
|
||||||
typedef int4 int3;
|
|
||||||
|
|
||||||
#define __uint_as_float(x) as_float(x)
|
#define __uint_as_float(x) as_float(x)
|
||||||
#define __float_as_uint(x) as_uint(x)
|
#define __float_as_uint(x) as_uint(x)
|
||||||
#define __int_as_float(x) as_float(x)
|
#define __int_as_float(x) as_float(x)
|
||||||
@ -88,13 +81,25 @@ typedef int4 int3;
|
|||||||
#define powf(x, y) pow(((float)x), ((float)y))
|
#define powf(x, y) pow(((float)x), ((float)y))
|
||||||
#define fabsf(x) fabs(((float)x))
|
#define fabsf(x) fabs(((float)x))
|
||||||
#define copysignf(x, y) copysign(((float)x), ((float)y))
|
#define copysignf(x, y) copysign(((float)x), ((float)y))
|
||||||
|
#define cosf(x) cos(((float)x))
|
||||||
|
#define asinf(x) asin(((float)x))
|
||||||
|
#define acosf(x) acos(((float)x))
|
||||||
|
#define atanf(x) atan(((float)x))
|
||||||
|
#define tanf(x) tan(((float)x))
|
||||||
|
#define logf(x) log(((float)x))
|
||||||
|
#define floorf(x) floor(((float)x))
|
||||||
|
#define expf(x) exp(((float)x))
|
||||||
|
#define hypotf(x, y) hypot(((float)x), ((float)y))
|
||||||
|
#define atan2f(x, y) atan2(((float)x), ((float)y))
|
||||||
|
#define fmaxf(x, y) fmax(((float)x), ((float)y))
|
||||||
|
#define fminf(x, y) fmin(((float)x), ((float)y))
|
||||||
|
|
||||||
|
/* data lookup defines */
|
||||||
#define kernel_data (*kg->data)
|
#define kernel_data (*kg->data)
|
||||||
#define kernel_tex_interp(t, x) \
|
#define kernel_tex_interp(t, x) kernel_tex_interp_(kg->t, kg->t##_width, x)
|
||||||
kernel_tex_interp_(kg->t, kg->t##_width, x)
|
#define kernel_tex_fetch(t, index) kg->t[index]
|
||||||
#define kernel_tex_fetch(t, index) \
|
|
||||||
kg->t[index]
|
|
||||||
|
|
||||||
|
/* define NULL */
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
||||||
#include "util_types.h"
|
#include "util_types.h"
|
||||||
|
@ -129,7 +129,7 @@ __device float3 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int pass, Ray
|
|||||||
L += throughput*shader_eval_background(kg, &sd, path_flag);
|
L += throughput*shader_eval_background(kg, &sd, path_flag);
|
||||||
shader_release(kg, &sd);
|
shader_release(kg, &sd);
|
||||||
#else
|
#else
|
||||||
L += throughputmake_float3(0.8f, 0.8f, 0.8f);
|
L += make_float3(0.8f, 0.8f, 0.8f);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
#define OBJECT_SIZE 16
|
#define OBJECT_SIZE 16
|
||||||
|
|
||||||
|
#define __SOBOL__
|
||||||
#define __INSTANCING__
|
#define __INSTANCING__
|
||||||
#define __DPDU__
|
#define __DPDU__
|
||||||
#define __UV__
|
#define __UV__
|
||||||
@ -34,8 +35,9 @@ CCL_NAMESPACE_BEGIN
|
|||||||
#define __EMISSION__
|
#define __EMISSION__
|
||||||
#define __CAUSTICS_TRICKS__
|
#define __CAUSTICS_TRICKS__
|
||||||
#define __SVM__
|
#define __SVM__
|
||||||
#define __SOBOL__
|
#ifndef __KERNEL_OPENCL__
|
||||||
#define __TEXTURES__
|
#define __TEXTURES__
|
||||||
|
#endif
|
||||||
#define __RAY_DIFFERENTIALS__
|
#define __RAY_DIFFERENTIALS__
|
||||||
#define __CAMERA_CLIPPING__
|
#define __CAMERA_CLIPPING__
|
||||||
#define __INTERSECTION_REFINE__
|
#define __INTERSECTION_REFINE__
|
||||||
@ -286,9 +288,13 @@ typedef struct KernelCamera {
|
|||||||
|
|
||||||
/* differentials */
|
/* differentials */
|
||||||
float3 dx;
|
float3 dx;
|
||||||
|
#ifndef WITH_OPENCL
|
||||||
float pad1;
|
float pad1;
|
||||||
|
#endif
|
||||||
float3 dy;
|
float3 dy;
|
||||||
|
#ifndef WITH_OPENCL
|
||||||
float pad2;
|
float pad2;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clipping */
|
/* clipping */
|
||||||
float nearclip;
|
float nearclip;
|
||||||
@ -321,7 +327,9 @@ typedef struct KernelSunSky {
|
|||||||
/* sun direction in spherical and cartesian */
|
/* sun direction in spherical and cartesian */
|
||||||
float theta, phi, pad3, pad4;
|
float theta, phi, pad3, pad4;
|
||||||
float3 dir;
|
float3 dir;
|
||||||
|
#ifndef WITH_OPENCL
|
||||||
float pad;
|
float pad;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* perez function parameters */
|
/* perez function parameters */
|
||||||
float zenith_Y, zenith_x, zenith_y, pad2;
|
float zenith_Y, zenith_x, zenith_y, pad2;
|
||||||
|
@ -34,7 +34,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint
|
|||||||
case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break;
|
case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack_store_float(stack, out_offset, info? 1.0f: 0.0f);
|
stack_store_float(stack, out_offset, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@ -38,12 +38,16 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
#ifndef __KERNEL_OPENCL__
|
||||||
|
|
||||||
#define M_PI_F ((float)3.14159265358979323846264338327950288)
|
#define M_PI_F ((float)3.14159265358979323846264338327950288)
|
||||||
#define M_PI_2_F ((float)1.57079632679489661923132169163975144)
|
#define M_PI_2_F ((float)1.57079632679489661923132169163975144)
|
||||||
#define M_PI_4_F ((float)0.785398163397448309615660845819875721)
|
#define M_PI_4_F ((float)0.785398163397448309615660845819875721)
|
||||||
#define M_1_PI_F ((float)0.318309886183790671537767526745028724)
|
#define M_1_PI_F ((float)0.318309886183790671537767526745028724)
|
||||||
#define M_2_PI_F ((float)0.636619772367581343075535053490057448)
|
#define M_2_PI_F ((float)0.636619772367581343075535053490057448)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Scalar */
|
/* Scalar */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -70,9 +70,13 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
/* Shorter Unsigned Names */
|
/* Shorter Unsigned Names */
|
||||||
|
|
||||||
|
#ifndef __KERNEL_OPENCL__
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __KERNEL_GPU__
|
#ifndef __KERNEL_GPU__
|
||||||
|
|
||||||
/* Fixed Bits Types */
|
/* Fixed Bits Types */
|
||||||
|
Loading…
Reference in New Issue
Block a user