Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable dual source blend until a valid support test is found
  • Loading branch information
Tinob committed Apr 1, 2013
1 parent f432d60 commit 5ae8bec
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions Source/Plugins/Plugin_VideoDX9/Src/main.cpp
Expand Up @@ -103,7 +103,7 @@ void InitBackendInfo()
g_Config.backend_info.bUseMinimalMipCount = true;
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bSupportsSeparateAlphaFunction = device_caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND;
// Dual source blend will be tested later because in most devices the support is not declared in the device caps
// Dual source blend disabled by default until a proper method to test for support is found
g_Config.backend_info.bSupportsDualSourceBlend = false;
g_Config.backend_info.bSupportsFormatReinterpretation = true;
g_Config.backend_info.bSupportsPixelLighting = C_PLIGHTS + 40 <= maxConstants && C_PMATERIALS + 4 <= maxConstants;
Expand Down Expand Up @@ -189,45 +189,7 @@ void VideoBackend::Video_Prepare()
PixelShaderManager::Init();
CommandProcessor::Init();
PixelEngine::Init();
DLCache::Init();
// Test fo dual source blend support
// We can only support dual source blend if we first suport a separate alpha function
g_Config.backend_info.bSupportsDualSourceBlend = g_Config.backend_info.bSupportsSeparateAlphaFunction;
if(g_Config.backend_info.bSupportsDualSourceBlend)
{
// Test all the belnding modes that dual source blend requires
DWORD d3d_state = 0;
DWORD d3d_old_state = 0;
D3D::dev->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
D3D::dev->GetRenderState(D3DRS_SRCBLEND, &d3d_old_state);
// Test for source D3DBLEND_SRCCOLOR2 support
D3D::dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR2);
D3D::dev->GetRenderState(D3DRS_SRCBLEND, &d3d_state);
g_Config.backend_info.bSupportsDualSourceBlend = (d3d_state == D3DBLEND_SRCCOLOR2);
// Test for source D3DBLEND_INVSRCCOLOR2 support
d3d_state = 0;
D3D::dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_INVSRCCOLOR2);
D3D::dev->GetRenderState(D3DRS_SRCBLEND, &d3d_state);
g_Config.backend_info.bSupportsDualSourceBlend = g_Config.backend_info.bSupportsDualSourceBlend && d3d_state == D3DBLEND_INVSRCCOLOR2;
// Restore original state
D3D::dev->SetRenderState(D3DRS_SRCBLEND, d3d_old_state);

d3d_old_state = 0;
D3D::dev->GetRenderState(D3DRS_DESTBLEND, &d3d_old_state);
// Test for destination D3DBLEND_SRCCOLOR2 support
D3D::dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR2);
D3D::dev->GetRenderState(D3DRS_DESTBLEND, &d3d_state);
g_Config.backend_info.bSupportsDualSourceBlend = g_Config.backend_info.bSupportsDualSourceBlend && d3d_state == D3DBLEND_SRCCOLOR2;
// test for destination D3DBLEND_INVSRCCOLOR2 support
d3d_state = 0;
D3D::dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR2);
D3D::dev->GetRenderState(D3DRS_DESTBLEND, &d3d_state);
g_Config.backend_info.bSupportsDualSourceBlend = g_Config.backend_info.bSupportsDualSourceBlend && d3d_state == D3DBLEND_INVSRCCOLOR2;
// Restore original state
D3D::dev->SetRenderState(D3DRS_DESTBLEND, d3d_old_state);

D3D::dev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
}
DLCache::Init();
// Notify the core that the video backend is ready
Host_Message(WM_USER_CREATE);
}
Expand Down

0 comments on commit 5ae8bec

Please sign in to comment.