Keeping track of discard
Shader compilation now keeps track of the discard key word. Previously only variables were monitored. But discard, which needs special treatment in some cases, went unnoticed by the compiler as discard is not a variable but a flow control. This commit adds monitoring for discard.
This commit is contained in:
parent
6c569c90b6
commit
c101dd5fa6
2 changed files with 9 additions and 0 deletions
|
@ -704,6 +704,10 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
|
|||
}
|
||||
code += ";\n";
|
||||
} else if (cf_node->flow_op == SL::FLOW_OP_DISCARD) {
|
||||
if (p_actions.usage_flag_pointers.has("DISCARD") && !used_flag_pointers.has("DISCARD")) {
|
||||
*p_actions.usage_flag_pointers["DISCARD"] = true;
|
||||
used_flag_pointers.insert("DISCARD");
|
||||
}
|
||||
code += "discard;";
|
||||
} else if (cf_node->flow_op == SL::FLOW_OP_CONTINUE) {
|
||||
code += "continue;";
|
||||
|
|
|
@ -700,6 +700,11 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
|
|||
}
|
||||
} else if (cfnode->flow_op == SL::FLOW_OP_DISCARD) {
|
||||
|
||||
if (p_actions.usage_flag_pointers.has("DISCARD") && !used_flag_pointers.has("DISCARD")) {
|
||||
*p_actions.usage_flag_pointers["DISCARD"] = true;
|
||||
used_flag_pointers.insert("DISCARD");
|
||||
}
|
||||
|
||||
code = "discard;";
|
||||
} else if (cfnode->flow_op == SL::FLOW_OP_CONTINUE) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue