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: Patrick Rudolph <siro@das-labor.org> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
09b09b307a
commit
3f7e5d647e
@ -7927,6 +7927,8 @@ static void test_miptree_layout(void)
|
|||||||
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
|
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
|
||||||
{D3DFMT_A8, "D3DFMT_A8"},
|
{D3DFMT_A8, "D3DFMT_A8"},
|
||||||
{D3DFMT_L8, "D3DFMT_L8"},
|
{D3DFMT_L8, "D3DFMT_L8"},
|
||||||
|
{MAKEFOURCC('A','T','I','1'), "D3DFMT_ATI1"},
|
||||||
|
{MAKEFOURCC('A','T','I','2'), "D3DFMT_ATI2"},
|
||||||
};
|
};
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
|
@ -11049,6 +11049,8 @@ static void test_miptree_layout(void)
|
|||||||
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
|
{D3DFMT_A8R8G8B8, "D3DFMT_A8R8G8B8"},
|
||||||
{D3DFMT_A8, "D3DFMT_A8"},
|
{D3DFMT_A8, "D3DFMT_A8"},
|
||||||
{D3DFMT_L8, "D3DFMT_L8"},
|
{D3DFMT_L8, "D3DFMT_L8"},
|
||||||
|
{MAKEFOURCC('A','T','I','1'), "D3DFMT_ATI1"},
|
||||||
|
{MAKEFOURCC('A','T','I','2'), "D3DFMT_ATI2"},
|
||||||
};
|
};
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
|
@ -3577,6 +3577,9 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
|
|||||||
if (format->id == WINED3DFMT_UNKNOWN)
|
if (format->id == WINED3DFMT_UNKNOWN)
|
||||||
return 0;
|
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);
|
wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
|
||||||
|
|
||||||
return slice_pitch * depth;
|
return slice_pitch * depth;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user