Cycles: Remove some ifdefs for OSL < 1.7.1.
authorThomas Dinges <blender@dingto.org>
Thu, 11 Feb 2016 12:57:39 +0000 (13:57 +0100)
committerThomas Dinges <blender@dingto.org>
Thu, 11 Feb 2016 12:58:50 +0000 (13:58 +0100)
That means that we now only support OSL 1.7.1 or newer. Please update libs or re-run install-depsh.sh.

intern/cycles/blender/blender_shader.cpp
intern/cycles/kernel/osl/osl_closures.h
intern/cycles/kernel/osl/osl_shader.cpp
intern/cycles/render/nodes.cpp

index c9a7f2756b713b76449e52cf4d0218bc1561f458..b82e7dd47b77fd71cec081571c0cbd0519c0791b 100644 (file)
@@ -114,9 +114,6 @@ static ShaderSocketType convert_osl_socket_type(OSL::OSLQuery& query,
                                                 BL::NodeSocket& b_socket)
 {
        ShaderSocketType socket_type = convert_socket_type(b_socket);
-#if OSL_LIBRARY_VERSION_CODE < 10701
-       (void) query;
-#else
        if(socket_type == SHADER_SOCKET_VECTOR) {
                /* TODO(sergey): Do we need compatible_name() here? */
                const OSL::OSLQuery::Parameter *param = query.getparam(b_socket.name());
@@ -130,7 +127,7 @@ static ShaderSocketType convert_osl_socket_type(OSL::OSLQuery& query,
                        }
                }
        }
-#endif
+
        return socket_type;
 }
 #endif  /* WITH_OSL */
@@ -561,7 +558,7 @@ static ShaderNode *add_node(Scene *scene,
                         * input/output type info needed for proper node construction.
                         */
                        OSL::OSLQuery query;
-#if OSL_LIBRARY_VERSION_CODE >= 10701
+
                        if(!bytecode_hash.empty()) {
                                query.open_bytecode(b_script_node.bytecode());
                        }
@@ -569,7 +566,6 @@ static ShaderNode *add_node(Scene *scene,
                                !OSLShaderManager::osl_query(query, b_script_node.filepath());
                        }
                        /* TODO(sergey): Add proper query info error parsing. */
-#endif
 
                        /* Generate inputs/outputs from node sockets
                         *
index 526c03557f7063256faa2cac82739a92e86be496..1578d06cd56c82c32aff881a4896389ce847d5dc 100644 (file)
@@ -80,11 +80,6 @@ void name(RendererServices *, int id, void *data) \
 #define TO_COLOR3(v) OSL::Color3(v.x, v.y, v.z)
 #define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
 
-#if OSL_LIBRARY_VERSION_CODE < 10700
-#  undef CLOSURE_STRING_KEYPARAM
-#  define CLOSURE_STRING_KEYPARAM(st, fld, key) { TypeDesc::TypeString, 0, key, 0 }
-#endif
-
 /* Closure */
 
 class CClosurePrimitive {
@@ -105,9 +100,7 @@ public:
 
        Category category;
 
-#if OSL_LIBRARY_VERSION_CODE >= 10700
        OSL::ustring label;
-#endif
 };
 
 /* BSDF */
index 361a88548bdaa477f973f66fd9167b97fa75471c..f58368e6789b7df7ad44804a88b02822207745f0 100644 (file)
@@ -147,11 +147,7 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag,
        /* OSL gives us a closure tree, we flatten it into arrays per
         * closure type, for evaluation, sampling, etc later on. */
 
-#if OSL_LIBRARY_VERSION_CODE < 10700
-       switch(closure->type) {
-#else
        switch(closure->id) {
-#endif
                case OSL::ClosureColor::MUL: {
                        OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
                        flatten_surface_closure_tree(sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
@@ -355,11 +351,7 @@ static float3 flatten_background_closure_tree(const OSL::ClosureColor *closure)
         * is only one supported closure type at the moment, which has no evaluation
         * functions, so we just sum the weights */
 
-#if OSL_LIBRARY_VERSION_CODE < 10700
-       switch(closure->type) {
-#else
        switch(closure->id) {
-#endif
                case OSL::ClosureColor::MUL: {
                        OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
 
@@ -417,11 +409,7 @@ static void flatten_volume_closure_tree(ShaderData *sd,
        /* OSL gives us a closure tree, we flatten it into arrays per
         * closure type, for evaluation, sampling, etc later on. */
 
-#if OSL_LIBRARY_VERSION_CODE < 10700
-       switch(closure->type) {
-#else
        switch(closure->id) {
-#endif
                case OSL::ClosureColor::MUL: {
                        OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
                        flatten_volume_closure_tree(sd, mul->closure, TO_FLOAT3(mul->weight) * weight);
index c7b2087cf78397d26ba87babdb3ff5a9336da3ef..cb585377f9748048dbdf2a020ffd5948c14b8274 100644 (file)
@@ -4599,28 +4599,6 @@ void OSLScriptNode::compile(SVMCompiler& /*compiler*/)
 
 void OSLScriptNode::compile(OSLCompiler& compiler)
 {
-#if defined(WITH_OSL) && (OSL_LIBRARY_VERSION_CODE < 10701)
-       /* XXX fix for #36790:
-        * point and normal parameters are reflected as generic SOCK_VECTOR sockets
-        * on the node. Socket fixed input values need to be copied explicitly here for
-        * vector sockets, otherwise OSL will reject the value due to mismatching type.
-        */
-       foreach(ShaderInput *input, this->inputs) {
-               if(!input->link) {
-                       /* no need for compatible_name here, OSL parameter names are always unique */
-                       string param_name(input->name);
-                       switch(input->type) {
-                               case SHADER_SOCKET_VECTOR:
-                                       compiler.parameter_point(param_name.c_str(), input->value);
-                                       compiler.parameter_normal(param_name.c_str(), input->value);
-                                       break;
-                               default:
-                                       break;
-                       }
-               }
-       }
-#endif
-
        if(!filepath.empty())
                compiler.add(this, filepath.c_str(), true);
        else