You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
[3.x] Fix shader crash when using local var with the same name as varying
This commit is contained in:
@@ -3495,6 +3495,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
||||
bool is_const = false;
|
||||
int array_size = 0;
|
||||
StringName struct_name;
|
||||
bool is_local = false;
|
||||
|
||||
if (p_block && p_block->block_tag != SubClassTag::TAG_GLOBAL) {
|
||||
int idx = 0;
|
||||
@@ -3547,6 +3548,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
||||
_set_error("Can't use function as identifier: " + String(identifier));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
is_local = ident_type == IDENTIFIER_LOCAL_VAR || ident_type == IDENTIFIER_FUNCTION_ARGUMENT;
|
||||
}
|
||||
|
||||
Node *index_expression = nullptr;
|
||||
@@ -3623,6 +3626,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
||||
arrname->call_expression = call_expression;
|
||||
arrname->assign_expression = assign_expression;
|
||||
arrname->is_const = is_const;
|
||||
arrname->is_local = is_local;
|
||||
expr = arrname;
|
||||
|
||||
} else {
|
||||
@@ -3631,6 +3635,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
|
||||
varname->datatype_cache = data_type;
|
||||
varname->is_const = is_const;
|
||||
varname->struct_name = struct_name;
|
||||
varname->is_local = is_local;
|
||||
expr = varname;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user