diff options
author | madshi <madshi@users.sourceforge.net> | 2011-03-19 14:28:11 +0300 |
---|---|---|
committer | madshi <madshi@users.sourceforge.net> | 2011-03-19 14:28:11 +0300 |
commit | e4cbd97e7c04ec9fec29b7ae4803fb6c0b18ee8f (patch) | |
tree | d0da197247c7379d224da64a22167297cb3d81b1 /src/filters/renderer/VideoRenderers | |
parent | 8f3d43d2e9a197c2b848ba0107d2eea5cc549f3e (diff) |
fixed: AlphaBlt corrupted render state for D3DCREATE_PUREDEVICE devices
fixed: MPC-HC subtitle renderer didn't work with Haali Renderer, anymore
fixed: "D3D Fullscreen" option makes no sense for newer madVR builds
fixed: madVR allocator didn't release subtitle resources when asked to
added: support for madVR's text message OSD interface
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2988 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/renderer/VideoRenderers')
7 files changed, 43 insertions, 26 deletions
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp index 47b2e6ec1..da92e8ac2 100644 --- a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp +++ b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp @@ -58,7 +58,7 @@ HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, bool bFullscreen, ISubPicAlloca || clsid == CLSID_RM9AllocatorPresenter && !(*ppAP = DNew CRM9AllocatorPresenter(hWnd, bFullscreen, hr, Error))
|| clsid == CLSID_QT9AllocatorPresenter && !(*ppAP = DNew CQT9AllocatorPresenter(hWnd, bFullscreen, hr, Error))
|| clsid == CLSID_DXRAllocatorPresenter && !(*ppAP = DNew CDXRAllocatorPresenter(hWnd, hr, Error))
- || clsid == CLSID_madVRAllocatorPresenter && !(*ppAP = DNew CmadVRAllocatorPresenter(hWnd, bFullscreen, hr, Error))) {
+ || clsid == CLSID_madVRAllocatorPresenter && !(*ppAP = DNew CmadVRAllocatorPresenter(hWnd, hr, Error))) {
return E_OUTOFMEMORY;
}
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp index 90e0cb9cd..a133999a6 100644 --- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp @@ -973,7 +973,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) if(m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
- m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
if(!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
diff --git a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp index 98580e2d1..950fe4cb3 100644 --- a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp +++ b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp @@ -1584,10 +1584,15 @@ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* hr = m_pD3DDev->SetTexture(0, pTexture);
+ // GetRenderState fails for devices created with D3DCREATE_PUREDEVICE
+ // so we need to provide default values in case GetRenderState fails
DWORD abe, sb, db;
- hr = m_pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe);
- hr = m_pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb);
- hr = m_pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db);
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe)))
+ abe = FALSE;
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb)))
+ sb = D3DBLEND_ONE;
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db)))
+ db = D3DBLEND_ZERO;
hr = m_pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
hr = m_pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
diff --git a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp index 20e4dbb18..d8b7eaa25 100644 --- a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp @@ -124,7 +124,7 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) if(m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
- m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
if(!m_pAllocator) {
return E_FAIL;
}
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp index 64047b160..d2c725308 100644 --- a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp +++ b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp @@ -609,7 +609,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) if(m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
- m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
if(!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
@@ -879,7 +879,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) if(m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
- m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
if(!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
@@ -1393,10 +1393,15 @@ HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture) hr = m_pD3DDev->SetTexture(0, pTexture);
+ // GetRenderState fails for devices created with D3DCREATE_PUREDEVICE
+ // so we need to provide default values in case GetRenderState fails
DWORD abe, sb, db;
- hr = m_pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe);
- hr = m_pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb);
- hr = m_pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db);
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe)))
+ abe = FALSE;
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb)))
+ sb = D3DBLEND_ONE;
+ if (FAILED(m_pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db)))
+ db = D3DBLEND_ZERO;
hr = m_pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
hr = m_pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp index dd49f718a..576511b24 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp @@ -30,20 +30,21 @@ using namespace DSObjects;
-interface __declspec(uuid("51FA8F61-1444-4597-996E-7495405753E6"))
-IMadVRFullscreen :
+interface __declspec(uuid("D6EE8031-214E-4E9E-A3A7-458925F933AB"))
+IMadVRExclusiveModeInfo :
public IUnknown {
- STDMETHOD(ActivateFullscreenMode)(void) = 0;
+ STDMETHOD_(BOOL, IsExclusiveModeActive)(void) = 0;
+ STDMETHOD_(BOOL, IsMadVRSeekbarEnabled)(void) = 0;
};
+
//
// CmadVRAllocatorPresenter
//
-CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error)
+CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error)
: CSubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
- , m_bIsFullscreen(bFullscreen)
{
if(FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
@@ -92,7 +93,13 @@ STDMETHODIMP CmadVRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
{
- CheckPointer(pD3DDev, E_POINTER);
+ if (!pD3DDev)
+ {
+ // release all resources
+ m_pSubPicQueue = NULL;
+ m_pAllocator = NULL;
+ return S_OK;
+ }
CSize size;
switch(GetRenderersSettings().nSPCMaxRes) {
@@ -132,7 +139,7 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) if(m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
- m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
+ m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
if(!m_pAllocator) {
return E_FAIL;
}
@@ -181,13 +188,6 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) return E_FAIL;
}
- if (m_bIsFullscreen) {
- CComQIPtr<IMadVRFullscreen> pVRF = m_pDXR;
- if (pVRF != NULL) {
- pVRF->ActivateFullscreenMode();
- }
- }
-
CComQIPtr<ISubRender> pSR = m_pDXR;
if(!pSR) {
m_pDXR = NULL;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h index 8b9542f96..13ec04a82 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h @@ -26,6 +26,13 @@ #include "../../../SubPic/SubPicAllocatorPresenterImpl.h"
#include "../../../SubPic/ISubRender.h"
+interface __declspec(uuid("ABA34FDA-DD22-4E00-9AB4-4ABF927D0B0C"))
+IMadVRTextOsd :
+public IUnknown {
+ STDMETHOD(OsdDisplayMessage)(LPCWSTR text, DWORD milliseconds) = 0;
+ STDMETHOD(OsdClearMessage)(void) = 0;
+};
+
namespace DSObjects
{
class CmadVRAllocatorPresenter
@@ -79,7 +86,7 @@ namespace DSObjects bool m_bIsFullscreen;
public:
- CmadVRAllocatorPresenter(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error);
+ CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString &_Error);
virtual ~CmadVRAllocatorPresenter();
DECLARE_IUNKNOWN
|