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; }