From 83ff5b504185910ebf277e142c8d1392024583f7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 2 Sep 2010 19:25:04 +0200 Subject: [PATCH] ddraw: Handle D3DRENDERSTATE_TEXTUREHANDLE and D3DRENDERSTATE_TEXTUREMAPBLEND in d3d7. --- dlls/ddraw/device.c | 12 ++++++++++++ dlls/ddraw/tests/d3d.c | 30 ++++++++++-------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index e63215111cb..9632bd576eb 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -2492,6 +2492,12 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, hr = E_NOTIMPL; break; + case D3DRENDERSTATE_TEXTUREHANDLE: + case D3DRENDERSTATE_TEXTUREMAPBLEND: + WARN("Render state %#x is invalid in d3d7.\n", RenderStateType); + hr = DDERR_INVALIDPARAMS; + break; + default: if (RenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00 && RenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31) @@ -2802,6 +2808,12 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface, hr = E_NOTIMPL; break; + case D3DRENDERSTATE_TEXTUREHANDLE: + case D3DRENDERSTATE_TEXTUREMAPBLEND: + WARN("Render state %#x is invalid in d3d7.\n", RenderStateType); + hr = DDERR_INVALIDPARAMS; + break; + default: if (RenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00 && RenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31) diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 53ef04b5d40..2f0f3c4f17b 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -1818,28 +1818,18 @@ out: static void D3D7_OldRenderStateTest(void) { - HRESULT rc; + HRESULT hr; DWORD val; - /* Test reaction to some deprecated states in D3D7. - - * IDirect3DDevice7 in Wine currently relays such states to wined3d where they are do-nothing and return 0, instead - * of INVALIDPARAMS. Unless an app is found which cares this is probably ok. What this test shows is that these states - * need not to be handled in D3D7. - */ - todo_wine { - rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREHANDLE, 0); - ok(rc == DDERR_INVALIDPARAMS, "IDirect3DDevice7_SetRenderState returned %08x\n", rc); - - rc = IDirect3DDevice7_GetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREHANDLE, &val); - ok(rc == DDERR_INVALIDPARAMS, "IDirect3DDevice7_GetRenderState returned %08x\n", rc); - - rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); - ok(rc == DDERR_INVALIDPARAMS, "IDirect3DDevice7_SetRenderState returned %08x\n", rc); - - rc = IDirect3DDevice7_GetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREMAPBLEND, &val); - ok(rc == DDERR_INVALIDPARAMS, "IDirect3DDevice7_GetRenderState returned %08x\n", rc); - } + /* Test reaction to some deprecated states in D3D7. */ + hr = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREHANDLE, 0); + ok(hr == DDERR_INVALIDPARAMS, "IDirect3DDevice7_SetRenderState returned %#x.\n", hr); + hr = IDirect3DDevice7_GetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREHANDLE, &val); + ok(hr == DDERR_INVALIDPARAMS, "IDirect3DDevice7_GetRenderState returned %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); + ok(hr == DDERR_INVALIDPARAMS, "IDirect3DDevice7_SetRenderState returned %#x.\n", hr); + hr = IDirect3DDevice7_GetRenderState(lpD3DDevice, D3DRENDERSTATE_TEXTUREMAPBLEND, &val); + ok(hr == DDERR_INVALIDPARAMS, "IDirect3DDevice7_GetRenderState returned %#x.\n", hr); } #define IS_VALUE_NEAR(a, b) ( ((a) == (b)) || ((a) == (b) - 1) || ((a) == (b) + 1) )