Fix Cycles kernel build without render passes support.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 17 Jul 2016 16:09:58 +0000 (18:09 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 18 Jul 2016 20:40:08 +0000 (22:40 +0200)
intern/cycles/kernel/kernel_accumulate.h
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h

index 5f5a360..0e13b22 100644 (file)
@@ -50,7 +50,7 @@ ccl_device_inline void bsdf_eval_init(BsdfEval *eval, ClosureType type, float3 v
        else
                eval->diffuse = value;
 #else
-       *eval = value;
+       eval->diffuse = value;
 #endif
 }
 
@@ -80,7 +80,7 @@ void bsdf_eval_accum(BsdfEval *eval, ClosureType type, float3 value)
        else
                eval->diffuse += value;
 #else
-       *eval += value;
+       eval->diffuse += value;
 #endif
 }
 
@@ -98,7 +98,7 @@ ccl_device_inline bool bsdf_eval_is_zero(BsdfEval *eval)
        else
                return is_zero(eval->diffuse);
 #else
-       return is_zero(*eval);
+       return is_zero(eval->diffuse);
 #endif
 }
 
@@ -117,7 +117,7 @@ ccl_device_inline void bsdf_eval_mul(BsdfEval *eval, float3 value)
        else
                eval->diffuse *= value;
 #else
-       *eval *= value;
+       eval->diffuse *= value;
 #endif
 }
 
@@ -172,7 +172,7 @@ ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
        else
                L->emission = make_float3(0.0f, 0.0f, 0.0f);
 #else
-       *L = make_float3(0.0f, 0.0f, 0.0f);
+       L->emission = make_float3(0.0f, 0.0f, 0.0f);
 #endif
 }
 
@@ -207,7 +207,7 @@ ccl_device_inline void path_radiance_bsdf_bounce(PathRadiance *L, ccl_addr_space
        else
                *throughput *= bsdf_eval->diffuse*inverse_pdf;
 #else
-       *throughput *= *bsdf_eval*inverse_pdf;
+       *throughput *= bsdf_eval->diffuse*inverse_pdf;
 #endif
 }
 
@@ -225,7 +225,7 @@ ccl_device_inline void path_radiance_accum_emission(PathRadiance *L, float3 thro
        else
                L->emission += throughput*value;
 #else
-       *L += throughput*value;
+       L->emission += throughput*value;
 #endif
 }
 
@@ -246,7 +246,7 @@ ccl_device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput
        else
                L->emission += throughput*bsdf*ao;
 #else
-       *L += throughput*bsdf*ao;
+       L->emission += throughput*bsdf*ao;
 #endif
 }
 
@@ -277,7 +277,7 @@ ccl_device_inline void path_radiance_accum_light(PathRadiance *L, float3 through
        else
                L->emission += throughput*bsdf_eval->diffuse*shadow;
 #else
-       *L += throughput*(*bsdf_eval)*shadow;
+       L->emission += throughput*bsdf_eval->diffuse*shadow;
 #endif
 }
 
@@ -295,7 +295,7 @@ ccl_device_inline void path_radiance_accum_background(PathRadiance *L, float3 th
        else
                L->emission += throughput*value;
 #else
-       *L += throughput*value;
+       L->emission += throughput*value;
 #endif
 }
 
@@ -441,7 +441,7 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg, PathRadi
        else
                L_sum = L->emission;
 #else
-       L_sum = *L;
+       L_sum = L->emission;
 #endif
 
        /* Reject invalid value */
@@ -477,7 +477,7 @@ ccl_device_inline void path_radiance_accum_sample(PathRadiance *L, PathRadiance
        L->shadow += L_sample->shadow*fac;
        L->mist += L_sample->mist*fac;
 #else
-       *L += *L_sample * fac;
+       L->emission += L_sample->emission * fac;
 #endif
 }
 
index 5de58ba..a9be2ae 100644 (file)
@@ -387,12 +387,13 @@ typedef enum BakePassFilterCombos {
        BAKE_FILTER_SUBSURFACE_INDIRECT = (BAKE_FILTER_INDIRECT | BAKE_FILTER_SUBSURFACE),
 } BakePassFilterCombos;
 
-#ifdef __PASSES__
-
 typedef ccl_addr_space struct PathRadiance {
+#ifdef __PASSES__
        int use_light_pass;
+#endif
 
        float3 emission;
+#ifdef __PASSES__
        float3 background;
        float3 ao;
 
@@ -426,25 +427,23 @@ typedef ccl_addr_space struct PathRadiance {
 
        float4 shadow;
        float mist;
+#endif
 } PathRadiance;
 
 typedef struct BsdfEval {
+#ifdef __PASSES__
        int use_light_pass;
+#endif
 
        float3 diffuse;
+#ifdef __PASSES__
        float3 glossy;
        float3 transmission;
        float3 transparent;
        float3 subsurface;
        float3 scatter;
-} BsdfEval;
-
-#else
-
-typedef ccl_addr_space float3 PathRadiance;
-typedef float3 BsdfEval;
-
 #endif
+} BsdfEval;
 
 /* Shader Flag */
 
index 962196c..ec82d4b 100644 (file)
@@ -109,6 +109,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg,
 {
        if(type >= SHADER_EVAL_BAKE) {
                kernel_assert(output_luma == NULL);
+#ifdef __BAKING__
                kernel_bake_evaluate(kg,
                                     input,
                                     output,
@@ -117,6 +118,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg,
                                     i,
                                     offset,
                                     sample);
+#endif
        }
        else {
                kernel_shader_evaluate(kg,