diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-11 15:37:27 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 11:57:03 +0300 |
commit | 2d28df783a029ee5b64da005b2fa400e4e8de976 (patch) | |
tree | 52761ab5351a3db388482029625e3c0526044037 /source/blender/nodes | |
parent | 642c8010b210e1671f4faa0ca1c097c77f19042a (diff) |
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.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_object_info.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c index 5520f6f325f..118b8136693 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c @@ -35,13 +35,17 @@ static int node_shader_gpu_object_info(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { + Material *ma = GPU_material_get_material(mat); + /* Convert to float. */ + float index = ma ? ma->index : 0; return GPU_stack_link(mat, node, "node_object_info", in, out, GPU_builtin(GPU_OBJECT_MATRIX), - GPU_builtin(GPU_OBJECT_INFO)); + GPU_builtin(GPU_OBJECT_INFO), + GPU_constant(&index)); } static void node_shader_exec_object_info(void *UNUSED(data), |