Re: [2/3] d3d9: Partial implementation of IDirect3DSwapChain9Ex (try 2)
On 30 August 2013 17:09, Michael Müller mich...@fds-team.de wrote: +static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount(IDirect3DSwapChain9Ex *iface, +UINT *pLastPresentCount) +{ +FIXME(iface %p, pLastPresentCount %p, stub!\n, iface, pLastPresentCount); + +if(pLastPresentCount) +*pLastPresentCount = 0; + +return D3D_OK; +} Please use the same style as the rest of the code. E.g., if (last_present_count). +static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx(IDirect3DSwapChain9Ex *iface, +D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) +{ +struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(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; +} This is different from d3d9_GetAdapterDisplayModeEx(). The way you handle pMode-Size looks suspicious, while the NULL checks on pMode and pRotation may make sense. Please add tests to show this is correct. (See also test_get_adapter_displaymode_ex(), although that test has some room for improvement itself.)
Re: d3d9: Partial implementation of IDirect3DSwapChain9Ex
On 8/30/2013 12:19, Michael Müller wrote: 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(-) @@ -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; } I don't know if d3d9 is special in this regard, but this is a wrong way to implement derived interface. You need you make everything IDirect3DSwapChain9Ex, for example this one: /* - * 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 is no longer just IDirect3DSwapChain9. This will fix vtbl type too.
Re: d3d9: Partial implementation of IDirect3DSwapChain9Ex
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Am 2013-08-30 10:19, schrieb Michael Müller: 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. Good work on finding out what causes that bug! -if (IsEqualGUID(riid, IID_IDirect3DSwapChain9) +if (IsEqualGUID(riid, IID_IDirect3DSwapChain9) || IsEqualGUID(riid, IID_IDirect3DSwapChain9Ex) || IsEqualGUID(riid, IID_IUnknown)) For IDirect3D9Ex and IDirect3DDevice9Ex, the Ex versions are only available if IDirect3D9 was created with the extended method. I suspect swapchains are the same. Please write some tests for this. +TRACE(iface %p, pLastPresentCount %p.\n, iface, pLastPresentCount); +WARN(not implemented.\n); If a function is not implemented we write a FIXME, e.g. FIXME(iface %p, pLastPresentCount %p, stub!\n, iface, pLastPresentCount); If this causes too much spam on the console, you can use a static variable to print it just once. +if (SUCCEEDED(hr)) +{ +if(pMode){ Please use a code style that is consistent with the rest of the file. Tbh the existing files aren't as consistent as we'd like. The general rule is a space between if and (, and { in newlines. 4 spaces intendation. If there's a one-line statement in an if, put that statement in a new line and don't write curly brackets. My personal opinion, and the style I use, is to use brackets for both branches of an if-else if one of those branches has more than one line. - * IDirect3DSwapChain9 interface + * IDirect3DSwapChain9(Ex) interface */ #define INTERFACE IDirect3DSwapChain9 DECLARE_INTERFACE_(IDirect3DSwapChain9,IUnknown) You have to create a new interface declaration named IDirect3DSwapChain9Ex with all the methods and the invocation macros. The header change should go in a separate patch. The d3d9 code should be changed to always use IDirect3D9Swapchain9Ex, like it does for device and direct3d. Thanks for your work! Stefan -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.20 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJSIFimAAoJEN0/YqbEcdMwbW0P/jC/gsziWzCtxBH1gDETnX6+ j0csX5cORWKCaq/wsPbT9ZDVV/OYFYlWRB0QZiJIUWAp4PzdGXCxQN8srdybT1hp PG3HTDzv4Kmq57fYSXEoLnZNO/pgfr4JiGmhcwQSyheJ1+lcb5Z/GE09goHwcLce CJVrIQu9f05TQb+r0BJCxIyGAIuq8to7xdIJ1tPR2MmKwYzS0XWkB1yN8QIGy/Qm z4aH7JGsOJ37t/90D4eHVBX6EtiI6pRHHiaO3hFrgYiu7wf/CeiE3E9QWnwycG1h DdPWjreQx+6/JQfg71eXDW81WYgdRl7TfMfBOc8UFh7Byj9b4llR0E+NFSkQ81NL XAQkB/PthmEpJIH1tSo91aNrZkfN/jw7D1gA4kUHFEtr5n1yuUXQQvKLYEOMWrV0 lV1plnzzLEZa50c0Y3/zCgQFCbzgo47ohO/4msMHOU33n255oJg/Bd6CLoA1oPFq hxQkkv0bW5VL6Jn0WVAC1FPjfmRF6zD6h9n8KKPWU2rz/tmkoEhoJ0Nd2a483N86 6EvOTpecczmNBlICFvyUOVAisHnVdwk+cPI+6hoqHBq0C7fGXi7R41pDOvf4o1yH wZyMH4e+kiG+7qaeGRwsTEDW1V77VAbPXJkNZPU2Wvb/gVzLU1TVQ87Bz5T83tpv tFvZjJrjOYO4qL4Afm14 =zjgo -END PGP SIGNATURE-