Commit: 14be4b506ac8011b2d9d733a1577b0e995571ff5
Author: Thomas Dinges
Date:   Sun Jun 1 07:11:13 2014 +0200
https://developer.blender.org/rB14be4b506ac8011b2d9d733a1577b0e995571ff5

Cycles: Small optimization for scenes without Transparent Shaders, helps a few 
percent.

Differential Revision: https://developer.blender.org/D570

===================================================================

M       intern/cycles/render/integrator.cpp
M       intern/cycles/render/shader.cpp

===================================================================

diff --git a/intern/cycles/render/integrator.cpp 
b/intern/cycles/render/integrator.cpp
index 59a0de0..051ba1b 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -95,7 +95,11 @@ void Integrator::device_update(Device *device, DeviceScene 
*dscene, Scene *scene
        kintegrator->transparent_max_bounce = transparent_max_bounce + 1;
        kintegrator->transparent_min_bounce = transparent_min_bounce + 1;
 
-       kintegrator->transparent_shadows = transparent_shadows;
+       /* At this point kintegrator->transparent_shadows is set automatically
+        * based on whether shaders use transparent shadows (see shader.cpp).
+        * If user doesn't want transparent shadows, force them off. */
+       if(!transparent_shadows)
+               kintegrator->transparent_shadows = false;
 
        kintegrator->volume_homogeneous_sampling = volume_homogeneous_sampling;
        kintegrator->volume_max_steps = volume_max_steps;
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index d48cd75..0f9a5a5 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -229,6 +229,7 @@ void ShaderManager::device_update_common(Device *device, 
DeviceScene *dscene, Sc
        uint i = 0;
        bool has_converter_blackbody = false;
        bool has_volumes = false;
+       bool has_transparent_shadows = false;
 
        foreach(Shader *shader, scene->shaders) {
                uint flag = 0;
@@ -267,6 +268,10 @@ void ShaderManager::device_update_common(Device *device, 
DeviceScene *dscene, Sc
 
                shader_flag[i++] = flag;
                shader_flag[i++] = shader->pass_id;
+               
+               /* Check if we need transparent shadows */
+               if(flag & SD_HAS_TRANSPARENT_SHADOW)
+                       has_transparent_shadows = true;
        }
 
        device->tex_alloc("__shader_flag", dscene->shader_flag);
@@ -285,9 +290,10 @@ void ShaderManager::device_update_common(Device *device, 
DeviceScene *dscene, Sc
                blackbody_table_offset = TABLE_OFFSET_INVALID;
        }
 
-       /* volumes */
+       /* integrator */
        KernelIntegrator *kintegrator = &dscene->data.integrator;
        kintegrator->use_volumes = has_volumes;
+       kintegrator->transparent_shadows = has_transparent_shadows;
 }
 
 void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, 
Scene *scene)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to