Blender V4.3
OSLRenderServices Class Reference

#include <services.h>

Inherits OSL::RendererServices.

Public Member Functions

 OSLRenderServices (OSL::TextureSystem *texture_system, int device_type)
 
 ~OSLRenderServices ()
 
int supports (string_view feature) const override
 
bool get_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) override
 
bool get_inverse_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) override
 
bool get_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSLUStringHash from, float time) override
 
bool get_inverse_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSLUStringHash to, float time) override
 
bool get_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform) override
 
bool get_inverse_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform) override
 
bool get_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSLUStringHash from) override
 
bool get_inverse_matrix (OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSLUStringHash from) override
 
bool get_array_attribute (OSL::ShaderGlobals *sg, bool derivatives, OSLUStringHash object, TypeDesc type, OSLUStringHash name, int index, void *val) override
 
bool get_attribute (OSL::ShaderGlobals *sg, bool derivatives, OSLUStringHash object, TypeDesc type, OSLUStringHash name, void *val) override
 
bool get_attribute (ShaderData *sd, bool derivatives, OSLUStringHash object_name, TypeDesc type, OSLUStringHash name, void *val)
 
bool get_userdata (bool derivatives, OSLUStringHash name, TypeDesc type, OSL::ShaderGlobals *sg, void *val) override
 
int pointcloud_search (OSL::ShaderGlobals *sg, OSLUStringHash filename, const OSL::Vec3 &center, float radius, int max_points, bool sort, size_t *out_indices, float *out_distances, int derivs_offset) override
 
int pointcloud_get (OSL::ShaderGlobals *sg, OSLUStringHash filename, size_t *indices, int count, OSLUStringHash attr_name, TypeDesc attr_type, void *out_data) override
 
bool pointcloud_write (OSL::ShaderGlobals *sg, OSLUStringHash filename, const OSL::Vec3 &pos, int nattribs, const OSLUStringRep *names, const TypeDesc *types, const void **data) override
 
bool trace (TraceOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &P, const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &R, const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy) override
 
bool getmessage (OSL::ShaderGlobals *sg, OSLUStringHash source, OSLUStringHash name, TypeDesc type, void *val, bool derivatives) override
 
TextureSystem::TextureHandle * get_texture_handle (OSLUStringHash filename) override
 
bool good (TextureSystem::TextureHandle *texture_handle) override
 
bool texture (OSLUStringHash filename, TextureSystem::TextureHandle *texture_handle, TexturePerthread *texture_thread_info, TextureOpt &options, OSL::ShaderGlobals *sg, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, int nchannels, float *result, float *dresultds, float *dresultdt, OSLUStringHash *errormessage) override
 
bool texture3d (OSLUStringHash filename, TextureHandle *texture_handle, TexturePerthread *texture_thread_info, TextureOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &P, const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &dPdz, int nchannels, float *result, float *dresultds, float *dresultdt, float *dresultdr, OSLUStringHash *errormessage) override
 
bool environment (OSLUStringHash filename, TextureHandle *texture_handle, TexturePerthread *texture_thread_info, TextureOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &R, const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, int nchannels, float *result, float *dresultds, float *dresultdt, OSLUStringHash *errormessage) override
 
bool get_texture_info (OSL::ShaderGlobals *sg, OSLUStringHash filename, TextureHandle *texture_handle, int subimage, OSLUStringHash dataname, TypeDesc datatype, void *data) override
 

Static Public Member Functions

static void register_closures (OSL::ShadingSystem *ss)
 
static bool get_background_attribute (const KernelGlobalsCPU *kg, ShaderData *sd, OSLUStringHash name, TypeDesc type, bool derivatives, void *val)
 
static bool get_object_standard_attribute (const KernelGlobalsCPU *kg, ShaderData *sd, OSLUStringHash name, TypeDesc type, bool derivatives, void *val)
 

Public Attributes

OSLTextureHandleMap textures
 

Static Public Attributes

static ustring u_distance
 
static ustring u_index
 
static ustring u_world
 
static ustring u_camera
 
static ustring u_screen
 
static ustring u_raster
 
static ustring u_ndc
 
static ustring u_object_location
 
static ustring u_object_color
 
static ustring u_object_alpha
 
static ustring u_object_index
 
static ustring u_object_is_light
 
static ustring u_geom_dupli_generated
 
static ustring u_geom_dupli_uv
 
static ustring u_material_index
 
static ustring u_object_random
 
static ustring u_particle_index
 
static ustring u_particle_random
 
static ustring u_particle_age
 
static ustring u_particle_lifetime
 
static ustring u_particle_location
 
static ustring u_particle_rotation
 
static ustring u_particle_size
 
static ustring u_particle_velocity
 
static ustring u_particle_angular_velocity
 
static ustring u_geom_numpolyvertices
 
static ustring u_geom_trianglevertices
 
static ustring u_geom_polyvertices
 
static ustring u_geom_name
 
static ustring u_geom_undisplaced
 
static ustring u_is_smooth
 
static ustring u_is_curve
 
static ustring u_curve_thickness
 
static ustring u_curve_length
 
static ustring u_curve_tangent_normal
 
static ustring u_curve_random
 
static ustring u_is_point
 
static ustring u_point_position
 
static ustring u_point_radius
 
static ustring u_point_random
 
static ustring u_normal_map_normal
 
static ustring u_path_ray_length
 
static ustring u_path_ray_depth
 
static ustring u_path_diffuse_depth
 
static ustring u_path_glossy_depth
 
static ustring u_path_transparent_depth
 
static ustring u_path_transmission_depth
 
static ustring u_trace
 
static ustring u_hit
 
static ustring u_hitdist
 
static ustring u_N
 
static ustring u_Ng
 
static ustring u_P
 
static ustring u_I
 
static ustring u_u
 
static ustring u_v
 
static ustring u_empty
 
static ustring u_at_bevel
 
static ustring u_at_ao
 
static ImageManagerimage_manager = nullptr
 

Detailed Description

Definition at line 85 of file services.h.

Constructor & Destructor Documentation

◆ OSLRenderServices()

OSLRenderServices::OSLRenderServices ( OSL::TextureSystem * texture_system,
int device_type )

Definition at line 127 of file services.cpp.

◆ ~OSLRenderServices()

OSLRenderServices::~OSLRenderServices ( )

Definition at line 132 of file services.cpp.

References VLOG_INFO.

Member Function Documentation

◆ environment()

bool OSLRenderServices::environment ( OSLUStringHash filename,
TextureHandle * texture_handle,
TexturePerthread * texture_thread_info,
TextureOpt & options,
OSL::ShaderGlobals * sg,
const OSL::Vec3 & R,
const OSL::Vec3 & dRdx,
const OSL::Vec3 & dRdy,
int nchannels,
float * result,
float * dresultds,
float * dresultdt,
OSLUStringHash * errormessage )
override

◆ get_array_attribute()

bool OSLRenderServices::get_array_attribute ( OSL::ShaderGlobals * sg,
bool derivatives,
OSLUStringHash object,
TypeDesc type,
OSLUStringHash name,
int index,
void * val )
override

Definition at line 404 of file services.cpp.

◆ get_attribute() [1/2]

bool OSLRenderServices::get_attribute ( OSL::ShaderGlobals * sg,
bool derivatives,
OSLUStringHash object,
TypeDesc type,
OSLUStringHash name,
void * val )
override

Definition at line 1117 of file services.cpp.

References get_attribute(), NULL, and ShaderData.

Referenced by get_attribute(), and getmessage().

◆ get_attribute() [2/2]

bool OSLRenderServices::get_attribute ( ShaderData * sd,
bool derivatives,
OSLUStringHash object_name,
TypeDesc type,
OSLUStringHash name,
void * val )

◆ get_background_attribute()

◆ get_inverse_matrix() [1/4]

bool OSLRenderServices::get_inverse_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSL::TransformationPtr xform )
override

◆ get_inverse_matrix() [2/4]

bool OSLRenderServices::get_inverse_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSL::TransformationPtr xform,
float time )
override

◆ get_inverse_matrix() [3/4]

bool OSLRenderServices::get_inverse_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSLUStringHash from )
override

Definition at line 377 of file services.cpp.

References copy_matrix(), kernel_data, ShaderData, u_camera, u_ndc, u_raster, and u_screen.

◆ get_inverse_matrix() [4/4]

bool OSLRenderServices::get_inverse_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSLUStringHash to,
float time )
override

Definition at line 262 of file services.cpp.

References copy_matrix(), kernel_data, ShaderData, u_camera, u_ndc, u_raster, u_screen, and u_world.

◆ get_matrix() [1/4]

bool OSLRenderServices::get_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSL::TransformationPtr xform )
override

◆ get_matrix() [2/4]

bool OSLRenderServices::get_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSL::TransformationPtr xform,
float time )
override

◆ get_matrix() [3/4]

bool OSLRenderServices::get_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSLUStringHash from )
override

Definition at line 350 of file services.cpp.

References copy_matrix(), kernel_data, ShaderData, u_camera, u_ndc, u_raster, and u_screen.

◆ get_matrix() [4/4]

bool OSLRenderServices::get_matrix ( OSL::ShaderGlobals * sg,
OSL::Matrix44 & result,
OSLUStringHash from,
float time )
override

Definition at line 230 of file services.cpp.

References copy_matrix(), kernel_data, ShaderData, u_camera, u_ndc, u_raster, u_screen, and u_world.

◆ get_object_standard_attribute()

bool OSLRenderServices::get_object_standard_attribute ( const KernelGlobalsCPU * kg,
ShaderData * sd,
OSLUStringHash name,
TypeDesc type,
bool derivatives,
void * val )
static

◆ get_texture_handle()

◆ get_texture_info()

bool OSLRenderServices::get_texture_info ( OSL::ShaderGlobals * sg,
OSLUStringHash filename,
TextureHandle * texture_handle,
int subimage,
OSLUStringHash dataname,
TypeDesc datatype,
void * data )
override

Definition at line 1661 of file services.cpp.

References data, OSLTextureHandle::OIIO, and to_ustring().

◆ get_userdata()

bool OSLRenderServices::get_userdata ( bool derivatives,
OSLUStringHash name,
TypeDesc type,
OSL::ShaderGlobals * sg,
void * val )
override

Definition at line 1168 of file services.cpp.

◆ getmessage()

bool OSLRenderServices::getmessage ( OSL::ShaderGlobals * sg,
OSLUStringHash source,
OSLUStringHash name,
TypeDesc type,
void * val,
bool derivatives )
override

◆ good()

bool OSLRenderServices::good ( TextureSystem::TextureHandle * texture_handle)
override

Definition at line 1268 of file services.cpp.

◆ pointcloud_get()

int OSLRenderServices::pointcloud_get ( OSL::ShaderGlobals * sg,
OSLUStringHash filename,
size_t * indices,
int count,
OSLUStringHash attr_name,
TypeDesc attr_type,
void * out_data )
override

Definition at line 1705 of file services.cpp.

◆ pointcloud_search()

int OSLRenderServices::pointcloud_search ( OSL::ShaderGlobals * sg,
OSLUStringHash filename,
const OSL::Vec3 & center,
float radius,
int max_points,
bool sort,
size_t * out_indices,
float * out_distances,
int derivs_offset )
override

Definition at line 1692 of file services.cpp.

◆ pointcloud_write()

bool OSLRenderServices::pointcloud_write ( OSL::ShaderGlobals * sg,
OSLUStringHash filename,
const OSL::Vec3 & pos,
int nattribs,
const OSLUStringRep * names,
const TypeDesc * types,
const void ** data )
override

Definition at line 1716 of file services.cpp.

◆ register_closures()

void OSLRenderServices::register_closures ( OSL::ShadingSystem * ss)
static

Definition at line 66 of file closures.cpp.

References OSL_CLOSURE_LAYER_ID, and osl_closure_layer_params().

◆ supports()

int OSLRenderServices::supports ( string_view feature) const
override

Definition at line 139 of file services.cpp.

References DEVICE_OPTIX.

◆ texture()

bool OSLRenderServices::texture ( OSLUStringHash filename,
TextureSystem::TextureHandle * texture_handle,
TexturePerthread * texture_thread_info,
TextureOpt & options,
OSL::ShaderGlobals * sg,
float s,
float t,
float dsdx,
float dtdx,
float dsdy,
float dtdy,
int nchannels,
float * result,
float * dresultds,
float * dresultdt,
OSLUStringHash * errormessage )
override

◆ texture3d()

bool OSLRenderServices::texture3d ( OSLUStringHash filename,
TextureHandle * texture_handle,
TexturePerthread * texture_thread_info,
TextureOpt & options,
OSL::ShaderGlobals * sg,
const OSL::Vec3 & P,
const OSL::Vec3 & dPdx,
const OSL::Vec3 & dPdy,
const OSL::Vec3 & dPdz,
int nchannels,
float * result,
float * dresultds,
float * dresultdt,
float * dresultdr,
OSLUStringHash * errormessage )
override

◆ trace()

bool OSLRenderServices::trace ( TraceOpt & options,
OSL::ShaderGlobals * sg,
const OSL::Vec3 & P,
const OSL::Vec3 & dPdx,
const OSL::Vec3 & dPdy,
const OSL::Vec3 & R,
const OSL::Vec3 & dRdx,
const OSL::Vec3 & dRdy )
override

Member Data Documentation

◆ image_manager

ImageManager * OSLRenderServices::image_manager = nullptr
static

Definition at line 364 of file services.h.

◆ textures

OSLTextureHandleMap OSLRenderServices::textures

Definition at line 362 of file services.h.

◆ u_at_ao

ustring OSLRenderServices::u_at_ao
static

Definition at line 356 of file services.h.

◆ u_at_bevel

ustring OSLRenderServices::u_at_bevel
static

Definition at line 355 of file services.h.

◆ u_camera

ustring OSLRenderServices::u_camera
static

Definition at line 301 of file services.h.

Referenced by get_inverse_matrix(), get_inverse_matrix(), get_matrix(), and get_matrix().

◆ u_curve_length

ustring OSLRenderServices::u_curve_length
static

Definition at line 331 of file services.h.

◆ u_curve_random

ustring OSLRenderServices::u_curve_random
static

Definition at line 333 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_curve_tangent_normal

ustring OSLRenderServices::u_curve_tangent_normal
static

Definition at line 332 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_curve_thickness

ustring OSLRenderServices::u_curve_thickness
static

Definition at line 330 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_distance

ustring OSLRenderServices::u_distance
static

Definition at line 298 of file services.h.

◆ u_empty

ustring OSLRenderServices::u_empty
static

◆ u_geom_dupli_generated

ustring OSLRenderServices::u_geom_dupli_generated
static

Definition at line 310 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_dupli_uv

ustring OSLRenderServices::u_geom_dupli_uv
static

Definition at line 311 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_name

ustring OSLRenderServices::u_geom_name
static

Definition at line 326 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_numpolyvertices

ustring OSLRenderServices::u_geom_numpolyvertices
static

Definition at line 323 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_polyvertices

ustring OSLRenderServices::u_geom_polyvertices
static

Definition at line 325 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_trianglevertices

ustring OSLRenderServices::u_geom_trianglevertices
static

Definition at line 324 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_geom_undisplaced

ustring OSLRenderServices::u_geom_undisplaced
static

Definition at line 327 of file services.h.

Referenced by osl_eval_nodes< SHADER_TYPE_SURFACE >().

◆ u_hit

ustring OSLRenderServices::u_hit
static

Definition at line 346 of file services.h.

Referenced by getmessage().

◆ u_hitdist

ustring OSLRenderServices::u_hitdist
static

Definition at line 347 of file services.h.

Referenced by getmessage().

◆ u_I

ustring OSLRenderServices::u_I
static

Definition at line 351 of file services.h.

Referenced by getmessage().

◆ u_index

ustring OSLRenderServices::u_index
static

Definition at line 299 of file services.h.

◆ u_is_curve

ustring OSLRenderServices::u_is_curve
static

Definition at line 329 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_is_point

ustring OSLRenderServices::u_is_point
static

Definition at line 334 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_is_smooth

ustring OSLRenderServices::u_is_smooth
static

Definition at line 328 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_material_index

ustring OSLRenderServices::u_material_index
static

Definition at line 312 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_N

ustring OSLRenderServices::u_N
static

Definition at line 348 of file services.h.

Referenced by getmessage().

◆ u_ndc

ustring OSLRenderServices::u_ndc
static

◆ u_Ng

ustring OSLRenderServices::u_Ng
static

Definition at line 349 of file services.h.

Referenced by getmessage().

◆ u_normal_map_normal

ustring OSLRenderServices::u_normal_map_normal
static

Definition at line 338 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_alpha

ustring OSLRenderServices::u_object_alpha
static

Definition at line 307 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_color

ustring OSLRenderServices::u_object_color
static

Definition at line 306 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_index

ustring OSLRenderServices::u_object_index
static

Definition at line 308 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_is_light

ustring OSLRenderServices::u_object_is_light
static

Definition at line 309 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_location

ustring OSLRenderServices::u_object_location
static

Definition at line 305 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_object_random

ustring OSLRenderServices::u_object_random
static

Definition at line 313 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_P

ustring OSLRenderServices::u_P
static

Definition at line 350 of file services.h.

Referenced by getmessage().

◆ u_particle_age

ustring OSLRenderServices::u_particle_age
static

Definition at line 316 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_angular_velocity

ustring OSLRenderServices::u_particle_angular_velocity
static

Definition at line 322 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_index

ustring OSLRenderServices::u_particle_index
static

Definition at line 314 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_lifetime

ustring OSLRenderServices::u_particle_lifetime
static

Definition at line 317 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_location

ustring OSLRenderServices::u_particle_location
static

Definition at line 318 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_random

ustring OSLRenderServices::u_particle_random
static

Definition at line 315 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_rotation

ustring OSLRenderServices::u_particle_rotation
static

Definition at line 319 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_size

ustring OSLRenderServices::u_particle_size
static

Definition at line 320 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_particle_velocity

ustring OSLRenderServices::u_particle_velocity
static

Definition at line 321 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_path_diffuse_depth

ustring OSLRenderServices::u_path_diffuse_depth
static

Definition at line 341 of file services.h.

Referenced by get_background_attribute().

◆ u_path_glossy_depth

ustring OSLRenderServices::u_path_glossy_depth
static

Definition at line 342 of file services.h.

Referenced by get_background_attribute().

◆ u_path_ray_depth

ustring OSLRenderServices::u_path_ray_depth
static

Definition at line 340 of file services.h.

Referenced by get_background_attribute().

◆ u_path_ray_length

ustring OSLRenderServices::u_path_ray_length
static

Definition at line 339 of file services.h.

Referenced by get_background_attribute().

◆ u_path_transmission_depth

ustring OSLRenderServices::u_path_transmission_depth
static

Definition at line 344 of file services.h.

Referenced by get_background_attribute().

◆ u_path_transparent_depth

ustring OSLRenderServices::u_path_transparent_depth
static

Definition at line 343 of file services.h.

Referenced by get_background_attribute().

◆ u_point_position

ustring OSLRenderServices::u_point_position
static

Definition at line 335 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_point_radius

ustring OSLRenderServices::u_point_radius
static

Definition at line 336 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_point_random

ustring OSLRenderServices::u_point_random
static

Definition at line 337 of file services.h.

Referenced by get_object_standard_attribute().

◆ u_raster

ustring OSLRenderServices::u_raster
static

Definition at line 303 of file services.h.

Referenced by get_inverse_matrix(), get_inverse_matrix(), get_matrix(), and get_matrix().

◆ u_screen

ustring OSLRenderServices::u_screen
static

Definition at line 302 of file services.h.

Referenced by get_inverse_matrix(), get_inverse_matrix(), get_matrix(), and get_matrix().

◆ u_trace

ustring OSLRenderServices::u_trace
static

Definition at line 345 of file services.h.

Referenced by getmessage().

◆ u_u

ustring OSLRenderServices::u_u
static

Definition at line 352 of file services.h.

Referenced by getmessage().

◆ u_v

ustring OSLRenderServices::u_v
static

Definition at line 353 of file services.h.

Referenced by getmessage().

◆ u_world

ustring OSLRenderServices::u_world
static

Definition at line 300 of file services.h.

Referenced by get_inverse_matrix(), and get_matrix().


The documentation for this class was generated from the following files: