[Bf-blender-cvs] [6701db773e6] master: Cleanup: don't perform some GPU shader codegen operations twice

Brecht Van Lommel noreply at git.blender.org
Sat Feb 15 21:13:28 CET 2020


Commit: 6701db773e660e5306e305a1b10f8ea52955f06b
Author: Brecht Van Lommel
Date:   Wed Feb 12 12:48:44 2020 +0100
Branches: master
https://developer.blender.org/rB6701db773e660e5306e305a1b10f8ea52955f06b

Cleanup: don't perform some GPU shader codegen operations twice

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

M	source/blender/gpu/intern/gpu_codegen.c
M	source/blender/gpu/intern/gpu_codegen.h
M	source/blender/gpu/intern/gpu_material.c

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

diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 3f7a5962efc..4787015e3d6 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1684,7 +1684,7 @@ static void gpu_nodes_free(ListBase *nodes)
 
 /* vertex attributes */
 
-void GPU_nodes_get_vertex_attrs(ListBase *nodes, GPUVertAttrLayers *attrs)
+static void gpu_nodes_get_vertex_attrs(ListBase *nodes, GPUVertAttrLayers *attrs)
 {
   GPUNode *node;
   GPUInput *input;
@@ -1942,7 +1942,7 @@ static void gpu_nodes_tag(GPUNodeLink *link)
   }
 }
 
-void GPU_nodes_prune(ListBase *nodes, GPUNodeLink *outlink)
+static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink)
 {
   GPUNode *node, *next;
 
@@ -2009,10 +2009,10 @@ GPUPass *GPU_generate_pass(GPUMaterial *material,
   char *vertexcode, *geometrycode, *fragmentcode;
   GPUPass *pass = NULL, *pass_hash = NULL;
 
-  /* prune unused nodes */
-  GPU_nodes_prune(nodes, frag_outlink);
-
-  GPU_nodes_get_vertex_attrs(nodes, attrs);
+  /* Prune the unused nodes and extract attributes before compiling so the
+   * generated VBOs are ready to accept the future shader. */
+  gpu_nodes_prune(nodes, frag_outlink);
+  gpu_nodes_get_vertex_attrs(nodes, attrs);
 
   /* generate code */
   char *fragmentgen = code_generate_fragment(material, nodes, frag_outlink->output, builtins);
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index f8e1b76580f..baa4debf862 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -188,8 +188,6 @@ GPUPass *GPU_generate_pass(GPUMaterial *material,
 struct GPUShader *GPU_pass_shader_get(GPUPass *pass);
 
 void GPU_nodes_extract_dynamic_inputs(struct GPUShader *shader, ListBase *inputs, ListBase *nodes);
-void GPU_nodes_get_vertex_attrs(ListBase *nodes, struct GPUVertAttrLayers *attrs);
-void GPU_nodes_prune(ListBase *nodes, struct GPUNodeLink *outlink);
 
 bool GPU_pass_compile(GPUPass *pass, const char *shname);
 void GPU_pass_release(GPUPass *pass);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 2f52aea2c91..d8d431e329a 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -690,10 +690,6 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
                                  "#  define USE_SSS\n"
                                  "#endif\n");
     }
-    /* Prune the unused nodes and extract attributes before compiling so the
-     * generated VBOs are ready to accept the future shader. */
-    GPU_nodes_prune(&mat->nodes, mat->outlink);
-    GPU_nodes_get_vertex_attrs(&mat->nodes, &mat->attrs);
     /* Create source code and search pass cache for an already compiled version. */
     mat->pass = GPU_generate_pass(mat,
                                   mat->outlink,



More information about the Bf-blender-cvs mailing list