Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-12 14:48:44 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-15 22:33:15 +0300
commit6701db773e660e5306e305a1b10f8ea52955f06b (patch)
tree398947496e7920d12dc8ec84bc8fb9f0cd5ad558 /source/blender
parentab18dbb67e059ce1505189a14739e1e4deffacc1 (diff)
Cleanup: don't perform some GPU shader codegen operations twice
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c12
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h2
-rw-r--r--source/blender/gpu/intern/gpu_material.c4
3 files changed, 6 insertions, 12 deletions
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,