Allow using vertex-stage varying in both fragment
and light
This commit is contained in:
parent
a4c863791e
commit
17b462cc5f
2 changed files with 6 additions and 22 deletions
|
@ -3324,8 +3324,7 @@ bool ShaderLanguage::_validate_varying_assign(ShaderNode::Varying &p_varying, St
|
|||
p_varying.stage = ShaderNode::Varying::STAGE_FRAGMENT;
|
||||
}
|
||||
break;
|
||||
case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT:
|
||||
case ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT:
|
||||
case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT_LIGHT:
|
||||
case ShaderNode::Varying::STAGE_VERTEX:
|
||||
if (current_function == varying_function_names.fragment) {
|
||||
*r_message = RTR("Varyings which assigned in 'vertex' function may not be reassigned in 'fragment' or 'light'.");
|
||||
|
@ -3351,10 +3350,8 @@ bool ShaderLanguage::_validate_varying_using(ShaderNode::Varying &p_varying, Str
|
|||
*r_message = RTR("Varying must be assigned before using!");
|
||||
return false;
|
||||
case ShaderNode::Varying::STAGE_VERTEX:
|
||||
if (current_function == varying_function_names.fragment) {
|
||||
p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT;
|
||||
} else if (current_function == varying_function_names.light) {
|
||||
p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT;
|
||||
if (current_function == varying_function_names.fragment || current_function == varying_function_names.light) {
|
||||
p_varying.stage = ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT_LIGHT;
|
||||
}
|
||||
break;
|
||||
case ShaderNode::Varying::STAGE_FRAGMENT:
|
||||
|
@ -3362,18 +3359,6 @@ bool ShaderLanguage::_validate_varying_using(ShaderNode::Varying &p_varying, Str
|
|||
p_varying.stage = ShaderNode::Varying::STAGE_FRAGMENT_TO_LIGHT;
|
||||
}
|
||||
break;
|
||||
case ShaderNode::Varying::STAGE_VERTEX_TO_FRAGMENT:
|
||||
if (current_function == varying_function_names.light) {
|
||||
*r_message = RTR("Varying must only be used in two different stages, which can be 'vertex' 'fragment' and 'light'");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ShaderNode::Varying::STAGE_VERTEX_TO_LIGHT:
|
||||
if (current_function == varying_function_names.fragment) {
|
||||
*r_message = RTR("Varying must only be used in two different stages, which can be 'vertex' 'fragment' and 'light'");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -646,10 +646,9 @@ public:
|
|||
struct Varying {
|
||||
enum Stage {
|
||||
STAGE_UNKNOWN,
|
||||
STAGE_VERTEX, // transition stage to STAGE_VERTEX_TO_FRAGMENT or STAGE_VERTEX_TO_LIGHT, emits error if they are not used
|
||||
STAGE_FRAGMENT, // transition stage to STAGE_FRAGMENT_TO_LIGHT, emits error if it's not used
|
||||
STAGE_VERTEX_TO_FRAGMENT,
|
||||
STAGE_VERTEX_TO_LIGHT,
|
||||
STAGE_VERTEX, // transition stage to STAGE_VERTEX_TO_FRAGMENT_LIGHT, emits warning if it's not used
|
||||
STAGE_FRAGMENT, // transition stage to STAGE_FRAGMENT_TO_LIGHT, emits warning if it's not used
|
||||
STAGE_VERTEX_TO_FRAGMENT_LIGHT,
|
||||
STAGE_FRAGMENT_TO_LIGHT,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue