Ensure original (removed) state overrides replacement state when recreating shaders

When the shader visitor replaces state (e.g. changes the deprecated
alpha test to a shader-based one) it backs up the original state. If
shaders are recreated, we need to know what the canonical state was and
create shaders to implement that instead of creating shaders to
implement dummy replacement state.

This was actually usually working as the removed state got checked after
the active state, so overwrote anything derived from it. However, if the
active state had the override bit set, that would make it override the
removed state.

Skipping any active state that duplicates removed state fixes this case.

Resolves #6108
dont-compose-content
AnyOldName3 4 years ago
parent 1f658209f8
commit 8a1b4bde8a

@ -279,6 +279,8 @@ namespace Shader
{
for (osg::StateSet::AttributeList::const_iterator it = attributeMap.begin(); it != attributeMap.end(); ++it)
{
if (attributeMap != removedAttributes && removedAttributes.count(it->first))
continue;
if (it->first.first == osg::StateAttribute::MATERIAL)
{
// This should probably be moved out of ShaderRequirements and be applied directly now it's a uniform instead of a define

Loading…
Cancel
Save