diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2021-07-15 18:05:41 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-07-15 18:07:19 +0300 |
commit | 14d5b47a27645cc1c3df7a908516b9510686ea3b (patch) | |
tree | f80904a9af3271553d0f0252e45fb04e99d8d4c3 /servers | |
parent | 9427bf38427da6366118bfd21fbb2f064bc5719d (diff) |
Prevent error if varying assigned but not used (push warning instead)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/shader_language.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index f771d6d0ef..01765c48b6 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -946,7 +946,9 @@ void ShaderLanguage::_parse_used_identifier(const StringName &p_identifier, Iden break; case IdentifierType::IDENTIFIER_VARYING: if (HAS_WARNING(ShaderWarning::UNUSED_VARYING_FLAG) && used_varyings.has(p_identifier)) { - used_varyings[p_identifier].used = true; + if (shader->varyings[p_identifier].stage != ShaderNode::Varying::STAGE_VERTEX && shader->varyings[p_identifier].stage != ShaderNode::Varying::STAGE_FRAGMENT) { + used_varyings[p_identifier].used = true; + } } break; case IdentifierType::IDENTIFIER_UNIFORM: @@ -7862,15 +7864,6 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct tk = _get_token(); } - - for (Map<StringName, ShaderNode::Varying>::Element *E = shader->varyings.front(); E; E = E->next()) { - if (E->get().stage == ShaderNode::Varying::STAGE_VERTEX || E->get().stage == ShaderNode::Varying::STAGE_FRAGMENT) { - _set_tkpos(E->get().tkpos); - _set_error(RTR("Varying must only be used in two different stages, which can be 'vertex' 'fragment' and 'light'")); - return ERR_PARSE_ERROR; - } - } - return OK; } |