Here’s the code:
if( !m_bs )
{
CD3D11_BLEND_DESC blendDesc{ D3D11_DEFAULT };
D3D11_RENDER_TARGET_BLEND_DESC& rt = blendDesc.RenderTarget[ 0 ];
rt.BlendEnable = TRUE;
rt.SrcBlend = D3D11_BLEND_BLEND_FACTOR;
rt.BlendOp = D3D11_BLEND_OP_ADD;
rt.DestBlend = D3D11_BLEND_ZERO;
rt.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE;
CHECK( device->CreateBlendState( &blendDesc, &m_bs ) );
}
float f;
switch( mode )
{
case 0: // 2x brighter
f = 2;
break;
case 1: // 50% darker
f = 0.5f;
break;
default:
return S_FALSE;
}
const float BlendFactor[ 4 ] = { f, f, f, f };
context->OMSetBlendState( m_bs, BlendFactor, 0xffffffff );
50% darker works OK, 2x brighter doesn’t change anything. Why? Is there undocumented limit on the blend factor values?
My render target is DXGI_FORMAT_R10G10B10A2_UNORM
, using D3D 11 feature level 11.0.
User contributions licensed under CC BY-SA 3.0