Module: wine Branch: master Commit: 9281bdb478ba5d2c40dd3baaf28b6d7aef292c28 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9281bdb478ba5d2c40dd3baaf2...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sun Aug 30 22:02:51 2009 +0200
wined3d: SetLOD is ignored on D3DPOOL_DEFAULT textures.
I am not testing SYSTEMMEM and SCRATCH textures. SCRATCH textures cannot be created, SYSTEMMEM ones cannot be used for texturing on Windows.
---
dlls/d3d9/tests/texture.c | 26 ++++++++++++++++++++++++++ dlls/wined3d/basetexture.c | 10 +++++----- 2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c index 2623b13..cc97e75 100644 --- a/dlls/d3d9/tests/texture.c +++ b/dlls/d3d9/tests/texture.c @@ -352,6 +352,31 @@ static void test_gettexture(IDirect3DDevice9 *device) { ok(texture == NULL, "Texture returned is %p, expected NULL\n", texture); }
+static void test_lod(IDirect3DDevice9 *device) +{ + HRESULT hr; + DWORD ret; + IDirect3DTexture9 *texture; + + hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 3, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, + &texture, NULL); + ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %08x\n", hr); + + /* SetLOD is only supported on D3DPOOL_MANAGED textures, but it doesn't return a HRESULT, + * so it can't return a normal error. Instead, the call is simply ignored + */ + ret = IDirect3DTexture9_SetLOD(texture, 0); + ok(ret == 0, "IDirect3DTexture9_SetLOD returned %u, expected 0\n", ret); + ret = IDirect3DTexture9_SetLOD(texture, 1); + ok(ret == 0, "IDirect3DTexture9_SetLOD returned %u, expected 0\n", ret); + ret = IDirect3DTexture9_SetLOD(texture, 2); + ok(ret == 0, "IDirect3DTexture9_SetLOD returned %u, expected 0\n", ret); + ret = IDirect3DTexture9_GetLOD(texture); + ok(ret == 0, "IDirect3DTexture9_GetLOD returned %u, expected 0\n", ret); + + IDirect3DTexture9_Release(texture); +} + START_TEST(texture) { D3DCAPS9 caps; @@ -376,6 +401,7 @@ START_TEST(texture) test_mipmap_gen(device_ptr); test_filter(device_ptr); test_gettexture(device_ptr); + test_lod(device_ptr);
refcount = IDirect3DDevice9_Release(device_ptr); ok(!refcount, "Device has %u references left\n", refcount); diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index 2bfbcc7..ab38b62 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -97,8 +97,12 @@ DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew) IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; DWORD old = This->baseTexture.LOD;
+ /* The d3d9:texture test shows that SetLOD is ignored on non-managed + * textures. The call always returns 0, and GetLOD always returns 0 + */ if (This->resource.pool != WINED3DPOOL_MANAGED) { - return WINED3DERR_INVALIDCALL; + TRACE("Ignoring SetLOD on %s texture, returning 0\n", debug_d3dpool(This->resource.pool)); + return 0; }
if(LODNew >= This->baseTexture.levels) @@ -123,10 +127,6 @@ DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) { IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- if (This->resource.pool != WINED3DPOOL_MANAGED) { - return WINED3DERR_INVALIDCALL; - } - TRACE("(%p) : returning %d\n", This, This->baseTexture.LOD);
return This->baseTexture.LOD;