ShaderComposition mechanism on the osg::State fixed: condition improved

This commit is contained in:
valid-ptr 2020-10-28 15:13:19 +03:00 committed by konstantin.matveyev
parent 43724f004e
commit 0415b7df84

View File

@ -715,7 +715,7 @@ void State::apply(const StateSet* dstate)
// Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism) // Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism)
if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 || if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 ||
(_lastAppliedProgramObject->getProgram() != _attributeMap[_lastAppliedProgramObject->getProgram()->getTypeMemberPair()].last_applied_attribute))) (_lastAppliedProgramObject->getProgram() != getLastAppliedAttribute(osg::StateAttribute::PROGRAM))))
{ {
// No program has been applied by the StateSet stack so assume shader composition is required // No program has been applied by the StateSet stack so assume shader composition is required
applyShaderComposition(); applyShaderComposition();
@ -786,7 +786,7 @@ void State::apply()
// Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism) // Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism)
if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 || if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 ||
(_lastAppliedProgramObject->getProgram() != _attributeMap[_lastAppliedProgramObject->getProgram()->getTypeMemberPair()].last_applied_attribute))) (_lastAppliedProgramObject->getProgram() != getLastAppliedAttribute(osg::StateAttribute::PROGRAM))))
{ {
// No program has been applied by the StateSet stack so assume shader composition is required // No program has been applied by the StateSet stack so assume shader composition is required
applyShaderComposition(); applyShaderComposition();