Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/osl.h
| Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | struct OSLShaderInfo { | ||||
| bool has_surface_transparent; | bool has_surface_transparent; | ||||
| bool has_surface_bssrdf; | bool has_surface_bssrdf; | ||||
| }; | }; | ||||
| /* Shader Manage */ | /* Shader Manage */ | ||||
| class OSLShaderManager : public ShaderManager { | class OSLShaderManager : public ShaderManager { | ||||
| public: | public: | ||||
| OSLShaderManager(); | OSLShaderManager(Device *device); | ||||
| ~OSLShaderManager(); | ~OSLShaderManager(); | ||||
| static void free_memory(); | static void free_memory(); | ||||
| void reset(Scene *scene) override; | void reset(Scene *scene) override; | ||||
| bool use_osl() override | bool use_osl() override | ||||
| { | { | ||||
| Show All 21 Lines | public: | ||||
| /* create OSL node using OSLQuery */ | /* create OSL node using OSLQuery */ | ||||
| static OSLNode *osl_node(ShaderGraph *graph, | static OSLNode *osl_node(ShaderGraph *graph, | ||||
| ShaderManager *manager, | ShaderManager *manager, | ||||
| const std::string &filepath, | const std::string &filepath, | ||||
| const std::string &bytecode_hash = "", | const std::string &bytecode_hash = "", | ||||
| const std::string &bytecode = ""); | const std::string &bytecode = ""); | ||||
| protected: | private: | ||||
| void texture_system_init(); | void texture_system_init(); | ||||
| void texture_system_free(); | void texture_system_free(); | ||||
| void shading_system_init(); | void shading_system_init(); | ||||
| void shading_system_free(); | void shading_system_free(); | ||||
| OSL::ShadingSystem *ss; | Device *device_; | ||||
| OSL::TextureSystem *ts; | |||||
| OSLRenderServices *services; | |||||
| OSL::ErrorHandler errhandler; | |||||
| map<string, OSLShaderInfo> loaded_shaders; | map<string, OSLShaderInfo> loaded_shaders; | ||||
| static OSL::TextureSystem *ts_shared; | static OSL::TextureSystem *ts_shared; | ||||
| static thread_mutex ts_shared_mutex; | static thread_mutex ts_shared_mutex; | ||||
| static int ts_shared_users; | static int ts_shared_users; | ||||
| static OSL::ShadingSystem *ss_shared; | static OSL::ErrorHandler errhandler; | ||||
| static OSLRenderServices *services_shared; | static map<int, OSL::ShadingSystem *> ss_shared; | ||||
| static thread_mutex ss_shared_mutex; | static thread_mutex ss_shared_mutex; | ||||
| static thread_mutex ss_mutex; | static thread_mutex ss_mutex; | ||||
| static int ss_shared_users; | static int ss_shared_users; | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| /* Graph Compiler */ | /* Graph Compiler */ | ||||
| class OSLCompiler { | class OSLCompiler { | ||||
| public: | public: | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| OSLCompiler(OSLShaderManager *manager, | OSLCompiler(OSLShaderManager *manager, OSL::ShadingSystem *shadingsys, Scene *scene); | ||||
| OSLRenderServices *services, | |||||
| OSL::ShadingSystem *shadingsys, | |||||
| Scene *scene); | |||||
| #endif | #endif | ||||
| void compile(OSLGlobals *og, Shader *shader); | void compile(OSLGlobals *og, Shader *shader); | ||||
| void add(ShaderNode *node, const char *name, bool isfilepath = false); | void add(ShaderNode *node, const char *name, bool isfilepath = false); | ||||
| void parameter(ShaderNode *node, const char *name); | void parameter(ShaderNode *node, const char *name); | ||||
| void parameter(const char *name, float f); | void parameter(const char *name, float f); | ||||
| ▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines | |||||