Hack-fix for crash-by-assertion on mingw builds on startup if the CUDA driver on
authorJoshua Leung <aligorith@gmail.com>
Sat, 12 Nov 2011 03:59:45 +0000 (03:59 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sat, 12 Nov 2011 03:59:45 +0000 (03:59 +0000)
the computer is too old (and probably can't be upgraded to a version that does)
to support the cuDriverGetVersion method.

intern/cycles/util/util_cuda.cpp

index fdf3d664a11563c1364952816085b41ffb7914b7..f81a11ba9dabe7d244f980fa373ff8ac47cb28c2 100644 (file)
@@ -147,6 +147,8 @@ tcuCtxSetCurrent *cuCtxSetCurrent;
 CCL_NAMESPACE_BEGIN
 
 /* utility macros */
+#define CUDA_LIBRARY_FIND_CHECKED(name) \
+       name = (t##name*)dynamic_library_find(lib, #name);
 
 #define CUDA_LIBRARY_FIND(name) \
        name = (t##name*)dynamic_library_find(lib, #name); \
@@ -188,7 +190,7 @@ bool cuLibraryInit()
        /* detect driver version */
        int driver_version = 1000;
 
-       CUDA_LIBRARY_FIND(cuDriverGetVersion);
+       CUDA_LIBRARY_FIND_CHECKED(cuDriverGetVersion);
        if(cuDriverGetVersion)
                cuDriverGetVersion(&driver_version);