diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 771be4bb3d4..45d3b3f09fa 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -2715,8 +2715,7 @@ void RendererStorageRD::MaterialData::update_textures(const Maparguments[i], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); - if (is_texture_func && i == 1 && (onode->arguments[i]->type == SL::Node::TYPE_VARIABLE || onode->arguments[i]->type == SL::Node::TYPE_OPERATOR)) { + if (is_texture_func && i == 1) { //need to map from texture to sampler in order to sample StringName texture_uniform; bool correct_texture_uniform = false; - if (onode->arguments[i]->type == SL::Node::TYPE_VARIABLE) { - const SL::VariableNode *varnode = static_cast(onode->arguments[i]); - texture_uniform = varnode->name; - correct_texture_uniform = true; - } else { // array indexing operator handling - const SL::OperatorNode *opnode = static_cast(onode->arguments[i]); - if (opnode->op == SL::Operator::OP_INDEX && opnode->arguments[0]->type == SL::Node::TYPE_ARRAY) { - const SL::ArrayNode *anode = static_cast(opnode->arguments[0]); + switch (onode->arguments[i]->type) { + case SL::Node::TYPE_VARIABLE: { + const SL::VariableNode *varnode = static_cast(onode->arguments[i]); + texture_uniform = varnode->name; + correct_texture_uniform = true; + } break; + case SL::Node::TYPE_ARRAY: { + const SL::ArrayNode *anode = static_cast(onode->arguments[i]); texture_uniform = anode->name; correct_texture_uniform = true; - } + } break; + default: + break; } if (correct_texture_uniform) {