Cycles: Remove old nasty workaround
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 11 Dec 2018 13:33:24 +0000 (14:33 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 11 Dec 2018 13:34:52 +0000 (14:34 +0100)
It used to be used for some sort of ignoring automatically
generated bump nodes. But nowadays it causes one of the shaders
in Classroom demo file to be compiled wrong.

intern/cycles/render/svm.cpp
intern/cycles/render/svm.h

index fb32f1ba0946e7269c4364cdee349101a035c333..01fda0a9e019985f7f0b4a2170c1ec398c62de54 100644 (file)
@@ -411,31 +411,20 @@ uint SVMCompiler::attribute_standard(ustring name)
        return (std)? attribute(std): attribute(name);
 }
 
-bool SVMCompiler::node_skip_input(ShaderNode * /*node*/, ShaderInput *input)
-{
-       /* nasty exception .. */
-       if(current_type == SHADER_TYPE_DISPLACEMENT && input->link && input->link->parent->special_type == SHADER_SPECIAL_TYPE_BUMP)
-               return true;
-
-       return false;
-}
-
 void SVMCompiler::find_dependencies(ShaderNodeSet& dependencies,
                                     const ShaderNodeSet& done,
                                     ShaderInput *input,
                                     ShaderNode *skip_node)
 {
        ShaderNode *node = (input->link)? input->link->parent: NULL;
-
        if(node != NULL &&
           done.find(node) == done.end() &&
           node != skip_node &&
           dependencies.find(node) == dependencies.end())
        {
-               foreach(ShaderInput *in, node->inputs)
-                       if(!node_skip_input(node, in))
-                               find_dependencies(dependencies, done, in, skip_node);
-
+               foreach(ShaderInput *in, node->inputs) {
+                       find_dependencies(dependencies, done, in, skip_node);
+               }
                dependencies.insert(node);
        }
 }
@@ -482,18 +471,19 @@ void SVMCompiler::generate_svm_nodes(const ShaderNodeSet& nodes,
                        if(!done_flag[node->id]) {
                                bool inputs_done = true;
 
-                               foreach(ShaderInput *input, node->inputs)
-                                       if(!node_skip_input(node, input))
-                                               if(input->link && !done_flag[input->link->parent->id])
-                                                       inputs_done = false;
-
+                               foreach(ShaderInput *input, node->inputs) {
+                                       if(input->link && !done_flag[input->link->parent->id]) {
+                                               inputs_done = false;
+                                       }
+                               }
                                if(inputs_done) {
                                        generate_node(node, done);
                                        done.insert(node);
                                        done_flag[node->id] = true;
                                }
-                               else
+                               else {
                                        nodes_done = false;
+                               }
                        }
                }
        } while(!nodes_done);
@@ -504,7 +494,7 @@ void SVMCompiler::generate_closure_node(ShaderNode *node,
 {
        /* execute dependencies for closure */
        foreach(ShaderInput *in, node->inputs) {
-               if(!node_skip_input(node, in) && in->link) {
+               if(in->link != NULL) {
                        ShaderNodeSet dependencies;
                        find_dependencies(dependencies, state->nodes_done, in);
                        generate_svm_nodes(dependencies, state);
index af97a490a872e9b1d2aa130a1606666d6d296bc0..ddf35602fa6e6602c24316f55c56c242754a9115 100644 (file)
@@ -188,8 +188,6 @@ protected:
        int stack_size(SocketType::Type type);
        void stack_clear_users(ShaderNode *node, ShaderNodeSet& done);
 
-       bool node_skip_input(ShaderNode *node, ShaderInput *input);
-
        /* single closure */
        void find_dependencies(ShaderNodeSet& dependencies,
                               const ShaderNodeSet& done,