[Bf-blender-cvs] [076e5eb] opensubdiv-modifier: Make OpenSubdiv-CAPI aware of clew

Sergey Sharybin noreply at git.blender.org
Sun May 25 04:36:13 CEST 2014


Commit: 076e5ebb2af99ba71e8ce1998be192f7ad6922f1
Author: Sergey Sharybin
Date:   Wed May 21 15:45:13 2014 +0200
https://developer.blender.org/rB076e5ebb2af99ba71e8ce1998be192f7ad6922f1

Make OpenSubdiv-CAPI aware of clew

So now OpenCL backennd is expected to be portable across the platforms.

Requires latest dev branch of OpenSubdiv dev branch.

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

M	build_files/cmake/Modules/FindOpenSubdiv.cmake
M	build_files/cmake/macros.cmake
M	extern/CMakeLists.txt
M	extern/SConscript
A	extern/clew/CMakeLists.txt
A	extern/clew/SConscript
A	extern/clew/include/clew.h
A	extern/clew/src/clew.c
D	extern/libclew/CMakeLists.txt
D	extern/libclew/SConscript
D	extern/libclew/include/clew.h
D	extern/libclew/src/clew.c
M	intern/opensubdiv/CMakeLists.txt
M	intern/opensubdiv/SConscript
M	intern/opensubdiv/clInit.h
M	source/blender/compositor/CMakeLists.txt
M	source/blender/compositor/SConscript
M	source/creator/CMakeLists.txt

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

diff --git a/build_files/cmake/Modules/FindOpenSubdiv.cmake b/build_files/cmake/Modules/FindOpenSubdiv.cmake
index efe3707..05847ae 100644
--- a/build_files/cmake/Modules/FindOpenSubdiv.cmake
+++ b/build_files/cmake/Modules/FindOpenSubdiv.cmake
@@ -29,8 +29,8 @@ ENDIF()
 
 SET(_opensubdiv_FIND_COMPONENTS
   osdutil
-  osdCPU
   osdGPU
+  osdCPU
 )
 
 SET(_opensubdiv_SEARCH_DIRS
@@ -114,13 +114,6 @@ IF(OPENSUBDIV_FOUND)
       LIST(APPEND OPENSUBDIV_LIBRARIES ${CUDA_CUDART_LIBRARY})
     ENDIF()
   ENDIF()
-
-  IF(OPENSUBDIV_HAS_OPENCL)
-    # TODO(sergey): Exactly the same reason as above.
-    # TODO(sergey): There's no OpenCL finder in CMake
-    #FIND_PACKAGE(OpenCL)
-    LIST(APPEND OPENSUBDIV_LIBRARIES "OpenCL")
-  ENDIF()
 ENDIF(OPENSUBDIV_FOUND)
 
 MARK_AS_ADVANCED(
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index db1fa5d..a7def8f 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -344,7 +344,7 @@ macro(setup_liblinks
 			target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
 			unset(OPENSUBDIV_LIBRARIES_DEBUG)
 		else()
-			target_link_libraries(${target} "${OPENSUBDIV_LIBRARIES}")
+			target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
 		endif()
 	endif()
 	if(WITH_BOOST)
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 7d41e09..301386f 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -70,8 +70,8 @@ if(WITH_LZMA)
 	add_subdirectory(lzma)
 endif()
 
-if(WITH_COMPOSITOR)
-    add_subdirectory(libclew)
+if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
+    add_subdirectory(clew)
 endif()
 
 if(WITH_MOD_BOOLEAN)
diff --git a/extern/SConscript b/extern/SConscript
index 302446b..c3c026a 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -20,8 +20,8 @@ if env['WITH_BF_ELTOPO']:
 if env['WITH_BF_BULLET']:
     SConscript(['bullet2/src/SConscript'])
 
-if env['WITH_BF_COMPOSITOR']:
-    SConscript (['libclew/SConscript'])
+if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_OPENSUBDIV']:
+    SConscript (['clew/SConscript'])
 
 if env['WITH_BF_OPENJPEG'] and env['BF_OPENJPEG_LIB'] == '':
     SConscript(['libopenjpeg/SConscript'])
diff --git a/extern/libclew/CMakeLists.txt b/extern/clew/CMakeLists.txt
similarity index 94%
rename from extern/libclew/CMakeLists.txt
rename to extern/clew/CMakeLists.txt
index 1953cb2..891c330 100644
--- a/extern/libclew/CMakeLists.txt
+++ b/extern/clew/CMakeLists.txt
@@ -38,4 +38,4 @@ set(SRC
 )
 
 
-blender_add_lib(extern_libclew "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(extern_clew "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/libclew/SConscript b/extern/clew/SConscript
similarity index 100%
rename from extern/libclew/SConscript
rename to extern/clew/SConscript
diff --git a/extern/clew/include/clew.h b/extern/clew/include/clew.h
new file mode 100644
index 0000000..7f5add2
--- /dev/null
+++ b/extern/clew/include/clew.h
@@ -0,0 +1,2748 @@
+#ifndef CLEW_HPP_INCLUDED
+#define CLEW_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////
+//  Copyright (c) 2009-2011 Organic Vectory B.V., KindDragon
+//  Written by George van Venrooij
+//
+//  Distributed under the MIT License.
+//////////////////////////////////////////////////////////////////////////
+
+//! \file clew.h
+//! \brief OpenCL run-time loader header
+//!
+//! This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the 
+//! official OpenCL spec. The purpose of this code is to load the OpenCL dynamic
+//! library at run-time and thus allow the executable to function on many
+//! platforms regardless of the vendor of the OpenCL driver actually installed.
+//! Some of the techniques used here were inspired by work done in the GLEW
+//! library (http://glew.sourceforge.net/)
+
+//  Run-time dynamic linking functionality based on concepts used in GLEW
+#ifdef  __OPENCL_CL_H
+#error cl.h included before clew.h
+#endif
+
+#ifdef  __OPENCL_CL_PLATFORM_H
+#error cl_platform.h included before clew.h
+#endif
+
+//  Prevent cl.h inclusion
+#define __OPENCL_CL_H
+//  Prevent cl_platform.h inclusion
+#define __CL_PLATFORM_H
+
+/*******************************************************************************
+* Copyright (c) 2008-2010 The Khronos Group Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and/or associated documentation files (the
+* "Materials"), to deal in the Materials without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Materials, and to
+* permit persons to whom the Materials are furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Materials.
+*
+* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+******************************************************************************/
+#ifdef __APPLE__
+    /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
+    #include <AvailabilityMacros.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_WIN32)
+    #define CL_API_ENTRY
+    #define CL_API_CALL     __stdcall
+    #define CL_CALLBACK     __stdcall
+#else
+    #define CL_API_ENTRY
+    #define CL_API_CALL
+    #define CL_CALLBACK
+#endif
+
+#ifdef __APPLE__
+    #define CL_EXTENSION_WEAK_LINK                  __attribute__((weak_import))       
+    #define CL_API_SUFFIX__VERSION_1_0              AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+    #define CL_EXT_SUFFIX__VERSION_1_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+    #define CL_API_SUFFIX__VERSION_1_1              CL_EXTENSION_WEAK_LINK
+    #define CL_EXT_SUFFIX__VERSION_1_1              CL_EXTENSION_WEAK_LINK
+    #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED   CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#else
+    #define CL_EXTENSION_WEAK_LINK                         
+    #define CL_API_SUFFIX__VERSION_1_0
+    #define CL_EXT_SUFFIX__VERSION_1_0
+    #define CL_API_SUFFIX__VERSION_1_1
+    #define CL_EXT_SUFFIX__VERSION_1_1
+    #define CL_API_SUFFIX__VERSION_1_2
+    #define CL_EXT_SUFFIX__VERSION_1_2
+
+    #ifdef __GNUC__
+        #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+            #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
+        #else
+            #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated))
+            #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
+        #endif
+
+        #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
+            #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+        #else
+            #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
+            #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+        #endif
+    #elif _WIN32
+        #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+            #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
+        #else
+            #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated)
+        #endif
+
+        #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
+            #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+        #else
+            #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+            #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated)
+        #endif
+    #else
+        #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
+        #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
+
+        #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+        #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+    #endif
+#endif
+
+#if (defined (_WIN32) && defined(_MSC_VER))
+
+/* scalar types  */
+typedef signed   __int8         cl_char;
+typedef unsigned __int8         cl_uchar;
+typedef signed   __int16        cl_short;
+typedef unsigned __int16        cl_ushort;
+typedef signed   __int32        cl_int;
+typedef unsigned __int32        cl_uint;
+typedef signed   __int64        cl_long;
+typedef unsigned __int64        cl_ulong;
+
+typedef unsigned __int16        cl_half;
+typedef float                   cl_float;
+typedef double                  cl_double;
+
+/* Macro names and corresponding values defined by OpenCL */
+#define CL_CHAR_BIT         8
+#define CL_SCHAR_MAX        127
+#define CL_SCHAR_MIN        (-127-1)
+#define CL_CHAR_MAX         CL_SCHAR_MAX
+#define CL_CHAR_MIN         CL_SCHAR_MIN
+#define CL_UCHAR_MAX        255
+#define CL_SHRT_MAX         32767
+#define CL_SHRT_MIN         (-32767-1)
+#define CL_USHRT_MAX        65535
+#define CL_INT_MAX          2147483647
+#define CL_INT_MIN          (-2147483647-1)
+#define CL_UINT_MAX         0xffffffffU
+#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG          6
+#define CL_FLT_MANT_DIG     24
+#define CL_FLT_MAX_10_EXP   +38
+#define CL_FLT_MAX_EXP      +128
+#define CL_FLT_MIN_10_EXP   -37
+#define CL_FLT_MIN_EXP      -125
+#define CL_FLT_RADIX        2
+#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN          1.175494350822287507969e-38f
+#define CL_FLT_EPSILON      0x1.0p-23f
+
+#define CL_DBL_DIG          15
+#define CL_DBL_MANT_DIG     53
+#define CL_DBL_MAX_10_EXP   +308
+#define CL_DBL_MAX_EXP      +1024
+#defi

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list