Commit: 3e364aec34a630a6304d56dbe242fd57187169d9
Author: varunsundar08
Date:   Tue Apr 28 18:38:55 2015 +0530
Branches: cycles_kernel_split
https://developer.blender.org/rB3e364aec34a630a6304d56dbe242fd57187169d9

Bypass selective-compilation-of-svm-nodes for viewport

  By-passing "selective-compilation-of-svm-nodes" optimization
  will limit kernel re-compilations during viewport render

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

M       intern/cycles/device/device_opencl.cpp
M       intern/cycles/render/session.cpp
M       intern/cycles/render/svm.cpp

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

diff --git a/intern/cycles/device/device_opencl.cpp 
b/intern/cycles/device/device_opencl.cpp
index 793781e..190c1b1 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -2206,6 +2206,22 @@ public:
 
                /* TODO : Use OpenCLCahce with spit kernel */
 
+               /* if it is an interactive render; we ceil clos_max value to a 
multiple of 5 in order
+               * to limit re-compilations
+               */
+               if (!background) {
+                       /* clos_max value can't be 0  */
+                       clos_max = (clos_max == 0) ? 1 : clos_max;
+                       clos_max = (((clos_max - 1) / 5) + 1) * 5;
+                       /* clos_max value can't be greater than MAX_CLOSURE */
+                       clos_max = (clos_max > MAX_CLOSURE) ? MAX_CLOSURE : 
clos_max;
+
+                       if (current_clos_max == clos_max) {
+                               /* present kernels have been created with the 
same closure count build option */
+                               return true;
+                       }
+               }
+
                string svm_build_options = "";
                string max_closure_build_option = "";
                string compute_device_type_build_option = "";
@@ -2225,22 +2241,6 @@ public:
                }
                svm_build_options += " ";
 
-               /* if it is an interactive render; we ceil clos_max value to a 
multiple of 5 in order
-               * to limit re-compilations
-               */
-               if (!background) {
-                       /* clos_max value can't be 0  */
-                       clos_max = (clos_max == 0) ? 1 : clos_max;
-                       clos_max = (((clos_max - 1) / 5) + 1) * 5;
-                       /* clos_max value can't be greater than MAX_CLOSURE */
-                       clos_max = (clos_max > MAX_CLOSURE) ? MAX_CLOSURE : 
clos_max;
-
-                       if (current_clos_max == clos_max) {
-                               /* present kernels have been created with the 
same closure count build option */
-                               return true;
-                       }
-               }
-
                /* Set max closure build option */
 #ifdef __MULTI_CLOSURE__
                max_closure_build_option += string_printf("-DMAX_CLOSURE=%d ", 
clos_max);
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index ea4e3ae..2eb8451 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -616,7 +616,7 @@ void Session::load_kernels()
 {
        thread_scoped_lock scene_lock(scene->mutex);
 
-       if (!kernels_loaded || !device->get_background()) {
+       if (!kernels_loaded || (device->use_split_kernel && 
!device->get_background())) {
                /* for split kernel, in case if interactive rendering, we
                 * we need to check kernel-reload before doing path trace
                 */
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 7328394..bb8857e 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -81,14 +81,24 @@ void SVMShaderManager::device_update(Device *device, 
DeviceScene *dscene, Scene
                compiler.compile(shader, svm_nodes, i);
        }
 
-       /* Populate set of closure nodes associated with the scene */
-       /* Check if NODE_END is indeed the start of NodeType enum */
-       assert(NODE_END == 0);
-       for(int node_iter = 0; node_iter < svm_nodes.size(); node_iter++) {
-               int4 node = svm_nodes[node_iter];
-               if (node.x >= NODE_END && node.x <= NODE_UVMAP) {
-                       /* if node.x is within start and end of NodeType insert 
node type into device->associated_closure_nodes */
-                       device->closure_nodes.insert(node.x);
+       if (!device->get_background()) {
+               /* In case of interactive render, we skip selective compilation 
of svm nodes optimization */
+               /* Check if NODE_END is indeed the start of NodeType enum */
+               assert(NODE_END == 0);
+               for (int node_type_iter = NODE_END; node_type_iter <= 
NODE_UVMAP; node_type_iter++) {
+                       device->closure_nodes.insert(node_type_iter);
+               }
+       }
+       else {
+               /* Populate set of closure nodes associated with the scene */
+               /* Check if NODE_END is indeed the start of NodeType enum */
+               assert(NODE_END == 0);
+               for(int node_iter = 0; node_iter < svm_nodes.size(); 
node_iter++) {
+                       int4 node = svm_nodes[node_iter];
+                       if (node.x >= NODE_END && node.x <= NODE_UVMAP) {
+                               /* if node.x is within start and end of 
NodeType insert node type into device->associated_closure_nodes */
+                               device->closure_nodes.insert(node.x);
+                       }
                }
        }

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

Reply via email to