Commit: a6ca8a1b736e098b6c909e5eb23134afb617ff1e
Author: Thomas Dinges
Date:   Sat Feb 6 00:07:20 2016 +0100
Branches: master
https://developer.blender.org/rBa6ca8a1b736e098b6c909e5eb23134afb617ff1e

Cleanup: Remove support for OSL versions < 1.6.

We can get rid of more ifdefs once all platforms are on OSL 1.7 soon.

===================================================================

M       intern/cycles/kernel/osl/osl_services.cpp
M       intern/cycles/kernel/osl/osl_services.h
M       intern/cycles/kernel/osl/osl_shader.cpp
M       intern/cycles/render/osl.cpp

===================================================================

diff --git a/intern/cycles/kernel/osl/osl_services.cpp 
b/intern/cycles/kernel/osl/osl_services.cpp
index 0595282..8f3c036 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -852,69 +852,6 @@ bool OSLRenderServices::has_userdata(ustring name, 
TypeDesc type, OSL::ShaderGlo
        return false; /* never called by OSL */
 }
 
-#if OSL_LIBRARY_VERSION_CODE < 10600
-bool OSLRenderServices::texture(ustring filename,
-                                TextureOpt &options,
-                                OSL::ShaderGlobals *sg,
-                                float s, float t,
-                                float dsdx, float dtdx,
-                                float dsdy, float dtdy,
-                                float *result)
-{
-       OSL::TextureSystem *ts = osl_ts;
-       ShaderData *sd = (ShaderData *)(sg->renderstate);
-       KernelGlobals *kg = sd->osl_globals;
-       OSLThreadData *tdata = kg->osl_tdata;
-       OIIO::TextureSystem::Perthread *texture_thread_info =
-              tdata->oiio_thread_info;
-       OIIO::TextureSystem::TextureHandle *texture_handle = NULL;
-       if(filename[0] != '@') {
-               texture_handle = ts->get_texture_handle(filename, 
texture_thread_info);
-       }
-       return texture(filename,
-                      texture_handle,
-                      texture_thread_info,
-                      options,
-                      sg,
-                      s, t,
-                      dsdx, dtdx, dsdy, dtdy,
-                      options.nchannels,
-                      result,
-                      NULL, NULL);
-}
-
-bool OSLRenderServices::texture3d(ustring filename,
-                                  TextureOpt &options,
-                                  OSL::ShaderGlobals *sg,
-                                  const OSL::Vec3 &P,
-                                  const OSL::Vec3 &dPdx,
-                                  const OSL::Vec3 &dPdy,
-                                  const OSL::Vec3 &dPdz,
-                                  float *result)
-{
-       OSL::TextureSystem *ts = osl_ts;
-       ShaderData *sd = (ShaderData *)(sg->renderstate);
-       KernelGlobals *kg = sd->osl_globals;
-       OSLThreadData *tdata = kg->osl_tdata;
-       OIIO::TextureSystem::Perthread *texture_thread_info =
-              tdata->oiio_thread_info;
-       OIIO::TextureSystem::TextureHandle *texture_handle = NULL;
-       if(filename[0] != '@') {
-               texture_handle = ts->get_texture_handle(filename, 
texture_thread_info);
-       }
-       return texture3d(filename,
-                        texture_handle,
-                        texture_thread_info,
-                        options,
-                        sg,
-                        P,
-                        dPdx, dPdy, dPdz,
-                        options.nchannels,
-                        result,
-                        NULL, NULL, NULL);
-}
-#endif  /* OSL_LIBRARY_VERSION_CODE < 10600 */
-
 bool OSLRenderServices::texture(ustring filename,
                                 TextureHandle *texture_handle,
                                 TexturePerthread *texture_thread_info,
diff --git a/intern/cycles/kernel/osl/osl_services.h 
b/intern/cycles/kernel/osl/osl_services.h
index 1d2f155..2701abb 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -93,11 +93,6 @@ public:
        bool getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
                        TypeDesc type, void *val, bool derivatives);
 
-#if OSL_LIBRARY_VERSION_CODE < 10600
-       typedef TextureSystem::TextureHandle TextureHandle;
-       typedef TextureSystem::Perthread TexturePerthread;
-#endif
-
        bool texture(ustring filename,
                     TextureSystem::TextureHandle *texture_handle,
                     TexturePerthread *texture_thread_info,
@@ -182,36 +177,6 @@ public:
        static ustring u_v;
        static ustring u_empty;
 
-       /* Code to make OSL versions transition smooth. */
-
-#if OSL_LIBRARY_VERSION_CODE < 10600
-       bool texture(ustring filename,
-                    TextureOpt &options,
-                    OSL::ShaderGlobals *sg,
-                    float s, float t,
-                    float dsdx, float dtdx,
-                    float dsdy, float dtdy,
-                    float *result);
-
-       bool texture3d(ustring filename,
-                      TextureOpt &options,
-                      OSL::ShaderGlobals *sg,
-                      const OSL::Vec3 &P,
-                      const OSL::Vec3 &dPdx,
-                      const OSL::Vec3 &dPdy,
-                      const OSL::Vec3 &dPdz,
-                      float *result);
-
-       inline bool environment(ustring filename, TextureOpt &options,
-                               OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
-                               const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy,
-                               float *result)
-       {
-               return environment(filename, options, sg, R, dRdx, dRdy,
-                                  options.nchannels, result);
-       }
-#endif
-
 private:
        KernelGlobals *kernel_globals;
        OSL::TextureSystem *osl_ts;
diff --git a/intern/cycles/kernel/osl/osl_shader.cpp 
b/intern/cycles/kernel/osl/osl_shader.cpp
index 8acc042..361a885 100644
--- a/intern/cycles/kernel/osl/osl_shader.cpp
+++ b/intern/cycles/kernel/osl/osl_shader.cpp
@@ -339,11 +339,7 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData 
*sd, PathState *state
        int shader = sd->shader & SHADER_MASK;
 
        if(kg->osl->surface_state[shader]) {
-#if OSL_LIBRARY_VERSION_CODE < 10600
-               ss->execute(*octx, *(kg->osl->surface_state[shader]), *globals);
-#else
                ss->execute(octx, *(kg->osl->surface_state[shader]), *globals);
-#endif
        }
 
        /* flatten closure tree */
@@ -403,11 +399,7 @@ float3 OSLShader::eval_background(KernelGlobals *kg, 
ShaderData *sd, PathState *
        OSL::ShadingContext *octx = tdata->context[(int)ctx];
 
        if(kg->osl->background_state) {
-#if OSL_LIBRARY_VERSION_CODE < 10600
-               ss->execute(*octx, *(kg->osl->background_state), *globals);
-#else
                ss->execute(octx, *(kg->osl->background_state), *globals);
-#endif
        }
 
        /* return background color immediately */
@@ -518,11 +510,7 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData 
*sd, PathState *state,
        int shader = sd->shader & SHADER_MASK;
 
        if(kg->osl->volume_state[shader]) {
-#if OSL_LIBRARY_VERSION_CODE < 10600
-               ss->execute(*octx, *(kg->osl->volume_state[shader]), *globals);
-#else
                ss->execute(octx, *(kg->osl->volume_state[shader]), *globals);
-#endif
        }
        
        /* flatten closure tree */
@@ -548,11 +536,7 @@ void OSLShader::eval_displacement(KernelGlobals *kg, 
ShaderData *sd, ShaderConte
        int shader = sd->shader & SHADER_MASK;
 
        if(kg->osl->displacement_state[shader]) {
-#if OSL_LIBRARY_VERSION_CODE < 10600
-               ss->execute(*octx, *(kg->osl->displacement_state[shader]), 
*globals);
-#else
                ss->execute(octx, *(kg->osl->displacement_state[shader]), 
*globals);
-#endif
        }
 
        /* get back position */
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 67b07f1..78b06a8 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -264,11 +264,7 @@ void OSLShaderManager::shading_system_free()
 
 bool OSLShaderManager::osl_compile(const string& inputfile, const string& 
outputfile)
 {
-#if OSL_LIBRARY_VERSION_CODE < 10602
-       vector<string_view> options;
-#else
        vector<string> options;
-#endif
        string stdosl_path;
        string shader_path = path_get("shader");
 
@@ -283,11 +279,7 @@ bool OSLShaderManager::osl_compile(const string& 
inputfile, const string& output
        stdosl_path = path_get("shader/stdosl.h");
 
        /* compile */
-#if OSL_LIBRARY_VERSION_CODE >= 10602
        OSL::OSLCompiler *compiler = new 
OSL::OSLCompiler(&OSL::ErrorHandler::default_handler());
-#else
-       OSL::OSLCompiler *compiler = new OSL::OSLCompiler();
-#endif
        bool ok = compiler->compile(string_view(inputfile), options, 
string_view(stdosl_path));
        delete compiler;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to