[Bf-blender-cvs] [158305f] opensubdiv-modifier: OpenSubdiv: Update to the latest cuew/clew versions

Sergey Sharybin noreply at git.blender.org
Mon Aug 4 18:56:29 CEST 2014


Commit: 158305f2a2eb0fd9360819977e2eb76090b49090
Author: Sergey Sharybin
Date:   Mon Aug 4 22:56:09 2014 +0600
Branches: opensubdiv-modifier
https://developer.blender.org/rB158305f2a2eb0fd9360819977e2eb76090b49090

OpenSubdiv: Update to the latest cuew/clew versions

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

M	extern/cuew/auto/cuew_gen.py
M	extern/cuew/include/cuew.h
M	extern/cuew/src/cuew.c
M	intern/opensubdiv/cudaInit.h
M	source/blender/compositor/intern/COM_WorkScheduler.cpp

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

diff --git a/extern/cuew/auto/cuew_gen.py b/extern/cuew/auto/cuew_gen.py
index bc7f069..709ccea 100644
--- a/extern/cuew/auto/cuew_gen.py
+++ b/extern/cuew/auto/cuew_gen.py
@@ -31,7 +31,7 @@ INCLUDE_DIR = "/usr/include"
 LIB = "CUEW"
 REAL_LIB = "CUDA"
 VERSION_MAJOR = "1"
-VERSION_MINOR = "1"
+VERSION_MINOR = "2"
 COPYRIGHT = """/*
  * Copyright 2011-2014 Blender Foundation
  *
@@ -371,6 +371,12 @@ typedef unsigned int CUdeviceptr;
             print("")
 
     print("")
+    print("enum {")
+    print("  CUEW_SUCCESS = 0,")
+    print("  CUEW_ERROR_OPEN_FAILED = -1,")
+    print("  CUEW_ERROR_ATEXIT_FAILED = -2,")
+    print("};")
+    print("")
     print("int %sInit(void);" % (LIB.lower()))
     # TODO(sergey): Get rid of hardcoded CUresult.
     print("const char *%sErrorString(CUresult result);" % (LIB.lower()))
@@ -454,14 +460,14 @@ def print_init_guard():
 
   error = atexit(cuewExit);
   if (error) {
-    return 0;
+    return CUEW_ERROR_ATEXIT_FAILED;
   }
 
   /* Load library. */
   lib = dynamic_library_open(path);
 
   if (lib == NULL) {
-    return 0;
+    return CUEW_ERROR_OPEN_FAILED;
   }""")
     print("")
 
@@ -498,7 +504,7 @@ def print_dl_init():
             print("")
 
     print("")
-    print("  result = 1;")
+    print("  result = CUEW_SUCCESS;")
     print("  return result;")
 
     print("}")
@@ -514,7 +520,6 @@ def print_implementation():
 #  define pclose _pclose
 #  define _CRT_SECURE_NO_WARNINGS
 #endif
-
 """)
     print("#include <cuew.h>")
     print("#include <assert.h>")
diff --git a/extern/cuew/include/cuew.h b/extern/cuew/include/cuew.h
index 0f28680..fd03311 100644
--- a/extern/cuew/include/cuew.h
+++ b/extern/cuew/include/cuew.h
@@ -25,7 +25,7 @@ extern "C" {
 
 /* Defines. */
 #define CUEW_VERSION_MAJOR 1
-#define CUEW_VERSION_MINOR 1
+#define CUEW_VERSION_MINOR 2
 
 #define CUDA_VERSION 6000
 #define CU_IPC_HANDLE_SIZE 64
@@ -1120,6 +1120,12 @@ extern tcuGLMapBufferObjectAsync_v2 *cuGLMapBufferObjectAsync_v2;
 extern tcuGLUnmapBufferObjectAsync *cuGLUnmapBufferObjectAsync;
 
 
+enum {
+  CUEW_SUCCESS = 0,
+  CUEW_ERROR_OPEN_FAILED = -1,
+  CUEW_ERROR_ATEXIT_FAILED = -2,
+};
+
 int cuewInit(void);
 const char *cuewErrorString(CUresult result);
 const char *cuewCompilerPath(void);
diff --git a/extern/cuew/src/cuew.c b/extern/cuew/src/cuew.c
index ea04306..7c7f942 100644
--- a/extern/cuew/src/cuew.c
+++ b/extern/cuew/src/cuew.c
@@ -291,14 +291,14 @@ int cuewInit(void) {
 
   error = atexit(cuewExit);
   if (error) {
-    return 0;
+    return CUEW_ERROR_ATEXIT_FAILED;
   }
 
   /* Load library. */
   lib = dynamic_library_open(path);
 
   if (lib == NULL) {
-    return 0;
+    return CUEW_ERROR_OPEN_FAILED;
   }
 
   /* Detect driver version. */
@@ -514,7 +514,7 @@ int cuewInit(void) {
   CUDA_LIBRARY_FIND(cuGLUnmapBufferObjectAsync);
 
 
-  result = 1;
+  result = CUEW_SUCCESS;
   return result;
 }
 
diff --git a/intern/opensubdiv/cudaInit.h b/intern/opensubdiv/cudaInit.h
index a5a77d4..39ccb86 100644
--- a/intern/opensubdiv/cudaInit.h
+++ b/intern/opensubdiv/cudaInit.h
@@ -131,7 +131,7 @@ static bool HAS_CUDA_VERSION_4_0() {
 		cudaInitialized = true;
 
 #  ifdef OPENSUBDIV_HAS_CUEW
-		cudaLoadSuccess = cuewInit() != 0;
+		cudaLoadSuccess = cuewInit() == CUEW_SUCCESS;
 		if (!cudaLoadSuccess) {
 			fprintf(stderr, "Loading CUDA failed.\n");
 		}
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index f4b0bac..946d75a 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -326,7 +326,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads)
 		g_context = NULL;
 		g_program = NULL;
 
-		if (!clewInit()) /* this will check for errors and skip if already initialized */
+		if (clewInit() == CLEW_SUCCESS) /* this will check for errors and skip if already initialized */
 			return;
 
 		if (clCreateContextFromType) {




More information about the Bf-blender-cvs mailing list