Skip to content

Commit 4638f3d

Browse files
committed
Merge pull request godotengine#102892 from Chaosus/shader_fix_varying_increment_crash
Fix crash at using increment op for varying in `light` shader function
2 parents ba7b500 + 946c254 commit 4638f3d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

servers/rendering/shader_language.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7276,8 +7276,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
72767276
return nullptr;
72777277
}
72787278

7279-
if (!_validate_assign(expr, p_function_info)) {
7280-
_set_error(RTR("Invalid use of increment/decrement operator in a constant expression."));
7279+
String error;
7280+
if (!_validate_assign(expr, p_function_info, &error)) {
7281+
_set_error(error);
72817282
return nullptr;
72827283
}
72837284
expr = op;
@@ -7611,8 +7612,10 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
76117612
for (int i = expr_pos - 1; i >= next_op; i--) {
76127613
OperatorNode *op = alloc_node<OperatorNode>();
76137614
op->op = expression[i].op;
7614-
if ((op->op == OP_INCREMENT || op->op == OP_DECREMENT) && !_validate_assign(expression[i + 1].node, p_function_info)) {
7615-
_set_error(RTR("Invalid use of increment/decrement operator in a constant expression."));
7615+
7616+
String error;
7617+
if ((op->op == OP_INCREMENT || op->op == OP_DECREMENT) && !_validate_assign(expression[i + 1].node, p_function_info, &error)) {
7618+
_set_error(error);
76167619
return nullptr;
76177620
}
76187621
op->arguments.push_back(expression[i + 1].node);

0 commit comments

Comments
 (0)