 |
Blender
V2.93
|
Go to the documentation of this file.
17 #ifndef __KERNEL_COMPAT_OPENCL_H__
18 #define __KERNEL_COMPAT_OPENCL_H__
20 #define __KERNEL_GPU__
21 #define __KERNEL_OPENCL__
24 #define CCL_NAMESPACE_BEGIN
25 #define CCL_NAMESPACE_END
27 #ifdef __CL_NOINLINE__
28 # define ccl_noinline __attribute__((noinline))
35 #define ccl_device_inline ccl_device
36 #define ccl_device_forceinline ccl_device
37 #define ccl_device_noinline ccl_device ccl_noinline
38 #define ccl_device_noinline_cpu ccl_device
40 #define ccl_static_constant static __constant
41 #define ccl_constant __constant
42 #define ccl_global __global
43 #define ccl_local __local
44 #define ccl_local_param __local
45 #define ccl_private __private
46 #define ccl_restrict restrict
48 #define ccl_align(n) __attribute__((aligned(n)))
49 #define ccl_optional_struct_init
51 #if __OPENCL_VERSION__ >= 200 && !defined(__NV_CL_C_VERSION)
52 # define ccl_loop_no_unroll __attribute__((opencl_unroll_hint(1)))
54 # define ccl_loop_no_unroll
57 #ifdef __SPLIT_KERNEL__
58 # define ccl_addr_space __global
60 # define ccl_addr_space
63 #define ATTR_FALLTHROUGH
65 #define ccl_local_id(d) get_local_id(d)
66 #define ccl_global_id(d) get_global_id(d)
68 #define ccl_local_size(d) get_local_size(d)
69 #define ccl_global_size(d) get_global_size(d)
71 #define ccl_group_id(d) get_group_id(d)
72 #define ccl_num_groups(d) get_num_groups(d)
75 #ifndef __NODES_MAX_GROUP__
76 # define __NODES_MAX_GROUP__ NODE_GROUP_LEVEL_MAX
78 #ifndef __NODES_FEATURES__
79 # define __NODES_FEATURES__ NODE_FEATURE_ALL
83 #define kernel_assert(cond)
108 #define make_float2(x, y) ((float2)(x, y))
109 #define make_float3(x, y, z) ((float3)(x, y, z))
110 #define make_float4(x, y, z, w) ((float4)(x, y, z, w))
111 #define make_int2(x, y) ((int2)(x, y))
112 #define make_int3(x, y, z) ((int3)(x, y, z))
113 #define make_int4(x, y, z, w) ((int4)(x, y, z, w))
114 #define make_uchar4(x, y, z, w) ((uchar4)(x, y, z, w))
117 #define __uint_as_float(x) as_float(x)
118 #define __float_as_uint(x) as_uint(x)
119 #define __int_as_float(x) as_float(x)
120 #define __float_as_int(x) as_int(x)
121 #define powf(x, y) pow(((float)(x)), ((float)(y)))
122 #define fabsf(x) fabs(((float)(x)))
123 #define copysignf(x, y) copysign(((float)(x)), ((float)(y)))
124 #define asinf(x) asin(((float)(x)))
125 #define acosf(x) acos(((float)(x)))
126 #define atanf(x) atan(((float)(x)))
127 #define floorf(x) floor(((float)(x)))
128 #define ceilf(x) ceil(((float)(x)))
129 #define hypotf(x, y) hypot(((float)(x)), ((float)(y)))
130 #define atan2f(x, y) atan2(((float)(x)), ((float)(y)))
131 #define fmaxf(x, y) fmax(((float)(x)), ((float)(y)))
132 #define fminf(x, y) fmin(((float)(x)), ((float)(y)))
133 #define fmodf(x, y) fmod((float)(x), (float)(y))
134 #define sinhf(x) sinh(((float)(x)))
135 #define coshf(x) cosh(((float)(x)))
136 #define tanhf(x) tanh(((float)(x)))
141 # define sinf(x) native_sin(((float)(x)))
142 # define cosf(x) native_cos(((float)(x)))
143 # define tanf(x) native_tan(((float)(x)))
144 # define expf(x) native_exp(((float)(x)))
145 # define sqrtf(x) native_sqrt(((float)(x)))
146 # define logf(x) native_log(((float)(x)))
147 # define rcp(x) native_recip(x)
149 # define sinf(x) sin(((float)(x)))
150 # define cosf(x) cos(((float)(x)))
151 # define tanf(x) tan(((float)(x)))
152 # define expf(x) exp(((float)(x)))
153 # define sqrtf(x) sqrt(((float)(x)))
154 # define logf(x) log(((float)(x)))
155 # define rcp(x) recip(x)
159 #define kernel_data (*kg->data)
160 #define kernel_tex_array(tex) \
161 ((const ccl_global tex##_t *)(kg->buffers[kg->tex.cl_buffer] + kg->tex.data))
162 #define kernel_tex_fetch(tex, index) kernel_tex_array(tex)[(index)]
166 # define NULL ((void *)0)
170 #ifdef __KERNEL_CL_KHR_FP16__
171 # pragma OPENCL EXTENSION cl_khr_fp16 : enable