diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-14 18:11:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-14 18:11:58 +0400 |
commit | a252e27fec16e09efe873a6bbbd29b3ad5d4c67f (patch) | |
tree | f5f98df5363c83acdc51b911f55261f5fe334f9c /source | |
parent | 8439a165ff50a6b3f690c04347aae8a253e08ca2 (diff) |
Fix T38633: glsl not working well with mixed cycles/blender material nodes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 5 | ||||
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.c | 4 | ||||
-rw-r--r-- | source/blender/nodes/shader/node_shader_util.c | 7 | ||||
-rw-r--r-- | source/blender/nodes/shader/node_shader_util.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_common.c | 2 |
6 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index d219c1c6e8d..59ea921e11e 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -770,7 +770,7 @@ void ntreeShaderGetTexcoMode(struct bNodeTree *ntree, int osa, short extern void (*node_shader_lamp_loop)(struct ShadeInput *, struct ShadeResult *); void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, struct ShadeResult *)); -void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat); +void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat, short compatibility); /* ************** COMPOSITE NODES *************** */ diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 2781437225b..608c498bd1e 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1592,7 +1592,10 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) if (!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) { /* create nodes */ - ntreeGPUMaterialNodes(ma->nodetree, mat); + if (BKE_scene_use_new_shading_nodes(scene)) + ntreeGPUMaterialNodes(ma->nodetree, mat, NODE_NEW_SHADING); + else + ntreeGPUMaterialNodes(ma->nodetree, mat, NODE_OLD_SHADING); } else { if (BKE_scene_use_new_shading_nodes(scene)) { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 1e828ea321c..2186eb7c226 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -187,14 +187,14 @@ void register_node_tree_type_sh(void) /* GPU material from shader nodes */ -void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat) +void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat, short compatibility) { /* localize tree to create links for reroute and mute */ bNodeTree *localtree = ntreeLocalize(ntree); bNodeTreeExec *exec; exec = ntreeShaderBeginExecTree(localtree); - ntreeExecGPUNodes(exec, mat, 1); + ntreeExecGPUNodes(exec, mat, 1, compatibility); ntreeShaderEndExecTree(exec); ntreeFreeTree_ex(localtree, false); diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index 86e59cd779a..8e83140733a 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -219,7 +219,7 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree) return inactivenode; } -void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) +void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs, short compatibility) { bNodeExec *nodeexec; bNode *node; @@ -238,8 +238,9 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) do_it = FALSE; /* for groups, only execute outputs for edited group */ if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) { - if (do_outputs && (node->flag & NODE_DO_OUTPUT)) - do_it = TRUE; + if (node->typeinfo->compatibility & compatibility) + if (do_outputs && (node->flag & NODE_DO_OUTPUT)) + do_it = TRUE; } else do_it = TRUE; diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index cfd97ab0d9e..8a79603fab4 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -98,6 +98,6 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeSta void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs); void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out); -void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs); +void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs, short compatibility); #endif diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c index 0ea4f949597..3f03bb45d8f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.c +++ b/source/blender/nodes/shader/nodes/node_shader_common.c @@ -218,7 +218,7 @@ static int gpu_group_execute(GPUMaterial *mat, bNode *node, bNodeExecData *execd #if 0 /* XXX NODE_GROUP_EDIT is deprecated, depends on node space */ ntreeExecGPUNodes(exec, mat, (node->flag & NODE_GROUP_EDIT)); #else - ntreeExecGPUNodes(exec, mat, 0); + ntreeExecGPUNodes(exec, mat, 0, NODE_NEW_SHADING|NODE_OLD_SHADING); #endif group_gpu_move_outputs(node, out, exec->stack); |