d3d9: StateBlock is also created in EndStateBlock. With tests.
Vitaliy Margolen
wine-patch at kievinfo.com
Wed May 24 09:42:50 CDT 2006
ChangeLog:
d3d9: StateBlock is also created in EndStateBlock. With tests.
dlls/d3d9/stateblock.c | 13 +++++++++----
dlls/d3d9/tests/device.c | 8 ++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
-------------- next part --------------
c36e80c5bb078705125d3cdb56ab94115f5ce4b4
diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c
index 1d69410..977ab1e 100644
--- a/dlls/d3d9/stateblock.c
+++ b/dlls/d3d9/stateblock.c
@@ -150,12 +150,17 @@ HRESULT WINAPI IDirect3DDevice9Impl_En
}
/* allocate a new IDirectD3DStateBlock */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock9Impl));
+ if (!object) {
+ FIXME("(%p) Failed to allocate %d bytes\n", This, sizeof(IDirect3DStateBlock9Impl));
+ return E_OUTOFMEMORY;
+ }
object->ref = 1;
object->lpVtbl = &Direct3DStateBlock9_Vtbl;
-
- object->wineD3DStateBlock=wineD3DStateBlock;
-
- *ppSB=(IDirect3DStateBlock9*)object;
+ object->wineD3DStateBlock = wineD3DStateBlock;
+
+ IUnknown_AddRef(iface);
+ object->parentDevice = iface;
+ *ppSB=(IDirect3DStateBlock9*)object;
TRACE("(%p)Returning %p %p\n", This, *ppSB, wineD3DStateBlock);
return D3D_OK;
}
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 3e8b176..4a903e1 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -56,6 +56,7 @@ void test_refcount(void)
IDirect3DSurface9 *pRenderTarget = NULL;
IDirect3DSurface9 *pTextureLevel = NULL;
IDirect3DStateBlock9 *pStateBlock = NULL;
+ IDirect3DStateBlock9 *pStateBlock1 = NULL;
IDirect3DSwapChain9 *pSwapChain = NULL;
IDirect3DQuery9 *pQuery = NULL;
D3DPRESENT_PARAMETERS d3dpp;
@@ -157,6 +158,12 @@ void test_refcount(void)
hr = IDirect3DDevice9_CreateQuery( pDevice, D3DQUERYTYPE_EVENT, &pQuery );
CHECK_CALL( hr, "CreateQuery", pDevice, refcount+1 );
+ refcount = get_refcount( (IUnknown *)pDevice );
+ hr = IDirect3DDevice9_BeginStateBlock( pDevice );
+ CHECK_CALL( hr, "BeginStateBlock", pDevice, refcount );
+ hr = IDirect3DDevice9_EndStateBlock( pDevice, &pStateBlock1 );
+ CHECK_CALL( hr, "EndStateBlock", pDevice, refcount+1 );
+
cleanup:
if (pDevice) IUnknown_Release( pDevice );
@@ -182,6 +189,7 @@ cleanup:
if (pSwapChain) IUnknown_Release( pSwapChain );
*/
if (pQuery) IUnknown_Release( pQuery );
+ if (pStateBlock1) IUnknown_Release( pStateBlock1 );
if (pD3d) IUnknown_Release( pD3d );
More information about the wine-patches
mailing list