diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-12 14:48:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-15 22:33:15 +0300 |
commit | 6701db773e660e5306e305a1b10f8ea52955f06b (patch) | |
tree | 398947496e7920d12dc8ec84bc8fb9f0cd5ad558 /source/blender/gpu/intern/gpu_codegen.c | |
parent | ab18dbb67e059ce1505189a14739e1e4deffacc1 (diff) |
Cleanup: don't perform some GPU shader codegen operations twice
Diffstat (limited to 'source/blender/gpu/intern/gpu_codegen.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 12 |
1 files changed, 6 insertions, 6 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); |