mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
Prevent return statement from using in block in shader main functions
This commit is contained in:
parent
dbef4bbd98
commit
c7043dbfdc
@ -7190,11 +7190,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
||||
//check return type
|
||||
BlockNode *b = p_block;
|
||||
|
||||
if (b && b->parent_function && p_function_info.main_function) {
|
||||
_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;
|
||||
}
|
||||
@ -7204,6 +7199,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
||||
return ERR_BUG;
|
||||
}
|
||||
|
||||
if (b && b->parent_function && p_function_info.main_function) {
|
||||
_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);
|
||||
String array_size_string;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user