=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d8/tests: Test rhw depth clip with z enabled but no depth buffer set.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Feb 12 10:13:40 CST 2015
Module: wine
Branch: master
Commit: f460db7c80485efa379d091b18f1294b7e5ce776
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f460db7c80485efa379d091b18f1294b7e5ce776
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Thu Feb 12 10:58:46 2015 +0100
d3d8/tests: Test rhw depth clip with z enabled but no depth buffer set.
---
dlls/d3d8/tests/visual.c | 80 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 58 insertions(+), 22 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 7efc90d..40bbc59 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -4070,6 +4070,8 @@ static void zenable_test(void)
HRESULT hr;
UINT x, y;
UINT i, j;
+ UINT test;
+ IDirect3DSurface8 *ds, *rt;
static const struct
{
@@ -4094,34 +4096,68 @@ static void zenable_test(void)
goto done;
}
- hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE);
- ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
- ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_GetDepthStencilSurface(device, &ds);
+ ok(SUCCEEDED(hr), "Failed to get depth stencil surface, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target surface, hr %#x.\n", hr);
- hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 0.0f, 0);
- ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
- hr = IDirect3DDevice8_BeginScene(device);
- ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
- hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tquad, sizeof(*tquad));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice8_EndScene(device);
- ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
-
- for (i = 0; i < 4; ++i)
+ for (test = 0; test < 2; ++test)
{
- for (j = 0; j < 4; ++j)
+ /* The Windows 8 testbot (WARP) appears to clip with
+ * ZENABLE = D3DZB_TRUE and no depth buffer set. */
+ static const D3DCOLOR expected_broken[] =
{
- x = 80 * ((2 * j) + 1);
- y = 60 * ((2 * i) + 1);
- color = getPixelColor(device, x, y);
- ok(color_match(color, 0x0000ff00, 1),
- "Expected color 0x0000ff00 at %u, %u, got 0x%08x.\n", x, y, color);
+ 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x00ff0000,
+ 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x00ff0000,
+ 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x00ff0000,
+ 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x00ff0000,
+ };
+
+ if (!test)
+ {
+ hr = IDirect3DDevice8_SetRenderTarget(device, rt, NULL);
+ ok(SUCCEEDED(hr), "Failed to set depth stencil surface, hr %#x.\n", hr);
}
+ else
+ {
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderTarget(device, rt, ds);
+ ok(SUCCEEDED(hr), "Failed to set depth stencil surface, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_ZBUFFER, 0x00000000, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
+ }
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
+ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tquad, sizeof(*tquad));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 4; ++j)
+ {
+ x = 80 * ((2 * j) + 1);
+ y = 60 * ((2 * i) + 1);
+ color = getPixelColor(device, x, y);
+ ok(color_match(color, 0x0000ff00, 1)
+ || broken(color_match(color, expected_broken[i * 4 + j], 1) && !test),
+ "Expected color 0x0000ff00 at %u, %u, got 0x%08x.\n", x, y, color);
+ }
+ }
+
+ hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
+ ok(SUCCEEDED(hr), "Failed to present backbuffer, hr %#x.\n", hr);
}
- hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
- ok(SUCCEEDED(hr), "Failed to present backbuffer, hr %#x.\n", hr);
+ IDirect3DSurface8_Release(ds);
+ IDirect3DSurface8_Release(rt);
hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
More information about the wine-cvs
mailing list