Stefan Dösinger : d3d9/tests: Add refcount test for binding objects.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Nov 4 13:32:33 CST 2006


Module: wine
Branch: master
Commit: 9b74d7621428304c0b258c619409c0e0756f97d8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9b74d7621428304c0b258c619409c0e0756f97d8

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Nov  3 19:38:46 2006 +0100

d3d9/tests: Add refcount test for binding objects.

---

 dlls/d3d9/tests/device.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index be1dba2..2ed0926 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -315,8 +315,27 @@ static void test_refcount(void)
     /* Buffers */
     hr = IDirect3DDevice9_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer, NULL );
     CHECK_CALL( hr, "CreateIndexBuffer", pDevice, ++refcount );
+    if(pIndexBuffer)
+    {
+        tmp = get_refcount( (IUnknown *)pIndexBuffer );
+
+        hr = IDirect3DDevice9_SetIndices(pDevice, pIndexBuffer);
+        CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp);
+        hr = IDirect3DDevice9_SetIndices(pDevice, NULL);
+        CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp);
+    }
+
     hr = IDirect3DDevice9_CreateVertexBuffer( pDevice, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer, NULL );
     CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount );
+    if(pVertexBuffer)
+    {
+        tmp = get_refcount( (IUnknown *)pVertexBuffer );
+
+        hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, pVertexBuffer, 0, 3 * sizeof(float));
+        CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
+        hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, NULL, 0, 0);
+        CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
+    }
     /* Shaders */
     hr = IDirect3DDevice9_CreateVertexDeclaration( pDevice, decl, &pVertexDeclaration );
     CHECK_CALL( hr, "CreateVertexDeclaration", pDevice, ++refcount );
@@ -330,6 +349,13 @@ static void test_refcount(void)
     if (pTexture)
     {
         tmp = get_refcount( (IUnknown *)pTexture );
+
+        /* SetTexture should not increase refcounts */
+        hr = IDirect3DDevice9_SetTexture(pDevice, 0, (IDirect3DBaseTexture9 *) pTexture);
+        CHECK_CALL( hr, "SetTexture", pTexture, tmp);
+        hr = IDirect3DDevice9_SetTexture(pDevice, 0, NULL);
+        CHECK_CALL( hr, "SetTexture", pTexture, tmp);
+
         /* This should not increment device refcount */
         hr = IDirect3DTexture9_GetSurfaceLevel( pTexture, 1, &pTextureLevel );
         CHECK_CALL( hr, "GetSurfaceLevel", pDevice, refcount );




More information about the wine-cvs mailing list