d3d9/tests: Add refcount test for binding objects.

This commit is contained in:
Stefan Dösinger 2006-11-03 19:38:46 +01:00 committed by Alexandre Julliard
parent 7cae24fc36
commit 9b74d76214
1 changed files with 26 additions and 0 deletions

View File

@ -315,8 +315,27 @@ static void test_refcount(void)
/* Buffers */ /* Buffers */
hr = IDirect3DDevice9_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer, NULL ); hr = IDirect3DDevice9_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer, NULL );
CHECK_CALL( hr, "CreateIndexBuffer", pDevice, ++refcount ); 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 ); hr = IDirect3DDevice9_CreateVertexBuffer( pDevice, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer, NULL );
CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount ); 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 */ /* Shaders */
hr = IDirect3DDevice9_CreateVertexDeclaration( pDevice, decl, &pVertexDeclaration ); hr = IDirect3DDevice9_CreateVertexDeclaration( pDevice, decl, &pVertexDeclaration );
CHECK_CALL( hr, "CreateVertexDeclaration", pDevice, ++refcount ); CHECK_CALL( hr, "CreateVertexDeclaration", pDevice, ++refcount );
@ -330,6 +349,13 @@ static void test_refcount(void)
if (pTexture) if (pTexture)
{ {
tmp = get_refcount( (IUnknown *)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 */ /* This should not increment device refcount */
hr = IDirect3DTexture9_GetSurfaceLevel( pTexture, 1, &pTextureLevel ); hr = IDirect3DTexture9_GetSurfaceLevel( pTexture, 1, &pTextureLevel );
CHECK_CALL( hr, "GetSurfaceLevel", pDevice, refcount ); CHECK_CALL( hr, "GetSurfaceLevel", pDevice, refcount );