[PATCH] ddraw/tests: Only set DDSCAPS_OVERLAY if supported.
Stefan Dösinger
stefan at codeweavers.com
Mon Mar 10 08:46:19 CDT 2014
This patch is independent of 103075-103079.
VMWare apparently supports YUV formats as non-overlay formats (see
fg-win7u64* test machines). All the real hardware I have seen requires
DDSCAPS_OVERLAY for those formats.
There is no way to check format and surface type compatibility. If the
format is supported, but DDSCAPS_OVERLAY isn't, assume the driver
supports those formats without the overlay cap. If DDSCAPS_OVERLAY is
supported, use it for YUV formats.
---
dlls/ddraw/tests/ddraw4.c | 8 ++++++++
dlls/ddraw/tests/ddraw7.c | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 5a2dba1..f1b7b1a 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -4043,6 +4043,8 @@ static void test_block_formats_creation(void)
DWORD supported_fmts = 0, supported_overlay_fmts = 0;
DWORD num_fourcc_codes = 0, *fourcc_codes;
DDSURFACEDESC2 ddsd;
+ DDCAPS hal_caps, hel_caps;
+ BOOL overlay_support;
static const struct
{
DWORD fourcc;
@@ -4132,6 +4134,10 @@ static void test_block_formats_creation(void)
}
HeapFree(GetProcessHeap(), 0, fourcc_codes);
+ hr = IDirectDraw4_GetCaps(ddraw, &hal_caps, &hel_caps);
+ ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
+ overlay_support = !!(hal_caps.ddsCaps.dwCaps & DDSCAPS_OVERLAY);
+
for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
{
for (j = 0; j < sizeof(types) / sizeof(*types); j++)
@@ -4165,6 +4171,8 @@ static void test_block_formats_creation(void)
U4(ddsd).ddpfPixelFormat.dwFourCC = formats[i].fourcc;
ddsd.dwWidth = w;
ddsd.dwHeight = h;
+ if (!overlay_support)
+ ddsd.ddsCaps.dwCaps &= ~DDSCAPS_OVERLAY;
/* TODO: Handle power of two limitations. I cannot test the pow2
* behavior on windows because I have no hardware that doesn't at
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 1218a21..b1a4bf7 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -3850,6 +3850,8 @@ static void test_block_formats_creation(void)
DWORD supported_fmts = 0, supported_overlay_fmts = 0;
DWORD num_fourcc_codes = 0, *fourcc_codes;
DDSURFACEDESC2 ddsd;
+ DDCAPS hal_caps, hel_caps;
+ BOOL overlay_support;
static const struct
{
DWORD fourcc;
@@ -3939,6 +3941,10 @@ static void test_block_formats_creation(void)
}
HeapFree(GetProcessHeap(), 0, fourcc_codes);
+ hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, &hel_caps);
+ ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
+ overlay_support = !!(hal_caps.ddsCaps.dwCaps & DDSCAPS_OVERLAY);
+
for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
{
for (j = 0; j < sizeof(types) / sizeof(*types); j++)
@@ -3972,6 +3978,8 @@ static void test_block_formats_creation(void)
U4(ddsd).ddpfPixelFormat.dwFourCC = formats[i].fourcc;
ddsd.dwWidth = w;
ddsd.dwHeight = h;
+ if (!overlay_support)
+ ddsd.ddsCaps.dwCaps &= ~DDSCAPS_OVERLAY;
/* TODO: Handle power of two limitations. I cannot test the pow2
* behavior on windows because I have no hardware that doesn't at
--
1.8.3.2
More information about the wine-patches
mailing list