Merge pull request #50729 from Chaosus/shader_varying_enchancements2
Allow using vertex-stage varying in both `fragment` and `light` functions
This commit is contained in:
commit
a8fcfbf029
|
@ -3326,8 +3326,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'.");
|
||||
|
@ -3356,10 +3355,8 @@ bool ShaderLanguage::_validate_varying_using(ShaderNode::Varying &p_varying, Str
|
|||
unknown_varying_usages.push_back(usage);
|
||||
break;
|
||||
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:
|
||||
|
@ -3367,18 +3364,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 New Issue