Prevent error if varying assigned but not used (push warning instead)
This commit is contained in:
parent
9427bf3842
commit
14d5b47a27
1 changed files with 3 additions and 10 deletions
|
@ -946,8 +946,10 @@ 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)) {
|
||||
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:
|
||||
if (HAS_WARNING(ShaderWarning::UNUSED_UNIFORM_FLAG) && used_uniforms.has(p_identifier)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue