From: Zebediah Figura zfigura@codeweavers.com
* Disable lighting, which affects rendering tests in non-obvious ways.
* Show that the texture is explicitly never set in ddraw7.
* Show that the diffuse color is rendered in ddraw4 and ddraw7, which is consistent with the texture being unset in ddraw7 and suggests that the same applies to ddraw4.
This may or may not help with bug 54069, but if it does not, it hopefully will at least make the reason for failure clearer. --- dlls/ddraw/tests/ddraw1.c | 1 + dlls/ddraw/tests/ddraw2.c | 8 +++++++- dlls/ddraw/tests/ddraw4.c | 24 ++++++++++++++++-------- dlls/ddraw/tests/ddraw7.c | 20 +++++++++++++------- 4 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3e5bf3dee1a..660974cd60c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -14742,6 +14742,7 @@ static void test_texture_wrong_caps(const GUID *device_guid) ptr = (BYTE *)exec_desc.lpData + sizeof(quad); emit_process_vertices(&ptr, D3DPROCESSVERTICES_COPY, 0, 4); emit_set_rs(&ptr, D3DRENDERSTATE_TEXTUREHANDLE, texture_handle); + emit_set_rs(&ptr, D3DRENDERSTATE_LIGHTING, FALSE); emit_tquad(&ptr, 0); emit_end(&ptr); inst_length = (BYTE *)ptr - (BYTE *)exec_desc.lpData - sizeof(quad); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 6c07c9531f4..8160e4263a7 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -15645,9 +15645,9 @@ static void test_texture_wrong_caps(const GUID *device_guid) {32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000} }; D3DRECT clear_rect = {{0}, {0}, {640}, {480}}; + D3DTEXTUREHANDLE texture_handle, ret_handle; unsigned int color, expected_color; IDirectDrawSurface *surface, *rt; - D3DTEXTUREHANDLE texture_handle; IDirect3DMaterial2 *background; IDirect3DViewport2 *viewport; IDirect3DTexture2 *texture; @@ -15692,8 +15692,14 @@ static void test_texture_wrong_caps(const GUID *device_guid)
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, texture_handle); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_TEXTUREHANDLE, &ret_handle); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + todo_wine_if (!is_software_device_type(device_guid)) + ok(ret_handle == texture_handle, "Got handle %#lx.\n", ret_handle);
background = create_diffuse_material(device, 1.0f, 0.0f, 0.0f, 1.0f); viewport_set_background(device, viewport, background); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 943fbd36002..62059ab1dd1 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -18691,14 +18691,15 @@ static void test_texture_wrong_caps(const GUID *device_guid) static struct { struct vec3 position; + unsigned int diffuse; struct vec2 texcoord; } quad[] = { - {{-1.0f, -1.0f, 0.0f}, {0.0f, 1.0f}}, - {{-1.0f, 1.0f, 0.0f}, {0.0f, 0.0f}}, - {{ 1.0f, -1.0f, 0.0f}, {1.0f, 1.0f}}, - {{ 1.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, + {{-1.0f, -1.0f, 0.0f}, 0x00ff0000, {0.0f, 1.0f}}, + {{-1.0f, 1.0f, 0.0f}, 0x00ff0000, {0.0f, 0.0f}}, + {{ 1.0f, -1.0f, 0.0f}, 0x00ff0000, {1.0f, 1.0f}}, + {{ 1.0f, 1.0f, 0.0f}, 0x00ff0000, {1.0f, 0.0f}}, }; static DDPIXELFORMAT fmt = { @@ -18706,10 +18707,10 @@ static void test_texture_wrong_caps(const GUID *device_guid) {32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000} }; D3DRECT clear_rect = {{0}, {0}, {640}, {480}}; + IDirect3DTexture2 *texture, *ret_texture; unsigned int color, expected_color; IDirectDrawSurface4 *surface, *rt; IDirect3DViewport3 *viewport; - IDirect3DTexture2 *texture; IDirect3DDevice3 *device; IDirectDraw4 *ddraw; DDSURFACEDESC2 ddsd; @@ -18752,6 +18753,8 @@ static void test_texture_wrong_caps(const GUID *device_guid)
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); @@ -18760,21 +18763,26 @@ static void test_texture_wrong_caps(const GUID *device_guid) hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); - ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice3_SetTexture(device, 0, texture); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice3_GetTexture(device, 0, &ret_texture); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + todo_wine_if (!is_software_device_type(device_guid)) + ok(ret_texture == texture, "Got texture %p.\n", ret_texture); + hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice3_BeginScene(device); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, - D3DFVF_XYZ | D3DFVF_TEX1, quad, 4, 0); + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1, quad, 4, 0); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice3_EndScene(device); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
- expected_color = is_software_device_type(device_guid) ? 0x0000ff00 : 0x00ffffff; + expected_color = is_software_device_type(device_guid) ? 0x0000ff00 : 0x00ff0000; color = get_surface_color(rt, 320, 240); ok(color == expected_color, "Got color 0x%08x, expected 0x%08x.\n", color, expected_color);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d875afcfa16..d7892ad9472 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18952,21 +18952,22 @@ static void test_texture_wrong_caps(const GUID *device_guid) static struct { struct vec3 position; + unsigned int diffuse; struct vec2 texcoord; } quad[] = { - {{-1.0f, -1.0f, 0.0f}, {0.0f, 1.0f}}, - {{-1.0f, 1.0f, 0.0f}, {0.0f, 0.0f}}, - {{ 1.0f, -1.0f, 0.0f}, {1.0f, 1.0f}}, - {{ 1.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, + {{-1.0f, -1.0f, 0.0f}, 0x00ff0000, {0.0f, 1.0f}}, + {{-1.0f, 1.0f, 0.0f}, 0x00ff0000, {0.0f, 0.0f}}, + {{ 1.0f, -1.0f, 0.0f}, 0x00ff0000, {1.0f, 1.0f}}, + {{ 1.0f, 1.0f, 0.0f}, 0x00ff0000, {1.0f, 0.0f}}, }; static DDPIXELFORMAT fmt = { sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0, {32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000} }; - IDirectDrawSurface7 *surface, *rt; + IDirectDrawSurface7 *surface, *rt, *ret_surface; IDirect3DDevice7 *device; IDirectDraw7 *ddraw; DDSURFACEDESC2 ddsd; @@ -19004,6 +19005,8 @@ static void test_texture_wrong_caps(const GUID *device_guid)
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); @@ -19016,6 +19019,9 @@ static void test_texture_wrong_caps(const GUID *device_guid)
hr = IDirect3DDevice7_SetTexture(device, 0, surface); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice7_GetTexture(device, 0, &ret_surface); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + ok(!ret_surface, "Got surface %p.\n", ret_surface);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); @@ -19025,13 +19031,13 @@ static void test_texture_wrong_caps(const GUID *device_guid) hr = IDirect3DDevice7_BeginScene(device); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, - D3DFVF_XYZ | D3DFVF_TEX1, quad, 4, 0); + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1, quad, 4, 0); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); hr = IDirect3DDevice7_EndScene(device); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
color = get_surface_color(rt, 320, 240); - ok(color == 0, "Got unexpected color 0x%08x.\n", color); + ok(color == 0x00ff0000, "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface7_Release(surface); IDirectDrawSurface7_Release(rt);