Explorar o código

Merge pull request #39822 from Chaosus/shader_fix_const_pass

Fix few places in shaders where const passing still incorrect
Yuri Roubinsky %!s(int64=5) %!d(string=hai) anos
pai
achega
f1d7bb6b36
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      servers/rendering/shader_language.cpp

+ 4 - 2
servers/rendering/shader_language.cpp

@@ -3560,7 +3560,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
 											error = true;
 											error = true;
 										} else if (n->type == Node::TYPE_ARRAY) {
 										} else if (n->type == Node::TYPE_ARRAY) {
 											ArrayNode *an = static_cast<ArrayNode *>(n);
 											ArrayNode *an = static_cast<ArrayNode *>(n);
-											if (an->call_expression != nullptr) {
+											if (an->call_expression != nullptr || an->is_const) {
 												error = true;
 												error = true;
 											}
 											}
 										} else if (n->type == Node::TYPE_VARIABLE) {
 										} else if (n->type == Node::TYPE_VARIABLE) {
@@ -3569,7 +3569,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
 												error = true;
 												error = true;
 											} else {
 											} else {
 												StringName varname = vn->name;
 												StringName varname = vn->name;
-												if (shader->uniforms.has(varname)) {
+												if (shader->constants.has(varname)) {
+													error = true;
+												} else if (shader->uniforms.has(varname)) {
 													error = true;
 													error = true;
 												} else {
 												} else {
 													if (p_builtin_types.has(varname)) {
 													if (p_builtin_types.has(varname)) {