[PATCH 2/2] wined3d: Fix calculation of pitch for ATI2N format

Ričardas Barkauskas miegalius at gmail.com
Fri Feb 19 19:49:21 CST 2010


Fixes ATI2N pitch calculation bug.
Even though ATI2N is compressed format similar to DXT5, pitch calculations
behave as if it is a normal surface.

Fixes bug 21519 - Mass Effect 2 crashing.


Ričardas Barkauskas
REalm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100220/55a54cbe/attachment.htm>
-------------- next part --------------
From 4817709d811536d0e78c991ba7758120ac314fe9 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:35:02 +0200
Subject: wined3d: Fix calculation of pitch for ATI2N format

---
 dlls/d3d9/tests/surface.c   |    2 +-
 dlls/wined3d/surface_base.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d9/tests/surface.c b/dlls/d3d9/tests/surface.c
index 4693193..9b063da 100644
--- a/dlls/d3d9/tests/surface.c
+++ b/dlls/d3d9/tests/surface.c
@@ -256,7 +256,7 @@ static void test_lockrect_offset(IDirect3DDevice9 *device)
 
     offset = (BYTE *)locked_rect.pBits - base;
 
-    todo_wine ok(offset == 2160, "Got offset %u, expected offset 2160 for format ATI2N\n", offset);
+    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);
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 33e3d3e..1e4d7e3 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -330,7 +330,7 @@ DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
     DWORD ret;
     TRACE("(%p)\n", This);
 
-    if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
+    if ((format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED) && (format_desc->format != WINED3DFMT_ATI2N))
     {
         /* Since compressed formats are block based, pitch means the amount of
          * bytes to the next row of block rather than the next row of pixels. */
-- 
1.6.6.1


More information about the wine-patches mailing list