Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fixed compilation error on old GCC
dlls/ddraw/tests/ddraw1.c | 40 ++++++++++++---------------------------- dlls/ddraw/tests/ddraw2.c | 40 ++++++++++++---------------------------- dlls/ddraw/tests/ddraw4.c | 32 ++++++++++++-------------------- dlls/ddraw/tests/ddraw7.c | 32 ++++++++++++-------------------- 4 files changed, 48 insertions(+), 96 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 109910b820..56916d6568 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -82,14 +82,16 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw *ddraw) { IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); @@ -97,42 +99,24 @@ static BOOL ddraw_is_warp(IDirectDraw *ddraw) ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
+ return identifier; +} + +static BOOL ddraw_is_warp(IDirectDraw *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return !!strstr(identifier.szDriver, "warp"); }
static BOOL ddraw_is_nvidia(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x8086; }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1db7ad9329..a92e4dc50f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -84,14 +84,16 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw2 *ddraw) { IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); @@ -99,42 +101,24 @@ static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
+ return identifier; +} + +static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return !!strstr(identifier.szDriver, "warp"); }
static BOOL ddraw_is_nvidia(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x8086; }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 98c86d0bf0..5a356af4c5 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -94,45 +94,37 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) return TRUE; }
-static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw4 *ddraw) { DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
+ return identifier; +} + +static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return !!strstr(identifier.szDriver, "warp"); }
static BOOL ddraw_is_nvidia(IDirectDraw4 *ddraw) { - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw4 *ddraw) { - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x8086; }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 91822281d0..a8b1a8ed92 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -104,45 +104,37 @@ static ULONG get_refcount(IUnknown *iface) return IUnknown_Release(iface); }
-static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) +static DDDEVICEIDENTIFIER2 ddraw_dev_id(IDirectDraw7 *ddraw) { DDDEVICEIDENTIFIER2 identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
+ return identifier; +} + +static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) +{ + DDDEVICEIDENTIFIER2 identifier = ddraw_dev_id(ddraw); return !!strstr(identifier.szDriver, "warp"); }
static BOOL ddraw_is_nvidia(IDirectDraw7 *ddraw) { - DDDEVICEIDENTIFIER2 identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - + DDDEVICEIDENTIFIER2 identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw7 *ddraw) { - DDDEVICEIDENTIFIER2 identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - + DDDEVICEIDENTIFIER2 identifier = ddraw_dev_id(ddraw); return identifier.dwVendorId == 0x8086; }
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- v2: Fixed compilation error on old GCC
dlls/ddraw/tests/ddraw1.c | 10 +++++++++- dlls/ddraw/tests/ddraw2.c | 10 +++++++++- dlls/ddraw/tests/ddraw4.c | 10 +++++++++- dlls/ddraw/tests/ddraw7.c | 10 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 56916d6568..3f77ca10b5 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -120,6 +120,12 @@ static BOOL ddraw_is_intel(IDirectDraw *ddraw) return identifier.dwVendorId == 0x8086; }
+static BOOL ddraw_is_vmware(IDirectDraw *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); + return identifier.dwVendorId == 0x15ad; +} + static IDirectDrawSurface *create_overlay(IDirectDraw *ddraw, unsigned int width, unsigned int height, DWORD format) { @@ -8663,7 +8669,9 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + ok(SUCCEEDED(hr) || + broken(hr == DDERR_OUTOFCAPS && dwm_enabled()) || + broken(hr == E_NOTIMPL && ddraw_is_vmware(ddraw)), "Failed to update overlay, hr %#x.\n", hr);
/* Try to overlay the primary with a non-overlay surface. */ diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index a92e4dc50f..ad248a669f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -122,6 +122,12 @@ static BOOL ddraw_is_intel(IDirectDraw2 *ddraw) return identifier.dwVendorId == 0x8086; }
+static BOOL ddraw_is_vmware(IDirectDraw2 *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); + return identifier.dwVendorId == 0x15ad; +} + static IDirectDrawSurface *create_overlay(IDirectDraw2 *ddraw, unsigned int width, unsigned int height, DWORD format) { @@ -9797,7 +9803,9 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + ok(SUCCEEDED(hr) || + broken(hr == DDERR_OUTOFCAPS && dwm_enabled()) || + broken(hr == E_NOTIMPL && ddraw_is_vmware(ddraw)), "Failed to update overlay, hr %#x.\n", hr);
/* Try to overlay the primary with a non-overlay surface. */ diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5a356af4c5..abf393710d 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -128,6 +128,12 @@ static BOOL ddraw_is_intel(IDirectDraw4 *ddraw) return identifier.dwVendorId == 0x8086; }
+static BOOL ddraw_is_vmware(IDirectDraw4 *ddraw) +{ + DDDEVICEIDENTIFIER identifier = ddraw_dev_id(ddraw); + return identifier.dwVendorId == 0x15ad; +} + static IDirectDrawSurface4 *create_overlay(IDirectDraw4 *ddraw, unsigned int width, unsigned int height, DWORD format) { @@ -11259,7 +11265,9 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface4_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + ok(SUCCEEDED(hr) || + broken(hr == DDERR_OUTOFCAPS && dwm_enabled()) || + broken(hr == E_NOTIMPL && ddraw_is_vmware(ddraw)), "Failed to update overlay, hr %#x.\n", hr);
/* Try to overlay the primary with a non-overlay surface. */ diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index a8b1a8ed92..4b5c5561d3 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -138,6 +138,12 @@ static BOOL ddraw_is_intel(IDirectDraw7 *ddraw) return identifier.dwVendorId == 0x8086; }
+static BOOL ddraw_is_vmware(IDirectDraw7 *ddraw) +{ + DDDEVICEIDENTIFIER2 identifier = ddraw_dev_id(ddraw); + return identifier.dwVendorId == 0x15ad; +} + static IDirectDrawSurface7 *create_overlay(IDirectDraw7 *ddraw, unsigned int width, unsigned int height, DWORD format) { @@ -11220,7 +11226,9 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface7_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + ok(SUCCEEDED(hr) || + broken(hr == DDERR_OUTOFCAPS && dwm_enabled()) || + broken(hr == E_NOTIMPL && ddraw_is_vmware(ddraw)), "Failed to update overlay, hr %#x.\n", hr);
/* Try to overlay the primary with a non-overlay surface. */