Henri Verbeet : wined3d: Correctly calculate the resource size for ATI2N surfaces.
Alexandre Julliard
julliard at winehq.org
Mon Aug 16 12:25:00 CDT 2010
Module: wine
Branch: master
Commit: 6a9476b6090d80fb25fbf2039422c4c7858e40fd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6a9476b6090d80fb25fbf2039422c4c7858e40fd
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Sun Aug 15 23:21:46 2010 +0200
wined3d: Correctly calculate the resource size for ATI2N surfaces.
---
dlls/wined3d/surface_base.c | 6 ++++--
dlls/wined3d/utils.c | 7 +++++--
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 99857f3..e9e1ff7 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -327,7 +327,8 @@ 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 | WINED3DFMT_FLAG_BROKEN_PITCH))
+ == WINED3DFMT_FLAG_COMPRESSED)
{
/* 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. */
@@ -1860,7 +1861,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
TRACE("Lock Rect (%p) = l %d, t %d, r %d, b %d\n",
pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
- if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
+ if ((format_desc->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH))
+ == WINED3DFMT_FLAG_COMPRESSED)
{
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 479f329..a4ea624 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -139,6 +139,9 @@ struct wined3d_format_base_flags
DWORD flags;
};
+/* The ATI2N format behaves like an uncompressed format in LockRect(), but
+ * still needs to use the correct block based calculation for e.g. the
+ * resource size. */
static const struct wined3d_format_base_flags format_base_flags[] =
{
{WINED3DFMT_UYVY, WINED3DFMT_FLAG_FOURCC},
@@ -163,7 +166,7 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{WINED3DFMT_B4G4R4X4_UNORM, WINED3DFMT_FLAG_GETDC},
{WINED3DFMT_R8G8B8A8_UNORM, WINED3DFMT_FLAG_GETDC},
{WINED3DFMT_R8G8B8X8_UNORM, WINED3DFMT_FLAG_GETDC},
- {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_FOURCC},
+ {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_FOURCC | WINED3DFMT_FLAG_BROKEN_PITCH},
{WINED3DFMT_NVHU, WINED3DFMT_FLAG_FOURCC},
{WINED3DFMT_NVHS, WINED3DFMT_FLAG_FOURCC},
{WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_FLOAT},
@@ -192,7 +195,7 @@ static const struct wined3d_format_compression_info format_compression_info[] =
{WINED3DFMT_DXT3, 4, 4, 16},
{WINED3DFMT_DXT4, 4, 4, 16},
{WINED3DFMT_DXT5, 4, 4, 16},
- {WINED3DFMT_ATI2N, 1, 1, 1},
+ {WINED3DFMT_ATI2N, 4, 4, 16},
};
struct wined3d_format_vertex_info
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 37c41da..330d92b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2942,6 +2942,7 @@ extern WINED3DFORMAT pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN;
#define WINED3DFMT_FLAG_VTF 0x00002000
#define WINED3DFMT_FLAG_SHADOW 0x00004000
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
+#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
struct wined3d_format_desc
{
More information about the wine-cvs
mailing list