ddraw/tests: test if surface with DDSCAPS_ZBUFFER can be render target

Ričardas Barkauskas miegalius at gmail.com
Sun Oct 24 14:49:31 CDT 2010


Related to 3Dmark2000 not showing demo.

Ričardas Barkauskas
REalm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20101024/1dd29b0f/attachment.htm>
-------------- next part --------------
From c4ce20ba69868e60626fdbdc2fe80c21992476df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ri=C4=8Dardas=20Barkauskas?= <miegalius at gmail.com>
Date: Sun, 24 Oct 2010 21:47:35 +0300
Subject: ddraw/tests: test if surface with DDSCAPS_ZBUFFER can be render target

---
 dlls/ddraw/tests/d3d.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 5043a01..8088188 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -3133,9 +3133,9 @@ static void ComputeSphereVisibility(void)
 static void SetRenderTargetTest(void)
 {
     HRESULT hr;
-    IDirectDrawSurface7 *newrt, *oldrt;
+    IDirectDrawSurface7 *newrt, *failrt, *oldrt;
     D3DVIEWPORT7 vp;
-    DDSURFACEDESC2 ddsd;
+    DDSURFACEDESC2 ddsd, ddsd2;
     DWORD stateblock;
 
     memset(&ddsd, 0, sizeof(ddsd));
@@ -3144,6 +3144,7 @@ static void SetRenderTargetTest(void)
     ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
     ddsd.dwWidth = 64;
     ddsd.dwHeight = 64;
+
     hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &newrt, NULL);
     ok(hr == DD_OK, "IDirectDraw7_CreateSurface failed, hr=0x%08x\n", hr);
     if(FAILED(hr))
@@ -3152,6 +3153,20 @@ static void SetRenderTargetTest(void)
         return;
     }
 
+    memset(&ddsd2, 0, sizeof(ddsd2));
+    ddsd2.dwSize = sizeof(ddsd2);
+    ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+    ddsd2.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER;
+    ddsd2.dwWidth = 64;
+    ddsd2.dwHeight = 64;
+    U4(ddsd2).ddpfPixelFormat.dwSize = sizeof(U4(ddsd2).ddpfPixelFormat);
+    U4(ddsd2).ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
+    U1(U4(ddsd2).ddpfPixelFormat).dwZBufferBitDepth = 16;
+    U3(U4(ddsd2).ddpfPixelFormat).dwZBitMask = 0x0000FFFF;
+
+    hr = IDirectDraw7_CreateSurface(lpDD, &ddsd2, &failrt, NULL);
+    ok(hr == DD_OK, "IDirectDraw7_CreateSurface failed, hr=0x%08x\n", hr);
+
     memset(&vp, 0, sizeof(vp));
     vp.dwX = 10;
     vp.dwY = 10;
@@ -3165,6 +3180,9 @@ static void SetRenderTargetTest(void)
     hr = IDirect3DDevice7_GetRenderTarget(lpD3DDevice, &oldrt);
     ok(hr == DD_OK, "IDirect3DDevice7_GetRenderTarget failed, hr=0x%08x\n", hr);
 
+    hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, failrt, 0);
+    todo_wine ok(hr != D3D_OK, "IDirect3DDevice7_SetRenderTarget succeeded\n");
+
     hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, newrt, 0);
     ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x\n", hr);
     memset(&vp, 0xff, sizeof(vp));
@@ -3231,6 +3249,7 @@ static void SetRenderTargetTest(void)
 
     IDirectDrawSurface7_Release(oldrt);
     IDirectDrawSurface7_Release(newrt);
+    IDirectDrawSurface7_Release(failrt);
 }
 
 static UINT expect_message;
-- 
1.7.1


More information about the wine-patches mailing list