Commit 9bb70e27 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

d3d9/tests: Use proper helpers for iface calls.

parent 242f9acd
...@@ -107,7 +107,7 @@ static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL w ...@@ -107,7 +107,7 @@ static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL w
#define CHECK_RELEASE(obj,d,rc) \ #define CHECK_RELEASE(obj,d,rc) \
if (obj) { \ if (obj) { \
int tmp1, rc_new = rc; \ int tmp1, rc_new = rc; \
IUnknown_Release( obj ); \ IUnknown_Release( (IUnknown*)obj ); \
tmp1 = get_refcount( (IUnknown *)d ); \ tmp1 = get_refcount( (IUnknown *)d ); \
ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \ ok(tmp1 == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, tmp1); \
} }
...@@ -154,7 +154,7 @@ static void check_mipmap_levels(IDirect3DDevice9 *device, UINT width, UINT heigh ...@@ -154,7 +154,7 @@ static void check_mipmap_levels(IDirect3DDevice9 *device, UINT width, UINT heigh
} else } else
trace("CreateTexture failed: %08x\n", hr); trace("CreateTexture failed: %08x\n", hr);
if (texture) IUnknown_Release( texture ); if (texture) IDirect3DBaseTexture9_Release( texture );
} }
static void test_mipmap_levels(void) static void test_mipmap_levels(void)
...@@ -196,10 +196,10 @@ static void test_mipmap_levels(void) ...@@ -196,10 +196,10 @@ static void test_mipmap_levels(void)
cleanup: cleanup:
if (pDevice) if (pDevice)
{ {
UINT refcount = IUnknown_Release( pDevice ); UINT refcount = IDirect3DDevice9_Release( pDevice );
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
} }
if (pD3d) IUnknown_Release( pD3d ); if (pD3d) IDirect3D9_Release( pD3d );
DestroyWindow( hwnd ); DestroyWindow( hwnd );
} }
...@@ -255,10 +255,10 @@ static void test_checkdevicemultisampletype(void) ...@@ -255,10 +255,10 @@ static void test_checkdevicemultisampletype(void)
cleanup: cleanup:
if (pDevice) if (pDevice)
{ {
UINT refcount = IUnknown_Release( pDevice ); UINT refcount = IDirect3DDevice9_Release( pDevice );
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
} }
if (pD3d) IUnknown_Release( pD3d ); if (pD3d) IDirect3D9_Release( pD3d );
DestroyWindow( hwnd ); DestroyWindow( hwnd );
} }
......
...@@ -281,13 +281,13 @@ static int switch_render_target(IDirect3DDevice9 *device, struct event_data *eve ...@@ -281,13 +281,13 @@ static int switch_render_target(IDirect3DDevice9 *device, struct event_data *eve
ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret); ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret);
if (hret != D3D_OK) goto error; if (hret != D3D_OK) goto error;
IUnknown_Release(backbuffer); IDirect3DSurface9_Release(backbuffer);
event_data->new_swap_chain = swapchain; event_data->new_swap_chain = swapchain;
return EVENT_OK; return EVENT_OK;
error: error:
if (backbuffer) IUnknown_Release(backbuffer); if (backbuffer) IDirect3DSurface9_Release(backbuffer);
if (swapchain) IUnknown_Release(swapchain); if (swapchain) IDirect3DSwapChain9_Release(swapchain);
return EVENT_ERROR; return EVENT_ERROR;
} }
...@@ -299,12 +299,12 @@ static int revert_render_target(IDirect3DDevice9 *device, struct event_data *eve ...@@ -299,12 +299,12 @@ static int revert_render_target(IDirect3DDevice9 *device, struct event_data *eve
hret = IDirect3DDevice9_SetRenderTarget(device, 0, event_data->original_render_target); hret = IDirect3DDevice9_SetRenderTarget(device, 0, event_data->original_render_target);
ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret); ok (hret == D3D_OK, "SetRenderTarget returned %#x.\n", hret);
if (hret != D3D_OK) { if (hret != D3D_OK) {
IUnknown_Release(event_data->original_render_target); IDirect3DSurface9_Release(event_data->original_render_target);
return EVENT_ERROR; return EVENT_ERROR;
} }
IUnknown_Release(event_data->original_render_target); IDirect3DSurface9_Release(event_data->original_render_target);
IUnknown_Release(event_data->new_swap_chain); IDirect3DSwapChain9_Release(event_data->new_swap_chain);
return EVENT_OK; return EVENT_OK;
} }
...@@ -361,7 +361,7 @@ static int end_stateblock(IDirect3DDevice9 *device, struct event_data *event_dat ...@@ -361,7 +361,7 @@ static int end_stateblock(IDirect3DDevice9 *device, struct event_data *event_dat
static int release_stateblock(IDirect3DDevice9 *device, struct event_data *event_data) static int release_stateblock(IDirect3DDevice9 *device, struct event_data *event_data)
{ {
IUnknown_Release(event_data->stateblock); IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_OK; return EVENT_OK;
} }
...@@ -372,11 +372,11 @@ static int apply_stateblock(IDirect3DDevice9 *device, struct event_data *event_d ...@@ -372,11 +372,11 @@ static int apply_stateblock(IDirect3DDevice9 *device, struct event_data *event_d
hret = IDirect3DStateBlock9_Apply(event_data->stateblock); hret = IDirect3DStateBlock9_Apply(event_data->stateblock);
ok(hret == D3D_OK, "Apply returned %#x.\n", hret); ok(hret == D3D_OK, "Apply returned %#x.\n", hret);
if (hret != D3D_OK) { if (hret != D3D_OK) {
IUnknown_Release(event_data->stateblock); IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_ERROR; return EVENT_ERROR;
} }
IUnknown_Release(event_data->stateblock); IDirect3DStateBlock9_Release(event_data->stateblock);
return EVENT_OK; return EVENT_OK;
} }
......
...@@ -181,7 +181,7 @@ static void test_surface_alignment(IDirect3DDevice9 *device_ptr) ...@@ -181,7 +181,7 @@ static void test_surface_alignment(IDirect3DDevice9 *device_ptr)
ok(rc.Pitch == pitch, "Wrong pitch for DXT%d lvl[%d (%dx%d)]: expected %d got %d\n", ok(rc.Pitch == pitch, "Wrong pitch for DXT%d lvl[%d (%dx%d)]: expected %d got %d\n",
i + 1, j, descr.Width, descr.Height, pitch, rc.Pitch); i + 1, j, descr.Width, descr.Height, pitch, rc.Pitch);
} }
IUnknown_Release( pTexture ); IDirect3DTexture9_Release( pTexture );
} }
} }
......
...@@ -267,11 +267,11 @@ static HRESULT test_fvf_to_decl(IDirect3DDevice9 *device, IDirect3DVertexDeclara ...@@ -267,11 +267,11 @@ static HRESULT test_fvf_to_decl(IDirect3DDevice9 *device, IDirect3DVertexDeclara
else if (compare_elements(result_decl, expected_elements) != S_OK) else if (compare_elements(result_decl, expected_elements) != S_OK)
goto fail; goto fail;
if (result_decl) IUnknown_Release( result_decl ); if (result_decl) IDirect3DVertexDeclaration9_Release( result_decl );
return S_OK; return S_OK;
fail: fail:
if (result_decl) IUnknown_Release( result_decl ); if (result_decl) IDirect3DVertexDeclaration9_Release( result_decl );
return E_FAIL; return E_FAIL;
} }
...@@ -308,12 +308,12 @@ static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf, ...@@ -308,12 +308,12 @@ static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf,
if (test_fvf != result_fvf) goto fail; if (test_fvf != result_fvf) goto fail;
IDirect3DDevice9_SetVertexDeclaration ( device, NULL ); IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
if (vdecl) IUnknown_Release( vdecl ); if (vdecl) IDirect3DVertexDeclaration9_Release( vdecl );
return S_OK; return S_OK;
fail: fail:
IDirect3DDevice9_SetVertexDeclaration ( device, NULL ); IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
if (vdecl) IUnknown_Release( vdecl ); if (vdecl) IDirect3DVertexDeclaration9_Release( vdecl );
return E_FAIL; return E_FAIL;
} }
...@@ -644,7 +644,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) ...@@ -644,7 +644,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
cleanup: cleanup:
IDirect3DDevice9_SetVertexDeclaration ( pDevice, NULL ); IDirect3DDevice9_SetVertexDeclaration ( pDevice, NULL );
if ( default_decl ) IUnknown_Release (default_decl); if ( default_decl ) IDirect3DVertexDeclaration9_Release (default_decl);
} }
/* Check whether a declaration converted from FVF is shared. /* Check whether a declaration converted from FVF is shared.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment