[PATCH 1/2] d3d9/tests: Added test for ATI2N locking offset

Ričardas Barkauskas miegalius at gmail.com
Fri Feb 19 19:45:39 CST 2010


Tests locking offset behaviour for ATI2N format surfaces.
Related to bug 21519 - Mass Effect 2 crash.

Ričardas Barkauskas
REalm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100220/03ec94ba/attachment-0001.htm>
-------------- next part --------------
From cabbd1cdbfea19b6b34fb3ab8a47f879d897136b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ri=C4=8Dardas=20Barkauskas?= <miegalius at gmail.com>
Date: Sat, 20 Feb 2010 03:26:57 +0200
Subject: d3d9/tests: Added test for ATI2N locking offset

---
 dlls/d3d9/tests/surface.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/tests/surface.c b/dlls/d3d9/tests/surface.c
index 396e0c4..4693193 100644
--- a/dlls/d3d9/tests/surface.c
+++ b/dlls/d3d9/tests/surface.c
@@ -236,6 +236,32 @@ static void test_lockrect_offset(IDirect3DDevice9 *device)
 
         IDirect3DSurface9_Release(surface);
     }
+
+    /* While ATI2N is compressed format, it behaves diffrently from DXT ones */
+    hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128, MAKEFOURCC('A','T','I','2'), D3DPOOL_SCRATCH, &surface, 0);
+    ok(SUCCEEDED(hr), "CreateOffscreenPlainSurface failed (%08x)\n", hr);
+
+    hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
+    ok(SUCCEEDED(hr), "LockRect failed (%08x)\n", hr);
+
+    base = locked_rect.pBits;
+
+    hr = IDirect3DSurface9_UnlockRect(surface);
+    ok(SUCCEEDED(hr), "UnlockRect failed (%08x)\n", hr);
+    hr = IDirect3DSurface9_UnlockRect(surface);
+    ok(hr == D3DERR_INVALIDCALL, "Double UnlockRect returned %08x, expected D3DERR_INVALIDCALL\n", hr);
+
+    hr = IDirect3DSurface9_LockRect(surface, &locked_rect, &rect, 0);
+    ok(SUCCEEDED(hr), "LockRect failed (%08x)\n", hr);
+
+    offset = (BYTE *)locked_rect.pBits - base;
+
+    todo_wine ok(offset == 2160, "Got offset %u, expected offset 2160 for format ATI2N\n", offset);
+
+    hr = IDirect3DSurface9_UnlockRect(surface);
+    ok(SUCCEEDED(hr), "UnlockRect failed (%08x)\n", hr);
+
+    IDirect3DSurface9_Release(surface);
 }
 
 static void test_lockrect_invalid(IDirect3DDevice9 *device)
-- 
1.6.6.1


More information about the wine-patches mailing list