Fix for Cycles OSL: The RenderServices pointer in ShadingSystem is no longer accessible from the interface class (presumably because it is just the base class pointer anyway and would have to be casted). The OSLRenderServices pointer to our own implementation is now stored alongside the ShadingSystem in the kernel globals, so it can be accessed in thread_init.

This commit is contained in:
Lukas Toenne
2012-09-03 18:51:02 +00:00
parent 9b30e8d83a
commit f8c29c999f
3 changed files with 5 additions and 3 deletions

View File

@@ -30,12 +30,15 @@
CCL_NAMESPACE_BEGIN
class OSLRenderServices;
struct OSLGlobals {
/* use */
bool use;
/* shading system */
OSL::ShadingSystem *ss;
OSLRenderServices *services;
/* shader states */
vector<OSL::ShadingAttribStateRef> surface_state;

View File

@@ -45,9 +45,7 @@ void OSLShader::thread_init(KernelGlobals *kg)
tls_set(kg->osl.thread_data, tdata);
//((OSLRenderServices *)ssi->renderer())->thread_init(kg);
/* XXX not sure here - dingto */
thread_init(kg);
kg->osl.services->thread_init(kg);
}
void OSLShader::thread_free(KernelGlobals *kg)

View File

@@ -101,6 +101,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
/* setup shader engine */
og->ss = ss;
og->services = services;
int background_id = scene->shader_manager->get_shader_id(scene->default_background);
og->background_state = og->surface_state[background_id & SHADER_MASK];
og->use = true;