Fix T38633: glsl not working well with mixed cycles/blender material nodes.
This commit is contained in:
parent
8439a165ff
commit
a252e27fec
Notes:
blender-bot
2023-02-14 11:12:05 +01:00
Referenced by issue #38633, Cycles material sometimes overrides GLSL material functionality
|
@ -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 *************** */
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue