From 2d28df783a029ee5b64da005b2fa400e4e8de976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 11 May 2019 14:37:27 +0200 Subject: GPU: Move Material index to nodetree evaluation This removes the need to pass the Material* all over the place in the draw manager. Cleanup comming right after. --- source/blender/gpu/intern/gpu_material.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/gpu/intern/gpu_material.c') diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 6aa13b0d8ca..de9ed56abf5 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -231,6 +231,12 @@ ListBase *GPU_material_get_inputs(GPUMaterial *material) return &material->inputs; } +/* Return can be NULL if it's a world material. */ +Material *GPU_material_get_material(GPUMaterial *material) +{ + return material->ma; +} + GPUUniformBuffer *GPU_material_uniform_buffer_get(GPUMaterial *material) { return material->ubo; @@ -637,6 +643,7 @@ GPUMaterial *GPU_material_from_nodetree_find(ListBase *gpumaterials, * so only do this when they are needed. */ GPUMaterial *GPU_material_from_nodetree(Scene *scene, + struct Material *ma, struct bNodeTree *ntree, ListBase *gpumaterials, const void *engine_type, @@ -655,6 +662,7 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene, /* allocate material */ GPUMaterial *mat = MEM_callocN(sizeof(GPUMaterial), "GPUMaterial"); + mat->ma = ma; mat->scene = scene; mat->engine_type = engine_type; mat->options = options; -- cgit v1.2.3