diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-13 02:51:35 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-13 02:51:35 +0400 |
commit | 9e01abf7779a9272530d392767bdf9630544d519 (patch) | |
tree | 268d1a4e92e87ae6a9517cc1b9fee07822a95fc6 /intern/cycles/device/device_cuda.cpp | |
parent | 94bc2b0cffd27dc74f428aee86ca9e2782a14e0a (diff) |
Cycles: require Experimental to be set to enable CUDA on cards with shader model
lower than 1.3, since we're not officially supporting these. We're already not
providing CUDA binaries for these, so better make it clear when compiling from
source too.
Diffstat (limited to 'intern/cycles/device/device_cuda.cpp')
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 83d3f79d96f..eb0e20db355 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -214,6 +214,21 @@ public: return string("CUDA ") + deviceName; } + bool support_device(bool experimental) + { + if(!experimental) { + int major, minor; + cuDeviceComputeCapability(&major, &minor, cuDevId); + + if(major <= 1 && minor <= 2) { + cuda_error(string_printf("CUDA device supported only with shader model 1.3 or up, found %d.%d.", major, minor)); + return false; + } + } + + return true; + } + string compile_kernel() { /* compute cubin name */ @@ -236,11 +251,11 @@ public: if(path_exists(cubin)) return cubin; -#ifdef WITH_CUDA_BINARIES +#if defined(WITH_CUDA_BINARIES) && defined(_WIN32) if(major <= 1 && minor <= 2) cuda_error(string_printf("CUDA device supported only with shader model 1.3 or up, found %d.%d.", major, minor)); else - cuda_error("CUDA binary kernel for this graphics card not found."); + cuda_error("CUDA binary kernel for this graphics card shader model (%d.%d) not found.", major, minor); return ""; #else /* if not, find CUDA compiler */ @@ -283,12 +298,15 @@ public: #endif } - bool load_kernels() + bool load_kernels(bool experimental) { /* check if cuda init succeeded */ if(cuContext == 0) return false; + if(!support_device(experimental)) + return false; + /* get kernel */ string cubin = compile_kernel(); |