Commit 9281bdb4 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

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.
parent edf1c50b
...@@ -352,6 +352,31 @@ static void test_gettexture(IDirect3DDevice9 *device) { ...@@ -352,6 +352,31 @@ static void test_gettexture(IDirect3DDevice9 *device) {
ok(texture == NULL, "Texture returned is %p, expected NULL\n", texture); 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) START_TEST(texture)
{ {
D3DCAPS9 caps; D3DCAPS9 caps;
...@@ -376,6 +401,7 @@ START_TEST(texture) ...@@ -376,6 +401,7 @@ START_TEST(texture)
test_mipmap_gen(device_ptr); test_mipmap_gen(device_ptr);
test_filter(device_ptr); test_filter(device_ptr);
test_gettexture(device_ptr); test_gettexture(device_ptr);
test_lod(device_ptr);
refcount = IDirect3DDevice9_Release(device_ptr); refcount = IDirect3DDevice9_Release(device_ptr);
ok(!refcount, "Device has %u references left\n", refcount); ok(!refcount, "Device has %u references left\n", refcount);
......
...@@ -97,8 +97,12 @@ DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew) ...@@ -97,8 +97,12 @@ DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew)
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
DWORD old = This->baseTexture.LOD; 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) { 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) if(LODNew >= This->baseTexture.levels)
...@@ -123,10 +127,6 @@ DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) ...@@ -123,10 +127,6 @@ DWORD basetexture_get_lod(IWineD3DBaseTexture *iface)
{ {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
if (This->resource.pool != WINED3DPOOL_MANAGED) {
return WINED3DERR_INVALIDCALL;
}
TRACE("(%p) : returning %d\n", This, This->baseTexture.LOD); TRACE("(%p) : returning %d\n", This, This->baseTexture.LOD);
return This->baseTexture.LOD; return This->baseTexture.LOD;
......
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