From 9b1f8f7a96a754a1c17082bcdb73510026cf185e Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Thu, 25 Nov 2021 16:13:19 +0300 Subject: [PATCH] Revert "Pushes array of uniforms to first place in the buffer" --- servers/rendering/shader_language.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index c7a7ed154e2..50719ecfc34 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -7441,6 +7441,7 @@ Error ShaderLanguage::_parse_shader(const Map &p_funct int texture_uniforms = 0; int texture_binding = 0; + int uniforms = 0; int instance_index = 0; ShaderNode::Uniform::Scope uniform_scope = ShaderNode::Uniform::SCOPE_LOCAL; @@ -7791,6 +7792,9 @@ Error ShaderLanguage::_parse_shader(const Map &p_funct return ERR_PARSE_ERROR; } uniform2.texture_order = -1; + if (uniform_scope != ShaderNode::Uniform::SCOPE_INSTANCE) { + uniform2.order = uniforms++; + } } if (uniform2.array_size > 0) { @@ -8769,20 +8773,6 @@ Error ShaderLanguage::_parse_shader(const Map &p_funct tk = _get_token(); } - int uniforms = 0; - - // Need to push arrays to first place in a uniform buffer in order to correct work. - for (Map::Element *E = shader->uniforms.front(); E; E = E->next()) { - if (E->get().texture_order == -1 && E->get().scope != ShaderNode::Uniform::SCOPE_INSTANCE && E->get().array_size > 0) { - E->get().order = uniforms++; - } - } - for (Map::Element *E = shader->uniforms.front(); E; E = E->next()) { - if (E->get().texture_order == -1 && E->get().scope != ShaderNode::Uniform::SCOPE_INSTANCE && E->get().array_size == 0) { - E->get().order = uniforms++; - } - } - int error_line; String error_message; if (!_check_varying_usages(&error_line, &error_message)) {