20# include <OSL/llvm_util.h>
21# include <OSL/oslcomp.h>
22# include <OSL/oslexec.h>
23# include <OSL/oslquery.h>
45 OSLShaderInfo() =
default;
48 bool has_surface_emission =
false;
49 bool has_surface_transparent =
false;
50 bool has_surface_bssrdf =
false;
68 const bool reload_kernels);
73 static bool osl_compile(
const string &inputfile,
const string &outputfile);
74 static bool osl_query(OSL::OSLQuery &query,
const string &filepath);
77 const char *shader_test_loaded(
const string &
hash);
78 const char *shader_load_bytecode(
const string &
hash,
const string &bytecode);
79 const char *shader_load_filepath(
string filepath);
80 OSLShaderInfo *shader_loaded_info(
const string &
hash);
84 OSL::ShadingSystem *get_shading_system(
Device *sub_device);
85 OSL::TextureSystem *get_texture_system();
86 static void foreach_osl_device(
Device *device,
87 const std::function<
void(
Device *, OSLGlobals *)> &callback);
95 void texture_system_init();
96 void texture_system_free();
98 void shading_system_free();
100 void foreach_shading_system(
const std::function<
void(OSL::ShadingSystem *)> &callback);
101 void foreach_render_services(
const std::function<
void(
OSLRenderServices *)> &callback);
104 map<string, OSLShaderInfo> loaded_shaders;
106 std::shared_ptr<OSL::TextureSystem> ts;
107 map<DeviceType, std::shared_ptr<OSL::ShadingSystem>> ss_map;
119 OSLShaderManager() =
default;
120 ~OSLShaderManager()
override =
default;
134 void device_free(Device *device, DeviceScene *dscene,
Scene *scene)
override;
137 static OSLNode *osl_node(ShaderGraph *graph,
139 const std::string &filepath,
140 const std::string &bytecode_hash =
"",
141 const std::string &bytecode =
"");
144 static void osl_image_slots(Device *device, ImageManager *image_manager, set<int> &image_slots);
201 OSL::ShadingSystem *ss;
202 OSL::ShaderGroupRef current_group;
209 static std::atomic<int> texture_shared_unique_id;
unsigned long long int uint64_t
void reset()
clear internal cached data and reset random seed
void parameter_array(const char *name, const float f[], int arraylen)
void add(ShaderNode *node, const char *name, bool isfilepath=false)
void parameter_texture(const char *name, ustring filename, ustring colorspace)
void parameter(ShaderNode *node, const char *name)
void compile(Shader *shader)
void parameter_color_array(const char *name, const array< float3 > &f)
void parameter_texture_ies(const char *name, const int svm_slot)
void parameter_point(const char *name, const float3 f)
void parameter_vector(const char *name, const float3 f)
void parameter_attribute(const char *name, ustring s)
void parameter_color(const char *name, const float3 f)
void parameter_normal(const char *name, const float3 f)
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
void device_update_pre(Device *device, Scene *scene)
static void free_memory()
void device_update_post(Device *device, Scene *scene, Progress &progress, const bool reload_kernels)
OSLManager(Device *device)
virtual void device_free(Device *device, DeviceScene *dscene, Scene *scene)=0
virtual uint64_t get_attribute_id(ustring name)
virtual void device_update_specific(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress)=0
#define CCL_NAMESPACE_END
set< ShaderNode *, ShaderNodeIDComparator > ShaderNodeSet