1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 09:09:40 +00:00

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
This commit is contained in:
AnyOldName3 2021-06-27 00:12:07 +01:00
parent 1f658209f8
commit 8a1b4bde8a

View file

@ -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