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:
authorClément Foucault <foucault.clem@gmail.com>2018-08-01 20:25:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-08-01 23:08:36 +0300
commitad64cb63448d69ec1667bfa2e4941dfb996841dd (patch)
tree837354560da816a85fa4a4aa2602394eec7f0002 /source/blender/gpu/intern/gpu_material.c
parent4510f30026da8eb090062687f386b9e3a7cf3fa3 (diff)
GPUMaterial: Make Localize tree live longer
This is in order to reference the localized node->storage when populating the UBO data.
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 2264836f24a..5e0d9275aa2 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -595,7 +595,9 @@ GPUMaterial *GPU_material_from_nodetree(
mat->engine_type = engine_type;
mat->options = options;
- ntreeGPUMaterialNodes(ntree, mat, &has_surface_output, &has_volume_output);
+ /* localize tree to create links for reroute and mute */
+ bNodeTree *localtree = ntreeLocalize(ntree);
+ ntreeGPUMaterialNodes(localtree, mat, &has_surface_output, &has_volume_output);
if (has_surface_output) {
mat->domain |= GPU_DOMAIN_SURFACE;
@@ -640,6 +642,11 @@ GPUMaterial *GPU_material_from_nodetree(
mat->status = GPU_MAT_FAILED;
}
+ /* Only free after GPU_pass_shader_get where GPUUniformBuffer
+ * read data from the local tree. */
+ ntreeFreeTree(localtree);
+ MEM_freeN(localtree);
+
/* note that even if building the shader fails in some way, we still keep
* it to avoid trying to compile again and again, and simply do not use
* the actual shader on drawing */