Commit 6a9476b6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Correctly calculate the resource size for ATI2N surfaces.

parent 3a360130
......@@ -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. */
......
......@@ -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
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment