[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [61622] trunk/lib/windows_vc12/osl: MSVC 2013 windows x32 (vc120_xp, windows XP compatible) OSL 1.7.1

Martijn Berger martijn.berger at gmail.com
Tue Feb 9 16:45:19 CET 2016


Revision: 61622
          https://developer.blender.org/rBL61622
Author:   juicyfruit
Date:     2016-02-09 15:45:13 +0000 (Tue, 09 Feb 2016)
Log Message:
-----------
MSVC 2013 windows x32 (vc120_xp, windows XP compatible)  OSL 1.7.1

Modified Paths:
--------------
    trunk/lib/windows_vc12/osl/build.bat
    trunk/lib/windows_vc12/osl/flex_bison/bin/data/c.m4
    trunk/lib/windows_vc12/osl/flex_bison/bin/win_bison.exe
    trunk/lib/windows_vc12/osl/flex_bison/bin/win_flex.exe
    trunk/lib/windows_vc12/osl/include/OSL/genclosure.h
    trunk/lib/windows_vc12/osl/include/OSL/llvm_util.h
    trunk/lib/windows_vc12/osl/include/OSL/oslclosure.h
    trunk/lib/windows_vc12/osl/include/OSL/oslcomp.h
    trunk/lib/windows_vc12/osl/include/OSL/oslconfig.h
    trunk/lib/windows_vc12/osl/include/OSL/oslexec.h
    trunk/lib/windows_vc12/osl/include/OSL/oslquery.h
    trunk/lib/windows_vc12/osl/include/OSL/oslversion.h
    trunk/lib/windows_vc12/osl/include/OSL/rendererservices.h
    trunk/lib/windows_vc12/osl/lib/libtestshade.lib
    trunk/lib/windows_vc12/osl/lib/libtestshade_d.lib
    trunk/lib/windows_vc12/osl/lib/oslcomp.lib
    trunk/lib/windows_vc12/osl/lib/oslcomp_d.lib
    trunk/lib/windows_vc12/osl/lib/oslexec.lib
    trunk/lib/windows_vc12/osl/lib/oslexec_d.lib
    trunk/lib/windows_vc12/osl/lib/oslquery.lib
    trunk/lib/windows_vc12/osl/lib/oslquery_d.lib
    trunk/lib/windows_vc12/osl/shaders/emitter.osl
    trunk/lib/windows_vc12/osl/shaders/emitter.oso
    trunk/lib/windows_vc12/osl/shaders/glass.oso
    trunk/lib/windows_vc12/osl/shaders/image.oso
    trunk/lib/windows_vc12/osl/shaders/matte.oso
    trunk/lib/windows_vc12/osl/shaders/metal.oso
    trunk/lib/windows_vc12/osl/shaders/ubersurface.oso

Modified: trunk/lib/windows_vc12/osl/build.bat
===================================================================
--- trunk/lib/windows_vc12/osl/build.bat	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/build.bat	2016-02-09 15:45:13 UTC (rev 61622)
@@ -3,7 +3,7 @@
 
 set LIBDIR=%CD%\..
 set LIBNAME=osl
-set OSL_VERSION=1.6.9
+set OSL_VERSION=1.7.1
 
 set "OSL_SOURCE=https://github.com/imageworks/OpenShadingLanguage/archive/Release-%OSL_VERSION%.zip"
 

Modified: trunk/lib/windows_vc12/osl/flex_bison/bin/data/c.m4
===================================================================
--- trunk/lib/windows_vc12/osl/flex_bison/bin/data/c.m4	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/flex_bison/bin/data/c.m4	2016-02-09 15:45:13 UTC (rev 61622)
@@ -653,6 +653,14 @@
    This macro was not mandated originally: define only if we know
    we won't break user code: when these are the locations we know.  */
 
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+      || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+#  define __attribute__(Spec) /* empty */
+# endif
+#endif
+
 #ifndef YY_LOCATION_PRINT
 # if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
 

Modified: trunk/lib/windows_vc12/osl/flex_bison/bin/win_bison.exe
===================================================================
(Binary files differ)

Modified: trunk/lib/windows_vc12/osl/flex_bison/bin/win_flex.exe
===================================================================
(Binary files differ)

Modified: trunk/lib/windows_vc12/osl/include/OSL/genclosure.h
===================================================================
--- trunk/lib/windows_vc12/osl/include/OSL/genclosure.h	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/include/OSL/genclosure.h	2016-02-09 15:45:13 UTC (rev 61622)
@@ -70,16 +70,16 @@
     { TypeDesc(TypeDesc::STRING, TypeDesc::SCALAR, TypeDesc::NOXFORM, n),(int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
 
 // NOTE: this keyword args have to be always at the end of the list
-#define CLOSURE_INT_KEYPARAM(key) \
-    { TypeDesc::TypeInt, 0, key, 0 }
-#define CLOSURE_FLOAT_KEYPARAM(key) \
-    { TypeDesc::TypeFloat, 0, key, 0 }
-#define CLOSURE_COLOR_KEYPARAM(key) \
-    { TypeDesc::TypeColor, 0, key, 0 }
-#define CLOSURE_VECTOR_KEYPARAM(key) \
-    { TypeDesc::TypeVector, 0, key, 0 }
-#define CLOSURE_STRING_KEYPARAM(key) \
-    { TypeDesc::TypeString, 0, key, 0 }
+#define CLOSURE_INT_KEYPARAM(st, fld, key) \
+    { TypeDesc::TypeInt, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
+#define CLOSURE_FLOAT_KEYPARAM(st, fld, key) \
+    { TypeDesc::TypeFloat, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
+#define CLOSURE_COLOR_KEYPARAM(st, fld, key) \
+    { TypeDesc::TypeColor, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
+#define CLOSURE_VECTOR_KEYPARAM(st, fld, key) \
+    { TypeDesc::TypeVector, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
+#define CLOSURE_STRING_KEYPARAM(st, fld, key) \
+    { TypeDesc::TypeString, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
 
 #define CLOSURE_FINISH_PARAM(st) { TypeDesc(), sizeof(st), NULL, 0 }
 

Modified: trunk/lib/windows_vc12/osl/include/OSL/llvm_util.h
===================================================================
--- trunk/lib/windows_vc12/osl/include/OSL/llvm_util.h	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/include/OSL/llvm_util.h	2016-02-09 15:45:13 UTC (rev 61622)
@@ -317,6 +317,9 @@
     llvm::Value *constant (const char *s) {
         return constant(OIIO::ustring(s));
     }
+    llvm::Value *constant (const std::string &s) {
+        return constant(OIIO::ustring(s));
+    }
 
     /// Return an llvm::Value for a long long that is a packed
     /// representation of a TypeDesc.
@@ -373,6 +376,10 @@
     /// the function, if any.
     llvm::Value *call_function (const char *name,
                                 llvm::Value **args, int nargs);
+    template<size_t N>
+    llvm::Value* call_function (const char *name, llvm::Value* (&args)[N]) {
+        return call_function (name, &args[0], int(N));
+    }
 
     llvm::Value *call_function (const char *name, llvm::Value *arg0) {
         return call_function (name, &arg0, 1);
@@ -456,21 +463,13 @@
     llvm::Value *op_sub (llvm::Value *a, llvm::Value *b);
     llvm::Value *op_neg (llvm::Value *a);
     llvm::Value *op_mul (llvm::Value *a, llvm::Value *b);
+    llvm::Value *op_div (llvm::Value *a, llvm::Value *b);
+    llvm::Value *op_mod (llvm::Value *a, llvm::Value *b);
     llvm::Value *op_float_to_int (llvm::Value *a);
     llvm::Value *op_int_to_float (llvm::Value *a);
     llvm::Value *op_bool_to_int (llvm::Value *a);
     llvm::Value *op_float_to_double (llvm::Value *a);
 
-    /// Generate IR code for simple a/b, but considering OSL's semantics
-    /// that x/0 = 0, not inf.
-    llvm::Value *op_make_safe_div (OIIO::TypeDesc type,
-                                   llvm::Value *a, llvm::Value *b);
-
-    /// Generate IR code for simple a mod b, but considering OSL's
-    /// semantics that x mod 0 = 0, not inf.
-    llvm::Value *op_make_safe_mod (OIIO::TypeDesc type,
-                                   llvm::Value *a, llvm::Value *b);
-
     llvm::Value *op_and (llvm::Value *a, llvm::Value *b);
     llvm::Value *op_or (llvm::Value *a, llvm::Value *b);
     llvm::Value *op_xor (llvm::Value *a, llvm::Value *b);

Modified: trunk/lib/windows_vc12/osl/include/OSL/oslclosure.h
===================================================================
--- trunk/lib/windows_vc12/osl/include/OSL/oslclosure.h	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/include/OSL/oslclosure.h	2016-02-09 15:45:13 UTC (rev 61622)
@@ -64,6 +64,11 @@
 
 };
 
+// Forward declarations
+struct ClosureComponent;
+struct ClosureMul;
+struct ClosureAdd;
+
 /// ClosureColor is the base class for a lightweight tree representation
 /// of OSL closures for the sake of the executing OSL shader.
 ///
@@ -85,9 +90,24 @@
 /// definitely one of the three kinds of subclasses: ClosureComponent,
 /// ClosureMul, ClosureAdd.
 struct OSLEXECPUBLIC ClosureColor {
-    enum ClosureType { COMPONENT, MUL, ADD };
+    enum ClosureID { COMPONENT_BASE_ID = 0, MUL = -1, ADD = -2 };
 
-    ClosureType type;
+    int id;
+
+    const ClosureComponent* as_comp() const {
+        DASSERT(id >= COMPONENT_BASE_ID);
+        return reinterpret_cast<const ClosureComponent*>(this);
+    }
+
+    const ClosureMul* as_mul() const {
+        DASSERT(id == MUL);
+        return reinterpret_cast<const ClosureMul*>(this);
+    }
+
+    const ClosureAdd* as_add() const {
+        DASSERT(id == ADD);
+        return reinterpret_cast<const ClosureAdd*>(this);
+    }
 };
 
 
@@ -100,36 +120,6 @@
 /// whatever type of custom primitive component it actually is.
 struct OSLEXECPUBLIC ClosureComponent : public ClosureColor
 {
-    struct Attr
-    {
-        ustring   key;
-        union {
-            int     integer;
-            float   flt;
-            float   triple[3];  // This will fake Color3 and Vec3 which C++ doesn't allow in unions
-            void   *str;        // And this fakes a ustring (not allowed in unions either)
-        }         value;
-
-        // This members are just to avoid having to typecast all the time
-        int           & integer()       { return value.integer; }
-        const int     & integer() const { return value.integer; }
-        float         & flt()           { return value.flt; }
-        const float   & flt()     const { return value.flt; }
-        Color3        & color()         { return *(Color3*)       raw_data(); }
-        const Color3  & color()   const { return *(const Color3*) raw_data(); }
-        Vec3          & vector()        { return *(Vec3*)         raw_data(); }
-        const Vec3    & vector()  const { return *(const Vec3*)   raw_data(); }
-        ustring       & str()           { return *(ustring*)      raw_data(); }
-        const ustring & str()     const { return *(const ustring*)raw_data(); }
-
-    private:
-        char*       raw_data()       { return reinterpret_cast<char*>(&value); }
-        const char* raw_data() const { return reinterpret_cast<const char*>(&value); }
-    };
-
-    int    id;       ///< Id of the component
-    int    size;     ///< Memory used by the primitive
-    int    nattrs;   ///< Number of keyword attributes
     Vec3   w;        ///< Weight of this component
     char   mem[4];   ///< Memory for the primitive
                      ///  4 is the minimum, allocation
@@ -140,9 +130,13 @@
     ///
     void *data () { return &mem; }
     const void *data () const { return &mem; }
-    /// Attributes are always allocated at the end of the data block
-    Attr *attrs() { return (Attr *)((char *)data() + size); }
-    const Attr *attrs() const { return (Attr *)((char *)data() + size); }
+
+    /// Handy methods for extracting the underlying parameters as a struct
+    template <typename T>
+    const T* as() const { return reinterpret_cast<const T*>(mem); }
+
+    template <typename T>
+    T* as() { return reinterpret_cast<const T*>(mem); }
 };
 
 

Modified: trunk/lib/windows_vc12/osl/include/OSL/oslcomp.h
===================================================================
--- trunk/lib/windows_vc12/osl/include/OSL/oslcomp.h	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/include/OSL/oslcomp.h	2016-02-09 15:45:13 UTC (rev 61622)
@@ -41,7 +41,7 @@
 
 class OSLCOMPPUBLIC OSLCompiler {
 public:
-    /// DEPRECATED -- it's ok to directly construct an OSLCompiler now.
+    OSL_DEPRECATED("Directly construct or new an OSLCompiler")
     static OSLCompiler *create ();
 
     OSLCompiler (ErrorHandler *errhandler=NULL);

Modified: trunk/lib/windows_vc12/osl/include/OSL/oslconfig.h
===================================================================
--- trunk/lib/windows_vc12/osl/include/OSL/oslconfig.h	2016-02-07 07:50:51 UTC (rev 61621)
+++ trunk/lib/windows_vc12/osl/include/OSL/oslconfig.h	2016-02-09 15:45:13 UTC (rev 61622)
@@ -38,15 +38,18 @@
 // Detect if we're C++11.
 //
 // Note: oslversion.h defined OSL_BUILD_CPP11 to be 1 if OSL was built
-// using C++11. In contrast, OSL_USING_CPP11 defined below will be 1 if

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list