summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-22 13:18:32 +0200
committerGitHub <noreply@github.com>2021-09-22 13:18:32 +0200
commitf25aaa98d626ddbf4d19ee0b1f3cc8e3483b2fdb (patch)
treebe85ffdd9ba20980feada225055b678f171f6b65
parenta48dc10103be7477e3f63e5966e2c427c11aeb4e (diff)
parente9e21a592e5d7a001c37eeb0502f139775f858d0 (diff)
Merge pull request #52931 from Chaosus/fix_shader_comparison_crash
-rw-r--r--servers/rendering/shader_language.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 89537f8b7c..d6f8fe85c9 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -5252,7 +5252,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
#if DEBUG_ENABLED
- if (check_warnings && HAS_WARNING(ShaderWarning::FLOAT_COMPARISON_FLAG) && (op == OP_EQUAL || op == OP_NOT_EQUAL) && expression[i - 1].node->get_datatype() == TYPE_FLOAT && expression[i + 1].node->get_datatype() == TYPE_FLOAT) {
+ if (check_warnings && HAS_WARNING(ShaderWarning::FLOAT_COMPARISON_FLAG) && (op == OP_EQUAL || op == OP_NOT_EQUAL) &&
+ (!expression[i - 1].is_op && !expression[i + 1].is_op) &&
+ (expression[i - 1].node->get_datatype() == TYPE_FLOAT && expression[i + 1].node->get_datatype() == TYPE_FLOAT)) {
_add_line_warning(ShaderWarning::FLOAT_COMPARISON);
}
#endif // DEBUG_ENABLED