Possible bug in D3D11RenderSystem::createBlendState Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
bishopnator
Gnome
Posts: 388
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 18

Possible bug in D3D11RenderSystem::createBlendState

Post by bishopnator »

Hi, I am about to use the HlmsPsoProp::StrongBlendblockBits which were discussed here and I noticed 2 possible problems:

  1. in D3D11RenderSystem::createBlendState the blending operations are not setup corectly: If newBlock->mSeparateBlend is true, only newBlock->mBlendOperation is used, and if the mSeparateBlend is false, both newBlock->mSeparateBlend/newBlock->mBlendOperationAlpha are used. This seems like a code swap somehow.

    Code: Select all

    if( newBlock->mSeparateBlend )
    {
        ...
        blendDesc.RenderTarget[0].BlendOp = blendDesc.RenderTarget[0].BlendOpAlpha =
            D3D11Mappings::get( newBlock->mBlendOperation );
        ...
    }
    else
    {
        ...
        blendDesc.RenderTarget[0].BlendOp = D3D11Mappings::get( newBlock->mBlendOperation );
        blendDesc.RenderTarget[0].BlendOpAlpha =
            D3D11Mappings::get( newBlock->mBlendOperationAlpha );
        ...
    }
    
  2. If HlmsPsoProp::StrongBlendblockBits is set, the Ogre should in Hlms::applyStrongBlendblockRules properly set mSeparateBlend value (e.g. by calling calculateSeparateBlendMode at the end).
User avatar
bishopnator
Gnome
Posts: 388
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 18

Re: Possible bug in D3D11RenderSystem::createBlendState

Post by bishopnator »

Here are the suggested changes: https://github.com/OGRECave/ogre-next/pull/583