[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43736] trunk/blender/intern/cycles: Cycles: disable environment importance sampling code for CUDA cards with

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Jan 26 20:46:06 CET 2012


Revision: 43736
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43736
Author:   blendix
Date:     2012-01-26 19:45:59 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
Cycles: disable environment importance sampling code for CUDA cards with
compute model < 2.x, to avoid running out of memory in the compiler.

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/kernel_emission.h
    trunk/blender/intern/cycles/kernel/kernel_light.h
    trunk/blender/intern/cycles/kernel/kernel_shader.h
    trunk/blender/intern/cycles/kernel/kernel_types.h
    trunk/blender/intern/cycles/render/light.cpp

Modified: trunk/blender/intern/cycles/kernel/kernel_emission.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_emission.h	2012-01-26 19:20:33 UTC (rev 43735)
+++ trunk/blender/intern/cycles/kernel/kernel_emission.h	2012-01-26 19:45:59 UTC (rev 43736)
@@ -27,6 +27,7 @@
 	ShaderData sd;
 	float3 eval;
 
+#ifdef __BACKGROUND_MIS__
 	if(ls->type == LIGHT_BACKGROUND) {
 		Ray ray;
 		ray.D = ls->D;
@@ -36,7 +37,9 @@
 		shader_setup_from_background(kg, &sd, &ray);
 		eval = shader_eval_background(kg, &sd, 0);
 	}
-	else {
+	else
+#endif
+	{
 		shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v);
 		ls->Ng = sd.Ng;
 
@@ -164,6 +167,7 @@
 	float3 L = shader_eval_background(kg, &sd, path_flag);
 	shader_release(kg, &sd);
 
+#ifdef __BACKGROUND_MIS__
 	/* check if background light exists or if we should skip pdf */
 	int res = kernel_data.integrator.pdf_background_res;
 
@@ -175,6 +179,7 @@
 
 		return L*mis_weight;
 	}
+#endif
 
 	return L;
 #else

Modified: trunk/blender/intern/cycles/kernel/kernel_light.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_light.h	2012-01-26 19:20:33 UTC (rev 43735)
+++ trunk/blender/intern/cycles/kernel/kernel_light.h	2012-01-26 19:45:59 UTC (rev 43736)
@@ -192,6 +192,7 @@
 		ls->D = -D;
 		ls->t = FLT_MAX;
 	}
+#ifdef __BACKGROUND_MIS__
 	else if(type == LIGHT_BACKGROUND) {
 		/* infinite area light (e.g. light dome or env light) */
 		float3 D = background_light_sample(kg, randu, randv, pdf);
@@ -201,6 +202,7 @@
 		ls->D = -D;
 		ls->t = FLT_MAX;
 	}
+#endif
 	else {
 		ls->P = make_float3(data0.y, data0.z, data0.w);
 

Modified: trunk/blender/intern/cycles/kernel/kernel_shader.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_shader.h	2012-01-26 19:20:33 UTC (rev 43735)
+++ trunk/blender/intern/cycles/kernel/kernel_shader.h	2012-01-26 19:45:59 UTC (rev 43736)
@@ -26,7 +26,6 @@
  *
  */
 
-
 #ifdef __OSL__
 
 #include "osl_shader.h"

Modified: trunk/blender/intern/cycles/kernel/kernel_types.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_types.h	2012-01-26 19:20:33 UTC (rev 43735)
+++ trunk/blender/intern/cycles/kernel/kernel_types.h	2012-01-26 19:45:59 UTC (rev 43736)
@@ -70,10 +70,9 @@
 #ifdef __KERNEL_ADV_SHADING__
 #define __MULTI_CLOSURE__
 #define __TRANSPARENT_SHADOWS__
-#ifdef __KERNEL_CPU__
 #define __PASSES__
+#define __BACKGROUND_MIS__
 #endif
-#endif
 
 //#define __MULTI_LIGHT__
 //#define __OSL__

Modified: trunk/blender/intern/cycles/render/light.cpp
===================================================================
--- trunk/blender/intern/cycles/render/light.cpp	2012-01-26 19:20:33 UTC (rev 43735)
+++ trunk/blender/intern/cycles/render/light.cpp	2012-01-26 19:45:59 UTC (rev 43736)
@@ -402,6 +402,16 @@
 
 	float4 *light_data = dscene->light_data.resize(scene->lights.size()*LIGHT_SIZE);
 
+	if(!device->info.advanced_shading) {
+		/* remove unsupported light */
+		foreach(Light *light, scene->lights) {
+			if(light->type == LIGHT_BACKGROUND) {
+				scene->lights.erase(std::remove(scene->lights.begin(), scene->lights.end(), light), scene->lights.end());
+				break;
+			}
+		}
+	}
+
 	for(size_t i = 0; i < scene->lights.size(); i++) {
 		Light *light = scene->lights[i];
 		float3 co = light->co;



More information about the Bf-blender-cvs mailing list