Closed vdrfan closed 2 years ago
DX11 use D3D11_DEFAULT_SAMPLE_MASK. https://github.com/Aleksoid1978/VideoRenderer/blob/master/Source/DX11VideoProcessor.cpp#L256
Full transparent(ARGB) = 0xFF, 0, 0, 0.
when using OMSetBlendState m_pAlphaBlendStateInv(not m_pAlphaBlendState) then Full transparent(ARGB) = 0, 0, 0, 0. otherwise transparancy is not working as expected.
mpc-be has a variable for this in CDX9SubPic::AlphaBlt (see m_bInvAlpha) and mpc-be sets this to SetInverseAlpha(true); in LookupSubPic i think that DX11 Renderer should behave the same.
also EVR Renderer is mixing in this behaviour.
I do not understand what you want. Subtitles and OSD working, include transparent. If something is not right, show screenshots of what is wrong, as it should be.
We will not invert the alpha channel, because this will break compatibility with MPC-BE, MPC-HC and other players.
SetAlphaBitmap is not working as expected. for example, with full transparent Bitmap (ARGB 0,0,0,0), resulting image is opaque black.
change of following code would fix it: (also original comment is wrong "// ... inverse alpha channel for dst")
Function AlphaBlt in DX9VideoProcessor.cpp hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA); // ... inverse alpha channel for dst should be: pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
and in Function, CDX11VideoProcessor::AlphaBlt(... we should do: m_pDeviceContext->OMSetBlendState(m_pAlphaBlendStateInv, nullptr, D3D11_DEFAULT_SAMPLE_MASK);
regards, onur