Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
It seems to corrupt memory on Windows 10. The next test crashes.
--- dlls/ddraw/tests/ddraw7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d5969ab94929..c904e77849d7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -13340,7 +13340,7 @@ static void test_clip_planes_limits(void)
trace("Max user clip planes: %u.\n", caps.wMaxUserClipPlanes);
- for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i) + for (i = 0; i < caps.wMaxUserClipPlanes; ++i) { memset(plane, 0xff, sizeof(plane)); hr = IDirect3DDevice7_GetClipPlane(device, i, plane); @@ -13353,13 +13353,13 @@ static void test_clip_planes_limits(void) plane[0] = 2.0f; plane[1] = 8.0f; plane[2] = 5.0f; - for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i) + for (i = 0; i < caps.wMaxUserClipPlanes; ++i) { plane[3] = i; hr = IDirect3DDevice7_SetClipPlane(device, i, plane); ok(hr == D3D_OK, "Failed to set clip plane %u, hr %#x.\n", i, hr); } - for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i) + for (i = 0; i < caps.wMaxUserClipPlanes; ++i) { memset(plane, 0xff, sizeof(plane)); hr = IDirect3DDevice7_GetClipPlane(device, i, plane);
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Fixes a crash on Windows.
--- dlls/ddraw/tests/ddraw1.c | 1 + dlls/ddraw/tests/ddraw2.c | 1 + dlls/ddraw/tests/ddraw4.c | 1 + 3 files changed, 3 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index d27656576348..198b5d0a9235 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -11187,6 +11187,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 8b23c01b072b..21b2905e07bb 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -12543,6 +12543,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5eb391abd944..cbb3425d16cf 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -14597,6 +14597,7 @@ static void test_enum_surfaces(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=35269
Your paranoid android.
=== w8 (32 bit ddraw1) === ddraw1.c:10285: Test failed: Got unexpected color 0x00ffffff. ddraw1.c:10305: Test failed: Got unexpected color 0x00ffffff.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/ddraw/tests/d3d.c | 30 ------------------------- dlls/ddraw/tests/ddraw4.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 30 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 376008144678..205a4c6994c6 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -482,35 +482,6 @@ static void SceneTest(void) /* TODO: Verify that blitting works in the same way as in d3d9 */ }
-static void LimitTest(void) -{ - IDirectDrawSurface7 *pTexture = NULL; - HRESULT hr; - int i; - DDSURFACEDESC2 ddsd; - - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; - ddsd.dwWidth = 16; - ddsd.dwHeight = 16; - hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &pTexture, NULL); - ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); - if(!pTexture) return; - - for(i = 0; i < 8; i++) { - hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, pTexture); - ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr); - hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, NULL); - ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr); - hr = IDirect3DDevice7_SetTextureStageState(lpD3DDevice, i, D3DTSS_COLOROP, D3DTOP_ADD); - ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %08x\n", i, hr); - } - - IDirectDrawSurface7_Release(pTexture); -} - static HRESULT WINAPI enumDevicesCallback(GUID *Guid, char *DeviceDescription, char *DeviceName, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) { @@ -3475,7 +3446,6 @@ START_TEST(d3d) LightTest(); StateTest(); SceneTest(); - LimitTest(); D3D7EnumTest(); D3D7EnumLifetimeTest(); SetMaterialTest(); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index cbb3425d16cf..1e4a55cbe27b 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -14009,6 +14009,61 @@ static void test_compute_sphere_visibility(void) DestroyWindow(window); }
+static void test_texture_stages_limits(void) +{ + IDirectDrawSurface4 *surface; + DDSURFACEDESC2 surface_desc; + IDirect3DTexture2 *texture; + IDirect3DDevice3 *device; + IDirectDraw4 *ddraw; + IDirect3D3 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create 3D device.\n"); + DestroyWindow(window); + return; + } + hr = IDirect3DDevice3_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D interface, hr %#x.\n", hr); + hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get DirectDraw interface, hr %#x.\n", hr); + IDirect3D3_Release(d3d); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + hr = IDirectDrawSurface4_QueryInterface(surface, &IID_IDirect3DTexture2, (void **)&texture); + ok(SUCCEEDED(hr), "Failed to get texture interface, hr %#x.\n", hr); + IDirectDrawSurface4_Release(surface); + + for (i = 0; i < 8; ++i) + { + hr = IDirect3DDevice3_SetTexture(device, i, texture); + ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr); + hr = IDirect3DDevice3_SetTexture(device, i, NULL); + ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr); + hr = IDirect3DDevice3_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD); + ok(hr == D3D_OK, "Failed to set texture stage state %u, hr %#x.\n", i, hr); + } + + IDirectDraw4_Release(ddraw); + IDirect3DTexture2_Release(texture); + refcount = IDirect3DDevice3_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_map_synchronisation(void) { LARGE_INTEGER frequency, diff, ts[3]; @@ -14750,6 +14805,7 @@ START_TEST(ddraw4) test_ck_operation(); test_vb_refcount(); test_compute_sphere_visibility(); + test_texture_stages_limits(); test_map_synchronisation(); test_depth_readback(); test_clear(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index c904e77849d7..e1b387fc574e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -13385,6 +13385,57 @@ static void test_clip_planes_limits(void) DestroyWindow(window); }
+static void test_texture_stages_limits(void) +{ + IDirectDrawSurface7 *texture; + DDSURFACEDESC2 surface_desc; + IDirect3DDevice7 *device; + IDirectDraw7 *ddraw; + IDirect3D7 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create 3D device.\n"); + DestroyWindow(window); + return; + } + hr = IDirect3DDevice7_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D interface, hr %#x.\n", hr); + hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get DirectDraw interface, hr %#x.\n", hr); + IDirect3D7_Release(d3d); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &texture, NULL); + ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr); + + for (i = 0; i < 8; ++i) + { + hr = IDirect3DDevice7_SetTexture(device, i, texture); + ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetTexture(device, i, NULL); + ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD); + ok(hr == D3D_OK, "Failed to set texture stage state %u, hr %#x.\n", i, hr); + } + + IDirectDrawSurface7_Release(texture); + IDirectDraw7_Release(ddraw); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_map_synchronisation(void) { LARGE_INTEGER frequency, diff, ts[3]; @@ -14092,6 +14143,7 @@ START_TEST(ddraw7) test_vb_refcount(); test_compute_sphere_visibility(); test_clip_planes_limits(); + test_texture_stages_limits(); test_map_synchronisation(); test_depth_readback(); test_clear();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/ddraw/tests/d3d.c | 30 ------------------------------ dlls/ddraw/tests/ddraw2.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 39 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 30 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 205a4c6994c6..77836fd627ef 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -411,18 +411,6 @@ static void LightTest(void) } }
-static void StateTest( void ) -{ - HRESULT rc; - - /* The msdn says it's undocumented, does it return an error too? */ - rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, TRUE); - ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, TRUE) returned %08x\n", rc); - rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, FALSE); - ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, FALSE) returned %08x\n", rc); -} - - static void SceneTest(void) { HRESULT hr; @@ -1416,22 +1404,6 @@ out: IDirect3DVertexBuffer7_Release(lpVBufSrc); }
-static void D3D7_OldRenderStateTest(void) -{ - HRESULT hr; - DWORD val; - - /* 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) ) #define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -3444,14 +3416,12 @@ START_TEST(d3d) skip("Skipping d3d7 tests\n"); } else { LightTest(); - StateTest(); SceneTest(); D3D7EnumTest(); D3D7EnumLifetimeTest(); SetMaterialTest(); CapsTest(); VertexBufferDescTest(); - D3D7_OldRenderStateTest(); DeviceLoadTest(); SetRenderTargetTest(); VertexBufferLockRest(); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 21b2905e07bb..df1318b59d15 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -12153,6 +12153,49 @@ done: DestroyWindow(window); }
+static void test_set_render_state(void) +{ + IDirect3DDevice2 *device; + IDirectDraw2 *ddraw; + ULONG refcount; + HWND window; + DWORD state; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create 3D device.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, TRUE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + state = 0xdeadbeef; + hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, &state); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(!state, "Got unexpected render state %#x.\n", state); + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, &state); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(state == D3DTBLEND_MODULATE, "Got unexpected render state %#x.\n", state); + + refcount = IDirect3DDevice2_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + refcount = IDirectDraw2_Release(ddraw); + ok(!refcount, "DirectDraw has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_depth_readback(void) { DWORD depth, expected_depth, max_diff; @@ -12684,6 +12727,7 @@ START_TEST(ddraw2) test_display_mode_surface_pixel_format(); test_surface_desc_size(); test_ck_operation(); + test_set_render_state(); test_depth_readback(); test_clear(); test_enum_surfaces(); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e4a55cbe27b..6d2f96eac7b1 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -14064,6 +14064,44 @@ static void test_texture_stages_limits(void) DestroyWindow(window); }
+static void test_set_render_state(void) +{ + IDirect3DDevice3 *device; + ULONG refcount; + HWND window; + DWORD state; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create 3D device.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, TRUE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + state = 0xdeadbeef; + hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, &state); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(!state, "Got unexpected render state %#x.\n", state); + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, &state); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(state == D3DTBLEND_MODULATE, "Got unexpected render state %#x.\n", state); + + refcount = IDirect3DDevice3_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_map_synchronisation(void) { LARGE_INTEGER frequency, diff, ts[3]; @@ -14806,6 +14844,7 @@ START_TEST(ddraw4) test_vb_refcount(); test_compute_sphere_visibility(); test_texture_stages_limits(); + test_set_render_state(); test_map_synchronisation(); test_depth_readback(); test_clear(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index e1b387fc574e..745245a7e418 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -13436,6 +13436,46 @@ static void test_texture_stages_limits(void) DestroyWindow(window); }
+static void test_set_render_state(void) +{ + IDirect3DDevice7 *device; + ULONG refcount; + HWND window; + DWORD state; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create 3D device.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, TRUE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZVISIBLE, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + /* States deprecated in D3D7 */ + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, 0); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + state = 0xdeadbeef; + hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, &state); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(state == 0xdeadbeef, "Got unexpected render state %#x.\n", state); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + state = 0xdeadbeef; + hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_TEXTUREMAPBLEND, &state); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(state == 0xdeadbeef, "Got unexpected render state %#x.\n", state); + + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_map_synchronisation(void) { LARGE_INTEGER frequency, diff, ts[3]; @@ -14144,6 +14184,7 @@ START_TEST(ddraw7) test_compute_sphere_visibility(); test_clip_planes_limits(); test_texture_stages_limits(); + test_set_render_state(); test_map_synchronisation(); test_depth_readback(); test_clear();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com