1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00

Adapt destination alpha factor for AMD

As discussed in the comment, it's unclear to me whether this is a driver
bug or mandatory behaviour only AMD implement.

Some more context is here:
https://gitlab.com/OpenMW/openmw/-/issues/6119#note_618245903
This commit is contained in:
AnyOldName3 2021-07-04 23:00:33 +01:00
parent 0e57622bbe
commit e42b3bf960

View File

@ -2011,6 +2011,11 @@ namespace NifOsg
{
osg::ref_ptr<osg::BlendFunc> blendFunc (new osg::BlendFunc(getBlendMode((alphaprop->flags>>1)&0xf),
getBlendMode((alphaprop->flags>>5)&0xf)));
// on AMD hardware, alpha still seems to be stored with an RGBA framebuffer with OpenGL.
// This might be mandated by the OpenGL 2.1 specification section 2.14.9, or might be a bug.
// Either way, D3D8.1 doesn't do that, so adapt the destination factor.
if (blendFunc->getDestination() == GL_DST_ALPHA)
blendFunc->setDestination(GL_ONE);
blendFunc = shareAttribute(blendFunc);
stateset->setAttributeAndModes(blendFunc, osg::StateAttribute::ON);