162 ccl_private uint8_t *closure_pool = sg->closure_pool;
164 closure_pool =
reinterpret_cast<uint8_t *
>(
165 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureMul) - 1) &
166 (-
alignof(OSLClosureMul)));
167 sg->closure_pool = closure_pool +
sizeof(OSLClosureMul);
172 closure->weight = *weight;
173 closure->closure = a;
182 if (weight == 0.0f || !a) {
185 else if (weight == 1.0f) {
189 ccl_private uint8_t *closure_pool = sg->closure_pool;
191 closure_pool =
reinterpret_cast<uint8_t *
>(
192 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureMul) - 1) &
193 (-
alignof(OSLClosureMul)));
194 sg->closure_pool = closure_pool +
sizeof(OSLClosureMul);
199 closure->weight =
make_float3(weight, weight, weight);
200 closure->closure = a;
216 ccl_private uint8_t *closure_pool = sg->closure_pool;
218 closure_pool =
reinterpret_cast<uint8_t *
>(
219 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureAdd) - 1) &
220 (-
alignof(OSLClosureAdd)));
221 sg->closure_pool = closure_pool +
sizeof(OSLClosureAdd);
226 closure->closureA = a;
227 closure->closureB =
b;
235 ccl_private uint8_t *closure_pool = sg->closure_pool;
237 closure_pool =
reinterpret_cast<uint8_t *
>(
238 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureComponent) - 1) &
239 (-
alignof(OSLClosureComponent)));
240 sg->closure_pool = closure_pool +
sizeof(OSLClosureComponent) +
size;
243 reinterpret_cast<ccl_private OSLClosureComponent *
>(closure_pool);
253 ccl_private uint8_t *closure_pool = sg->closure_pool;
255 closure_pool =
reinterpret_cast<uint8_t *
>(
256 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureComponent) - 1) &
257 (-
alignof(OSLClosureComponent)));
258 sg->closure_pool = closure_pool +
sizeof(OSLClosureComponent) +
size;
261 reinterpret_cast<ccl_private OSLClosureComponent *
>(closure_pool);
263 closure->weight = *weight;
292 const int sourceline,
298 const int result = indexvalue < 0 ? 0 : indexvalue >=
length ?
length - 1 : indexvalue;
300 if (
result != indexvalue) {
301 printf(
"Index [%d] out of range\n", indexvalue);
359 int object = sd->object;
398 int object = sd->object;
433 const unsigned char type_basetype = type & 0xFF;
434 const unsigned char type_aggregate = (type >> 8) & 0xFF;
435 const int type_arraylen = type >> 32;
437 if (type_basetype == 11 ) {
438 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
443 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
448 if ((type_aggregate == 1 )) {
461 const unsigned char type_basetype = type & 0xFF;
462 const unsigned char type_aggregate = (type >> 8) & 0xFF;
463 const int type_arraylen = type >> 32;
465 if (type_basetype == 11 ) {
466 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
471 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
475 if ((type_aggregate == 1 )) {
488 const unsigned char type_basetype = type & 0xFF;
489 const unsigned char type_aggregate = (type >> 8) & 0xFF;
490 const int type_arraylen = type >> 32;
492 if (type_basetype == 11 ) {
493 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
498 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
503 if ((type_aggregate == 1 )) {
516 const unsigned char type_basetype = type & 0xFF;
517 const unsigned char type_aggregate = (type >> 8) & 0xFF;
518 const int type_arraylen = type >> 32;
520 if (type_basetype == 11 ) {
521 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
526 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
531 if ((type_aggregate == 1 )) {
553 const unsigned char type_basetype = type & 0xFF;
554 const unsigned char type_aggregate = (type >> 8) & 0xFF;
556 if (type_basetype == 11 && type_aggregate == 16 ) {
571 const unsigned char type_basetype = type & 0xFF;
572 const unsigned char type_aggregate = (type >> 8) & 0xFF;
573 const int type_arraylen = type >> 32;
575 if ((type_basetype == 7 ) && (type_aggregate == 1 ) &&
603 float f = sd->ray_length;
607#define READ_PATH_STATE(elem) \
608 ((state != -1) ? INTEGRATOR_STATE(state, path, elem) : \
609 (shadow_state != -1) ? INTEGRATOR_STATE(shadow_state, shadow_path, elem) : \
650#undef READ_PATH_STATE
687 if (primitive_is_volume_attribute(sd)) {
688 data.val = primitive_volume_attribute<T>(kg, sd, desc,
true);
803 return set_attribute4(f, type, derivatives, val);
847 float f = curve_thickness(kg, sd);
851 float3 f = curve_tangent_normal(sd);
855 float f = curve_random(kg, sd);
867 float f = point_radius(kg, sd);
871 float3 f = point_position(kg, sd);
875 float f = point_random(kg, sd);
939 const int derivatives,
942 const int array_lookup,
995#ifdef __KERNEL_OPTIX__
997 *ptr_data = kernel_params.osl_colorsystem;
1016 const int nchannels,
1028 if (nchannels > 0) {
1031 if (nchannels > 1) {
1034 if (nchannels > 2) {
1037 if (nchannels > 3) {
1043 if (nchannels > 0) {
1063 const int nchannels,
1075 const float4 rgba = kernel_tex_image_interp_3d(
1077 if (nchannels > 0) {
1080 if (nchannels > 1) {
1083 if (nchannels > 2) {
1086 if (nchannels > 3) {
1105 const int nchannels,
1111 if (nchannels > 0) {
1114 if (nchannels > 1) {
1117 if (nchannels > 2) {
1120 if (nchannels > 3) {
1217#if (OSL_LIBRARY_VERSION_CODE >= 11405) || (OSL_LIBRARY_VERSION_CODE < 11403)
1219 const int firstchannel)
1313 const int nchannels,
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static DBVT_INLINE btDbvtNode * sort(btDbvtNode *n, btDbvtNode *&r)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, const int id, const float x, float y)
ccl_device_forceinline float3 dPdx(const ccl_private ShaderData *sd)
ccl_device_forceinline float3 dPdy(const ccl_private ShaderData *sd)
ccl_device_inline ProjectionTransform projection_identity()
CCL_NAMESPACE_BEGIN struct Options options
#define kernel_assert(cond)
#define ccl_device_forceinline
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define ccl_device_extern
#define ccl_device_template_spec
#define ccl_device_constant
ccl_device_forceinline differential3 differential_from_compact(const float3 D, const float dD)
ccl_device_inline float3 triangle_smooth_normal_unnormalized(KernelGlobals kg, const ccl_private ShaderData *sd, const float3 Ng, const int prim, const float u, float v)
float length(VecOp< float, D >) RET
ccl_device_inline float hash_uint2_to_float(const uint kx, const uint ky)
CCL_NAMESPACE_BEGIN ccl_device float2 camera_sample_aperture(ccl_constant KernelCamera *cam, const float2 rand)
ccl_device_inline float3 camera_world_to_ndc(KernelGlobals kg, ccl_private ShaderData *sd, float3 P)
ccl_device Transform primitive_attribute_matrix(KernelGlobals kg, const AttributeDescriptor desc)
ccl_device_inline float3 object_dupli_uv(KernelGlobals kg, const int object)
ccl_device_inline int object_particle_id(KernelGlobals kg, const int object)
ccl_device int shader_pass_id(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device_inline Transform object_get_inverse_transform(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device float4 particle_rotation(KernelGlobals kg, const int particle)
ccl_device float3 particle_location(KernelGlobals kg, const int particle)
ccl_device float particle_lifetime(KernelGlobals kg, const int particle)
ccl_device float particle_age(KernelGlobals kg, const int particle)
ccl_device_inline uint particle_index(KernelGlobals kg, const int particle)
ccl_device_inline float3 object_color(KernelGlobals kg, const int object)
ccl_device_inline Transform object_get_transform(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device float3 particle_velocity(KernelGlobals kg, const int particle)
ccl_device_inline float object_alpha(KernelGlobals kg, const int object)
ccl_device float3 particle_angular_velocity(KernelGlobals kg, const int particle)
ccl_device_inline float3 object_dupli_generated(KernelGlobals kg, const int object)
ccl_device_inline float object_pass_id(KernelGlobals kg, const int object)
ccl_device float particle_size(KernelGlobals kg, const int particle)
ccl_device_inline float3 object_location(KernelGlobals kg, const ccl_private ShaderData *sd)
ccl_device_inline float object_random_number(KernelGlobals kg, const int object)
#define OSL_TEXTURE_HANDLE_SLOT(handle)
#define OSL_TEXTURE_HANDLE_TYPE(handle)
#define OSL_TEXTURE_HANDLE_TYPE_SVM
#define OSL_TEXTURE_HANDLE_TYPE_IES
const char * DeviceString
@ ATTR_STD_NORMAL_UNDISPLACED
ccl_device_inline float kernel_ies_interp(KernelGlobals kg, const int slot, const float h_angle, const float v_angle)
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
ccl_device_constant DeviceString u_particle_rotation
ccl_device_constant DeviceString u_point_position
ccl_device_constant DeviceString u_path_transparent_depth
ccl_device_constant DeviceString u_object_color
ccl_device_constant DeviceString u_is_point
ccl_device_constant DeviceString u_particle_lifetime
ccl_device_constant DeviceString u_geom_numpolyvertices
ccl_device_constant DeviceString u_sensor_size
ccl_device_constant DeviceString u_is_curve
ccl_device_constant DeviceString u_material_index
ccl_device_constant DeviceString u_aperture_size
ccl_device_constant DeviceString u_point_radius
ccl_device_constant DeviceString u_aperture_position
ccl_device_constant DeviceString u_particle_location
ccl_device_constant DeviceString u_object_is_light
ccl_device_constant DeviceString u_path_ray_length
ccl_device_constant DeviceString u_path_diffuse_depth
ccl_device_constant DeviceString u_path_transmission_depth
ccl_device_constant DeviceString u_geom_dupli_uv
ccl_device_constant DeviceString u_colorsystem
ccl_device_constant DeviceString u_aperture_aspect_ratio
ccl_device_constant DeviceString u_object_location
ccl_device_constant DeviceString u_focal_distance
ccl_device_constant DeviceString u_particle_age
ccl_device_constant DeviceString u_screen
ccl_device_constant DeviceString u_path_portal_depth
ccl_device_constant DeviceString _emptystring_
ccl_device_constant DeviceString u_is_smooth
ccl_device_constant DeviceString u_normal_map_normal
ccl_device_constant DeviceString u_path_ray_depth
ccl_device_constant DeviceString u_path_glossy_depth
ccl_device_constant DeviceString u_world
ccl_device_constant DeviceString u_object_alpha
ccl_device_constant DeviceString u_object
ccl_device_constant DeviceString u_particle_velocity
ccl_device_constant DeviceString u_raster
ccl_device_constant DeviceString u_image_resolution
ccl_device_constant DeviceString u_common
ccl_device_constant DeviceString u_camera
ccl_device_constant DeviceString u_curve_length
ccl_device_constant DeviceString u_particle_index
ccl_device_constant DeviceString u_particle_size
ccl_device_constant DeviceString u_bump_map_normal
ccl_device_constant DeviceString u_point_random
ccl_device_constant DeviceString u_geom_dupli_generated
ccl_device_constant DeviceString u_particle_angular_velocity
ccl_device_constant DeviceString u_shader
ccl_device_constant DeviceString u_object_random
ccl_device_constant DeviceString u_ndc
ccl_device_constant DeviceString u_object_index
ccl_device_constant DeviceString u_curve_tangent_normal
ccl_device_constant DeviceString u_geom_polyvertices
ccl_device_constant DeviceString u_geom_name
ccl_device_constant DeviceString u_curve_thickness
ccl_device_constant DeviceString u_particle_random
ccl_device_constant DeviceString u_geom_undisplaced
ccl_device_constant DeviceString u_curve_random
ccl_device_constant DeviceString u_geom_trianglevertices
CCL_NAMESPACE_BEGIN ccl_device_forceinline dual< T > primitive_surface_attribute(KernelGlobals kg, const ccl_private ShaderData *sd, const AttributeDescriptor desc, const bool dx=false, const bool dy=false)
ccl_device_extern bool osl_get_attribute(ccl_private ShaderGlobals *sg, const int derivatives, DeviceString object_name, DeviceString name, const int array_lookup, const int index, const TypeDesc type, ccl_private void *res)
ccl_device_forceinline void copy_matrix(ccl_private float *res, const Transform &tfm)
ccl_device_extern bool rs_environment(ccl_private ShaderGlobals *sg, RSDeviceString filename, ccl_private void *texture_handle, ccl_private void *texture_thread_info, ccl_private OSLTextureOptions *opt, const ccl_private float3 *R, const ccl_private float3 *dRdx, const ccl_private float3 *dRdy, const int nchannels, ccl_private float *result, ccl_private float *dresultds, ccl_private float *dresultdt, ccl_private void *errormessage)
ccl_device_extern int rs_pointcloud_get(ccl_private ShaderGlobals *sg, RSDeviceString filename, const ccl_private int *indices, int count, RSDeviceString attr_name, RSTypeDesc attr_type, ccl_private void *out_data)
ccl_device_extern void osl_trace_set_shade(ccl_private void *opt, int x)
ccl_device_extern ccl_private OSLClosure * osl_allocate_closure_component(ccl_private ShaderGlobals *sg, const int id, const int size)
ccl_device_extern void osl_texture_set_sblur(ccl_private OSLTextureOptions *opt, const float blur)
ccl_device_extern ccl_private OSLClosure * osl_add_closure_closure(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, ccl_private OSLClosure *b)
ccl_device_extern void osl_texture_set_time(ccl_private OSLTextureOptions *opt, const float time)
ccl_device_extern void osl_texture_set_stblur(ccl_private OSLTextureOptions *opt, const float blur)
ccl_device_extern int rs_pointcloud_search(ccl_private ShaderGlobals *sg, RSDeviceString filename, const ccl_private float3 *center, float radius, int max_points, bool sort, ccl_private int *out_indices, ccl_private float *out_distances, int derivs_offset)
ccl_device_extern void osl_texture_set_fill(ccl_private OSLTextureOptions *opt, const float fill)
ccl_device_extern bool rs_trace(ccl_private ShaderGlobals *sg, ccl_private void *options, const ccl_private float3 *P, const ccl_private float3 *dPdx, const ccl_private float3 *dPdy, const ccl_private float3 *R, const ccl_private float3 *dRdx, const ccl_private float3 *dRdy)
ccl_device_extern void osl_fprintf(ccl_private ShaderGlobals *sg, DeviceString filename, DeviceString format, void *args)
ccl_device_inline bool get_object_attribute_impl(KernelGlobals kg, ccl_private ShaderData *sd, const AttributeDescriptor &desc, const TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern bool rs_texture3d(ccl_private ShaderGlobals *sg, RSDeviceString filename, ccl_private void *texture_handle, ccl_private void *texture_thread_info, ccl_private OSLTextureOptions *opt, const ccl_private float3 *P, const ccl_private float3 *dPdx, const ccl_private float3 *dPdy, const ccl_private float3 *dPdz, const int nchannels, ccl_private float *result, ccl_private float *dresultds, ccl_private float *dresultdt, ccl_private float *dresultdr, ccl_private void *errormessage)
ccl_device_extern bool rs_texture(ccl_private ShaderGlobals *sg, RSDeviceString filename, ccl_private void *texture_handle, ccl_private void *texture_thread_info, ccl_private OSLTextureOptions *opt, const float s, const float t, const float dsdx, const float dtdx, const float dsdy, const float dtdy, const int nchannels, ccl_private float *result, ccl_private float *dresultds, ccl_private float *dresultdt, ccl_private void *errormessage)
ccl_device_extern void osl_texture_set_swidth(ccl_private OSLTextureOptions *opt, const float width)
ccl_device_extern void osl_trace_set_maxdist(ccl_private void *opt, float x)
ccl_device_extern void osl_texture_set_interp_code(ccl_private OSLTextureOptions *opt, const int mode)
ccl_device_extern bool rs_trace_get(ccl_private ShaderGlobals *sg, RSDeviceString name, RSTypeDesc type, ccl_private void *data, bool derivatives)
ccl_device_extern void osl_texture_set_twidth(ccl_private OSLTextureOptions *opt, const float width)
ccl_device_template_spec bool set_attribute(const dual1 v, const TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_inline bool get_background_attribute(KernelGlobals kg, ccl_private ShaderGlobals *sg, ccl_private ShaderData *sd, DeviceString name, const TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern void osl_texture_set_rwrap_code(ccl_private OSLTextureOptions *opt, const int mode)
ccl_device_extern bool rs_pointcloud_write(ccl_private ShaderGlobals *sg, RSDeviceString filename, const ccl_private float3 *pos, int nattribs, const ccl_private DeviceString *names, const ccl_private RSTypeDesc *types, const ccl_private void **data)
ccl_device_extern bool osl_get_inverse_matrix(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString to)
ccl_device_extern void osl_texture_set_subimagename(ccl_private OSLTextureOptions *opt, DeviceString subimagename_)
ccl_device_extern void osl_warning(ccl_private ShaderGlobals *sg, DeviceString format, void *args)
ccl_device_extern void osl_texture_set_swrap_code(ccl_private OSLTextureOptions *opt, const int mode)
ccl_device_inline bool get_object_attribute(KernelGlobals kg, ccl_private ShaderData *sd, const AttributeDescriptor &desc, const TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern void osl_init_trace_options(ccl_private void *oec, ccl_private void *opt)
ccl_device_extern void osl_texture_set_stwrap_code(ccl_private OSLTextureOptions *opt, const int mode)
ccl_device_extern void osl_trace_set_mindist(ccl_private void *opt, float x)
ccl_device_inline bool set_attribute_matrix(const ccl_private Transform &tfm, const TypeDesc type, ccl_private void *val)
ccl_device_extern uint osl_range_check_err(const int indexvalue, const int length, DeviceString symname, ccl_private ShaderGlobals *sg, DeviceString sourcefile, const int sourceline, DeviceString groupname, const int layer, DeviceString layername, DeviceString shadername)
ccl_device_inline bool get_camera_attribute(ccl_private ShaderGlobals *sg, KernelGlobals kg, DeviceString name, TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern void osl_texture_set_missingcolor_arena(ccl_private OSLTextureOptions *opt, ccl_private float3 *color)
ccl_device_extern void osl_trace_set_traceset(ccl_private void *opt, const DeviceString x)
ccl_device_extern void osl_texture_set_twrap_code(ccl_private OSLTextureOptions *opt, const int mode)
ccl_device_extern void osl_texture_set_tblur(ccl_private OSLTextureOptions *opt, const float blur)
ccl_device_extern ccl_private OSLClosure * osl_allocate_weighted_closure_component(ccl_private ShaderGlobals *sg, const int id, const int size, const ccl_private float3 *weight)
ccl_device_extern ccl_private OSLClosure * osl_mul_closure_float(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, const float weight)
ccl_device_extern void osl_texture_set_firstchannel(ccl_private OSLTextureOptions *opt, const int firstchannel)
ccl_device_extern void osl_texture_set_stwidth(ccl_private OSLTextureOptions *opt, const float width)
ccl_device_inline bool get_object_standard_attribute(KernelGlobals kg, ccl_private ShaderGlobals *sg, ccl_private ShaderData *sd, DeviceString name, const TypeDesc type, bool derivatives, ccl_private void *val)
#define READ_PATH_STATE(elem)
ccl_device_extern void osl_printf(ccl_private ShaderGlobals *sg, DeviceString format, void *args)
ccl_device_extern void osl_texture_set_missingcolor_alpha(ccl_private OSLTextureOptions *opt, const int nchannels, const float alpha)
ccl_device_extern bool rs_get_texture_info(ccl_private ShaderGlobals *sg, RSDeviceString filename, ccl_private void *texture_handle, ccl_private void *texture_thread_info, int subimage, RSDeviceString dataname, RSTypeDesc datatype, ccl_private void *data, ccl_private void *errormessage)
ccl_device_extern int osl_texture_decode_wrapmode(DeviceString name_)
ccl_device_extern void osl_texture_set_rwidth(ccl_private OSLTextureOptions *opt, const float width)
ccl_device_extern ccl_private OSLClosure * osl_mul_closure_color(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, const ccl_private float3 *weight)
ccl_device_extern void osl_texture_set_rblur(ccl_private OSLTextureOptions *opt, const float blur)
ccl_device_extern bool osl_get_matrix(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString from)
ccl_device_extern void osl_error(ccl_private ShaderGlobals *sg, DeviceString format, void *args)
ccl_device_extern void osl_texture_set_subimage(ccl_private OSLTextureOptions *opt, const int subimage)
ccl_device_extern bool rend_get_userdata(RSDeviceString name, ccl_private void *data, int data_size, const RSTypeDesc &type, int index)
ccl_device_extern bool rs_get_texture_info_st(ccl_private ShaderGlobals *sg, RSDeviceString filename, ccl_private void *texture_handle, const float s, const float t, ccl_private void *texture_thread_info, int subimage, RSDeviceString dataname, RSTypeDesc datatype, ccl_private void *data, ccl_private void *errormessage)
ccl_device_inline void set_data_float3(const dual3 data, bool derivatives, ccl_private void *val)
ccl_device bool attribute_bump_map_normal(KernelGlobals kg, ccl_private const ShaderData *sd, ccl_private dual3 &f)
ccl_device_inline void set_data_float4(const dual4 data, bool derivatives, ccl_private void *val)
ccl_device_inline void set_data_float(const dual1 data, bool derivatives, ccl_private void *val)
const IntegratorShadowStateCPU * ConstIntegratorShadowState
const IntegratorStateCPU * ConstIntegratorState
static bool find_attribute(const std::string &attributes, const char *search_attribute)
unsigned char vecsemantics