From 438fa44d4339eafbfdff512ba47ecbad69d5d157 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Thu, 28 Feb 2008 15:00:30 -0500 Subject: [PATCH] d3d9: Add tests showing the D3DUSAGE_RENDERTARGET and D3DUSAGE_AUTOGENMIPMAP are mutually exlusive. --- dlls/d3d9/tests/texture.c | 47 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c index 617ad773174..0b2e4069f06 100644 --- a/dlls/d3d9/tests/texture.c +++ b/dlls/d3d9/tests/texture.c @@ -115,19 +115,55 @@ static void test_cube_texture_from_pool(IDirect3DDevice9 *device_ptr, DWORD caps if(texture_ptr) IDirect3DCubeTexture9_Release(texture_ptr); } +static void test_cube_texture_mipmap_gen(IDirect3DDevice9 *device_ptr) +{ + IDirect3DCubeTexture9 *texture_ptr = NULL; + IDirect3D9 *d3d9; + HRESULT hr; + + hr = IDirect3DDevice9_GetDirect3D(device_ptr, &d3d9); + ok(hr == D3D_OK, "IDirect3DDevice9_GetDirect3D returned 0x%08x\n", hr); + + hr = IDirect3D9_CheckDeviceFormat(d3d9, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, + D3DUSAGE_AUTOGENMIPMAP, + D3DRTYPE_CUBETEXTURE, D3DFMT_X8R8G8B8); + if(FAILED(hr)) + { + skip("No cube mipmap generation support\n"); + return; + } + + /* testing shows that autogenmipmap and rendertarget are mutually exclusive options */ + hr = IDirect3DDevice9_CreateCubeTexture(device_ptr, 64, 0, (D3DUSAGE_RENDERTARGET | + D3DUSAGE_AUTOGENMIPMAP), D3DFMT_X8R8G8B8, + D3DPOOL_MANAGED, &texture_ptr, 0); + todo_wine ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n", + hr, D3DERR_INVALIDCALL); + if (texture_ptr) IDirect3DCubeTexture9_Release(texture_ptr); + texture_ptr = NULL; + + hr = IDirect3DDevice9_CreateCubeTexture(device_ptr, 64, 0, + D3DUSAGE_AUTOGENMIPMAP, D3DFMT_X8R8G8B8, + D3DPOOL_MANAGED, &texture_ptr, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed (0x%08x)\n", hr); + if (texture_ptr) IDirect3DCubeTexture9_Release(texture_ptr); + texture_ptr = NULL; +} + static void test_cube_textures(IDirect3DDevice9 *device_ptr, DWORD caps) { test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_DEFAULT, TRUE); test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_MANAGED, TRUE); test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SYSTEMMEM, TRUE); test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SCRATCH, FALSE); + test_cube_texture_mipmap_gen(device_ptr); } static void test_mipmap_gen(IDirect3DDevice9 *device) { HRESULT hr; IDirect3D9 *d3d9; - IDirect3DTexture9 *texture; + IDirect3DTexture9 *texture = NULL; IDirect3DSurface9 *surface; DWORD levels; D3DSURFACE_DESC desc; @@ -146,6 +182,15 @@ static void test_mipmap_gen(IDirect3DDevice9 *device) return; } + /* testing shows that autogenmipmap and rendertarget are mutually exclusive options */ + hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 0, (D3DUSAGE_RENDERTARGET | + D3DUSAGE_AUTOGENMIPMAP), D3DFMT_X8R8G8B8, + D3DPOOL_MANAGED, &texture, 0); + todo_wine ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n", + hr, D3DERR_INVALIDCALL); + if (texture) IDirect3DTexture9_Release(texture); + texture = NULL; + hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 0, D3DUSAGE_AUTOGENMIPMAP, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &texture, 0); ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed(%08x)\n", hr);