[PATCH 3/6] wined3d: Handle WINED3DFMT_FLAG_BROKEN_PITCH in wined3d_format_calculate_size().
Henri Verbeet
hverbeet at codeweavers.com
Fri Aug 26 06:51:20 CDT 2016
From: Patrick Rudolph <siro at das-labor.org>
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 at das-labor.org>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/d3d8/tests/device.c | 8 +++++---
dlls/d3d9/tests/device.c | 8 +++++---
dlls/wined3d/utils.c | 3 +++
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 530ef00..95567ca 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -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
{
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index fbafa14..9f1d39b 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -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
{
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 8989833..ee3af83 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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;
--
2.1.4
More information about the wine-patches
mailing list