diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-28 17:05:21 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-28 17:05:21 +0400 |
commit | 54b197695859f351f2116c40354f92a24baeb4e6 (patch) | |
tree | eca94040cb464c4d7c8699f60d443b345a9b7abe /intern/cycles/kernel/osl | |
parent | 0d7dbbb6e1fc0bb85d236ca1e04ff966f4ad39c9 (diff) |
Fix #35896: cycles crash with OSL image textures and viewport + preview render
running at the same time.
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index fd3f349286b..e1e43b117e7 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -104,9 +104,10 @@ OSLRenderServices::~OSLRenderServices() { } -void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_) +void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_, OSL::TextureSystem *osl_ts_) { kernel_globals = kernel_globals_; + osl_ts = osl_ts_; } bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) @@ -767,7 +768,7 @@ bool OSLRenderServices::texture(ustring filename, TextureOpt &options, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->texture(filename, options, s, t, dsdx, dtdx, dsdy, dtdy, result); if(!status) { @@ -789,7 +790,7 @@ bool OSLRenderServices::texture3d(ustring filename, TextureOpt &options, const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &dPdz, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->texture3d(filename, options, P, dPdx, dPdy, dPdz, result); if(!status) { @@ -811,7 +812,7 @@ bool OSLRenderServices::environment(ustring filename, TextureOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &R, const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->environment(filename, options, R, dRdx, dRdy, result); if(!status) { @@ -832,7 +833,7 @@ bool OSLRenderServices::get_texture_info(ustring filename, int subimage, ustring dataname, TypeDesc datatype, void *data) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; return ts->get_texture_info(filename, subimage, dataname, datatype, data); } diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 5043852846d..ca18c85a167 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -45,7 +45,7 @@ public: OSLRenderServices(); ~OSLRenderServices(); - void thread_init(KernelGlobals *kernel_globals); + void thread_init(KernelGlobals *kernel_globals, OSL::TextureSystem *ts); bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time); bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time); @@ -148,6 +148,7 @@ public: private: KernelGlobals *kernel_globals; + OSL::TextureSystem *osl_ts; }; CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index ddde199663a..0b0c8ab2e3c 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -47,7 +47,7 @@ void OSLShader::thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OS /* per thread kernel data init*/ kg->osl = osl_globals; - kg->osl->services->thread_init(kernel_globals); + kg->osl->services->thread_init(kernel_globals, osl_globals->ts); OSL::ShadingSystem *ss = kg->osl->ss; OSLThreadData *tdata = new OSLThreadData(); |