2 * Copyright 2011, Blender Foundation.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #include "osl_globals.h"
30 #include "osl_services.h"
31 #include "osl_shader.h"
33 #include "util_foreach.h"
35 #include "util_path.h"
36 #include "util_progress.h"
44 /* Shared Texture and Shading System */
46 OSL::TextureSystem *OSLShaderManager::ts_shared = NULL;
47 int OSLShaderManager::ts_shared_users = 0;
48 thread_mutex OSLShaderManager::ts_shared_mutex;
50 OSL::ShadingSystem *OSLShaderManager::ss_shared = NULL;
51 OSLRenderServices *OSLShaderManager::services_shared = NULL;
52 int OSLShaderManager::ss_shared_users = 0;
53 thread_mutex OSLShaderManager::ss_shared_mutex;
54 thread_mutex OSLShaderManager::ss_mutex;
58 OSLShaderManager::OSLShaderManager()
60 texture_system_init();
61 shading_system_init();
64 OSLShaderManager::~OSLShaderManager()
66 shading_system_free();
67 texture_system_free();
70 void OSLShaderManager::reset(Scene *scene)
72 shading_system_free();
73 shading_system_init();
76 void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
81 device_free(device, dscene, scene);
83 /* determine which shaders are in use */
84 device_update_shaders_used(scene);
87 OSLGlobals *og = (OSLGlobals*)device->osl_memory();
89 foreach(Shader *shader, scene->shaders) {
90 assert(shader->graph);
92 if(progress.get_cancel()) return;
94 /* we can only compile one shader at the time as the OSL ShadingSytem
95 * has a single state, but we put the lock here so different renders can
96 * compile shaders alternating */
97 thread_scoped_lock lock(ss_mutex);
99 OSLCompiler compiler((void*)this, (void*)ss, scene->image_manager);
100 compiler.background = (shader == scene->shaders[scene->default_background]);
101 compiler.compile(og, shader);
103 if(shader->use_mis && shader->has_surface_emission)
104 scene->light_manager->need_update = true;
107 /* setup shader engine */
110 og->services = services;
112 int background_id = scene->shader_manager->get_shader_id(scene->default_background);
113 og->background_state = og->surface_state[background_id & SHADER_MASK];
116 foreach(Shader *shader, scene->shaders)
117 shader->need_update = false;
121 /* set texture system */
122 scene->image_manager->set_osl_texture_system((void*)ts);
124 device_update_common(device, dscene, scene, progress);
128 thread_scoped_lock lock(ss_shared_mutex);
129 ss->optimize_all_groups();
133 void OSLShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *scene)
135 OSLGlobals *og = (OSLGlobals*)device->osl_memory();
137 device_free_common(device, dscene, scene);
139 /* clear shader engine */
144 og->surface_state.clear();
145 og->volume_state.clear();
146 og->displacement_state.clear();
147 og->background_state.reset();
150 void OSLShaderManager::texture_system_init()
152 /* create texture system, shared between different renders to reduce memory usage */
153 thread_scoped_lock lock(ts_shared_mutex);
155 if(ts_shared_users == 0) {
156 ts_shared = TextureSystem::create(true);
158 ts_shared->attribute("automip", 1);
159 ts_shared->attribute("autotile", 64);
160 ts_shared->attribute("gray_to_rgb", 1);
162 /* effectively unlimited for now, until we support proper mipmap lookups */
163 ts_shared->attribute("max_memory_MB", 16384);
170 void OSLShaderManager::texture_system_free()
172 /* shared texture system decrease users and destroy if no longer used */
173 thread_scoped_lock lock(ts_shared_mutex);
176 if(ts_shared_users == 0) {
177 OSL::TextureSystem::destroy(ts_shared);
184 void OSLShaderManager::shading_system_init()
186 /* create shading system, shared between different renders to reduce memory usage */
187 thread_scoped_lock lock(ss_shared_mutex);
189 if(ss_shared_users == 0) {
190 services_shared = new OSLRenderServices();
192 ss_shared = OSL::ShadingSystem::create(services_shared, ts_shared, &errhandler);
193 ss_shared->attribute("lockgeom", 1);
194 ss_shared->attribute("commonspace", "world");
195 ss_shared->attribute("searchpath:shader", path_get("shader"));
196 //ss_shared->attribute("greedyjit", 1);
198 /* our own ray types */
199 static const char *raytypes[] = {
200 "camera", /* PATH_RAY_CAMERA */
201 "reflection", /* PATH_RAY_REFLECT */
202 "refraction", /* PATH_RAY_TRANSMIT */
203 "diffuse", /* PATH_RAY_DIFFUSE */
204 "glossy", /* PATH_RAY_GLOSSY */
205 "singular", /* PATH_RAY_SINGULAR */
206 "transparent", /* PATH_RAY_TRANSPARENT */
207 "shadow", /* PATH_RAY_SHADOW_OPAQUE */
208 "shadow", /* PATH_RAY_SHADOW_TRANSPARENT */
212 "diffuse_ancestor", /* PATH_RAY_DIFFUSE_ANCESTOR */
213 "glossy_ancestor", /* PATH_RAY_GLOSSY_ANCESTOR */
216 const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]);
217 ss_shared->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
219 OSLShader::register_closures((OSLShadingSystem*)ss_shared);
221 loaded_shaders.clear();
225 services = services_shared;
229 void OSLShaderManager::shading_system_free()
231 /* shared shading system decrease users and destroy if no longer used */
232 thread_scoped_lock lock(ss_shared_mutex);
235 if(ss_shared_users == 0) {
236 OSL::ShadingSystem::destroy(ss_shared);
239 delete services_shared;
240 services_shared = NULL;
247 bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile)
249 vector<string> options;
252 /* specify output file name */
253 options.push_back("-o");
254 options.push_back(outputfile);
256 /* specify standard include path */
257 options.push_back("-I" + path_get("shader"));
258 stdosl_path = path_get("shader/stdosl.h");
261 OSL::OSLCompiler *compiler = OSL::OSLCompiler::create();
262 bool ok = compiler->compile(inputfile, options, stdosl_path);
268 bool OSLShaderManager::osl_query(OSL::OSLQuery& query, const string& filepath)
270 string searchpath = path_user_get("shaders");
271 return query.open(filepath, searchpath);
274 static string shader_filepath_hash(const string& filepath, uint64_t modified_time)
276 /* compute a hash from filepath and modified time to detect changes */
278 md5.append((const uint8_t*)filepath.c_str(), filepath.size());
279 md5.append((const uint8_t*)&modified_time, sizeof(modified_time));
281 return md5.get_hex();
284 const char *OSLShaderManager::shader_test_loaded(const string& hash)
286 map<string, OSLShaderInfo>::iterator it = loaded_shaders.find(hash);
287 return (it == loaded_shaders.end())? NULL: it->first.c_str();
290 OSLShaderInfo *OSLShaderManager::shader_loaded_info(const string& hash)
292 map<string, OSLShaderInfo>::iterator it = loaded_shaders.find(hash);
293 return (it == loaded_shaders.end())? NULL: &it->second;
296 const char *OSLShaderManager::shader_load_filepath(string filepath)
298 size_t len = filepath.size();
299 string extension = filepath.substr(len - 4);
300 uint64_t modified_time = path_modified_time(filepath);
302 if(extension == ".osl") {
304 string osopath = filepath.substr(0, len - 4) + ".oso";
305 uint64_t oso_modified_time = path_modified_time(osopath);
307 /* test if we have loaded the corresponding .OSO already */
308 if(oso_modified_time != 0) {
309 const char *hash = shader_test_loaded(shader_filepath_hash(osopath, oso_modified_time));
315 /* autocompile .OSL to .OSO if needed */
316 if(oso_modified_time == 0 || (oso_modified_time < modified_time)) {
317 OSLShaderManager::osl_compile(filepath, osopath);
318 modified_time = path_modified_time(osopath);
321 modified_time = oso_modified_time;
326 if(extension == ".oso") {
327 /* .OSO File, nothing to do */
329 else if(path_dirname(filepath) == "") {
330 /* .OSO File in search path */
331 filepath = path_join(path_user_get("shaders"), filepath + ".oso");
338 /* test if we have loaded this .OSO already */
339 const char *hash = shader_test_loaded(shader_filepath_hash(filepath, modified_time));
345 /* read oso bytecode from file */
346 string bytecode_hash = shader_filepath_hash(filepath, modified_time);
349 if(!path_read_text(filepath, bytecode)) {
350 fprintf(stderr, "Cycles shader graph: failed to read file %s\n", filepath.c_str());
352 loaded_shaders[bytecode_hash] = info; /* to avoid repeat tries */
356 return shader_load_bytecode(bytecode_hash, bytecode);
359 const char *OSLShaderManager::shader_load_bytecode(const string& hash, const string& bytecode)
361 ss->LoadMemoryCompiledShader(hash.c_str(), bytecode.c_str());
363 /* this is a bit weak, but works */
365 info.has_surface_emission = (bytecode.find("\"emission\"") != string::npos);
366 info.has_surface_transparent = (bytecode.find("\"transparent\"") != string::npos);
367 info.has_surface_bssrdf = (bytecode.find("\"bssrdf\"") != string::npos);
368 loaded_shaders[hash] = info;
370 return loaded_shaders.find(hash)->first.c_str();
375 OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, ImageManager *image_manager_)
378 shadingsys = shadingsys_;
379 image_manager = image_manager_;
380 current_type = SHADER_TYPE_SURFACE;
381 current_shader = NULL;
385 string OSLCompiler::id(ShaderNode *node)
387 /* assign layer unique name based on pointer address + bump mode */
389 stream << "node_" << node->name << "_" << node;
394 string OSLCompiler::compatible_name(ShaderNode *node, ShaderInput *input)
396 string sname(input->name);
399 /* strip whitespace */
400 while((i = sname.find(" ")) != string::npos)
401 sname.replace(i, 1, "");
403 /* if output exists with the same name, add "In" suffix */
404 foreach(ShaderOutput *output, node->outputs) {
405 if (strcmp(input->name, output->name)==0) {
414 string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
416 string sname(output->name);
419 /* strip whitespace */
420 while((i = sname.find(" ")) != string::npos)
421 sname.replace(i, 1, "");
423 /* if input exists with the same name, add "Out" suffix */
424 foreach(ShaderInput *input, node->inputs) {
425 if (strcmp(input->name, output->name)==0) {
434 bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
436 /* exception for output node, only one input is actually used
437 * depending on the current shader type */
439 if(!(input->usage & ShaderInput::USE_OSL))
442 if(node->name == ustring("output")) {
443 if(strcmp(input->name, "Surface") == 0 && current_type != SHADER_TYPE_SURFACE)
445 if(strcmp(input->name, "Volume") == 0 && current_type != SHADER_TYPE_VOLUME)
447 if(strcmp(input->name, "Displacement") == 0 && current_type != SHADER_TYPE_DISPLACEMENT)
449 if(strcmp(input->name, "Normal") == 0)
452 else if(node->name == ustring("bump")) {
453 if(strcmp(input->name, "Height") == 0)
456 else if(current_type == SHADER_TYPE_DISPLACEMENT && input->link && input->link->parent->name == ustring("bump"))
462 void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
464 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
468 name = ((OSLShaderManager*)manager)->shader_load_filepath(name);
474 /* pass in fixed parameter values */
475 foreach(ShaderInput *input, node->inputs) {
477 /* checks to untangle graphs */
478 if(node_skip_input(node, input))
480 /* already has default value assigned */
481 else if(input->default_value != ShaderInput::NONE)
484 string param_name = compatible_name(node, input);
485 switch(input->type) {
486 case SHADER_SOCKET_COLOR:
487 parameter_color(param_name.c_str(), input->value);
489 case SHADER_SOCKET_POINT:
490 parameter_point(param_name.c_str(), input->value);
492 case SHADER_SOCKET_VECTOR:
493 parameter_vector(param_name.c_str(), input->value);
495 case SHADER_SOCKET_NORMAL:
496 parameter_normal(param_name.c_str(), input->value);
498 case SHADER_SOCKET_FLOAT:
499 parameter(param_name.c_str(), input->value.x);
501 case SHADER_SOCKET_INT:
502 parameter(param_name.c_str(), (int)input->value.x);
504 case SHADER_SOCKET_STRING:
505 parameter(param_name.c_str(), input->value_string);
507 case SHADER_SOCKET_CLOSURE:
508 case SHADER_SOCKET_UNDEFINED:
514 /* create shader of the appropriate type. we pass "surface" to all shaders,
515 * because "volume" and "displacement" don't work yet in OSL. the shaders
516 * work fine, but presumably these values would be used for more strict
517 * checking, so when that is fixed, we should update the code here too. */
518 if(current_type == SHADER_TYPE_SURFACE)
519 ss->Shader("surface", name, id(node).c_str());
520 else if(current_type == SHADER_TYPE_VOLUME)
521 ss->Shader("surface", name, id(node).c_str());
522 else if(current_type == SHADER_TYPE_DISPLACEMENT)
523 ss->Shader("surface", name, id(node).c_str());
527 /* link inputs to other nodes */
528 foreach(ShaderInput *input, node->inputs) {
530 if(node_skip_input(node, input))
533 /* connect shaders */
534 string id_from = id(input->link->parent);
535 string id_to = id(node);
536 string param_from = compatible_name(input->link->parent, input->link);
537 string param_to = compatible_name(node, input);
539 ss->ConnectShaders(id_from.c_str(), param_from.c_str(), id_to.c_str(), param_to.c_str());
543 /* test if we shader contains specific closures */
544 OSLShaderInfo *info = ((OSLShaderManager*)manager)->shader_loaded_info(name);
547 if(info->has_surface_emission)
548 current_shader->has_surface_emission = true;
549 if(info->has_surface_transparent)
550 current_shader->has_surface_transparent = true;
551 if(info->has_surface_bssrdf) {
552 current_shader->has_surface_bssrdf = true;
553 current_shader->has_bssrdf_bump = true; /* can't detect yet */
558 void OSLCompiler::parameter(const char *name, float f)
560 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
561 ss->Parameter(name, TypeDesc::TypeFloat, &f);
564 void OSLCompiler::parameter_color(const char *name, float3 f)
566 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
567 ss->Parameter(name, TypeDesc::TypeColor, &f);
570 void OSLCompiler::parameter_point(const char *name, float3 f)
572 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
573 ss->Parameter(name, TypeDesc::TypePoint, &f);
576 void OSLCompiler::parameter_normal(const char *name, float3 f)
578 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
579 ss->Parameter(name, TypeDesc::TypeNormal, &f);
582 void OSLCompiler::parameter_vector(const char *name, float3 f)
584 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
585 ss->Parameter(name, TypeDesc::TypeVector, &f);
588 void OSLCompiler::parameter(const char *name, int f)
590 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
591 ss->Parameter(name, TypeDesc::TypeInt, &f);
594 void OSLCompiler::parameter(const char *name, const char *s)
596 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
597 ss->Parameter(name, TypeDesc::TypeString, &s);
600 void OSLCompiler::parameter(const char *name, ustring s)
602 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
603 const char *str = s.c_str();
604 ss->Parameter(name, TypeDesc::TypeString, &str);
607 void OSLCompiler::parameter(const char *name, const Transform& tfm)
609 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
610 ss->Parameter(name, TypeDesc::TypeMatrix, (float*)&tfm);
613 void OSLCompiler::parameter_array(const char *name, const float f[], int arraylen)
615 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
616 TypeDesc type = TypeDesc::TypeFloat;
617 type.arraylen = arraylen;
618 ss->Parameter(name, type, f);
621 void OSLCompiler::parameter_color_array(const char *name, const float f[][3], int arraylen)
623 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
624 TypeDesc type = TypeDesc::TypeColor;
625 type.arraylen = arraylen;
626 ss->Parameter(name, type, f);
629 void OSLCompiler::parameter_vector_array(const char *name, const float f[][3], int arraylen)
631 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
632 TypeDesc type = TypeDesc::TypeVector;
633 type.arraylen = arraylen;
634 ss->Parameter(name, type, f);
637 void OSLCompiler::parameter_normal_array(const char *name, const float f[][3], int arraylen)
639 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
640 TypeDesc type = TypeDesc::TypeNormal;
641 type.arraylen = arraylen;
642 ss->Parameter(name, type, f);
645 void OSLCompiler::parameter_point_array(const char *name, const float f[][3], int arraylen)
647 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
648 TypeDesc type = TypeDesc::TypePoint;
649 type.arraylen = arraylen;
650 ss->Parameter(name, type, f);
653 void OSLCompiler::parameter_array(const char *name, const int f[], int arraylen)
655 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
656 TypeDesc type = TypeDesc::TypeInt;
657 type.arraylen = arraylen;
658 ss->Parameter(name, type, f);
661 void OSLCompiler::parameter_array(const char *name, const char * const s[], int arraylen)
663 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
664 TypeDesc type = TypeDesc::TypeString;
665 type.arraylen = arraylen;
666 ss->Parameter(name, type, s);
669 void OSLCompiler::parameter_array(const char *name, const Transform tfm[], int arraylen)
671 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
672 TypeDesc type = TypeDesc::TypeMatrix;
673 type.arraylen = arraylen;
674 ss->Parameter(name, type, (const float *)tfm);
677 void OSLCompiler::find_dependencies(set<ShaderNode*>& dependencies, ShaderInput *input)
679 ShaderNode *node = (input->link)? input->link->parent: NULL;
682 foreach(ShaderInput *in, node->inputs)
683 if(!node_skip_input(node, in))
684 find_dependencies(dependencies, in);
686 dependencies.insert(node);
690 void OSLCompiler::generate_nodes(const set<ShaderNode*>& nodes)
692 set<ShaderNode*> done;
698 foreach(ShaderNode *node, nodes) {
699 if(done.find(node) == done.end()) {
700 bool inputs_done = true;
702 foreach(ShaderInput *input, node->inputs)
703 if(!node_skip_input(node, input))
704 if(input->link && done.find(input->link->parent) == done.end())
708 node->compile(*this);
711 if(node->has_surface_emission())
712 current_shader->has_surface_emission = true;
713 if(node->has_surface_transparent())
714 current_shader->has_surface_transparent = true;
715 if(node->has_surface_bssrdf()) {
716 current_shader->has_surface_bssrdf = true;
717 if(node->has_bssrdf_bump())
718 current_shader->has_bssrdf_bump = true;
725 } while(!nodes_done);
728 void OSLCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType type)
730 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
734 ss->ShaderGroupBegin(shader->name.c_str());
736 ShaderNode *output = graph->output();
737 set<ShaderNode*> dependencies;
739 if(type == SHADER_TYPE_SURFACE) {
740 /* generate surface shader */
741 find_dependencies(dependencies, output->input("Surface"));
742 generate_nodes(dependencies);
743 output->compile(*this);
745 else if(type == SHADER_TYPE_VOLUME) {
746 /* generate volume shader */
747 find_dependencies(dependencies, output->input("Volume"));
748 generate_nodes(dependencies);
749 output->compile(*this);
751 else if(type == SHADER_TYPE_DISPLACEMENT) {
752 /* generate displacement shader */
753 find_dependencies(dependencies, output->input("Displacement"));
754 generate_nodes(dependencies);
755 output->compile(*this);
760 ss->ShaderGroupEnd();
763 void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
765 if(shader->need_update) {
766 OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
767 ShaderGraph *graph = shader->graph;
768 ShaderNode *output = (graph)? graph->output(): NULL;
770 /* copy graph for shader with bump mapping */
771 if(output->input("Surface")->link && output->input("Displacement")->link)
772 if(!shader->graph_bump)
773 shader->graph_bump = shader->graph->copy();
776 shader->graph->finalize(false, true);
777 if(shader->graph_bump)
778 shader->graph_bump->finalize(true, true);
780 current_shader = shader;
782 shader->has_surface = false;
783 shader->has_surface_emission = false;
784 shader->has_surface_transparent = false;
785 shader->has_surface_bssrdf = false;
786 shader->has_bssrdf_bump = false;
787 shader->has_volume = false;
788 shader->has_displacement = false;
790 /* generate surface shader */
791 if(shader->used && graph && output->input("Surface")->link) {
792 compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
793 shader->osl_surface_ref = ss->state();
795 if(shader->graph_bump) {
797 compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE);
798 shader->osl_surface_bump_ref = ss->state();
801 shader->osl_surface_bump_ref = shader->osl_surface_ref;
805 shader->has_surface = true;
808 shader->osl_surface_ref = OSL::ShadingAttribStateRef();
809 shader->osl_surface_bump_ref = OSL::ShadingAttribStateRef();
812 /* generate volume shader */
813 if(shader->used && graph && output->input("Volume")->link) {
814 compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
815 shader->has_volume = true;
817 shader->osl_volume_ref = ss->state();
821 shader->osl_volume_ref = OSL::ShadingAttribStateRef();
823 /* generate displacement shader */
824 if(shader->used && graph && output->input("Displacement")->link) {
825 compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
826 shader->has_displacement = true;
827 shader->osl_displacement_ref = ss->state();
831 shader->osl_displacement_ref = OSL::ShadingAttribStateRef();
834 /* push state to array for lookup */
835 og->surface_state.push_back(shader->osl_surface_ref);
836 og->surface_state.push_back(shader->osl_surface_bump_ref);
838 og->volume_state.push_back(shader->osl_volume_ref);
839 og->volume_state.push_back(shader->osl_volume_ref);
841 og->displacement_state.push_back(shader->osl_displacement_ref);
842 og->displacement_state.push_back(shader->osl_displacement_ref);
847 void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
851 void OSLCompiler::parameter(const char *name, float f)
855 void OSLCompiler::parameter_color(const char *name, float3 f)
859 void OSLCompiler::parameter_vector(const char *name, float3 f)
863 void OSLCompiler::parameter_point(const char *name, float3 f)
867 void OSLCompiler::parameter_normal(const char *name, float3 f)
871 void OSLCompiler::parameter(const char *name, int f)
875 void OSLCompiler::parameter(const char *name, const char *s)
879 void OSLCompiler::parameter(const char *name, ustring s)
883 void OSLCompiler::parameter(const char *name, const Transform& tfm)
887 void OSLCompiler::parameter_array(const char *name, const float f[], int arraylen)
891 void OSLCompiler::parameter_color_array(const char *name, const float f[][3], int arraylen)
895 void OSLCompiler::parameter_vector_array(const char *name, const float f[][3], int arraylen)
899 void OSLCompiler::parameter_normal_array(const char *name, const float f[][3], int arraylen)
903 void OSLCompiler::parameter_point_array(const char *name, const float f[][3], int arraylen)
907 void OSLCompiler::parameter_array(const char *name, const int f[], int arraylen)
911 void OSLCompiler::parameter_array(const char *name, const char * const s[], int arraylen)
915 void OSLCompiler::parameter_array(const char *name, const Transform tfm[], int arraylen)
919 #endif /* WITH_OSL */