Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/render/osl.cpp')
-rw-r--r--intern/cycles/render/osl.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 1f0a243e6c1..06d832a29ca 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -20,10 +20,10 @@
#include "render/colorspace.h"
#include "render/graph.h"
#include "render/light.h"
+#include "render/nodes.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
-#include "render/nodes.h"
#ifdef WITH_OSL
@@ -102,8 +102,8 @@ void OSLShaderManager::device_update(Device *device,
device_free(device, dscene, scene);
- /* determine which shaders are in use */
- device_update_shaders_used(scene);
+ /* set texture system */
+ scene->image_manager->set_osl_texture_system((void *)ts);
/* create shaders */
OSLGlobals *og = (OSLGlobals *)device->osl_memory();
@@ -142,9 +142,6 @@ void OSLShaderManager::device_update(Device *device,
need_update = false;
- /* set texture system */
- scene->image_manager->set_osl_texture_system((void *)ts);
-
/* add special builtin texture types */
services->textures.insert(ustring("@ao"), new OSLTextureHandle(OSLTextureHandle::AO));
services->textures.insert(ustring("@bevel"), new OSLTextureHandle(OSLTextureHandle::BEVEL));
@@ -319,7 +316,7 @@ bool OSLShaderManager::osl_compile(const string &inputfile, const string &output
string include_path_arg = string("-I") + shader_path;
options.push_back(include_path_arg);
- stdosl_path = path_get("shader/stdosl.h");
+ stdosl_path = path_get("shader/stdcycles.h");
/* compile */
OSL::OSLCompiler *compiler = new OSL::OSLCompiler(&OSL::ErrorHandler::default_handler());
@@ -440,27 +437,35 @@ const char *OSLShaderManager::shader_load_bytecode(const string &hash, const str
return loaded_shaders.find(hash)->first.c_str();
}
-OSLNode *OSLShaderManager::osl_node(const std::string &filepath,
+/* This is a static function to avoid RTTI link errors with only this
+ * file being compiled without RTTI to match OSL and LLVM libraries. */
+OSLNode *OSLShaderManager::osl_node(ShaderManager *manager,
+ const std::string &filepath,
const std::string &bytecode_hash,
const std::string &bytecode)
{
+ if (!manager->use_osl()) {
+ return NULL;
+ }
+
/* create query */
+ OSLShaderManager *osl_manager = static_cast<OSLShaderManager *>(manager);
const char *hash;
if (!filepath.empty()) {
- hash = shader_load_filepath(filepath);
+ hash = osl_manager->shader_load_filepath(filepath);
}
else {
- hash = shader_test_loaded(bytecode_hash);
+ hash = osl_manager->shader_test_loaded(bytecode_hash);
if (!hash)
- hash = shader_load_bytecode(bytecode_hash, bytecode);
+ hash = osl_manager->shader_load_bytecode(bytecode_hash, bytecode);
}
if (!hash) {
return NULL;
}
- OSLShaderInfo *info = shader_loaded_info(hash);
+ OSLShaderInfo *info = osl_manager->shader_loaded_info(hash);
/* count number of inputs */
size_t num_inputs = 0;
@@ -755,16 +760,14 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
else if (current_type == SHADER_TYPE_VOLUME) {
if (node->has_spatial_varying())
current_shader->has_volume_spatial_varying = true;
+ if (node->has_attribute_dependency())
+ current_shader->has_volume_attribute_dependency = true;
}
if (node->has_object_dependency()) {
current_shader->has_object_dependency = true;
}
- if (node->has_attribute_dependency()) {
- current_shader->has_attribute_dependency = true;
- }
-
if (node->has_integrator_dependency()) {
current_shader->has_integrator_dependency = true;
}
@@ -1138,8 +1141,8 @@ void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
shader->has_displacement = false;
shader->has_surface_spatial_varying = false;
shader->has_volume_spatial_varying = false;
+ shader->has_volume_attribute_dependency = false;
shader->has_object_dependency = false;
- shader->has_attribute_dependency = false;
shader->has_integrator_dependency = false;
/* generate surface shader */