[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41068] branches/cycles/intern/cycles: Cycles: enable multi closure sampling and transparent shadows only on CPU and

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Oct 16 20:54:28 CEST 2011


Revision: 41068
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41068
Author:   blendix
Date:     2011-10-16 18:54:27 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
Cycles: enable multi closure sampling and transparent shadows only on CPU and
CUDA cards with shader model >= 2 for now (GTX 4xx, 5xx, ..). The CUDA compiler
can't handle the increased kernel size currently.

Modified Paths:
--------------
    branches/cycles/intern/cycles/device/device.cpp
    branches/cycles/intern/cycles/device/device.h
    branches/cycles/intern/cycles/device/device_cpu.cpp
    branches/cycles/intern/cycles/device/device_cuda.cpp
    branches/cycles/intern/cycles/device/device_multi.cpp
    branches/cycles/intern/cycles/device/device_network.cpp
    branches/cycles/intern/cycles/device/device_opencl.cpp
    branches/cycles/intern/cycles/kernel/kernel_types.h
    branches/cycles/intern/cycles/render/scene.h
    branches/cycles/intern/cycles/render/svm.cpp

Modified: branches/cycles/intern/cycles/device/device.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -157,8 +157,6 @@
 			return NULL;
 	}
 
-	device->device_type = type;
-
 	return device;
 }
 

Modified: branches/cycles/intern/cycles/device/device.h
===================================================================
--- branches/cycles/intern/cycles/device/device.h	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device.h	2011-10-16 18:54:27 UTC (rev 41068)
@@ -75,13 +75,12 @@
 protected:
 	Device() {}
 
-	DeviceType device_type;
 	bool background;
 
 public:
 	virtual ~Device() {}
 
-	DeviceType type() { return device_type; }
+	virtual bool support_full_kernel() = 0;
 
 	/* info */
 	virtual string description() = 0;

Modified: branches/cycles/intern/cycles/device/device_cpu.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_cpu.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device_cpu.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -69,6 +69,11 @@
 		kernel_globals_free(kg);
 	}
 
+	bool support_full_kernel()
+	{
+		return true;
+	}
+
 	string description()
 	{
 		return system_cpu_brand_string();

Modified: branches/cycles/intern/cycles/device/device_cuda.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_cuda.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device_cuda.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -181,6 +181,14 @@
 		cuda_assert(cuCtxDetach(cuContext))
 	}
 
+	bool support_full_kernel()
+	{
+		int major, minor;
+		cuDeviceComputeCapability(&major, &minor, cuDevId);
+
+		return (major >= 2);
+	}
+
 	string description()
 	{
 		/* print device information */

Modified: branches/cycles/intern/cycles/device/device_multi.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_multi.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device_multi.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -90,6 +90,16 @@
 			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 */

Modified: branches/cycles/intern/cycles/device/device_network.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_network.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device_network.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -57,6 +57,11 @@
 	{
 	}
 
+	bool support_full_kernel()
+	{
+		return false;
+	}
+
 	string description()
 	{
 		RPCSend snd(socket, "description");

Modified: branches/cycles/intern/cycles/device/device_opencl.cpp
===================================================================
--- branches/cycles/intern/cycles/device/device_opencl.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/device/device_opencl.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -402,6 +402,11 @@
 			clReleaseContext(cxContext);
 	}
 
+	bool support_full_kernel()
+	{
+		return false;
+	}
+
 	string description()
 	{
 		char name[1024];

Modified: branches/cycles/intern/cycles/kernel/kernel_types.h
===================================================================
--- branches/cycles/intern/cycles/kernel/kernel_types.h	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/kernel/kernel_types.h	2011-10-16 18:54:27 UTC (rev 41068)
@@ -44,15 +44,22 @@
 #define __EMISSION__
 #define __TEXTURES__
 #define __HOLDOUT__
-#define __MULTI_CLOSURE__
-#define __TRANSPARENT_SHADOWS__
 //#define __MULTI_LIGHT__
 #endif
 
 #ifdef __KERNEL_CPU__
+#define __MULTI_CLOSURE__
+#define __TRANSPARENT_SHADOWS__
 //#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__

Modified: branches/cycles/intern/cycles/render/scene.h
===================================================================
--- branches/cycles/intern/cycles/render/scene.h	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/render/scene.h	2011-10-16 18:54:27 UTC (rev 41068)
@@ -100,7 +100,6 @@
 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;
@@ -109,7 +108,6 @@
 	SceneParams()
 	{
 		shadingsystem = SVM;
-		use_multi_closure = true;
 		bvh_type = BVH_DYNAMIC;
 		use_bvh_cache = false;
 		use_bvh_spatial_split = false;

Modified: branches/cycles/intern/cycles/render/svm.cpp
===================================================================
--- branches/cycles/intern/cycles/render/svm.cpp	2011-10-16 17:55:39 UTC (rev 41067)
+++ branches/cycles/intern/cycles/render/svm.cpp	2011-10-16 18:54:27 UTC (rev 41068)
@@ -58,7 +58,7 @@
 	}
 	
 	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];




More information about the Bf-blender-cvs mailing list