[3.x] Prevent return statement from using in block in shader main func
This commit is contained in:
parent
3970f28f67
commit
5928cc90f8
1 changed files with 5 additions and 5 deletions
|
@ -5385,11 +5385,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
|||
//check return type
|
||||
BlockNode *b = p_block;
|
||||
|
||||
if (b && b->parent_function && (b->parent_function->name == "vertex" || b->parent_function->name == "fragment" || b->parent_function->name == "light")) {
|
||||
_set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name));
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
while (b && !b->parent_function) {
|
||||
b = b->parent_block;
|
||||
}
|
||||
|
@ -5399,6 +5394,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
|
|||
return ERR_BUG;
|
||||
}
|
||||
|
||||
if (b && b->parent_function && (b->parent_function->name == "vertex" || b->parent_function->name == "fragment" || b->parent_function->name == "light")) {
|
||||
_set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name));
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
String return_struct_name = String(b->parent_function->return_struct_name);
|
||||
|
||||
ControlFlowNode *flow = alloc_node<ControlFlowNode>();
|
||||
|
|
Loading…
Reference in a new issue