wined3d: Correctly calculate the resource size for ATI2N surfaces.

This commit is contained in:
Henri Verbeet 2010-08-15 23:21:46 +02:00 committed by Alexandre Julliard
parent 3a36013065
commit 6a9476b609
3 changed files with 10 additions and 4 deletions

View File

@ -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. */

View File

@ -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

View File

@ -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
{