diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2010-03-03 17:45:36 +0300 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2010-03-03 17:45:36 +0300 |
commit | aeee62deb22103b68a966d9af72c6280118cfcfd (patch) | |
tree | 5558644f8f2c5582e488c31363181d3dd010d924 /src/apps | |
parent | 8946395125db1cb70639a4665353cdc47fc75a8d (diff) |
Add : select D3D device for render, incl. DXVA(EVR Custom & VMR9-Renderless only) if 2 ore more video adapter in system;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1724 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps')
26 files changed, 138 insertions, 7 deletions
diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.cpp b/src/apps/mplayerc/DX9AllocatorPresenter.cpp index 0642a5a24..3c0239493 100644 --- a/src/apps/mplayerc/DX9AllocatorPresenter.cpp +++ b/src/apps/mplayerc/DX9AllocatorPresenter.cpp @@ -1011,7 +1011,7 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, pp.FullScreen_RefreshRateInHz = DisplayMode.RefreshRate;
hr = m_pD3DEx->CreateDeviceEx(
- GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ GetAdapter(m_pD3D, true), D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
&pp, &DisplayMode, &m_pD3DDevEx);
@@ -1027,7 +1027,7 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, if (!m_pD3DDev)
{
hr = m_pD3D->CreateDevice(
- GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ GetAdapter(m_pD3D, true), D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
&pp, &m_pD3DDev);
if (m_pD3DDev)
@@ -1079,7 +1079,7 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, if (m_pD3DEx)
{
hr = m_pD3DEx->CreateDeviceEx(
- GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ GetAdapter(m_pD3D, true), D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
&pp, NULL, &m_pD3DDevEx);
if (m_pD3DDevEx)
@@ -1088,7 +1088,7 @@ if (FAILED(g_pD3D->CreateDevice( AdapterToUse, DeviceType, hWnd, else
{
hr = m_pD3D->CreateDevice(
- GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ GetAdapter(m_pD3D, true), D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
&pp, &m_pD3DDev);
}
@@ -1270,7 +1270,7 @@ HRESULT CDX9AllocatorPresenter::AllocSurfaces(D3DFORMAT Format) void CDX9AllocatorPresenter::DeleteSurfaces()
{
- CAutoLock cAutoLock(this);
+ CAutoLock cAutoLock(this);
CAutoLock cRenderLock(&m_RenderLock);
for(int i = 0; i < m_nNbDXSurface+2; i++)
@@ -1280,11 +1280,27 @@ void CDX9AllocatorPresenter::DeleteSurfaces() }
}
-UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D)
+UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool CreateDevice)
{
if(m_hWnd == NULL || pD3D == NULL)
return D3DADAPTER_DEFAULT;
+ AppSettings& s = AfxGetAppSettings();
+ if(CreateDevice && (pD3D->GetAdapterCount()>1) && (s.D3D9RenderDevice != _T("")))
+ {
+ TCHAR strGUID[50];
+ D3DADAPTER_IDENTIFIER9 adapterIdentifier;
+
+ for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
+ {
+ if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK)
+ {
+ if ((::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0) && (s.D3D9RenderDevice == strGUID))
+ return adp;
+ }
+ }
+ }
+
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
if(hMonitor == NULL) return D3DADAPTER_DEFAULT;
diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.h b/src/apps/mplayerc/DX9AllocatorPresenter.h index 0d978ea96..07c563bd8 100644 --- a/src/apps/mplayerc/DX9AllocatorPresenter.h +++ b/src/apps/mplayerc/DX9AllocatorPresenter.h @@ -169,7 +169,7 @@ namespace DSObjects void StartWorkerThreads();
void StopWorkerThreads();
- UINT GetAdapter(IDirect3D9 *pD3D);
+ UINT GetAdapter(IDirect3D9 *pD3D, bool GetAdapter = false);
float m_bicubicA;
HRESULT InitResizers(float bicubicA, bool bNeedScreenSizeTexture);
diff --git a/src/apps/mplayerc/PPageOutput.cpp b/src/apps/mplayerc/PPageOutput.cpp index caa12d38c..157bee245 100644 --- a/src/apps/mplayerc/PPageOutput.cpp +++ b/src/apps/mplayerc/PPageOutput.cpp @@ -47,6 +47,8 @@ CPPageOutput::CPPageOutput() , m_fResetDevice(FALSE)
, m_iEvrBuffers(L"5")
, m_fD3DFullscreen(FALSE)
+ , m_fD3D9RenderDevice(FALSE)
+ , m_iD3D9RenderDevice(-1)
{
}
@@ -73,6 +75,10 @@ void CPPageOutput::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_FULLSCREEN_MONITOR_CHECK, m_fD3DFullscreen);
DDX_CBString(pDX, IDC_EVR_BUFFERS, m_iEvrBuffers);
+
+ DDX_Check(pDX, IDC_D3D9DEVICE, m_fD3D9RenderDevice);
+ DDX_CBIndex(pDX, IDC_D3D9DEVICE_COMBO, m_iD3D9RenderDevice);
+ DDX_Control(pDX, IDC_D3D9DEVICE_COMBO, m_iD3D9RenderDeviceCtrl);
}
BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
@@ -80,6 +86,7 @@ BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase) ON_CBN_SELCHANGE(IDC_DX_SURFACE, &CPPageOutput::OnSurfaceChange)
ON_CONTROL_RANGE(BN_CLICKED, IDC_DSSYSDEF, IDC_DSSYNC, &CPPageOutput::OnDSRendererChange)
ON_BN_CLICKED(IDC_FULLSCREEN_MONITOR_CHECK, OnFullscreenCheck)
+ ON_BN_CLICKED(IDC_D3D9DEVICE, OnD3D9DeviceCheck)
END_MESSAGE_MAP()
void CPPageOutput::DisableRadioButton(UINT nID, UINT nDefID)
@@ -187,6 +194,51 @@ BOOL CPPageOutput::OnInitDialog() CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
+ //
+ IDirect3D9* pD3D;
+ if (pD3D = Direct3DCreate9(D3D_SDK_VERSION))
+ {
+ TCHAR strGUID[50];
+ CString cstrGUID;
+ CString d3ddevice_str = _T("");
+ CStringArray adapterList;
+
+ D3DADAPTER_IDENTIFIER9 adapterIdentifier;
+
+ for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
+ {
+ if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK)
+ {
+ d3ddevice_str = adapterIdentifier.Description;
+ d3ddevice_str += _T(" - ");
+ d3ddevice_str += adapterIdentifier.DeviceName;
+ cstrGUID = _T("");
+ if (::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0)
+ {
+ cstrGUID = strGUID;
+ }
+ if((cstrGUID != _T("")))
+ {
+ boolean m_find = false;
+ for(i = 0; !m_find, i < m_D3D9GUIDNames.GetCount(); i++)
+ {
+ if(m_D3D9GUIDNames.GetAt(i) == cstrGUID) m_find = true;
+ }
+ if(!m_find)
+ {
+ m_iD3D9RenderDeviceCtrl.AddString(d3ddevice_str);
+ m_D3D9GUIDNames.Add(cstrGUID);
+ if (s.D3D9RenderDevice == cstrGUID)
+ m_iD3D9RenderDevice = m_iD3D9RenderDeviceCtrl.GetCount()-1;
+ }
+ }
+ }
+ }
+ pD3D->Release();
+ }
+
+ CorrectComboListWidth(m_iD3D9RenderDeviceCtrl, GetFont());
+
UpdateData(FALSE);
if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer))
@@ -227,6 +279,30 @@ BOOL CPPageOutput::OnInitDialog() OnDSRendererChange (m_iDSVideoRendererType + IDC_DSSYSDEF);
+ CheckDlgButton(IDC_D3D9DEVICE, BST_CHECKED);
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(TRUE);
+
+ if((m_iDSVideoRendererType == 6 || m_iDSVideoRendererType == 11) && (m_iD3D9RenderDeviceCtrl.GetCount() > 1))
+ {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
+ CheckDlgButton(IDC_D3D9DEVICE, BST_UNCHECKED);
+ if(m_iD3D9RenderDevice != -1)
+ {
+ CheckDlgButton(IDC_D3D9DEVICE, BST_CHECKED);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(TRUE);
+ }
+ }
+ else
+ {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(FALSE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
+ if(m_iD3D9RenderDevice == -1)
+ CheckDlgButton(IDC_D3D9DEVICE, BST_UNCHECKED);
+ }
+ UpdateData(TRUE);
+
CreateToolTip();
return TRUE; // return TRUE unless you set the focus to a control
@@ -262,6 +338,8 @@ BOOL CPPageOutput::OnApply() else
s.iEvrBuffers = 5;
+ s.D3D9RenderDevice = m_fD3D9RenderDevice ? m_D3D9GUIDNames[m_iD3D9RenderDevice] : _T("");
+
return __super::OnApply();
}
@@ -287,14 +365,29 @@ void CPPageOutput::OnDSRendererChange(UINT nIDbutton) GetDlgItem(IDC_EVR_BUFFERS)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
GetDlgItem(IDC_EVR_BUFFERS_TXT)->EnableWindow((nIDbutton - IDC_DSSYSDEF) == 11);
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(FALSE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(FALSE);
+
switch (nIDbutton - IDC_DSSYSDEF)
{
case 6 : // VMR9 renderless
+ if(m_iD3D9RenderDeviceCtrl.GetCount()>1)
+ {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
+ }
+
GetDlgItem(IDC_DSVMR9LOADMIXER)->EnableWindow(TRUE);
GetDlgItem(IDC_DSVMR9YUVMIXER)->EnableWindow(TRUE);
GetDlgItem(IDC_DSVMR9ALTERNATIVEVSYNC)->EnableWindow(TRUE);
GetDlgItem(IDC_RESETDEVICE)->EnableWindow(TRUE);
case 11 : // EVR custom presenter
+ if(m_iD3D9RenderDeviceCtrl.GetCount()>1)
+ {
+ GetDlgItem(IDC_D3D9DEVICE)->EnableWindow(TRUE);
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(IsDlgButtonChecked(IDC_D3D9DEVICE));
+ }
+
GetDlgItem(IDC_DX9RESIZER_COMBO)->EnableWindow(TRUE);
GetDlgItem(IDC_FULLSCREEN_MONITOR_CHECK)->EnableWindow(TRUE);
// GetDlgItem(IDC_CHECK1)->EnableWindow(TRUE); // Lock back buffer
@@ -337,4 +430,11 @@ void CPPageOutput::OnFullscreenCheck() UpdateData(FALSE);
}
SetModified();
+}
+
+void CPPageOutput::OnD3D9DeviceCheck()
+{
+ UpdateData();
+ GetDlgItem(IDC_D3D9DEVICE_COMBO)->EnableWindow(m_fD3D9RenderDevice);
+ SetModified();
}
\ No newline at end of file diff --git a/src/apps/mplayerc/PPageOutput.h b/src/apps/mplayerc/PPageOutput.h index 3f26869b5..635450e2c 100644 --- a/src/apps/mplayerc/PPageOutput.h +++ b/src/apps/mplayerc/PPageOutput.h @@ -25,6 +25,8 @@ #include "PPageBase.h"
+#include <d3dx9.h>
+
// CPPageOutput dialog
@@ -34,6 +36,7 @@ class CPPageOutput : public CPPageBase private:
CStringArray m_AudioRendererDisplayNames;
+ CStringArray m_D3D9GUIDNames;
void DisableRadioButton(UINT nID, UINT nDefID);
@@ -57,6 +60,10 @@ public: BOOL m_fVMR9AlterativeVSync;
BOOL m_fResetDevice;
CString m_iEvrBuffers;
+ //
+ BOOL m_fD3D9RenderDevice;
+ int m_iD3D9RenderDevice;
+ CComboBox m_iD3D9RenderDeviceCtrl;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
@@ -70,4 +77,5 @@ public: afx_msg void OnSurfaceChange();
afx_msg void OnDSRendererChange(UINT nIDbutton);
afx_msg void OnFullscreenCheck();
+ afx_msg void OnD3D9DeviceCheck();
};
diff --git a/src/apps/mplayerc/SettingsDefines.h b/src/apps/mplayerc/SettingsDefines.h index d62a604f4..268a23c47 100644 --- a/src/apps/mplayerc/SettingsDefines.h +++ b/src/apps/mplayerc/SettingsDefines.h @@ -215,3 +215,4 @@ #define IDS_RS_BDA_RECEIVER _T("BDAReceiver")
#define IDS_RS_DVB_LAST_CHANNEL _T("LastChannel")
+#define IDS_D3D9RENDERDEVICE _T("D3D9RenderDevice")
\ No newline at end of file diff --git a/src/apps/mplayerc/mplayerc.br.rc b/src/apps/mplayerc/mplayerc.br.rc Binary files differindex b25a5fb3e..8ee83db4d 100644 --- a/src/apps/mplayerc/mplayerc.br.rc +++ b/src/apps/mplayerc/mplayerc.br.rc diff --git a/src/apps/mplayerc/mplayerc.by.rc b/src/apps/mplayerc/mplayerc.by.rc Binary files differindex 369cf9c0f..c158ea657 100644 --- a/src/apps/mplayerc/mplayerc.by.rc +++ b/src/apps/mplayerc/mplayerc.by.rc diff --git a/src/apps/mplayerc/mplayerc.cpp b/src/apps/mplayerc/mplayerc.cpp index 7138e21f9..fe88c80d4 100644 --- a/src/apps/mplayerc/mplayerc.cpp +++ b/src/apps/mplayerc/mplayerc.cpp @@ -1964,6 +1964,8 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) pApp->WriteProfileString(IDS_R_SETTINGS, IDS_RS_ISDB, ISDb);
+ pApp->WriteProfileString(IDS_R_SETTINGS, IDS_D3D9RENDERDEVICE, D3D9RenderDevice);
+
pApp->WriteProfileString(_T("Shaders"), NULL, NULL);
pApp->WriteProfileInt(_T("Shaders"), _T("Initialized"), 1);
pApp->WriteProfileString(_T("Shaders"), _T("Combine"), m_shadercombine);
@@ -2401,6 +2403,8 @@ void CMPlayerCApp::Settings::UpdateData(bool fSave) ISDb = pApp->GetProfileString(IDS_R_SETTINGS, IDS_RS_ISDB, _T("www.opensubtitles.org/isdb"));
+ D3D9RenderDevice = pApp->GetProfileString(IDS_R_SETTINGS, IDS_D3D9RENDERDEVICE, _T(""));
+
pApp->WriteProfileInt(IDS_R_SETTINGS, _T("LastUsedPage"), 0);
//
diff --git a/src/apps/mplayerc/mplayerc.cz.rc b/src/apps/mplayerc/mplayerc.cz.rc Binary files differindex 7a6ef29c7..a784612f9 100644 --- a/src/apps/mplayerc/mplayerc.cz.rc +++ b/src/apps/mplayerc/mplayerc.cz.rc diff --git a/src/apps/mplayerc/mplayerc.de.rc b/src/apps/mplayerc/mplayerc.de.rc Binary files differindex a6851c880..07609bd75 100644 --- a/src/apps/mplayerc/mplayerc.de.rc +++ b/src/apps/mplayerc/mplayerc.de.rc diff --git a/src/apps/mplayerc/mplayerc.es.rc b/src/apps/mplayerc/mplayerc.es.rc Binary files differindex 32c431a05..31077ffed 100644 --- a/src/apps/mplayerc/mplayerc.es.rc +++ b/src/apps/mplayerc/mplayerc.es.rc diff --git a/src/apps/mplayerc/mplayerc.fr.rc b/src/apps/mplayerc/mplayerc.fr.rc Binary files differindex 89cd60b6f..90b0f0f91 100644 --- a/src/apps/mplayerc/mplayerc.fr.rc +++ b/src/apps/mplayerc/mplayerc.fr.rc diff --git a/src/apps/mplayerc/mplayerc.h b/src/apps/mplayerc/mplayerc.h index 6b87fa8e7..79c7dce4f 100644 --- a/src/apps/mplayerc/mplayerc.h +++ b/src/apps/mplayerc/mplayerc.h @@ -836,6 +836,8 @@ public: CStringW m_audiosLanguageOrder;
int fnChannels;
+
+ CString D3D9RenderDevice;
} m_s;
public:
diff --git a/src/apps/mplayerc/mplayerc.hu.rc b/src/apps/mplayerc/mplayerc.hu.rc Binary files differindex cd4af7614..d27ff7908 100644 --- a/src/apps/mplayerc/mplayerc.hu.rc +++ b/src/apps/mplayerc/mplayerc.hu.rc diff --git a/src/apps/mplayerc/mplayerc.it.rc b/src/apps/mplayerc/mplayerc.it.rc Binary files differindex d1a74bf18..b3e641dbe 100644 --- a/src/apps/mplayerc/mplayerc.it.rc +++ b/src/apps/mplayerc/mplayerc.it.rc diff --git a/src/apps/mplayerc/mplayerc.kr.rc b/src/apps/mplayerc/mplayerc.kr.rc Binary files differindex 9ab3bbfdc..6c3ef8692 100644 --- a/src/apps/mplayerc/mplayerc.kr.rc +++ b/src/apps/mplayerc/mplayerc.kr.rc diff --git a/src/apps/mplayerc/mplayerc.pl.rc b/src/apps/mplayerc/mplayerc.pl.rc Binary files differindex 8369676c6..affac44e5 100644 --- a/src/apps/mplayerc/mplayerc.pl.rc +++ b/src/apps/mplayerc/mplayerc.pl.rc diff --git a/src/apps/mplayerc/mplayerc.rc b/src/apps/mplayerc/mplayerc.rc Binary files differindex 036212dd1..f7f6f4912 100644 --- a/src/apps/mplayerc/mplayerc.rc +++ b/src/apps/mplayerc/mplayerc.rc diff --git a/src/apps/mplayerc/mplayerc.ru.rc b/src/apps/mplayerc/mplayerc.ru.rc Binary files differindex 5ec973212..0177894dd 100644 --- a/src/apps/mplayerc/mplayerc.ru.rc +++ b/src/apps/mplayerc/mplayerc.ru.rc diff --git a/src/apps/mplayerc/mplayerc.sc.rc b/src/apps/mplayerc/mplayerc.sc.rc Binary files differindex 253b289aa..532d4be61 100644 --- a/src/apps/mplayerc/mplayerc.sc.rc +++ b/src/apps/mplayerc/mplayerc.sc.rc diff --git a/src/apps/mplayerc/mplayerc.sk.rc b/src/apps/mplayerc/mplayerc.sk.rc Binary files differindex 706a72701..2c8583398 100644 --- a/src/apps/mplayerc/mplayerc.sk.rc +++ b/src/apps/mplayerc/mplayerc.sk.rc diff --git a/src/apps/mplayerc/mplayerc.sv.rc b/src/apps/mplayerc/mplayerc.sv.rc Binary files differindex fd4287d10..b692230fc 100644 --- a/src/apps/mplayerc/mplayerc.sv.rc +++ b/src/apps/mplayerc/mplayerc.sv.rc diff --git a/src/apps/mplayerc/mplayerc.tc.rc b/src/apps/mplayerc/mplayerc.tc.rc Binary files differindex 7ab5b48a4..918a366d3 100644 --- a/src/apps/mplayerc/mplayerc.tc.rc +++ b/src/apps/mplayerc/mplayerc.tc.rc diff --git a/src/apps/mplayerc/mplayerc.tr.rc b/src/apps/mplayerc/mplayerc.tr.rc Binary files differindex d97603280..ac224300f 100644 --- a/src/apps/mplayerc/mplayerc.tr.rc +++ b/src/apps/mplayerc/mplayerc.tr.rc diff --git a/src/apps/mplayerc/mplayerc.ua.rc b/src/apps/mplayerc/mplayerc.ua.rc Binary files differindex bacde0ddc..117498ce0 100644 --- a/src/apps/mplayerc/mplayerc.ua.rc +++ b/src/apps/mplayerc/mplayerc.ua.rc diff --git a/src/apps/mplayerc/resource.h b/src/apps/mplayerc/resource.h Binary files differindex bcfc35e47..dc2c06342 100644 --- a/src/apps/mplayerc/resource.h +++ b/src/apps/mplayerc/resource.h |