Cycles: disable environment importance sampling code for CUDA cards with
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 26 Jan 2012 19:45:59 +0000 (19:45 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 26 Jan 2012 19:45:59 +0000 (19:45 +0000)
compute model < 2.x, to avoid running out of memory in the compiler.

intern/cycles/kernel/kernel_emission.h
intern/cycles/kernel/kernel_light.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_types.h
intern/cycles/render/light.cpp

index b3a5b2bfcb41da8734afd591330423485551e685..513a453b58597976119c8d52969e4a59f05e91b5 100644 (file)
@@ -27,6 +27,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
        ShaderData sd;
        float3 eval;
 
+#ifdef __BACKGROUND_MIS__
        if(ls->type == LIGHT_BACKGROUND) {
                Ray ray;
                ray.D = ls->D;
@@ -36,7 +37,9 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
                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 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag,
        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 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag,
 
                return L*mis_weight;
        }
+#endif
 
        return L;
 #else
index 4c2b69c27163e7d24e2e0e14907fb808f3ea492d..aa125180a94310cda1b61872644e54115feb34c1 100644 (file)
@@ -192,6 +192,7 @@ __device void regular_light_sample(KernelGlobals *kg, int point,
                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 @@ __device void regular_light_sample(KernelGlobals *kg, int point,
                ls->D = -D;
                ls->t = FLT_MAX;
        }
+#endif
        else {
                ls->P = make_float3(data0.y, data0.z, data0.w);
 
index 1d2cf46aa566da67b863769d8b6c3d7b1a41a3e9..0f04af1275dd3989f81a11e14c28440d9b13722f 100644 (file)
@@ -26,7 +26,6 @@
  *
  */
 
-
 #ifdef __OSL__
 
 #include "osl_shader.h"
index 9ebe4120e3620528aa76878808a3ca9440c1fbc1..477b08f2f872ea9ec316dd528318605f4ada4911 100644 (file)
@@ -70,9 +70,8 @@ CCL_NAMESPACE_BEGIN
 #ifdef __KERNEL_ADV_SHADING__
 #define __MULTI_CLOSURE__
 #define __TRANSPARENT_SHADOWS__
-#ifdef __KERNEL_CPU__
 #define __PASSES__
-#endif
+#define __BACKGROUND_MIS__
 #endif
 
 //#define __MULTI_LIGHT__
index 777e764558f99ae760c11661b39348562671aba4..405aa8004571ceab159b4b79fcc1a8b3f5066dca 100644 (file)
@@ -402,6 +402,16 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
 
        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;