Cycles: enable multi closure sampling and transparent shadows only on CPU and
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 16 Oct 2011 18:54:27 +0000 (18:54 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 16 Oct 2011 18:54:27 +0000 (18:54 +0000)
CUDA cards with shader model >= 2 for now (GTX 4xx, 5xx, ..). The CUDA compiler
can't handle the increased kernel size currently.

intern/cycles/device/device.cpp
intern/cycles/device/device.h
intern/cycles/device/device_cpu.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/device/device_multi.cpp
intern/cycles/device/device_network.cpp
intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/kernel_types.h
intern/cycles/render/scene.h
intern/cycles/render/svm.cpp

index 01c5081770943fbed0290d3397700ffbb0420a1e..f43ccffe4614afb420fbda639b99c090d530f269 100644 (file)
@@ -157,8 +157,6 @@ Device *Device::create(DeviceType type, bool background, int threads)
                        return NULL;
        }
 
                        return NULL;
        }
 
-       device->device_type = type;
-
        return device;
 }
 
        return device;
 }
 
index 360478cfd75c5f3785b4121a3c87de8b2ad24014..5d6ac10dc407e48e9c7957dcfea0d075a331d5c3 100644 (file)
@@ -75,13 +75,12 @@ class Device {
 protected:
        Device() {}
 
 protected:
        Device() {}
 
-       DeviceType device_type;
        bool background;
 
 public:
        virtual ~Device() {}
 
        bool background;
 
 public:
        virtual ~Device() {}
 
-       DeviceType type() { return device_type; }
+       virtual bool support_full_kernel() = 0;
 
        /* info */
        virtual string description() = 0;
 
        /* info */
        virtual string description() = 0;
index 2409cc65998dea57e5749a27f4c97c3599e1c8fc..d6e1c20099695d7d61a3f17028e07e8ffb2a132b 100644 (file)
@@ -69,6 +69,11 @@ public:
                kernel_globals_free(kg);
        }
 
                kernel_globals_free(kg);
        }
 
+       bool support_full_kernel()
+       {
+               return true;
+       }
+
        string description()
        {
                return system_cpu_brand_string();
        string description()
        {
                return system_cpu_brand_string();
index 3773dda76311e15472f9112f3e520cef486366d5..1438dd67ca5a1bb7c352cb3c09cd75e85ec2a06b 100644 (file)
@@ -181,6 +181,14 @@ public:
                cuda_assert(cuCtxDetach(cuContext))
        }
 
                cuda_assert(cuCtxDetach(cuContext))
        }
 
+       bool support_full_kernel()
+       {
+               int major, minor;
+               cuDeviceComputeCapability(&major, &minor, cuDevId);
+
+               return (major >= 2);
+       }
+
        string description()
        {
                /* print device information */
        string description()
        {
                /* print device information */
index f2f6251685e77e6b925666cac46bdfbf6659056c..128c80ac39673412078f6489ec6dfa243ad8667c 100644 (file)
@@ -90,6 +90,16 @@ public:
                        delete sub.device;
        }
 
                        delete sub.device;
        }
 
+       bool support_full_kernel()
+       {
+               foreach(SubDevice& sub, devices) {
+                       if(!sub.device->support_full_kernel())
+                               return false;
+               }
+
+               return true;
+       }
+
        string description()
        {
                /* create map to find duplicate descriptions */
        string description()
        {
                /* create map to find duplicate descriptions */
index af7d90478cffe66449250f1162f81fe94a1d1230..a5ad84831fc2b3719b673a144e6ed26394f1feb4 100644 (file)
@@ -57,6 +57,11 @@ public:
        {
        }
 
        {
        }
 
+       bool support_full_kernel()
+       {
+               return false;
+       }
+
        string description()
        {
                RPCSend snd(socket, "description");
        string description()
        {
                RPCSend snd(socket, "description");
index bd26f4a78fb57325930e41a31d19689fd0fd08cb..d8df8025a0851a26e92ca1f86e37d1bfcd707cb3 100644 (file)
@@ -402,6 +402,11 @@ public:
                        clReleaseContext(cxContext);
        }
 
                        clReleaseContext(cxContext);
        }
 
+       bool support_full_kernel()
+       {
+               return false;
+       }
+
        string description()
        {
                char name[1024];
        string description()
        {
                char name[1024];
index df438fe8d901366c41ec641b431efa8482fd9790..d8270b2cd718214b4d5e3defa226ec92d0d0584c 100644 (file)
@@ -44,15 +44,22 @@ CCL_NAMESPACE_BEGIN
 #define __EMISSION__
 #define __TEXTURES__
 #define __HOLDOUT__
 #define __EMISSION__
 #define __TEXTURES__
 #define __HOLDOUT__
-#define __MULTI_CLOSURE__
-#define __TRANSPARENT_SHADOWS__
 //#define __MULTI_LIGHT__
 #endif
 
 #ifdef __KERNEL_CPU__
 //#define __MULTI_LIGHT__
 #endif
 
 #ifdef __KERNEL_CPU__
+#define __MULTI_CLOSURE__
+#define __TRANSPARENT_SHADOWS__
 //#define __OSL__
 #endif
 
 //#define __OSL__
 #endif
 
+#ifdef __KERNEL_CUDA__
+#if __CUDA_ARCH__ >= 200
+#define __MULTI_CLOSURE__
+#define __TRANSPARENT_SHADOWS__
+#endif
+#endif
+
 //#define __SOBOL_FULL_SCREEN__
 //#define __MODIFY_TP__
 //#define __QBVH__
 //#define __SOBOL_FULL_SCREEN__
 //#define __MODIFY_TP__
 //#define __QBVH__
index c191f8a56e5f58046c7ee4f5b07e9788abd16b64..17bd7e20129642afa9965563e19a7d940091e5a1 100644 (file)
@@ -100,7 +100,6 @@ public:
 class SceneParams {
 public:
        enum { OSL, SVM } shadingsystem;
 class SceneParams {
 public:
        enum { OSL, SVM } shadingsystem;
-       bool use_multi_closure;
        enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type;
        bool use_bvh_cache;
        bool use_bvh_spatial_split;
        enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type;
        bool use_bvh_cache;
        bool use_bvh_spatial_split;
@@ -109,7 +108,6 @@ public:
        SceneParams()
        {
                shadingsystem = SVM;
        SceneParams()
        {
                shadingsystem = SVM;
-               use_multi_closure = true;
                bvh_type = BVH_DYNAMIC;
                use_bvh_cache = false;
                use_bvh_spatial_split = false;
                bvh_type = BVH_DYNAMIC;
                use_bvh_cache = false;
                use_bvh_spatial_split = false;
index b9c4219f85201181ad9d0214780866ef43cd3381..f088a8143cc46157520f33bca3b577b0d288b30f 100644 (file)
@@ -58,7 +58,7 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
        }
        
        bool sunsky_done = false;
        }
        
        bool sunsky_done = false;
-       bool use_multi_closure = (scene->params.use_multi_closure && device->type() != DEVICE_OPENCL);
+       bool use_multi_closure = device->support_full_kernel();
 
        for(i = 0; i < scene->shaders.size(); i++) {
                Shader *shader = scene->shaders[i];
 
        for(i = 0; i < scene->shaders.size(); i++) {
                Shader *shader = scene->shaders[i];