Commit 3f7e5d64 authored by Patrick Rudolph's avatar Patrick Rudolph Committed by Alexandre Julliard

wined3d: Handle WINED3DFMT_FLAG_BROKEN_PITCH in wined3d_format_calculate_size().

The broken pitch calculation also affects the resource memory layout, as evidenced by the mip-tree layout tests. Found using apitrace, which crashes on Wine when playing back traces containing ATI1 textures. Signed-off-by: 's avatarPatrick Rudolph <siro@das-labor.org> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 09b09b30
......@@ -7924,9 +7924,11 @@ static void test_miptree_layout(void)
}
formats[] =
{
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
{D3DFMT_A8, "D3DFMT_A8"},
{D3DFMT_L8, "D3DFMT_L8"},
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
{D3DFMT_A8, "D3DFMT_A8"},
{D3DFMT_L8, "D3DFMT_L8"},
{MAKEFOURCC('A','T','I','1'), "D3DFMT_ATI1"},
{MAKEFOURCC('A','T','I','2'), "D3DFMT_ATI2"},
};
static const struct
{
......
......@@ -11046,9 +11046,11 @@ static void test_miptree_layout(void)
}
formats[] =
{
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
{D3DFMT_A8, "D3DFMT_A8"},
{D3DFMT_L8, "D3DFMT_L8"},
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
{D3DFMT_A8, "D3DFMT_A8"},
{D3DFMT_L8, "D3DFMT_L8"},
{MAKEFOURCC('A','T','I','1'), "D3DFMT_ATI1"},
{MAKEFOURCC('A','T','I','2'), "D3DFMT_ATI2"},
};
static const struct
{
......
......@@ -3577,6 +3577,9 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
if (format->id == WINED3DFMT_UNKNOWN)
return 0;
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BROKEN_PITCH)
return width * height * depth * format->byte_count;
wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
return slice_pitch * depth;
......
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