d3d9: Partial implementation of IDirect3DSwapChain9Ex
Michael Müller
michael at fds-team.de
Fri Aug 30 03:19:09 CDT 2013
This patch implements the IDirect3DSwapChain9Ex interface as an
extension of IDirect3DSwapChain9 and thus fixes bug 34252 - "Silverlight
accelerated graphics cause a D3D critical section lockup" since
Silverlight does no longer try to create a Direct3D context in an
endless loop. The functions d3d9_swapchain_GetLastPresentCount and
d3d9_swapchain_GetPresentStatistics are just stubs so far.
---
dlls/d3d9/swapchain.c | 71
++++++++++++++++++++++++++++++++++++++++++++++++-
include/d3d9.h | 14 +++++++++-
include/d3d9types.h | 8 ++++++
3 files changed, 91 insertions(+), 2 deletions(-)
-------------- next part --------------
From 28b13eb2ee6745ee0b9b546c265ce6045cc9dbe5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael at fds-team.de>
Date: Fri, 30 Aug 2013 04:36:13 +0200
Subject: d3d9: Partial implementation of IDirect3DSwapChain9Ex
---
dlls/d3d9/swapchain.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-
include/d3d9.h | 14 +++++++++-
include/d3d9types.h | 8 ++++++
3 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c
index 8177336..9cc35ce 100644
--- a/dlls/d3d9/swapchain.c
+++ b/dlls/d3d9/swapchain.c
@@ -34,7 +34,7 @@ static HRESULT WINAPI d3d9_swapchain_QueryInterface(IDirect3DSwapChain9 *iface,
{
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
- if (IsEqualGUID(riid, &IID_IDirect3DSwapChain9)
+ if (IsEqualGUID(riid, &IID_IDirect3DSwapChain9) || IsEqualGUID(riid, &IID_IDirect3DSwapChain9Ex)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IDirect3DSwapChain9_AddRef(iface);
@@ -221,12 +221,76 @@ static HRESULT WINAPI d3d9_swapchain_GetPresentParameters(IDirect3DSwapChain9 *i
return D3D_OK;
}
+static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount(IDirect3DSwapChain9 *iface,
+ UINT *pLastPresentCount)
+{
+ TRACE("iface %p, pLastPresentCount %p.\n", iface, pLastPresentCount);
+ WARN("not implemented.\n");
+
+ if(pLastPresentCount)
+ *pLastPresentCount = 0;
+
+ return D3D_OK;
+}
+
+static HRESULT WINAPI d3d9_swapchain_GetPresentStatistics(IDirect3DSwapChain9 *iface,
+ D3DPRESENTSTATS *pPresentationStatistics)
+{
+ TRACE("iface %p, pPresentationStatistics %p.\n", iface, pPresentationStatistics);
+ WARN("not implemented.\n");
+
+ if(pPresentationStatistics){
+ pPresentationStatistics->PresentCount = 0;
+ pPresentationStatistics->PresentRefreshCount = 0;
+ pPresentationStatistics->SyncRefreshCount = 0;
+ pPresentationStatistics->SyncQPCTime.QuadPart = 0;
+ pPresentationStatistics->SyncGPUTime.QuadPart = 0;
+ }
+
+ return D3D_OK;
+}
+
+static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx(IDirect3DSwapChain9 *iface,
+ D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation)
+{
+ struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9(iface);
+ struct wined3d_display_mode wined3d_mode;
+ enum wined3d_display_rotation wined3d_rotation;
+ HRESULT hr;
+
+ TRACE("iface %p, pMode %p, pRotation %p.\n", iface, pMode, pRotation);
+
+ wined3d_mutex_lock();
+ hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode, &wined3d_rotation);
+ wined3d_mutex_unlock();
+
+ if (SUCCEEDED(hr))
+ {
+ if(pMode){
+ pMode->Size = sizeof(D3DDISPLAYMODEEX);
+ pMode->Width = wined3d_mode.width;
+ pMode->Height = wined3d_mode.height;
+ pMode->RefreshRate = wined3d_mode.refresh_rate;
+ pMode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
+ pMode->ScanLineOrdering = wined3d_mode.scanline_ordering;
+ }
+
+ if(pRotation){
+ *pRotation = wined3d_rotation;
+ }
+ }
+
+ return hr;
+}
static const struct IDirect3DSwapChain9Vtbl d3d9_swapchain_vtbl =
{
+ /* IUnknown */
d3d9_swapchain_QueryInterface,
d3d9_swapchain_AddRef,
d3d9_swapchain_Release,
+
+ /* IDirect3DSwapChain9 */
d3d9_swapchain_Present,
d3d9_swapchain_GetFrontBufferData,
d3d9_swapchain_GetBackBuffer,
@@ -234,6 +298,11 @@ static const struct IDirect3DSwapChain9Vtbl d3d9_swapchain_vtbl =
d3d9_swapchain_GetDisplayMode,
d3d9_swapchain_GetDevice,
d3d9_swapchain_GetPresentParameters,
+
+ /* IDirect3DSwapChain9Ex */
+ d3d9_swapchain_GetLastPresentCount,
+ d3d9_swapchain_GetPresentStatistics,
+ d3d9_swapchain_GetDisplayModeEx
};
static void STDMETHODCALLTYPE d3d9_swapchain_wined3d_object_released(void *parent)
diff --git a/include/d3d9.h b/include/d3d9.h
index 382b241..71326c9 100644
--- a/include/d3d9.h
+++ b/include/d3d9.h
@@ -388,7 +388,7 @@ DECLARE_INTERFACE_(IDirect3DVolume9,IUnknown)
#endif
/*****************************************************************************
- * IDirect3DSwapChain9 interface
+ * IDirect3DSwapChain9(Ex) interface
*/
#define INTERFACE IDirect3DSwapChain9
DECLARE_INTERFACE_(IDirect3DSwapChain9,IUnknown)
@@ -405,6 +405,10 @@ DECLARE_INTERFACE_(IDirect3DSwapChain9,IUnknown)
STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice9** ppDevice) PURE;
STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
+ /*** IDirect3DSwapChain9Ex methods ***/
+ STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount) PURE;
+ STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics) PURE;
+ STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
};
#undef INTERFACE
@@ -421,6 +425,10 @@ DECLARE_INTERFACE_(IDirect3DSwapChain9,IUnknown)
#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a)
#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a)
+/*** IDirect3DSwapChain9Ex methods ***/
+#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a)
+#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a)
+#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b)
#else
/*** IUnknown methods ***/
#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
@@ -434,6 +442,10 @@ DECLARE_INTERFACE_(IDirect3DSwapChain9,IUnknown)
#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a)
#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a)
#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a)
+/*** IDirect3DSwapChain9Ex methods ***/
+#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->GetLastPresentCount(a)
+#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->GetPresentStats(a)
+#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->GetDisplayModeEx(a,b)
#endif
/*****************************************************************************
diff --git a/include/d3d9types.h b/include/d3d9types.h
index cdd3ada..a28d384 100644
--- a/include/d3d9types.h
+++ b/include/d3d9types.h
@@ -1517,6 +1517,14 @@ typedef struct _D3DVOLUME_DESC {
UINT Depth;
} D3DVOLUME_DESC;
+typedef struct _D3DPRESENTSTATS {
+ UINT PresentCount;
+ UINT PresentRefreshCount;
+ UINT SyncRefreshCount;
+ LARGE_INTEGER SyncQPCTime;
+ LARGE_INTEGER SyncGPUTime;
+} D3DPRESENTSTATS;
+
/* Parts added with d3d9ex */
#if !defined(D3D_DISABLE_9EX)
typedef enum D3DSCANLINEORDERING
--
1.7.9.5
More information about the wine-patches
mailing list