[PATCH 3/7] ddraw/tests: Pass in device to check for in render-target testing.

Jeff Smith whydoubt at gmail.com
Thu Dec 12 23:00:04 CST 2019


This allows the test to be performed on devices other than HAL.

Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
 dlls/ddraw/tests/ddraw1.c | 40 +++++++++++++----------
 dlls/ddraw/tests/ddraw2.c | 61 +++++++++++++++++++---------------
 dlls/ddraw/tests/ddraw4.c | 57 ++++++++++++++++++--------------
 dlls/ddraw/tests/ddraw7.c | 69 +++++++++++++++++++++++----------------
 4 files changed, 129 insertions(+), 98 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 862c98353e..9b0ee8e553 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -3884,7 +3884,7 @@ static void test_unsupported_formats(void)
     DestroyWindow(window);
 }
 
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
 {
     PALETTEENTRY palette_entries[256];
     IDirectDrawPalette *palette;
@@ -4057,9 +4057,9 @@ static void test_rt_caps(void)
     window = create_window();
     ddraw = create_ddraw();
     ok(!!ddraw, "Failed to create a ddraw object.\n");
-    if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
+    if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid)))
     {
-        skip("Failed to create a 3D device, skipping test.\n");
+        skip("Failed to create a (%s) 3D device, skipping test.\n", device_name);
         IDirectDraw_Release(ddraw);
         DestroyWindow(window);
         return;
@@ -4096,40 +4096,41 @@ static void test_rt_caps(void)
         surface_desc.dwHeight = 480;
         hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
         ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
-                "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+                "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
         if (FAILED(hr))
             continue;
 
         memset(&surface_desc, 0, sizeof(surface_desc));
         surface_desc.dwSize = sizeof(surface_desc);
         hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
         ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
-                "Test %u: Got unexpected caps %#x, expected %#x.\n",
-                i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+                "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+                device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
 
-        hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
-        ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].create_device_hr);
+        hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
+        ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].create_device_hr);
         if (hr == DDERR_NOPALETTEATTACHED)
         {
             hr = IDirectDrawSurface_SetPalette(surface, palette);
-            ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
-            hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+            hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device);
             if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
-                ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
             else
-                ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
         }
         if (SUCCEEDED(hr))
         {
             refcount = IDirect3DDevice_Release(device);
-            ok(refcount == 1, "Test %u: Got unexpected refcount %u.\n", i, refcount);
+            ok(refcount == 1, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount);
         }
 
         refcount = IDirectDrawSurface_Release(surface);
-        ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
     }
 
     IDirectDrawPalette_Release(palette);
@@ -4138,6 +4139,11 @@ static void test_rt_caps(void)
     DestroyWindow(window);
 }
 
+static void test_rt_caps(void)
+{
+    test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
 static void test_primary_caps(void)
 {
     const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index fbce6cb9c2..3c5485af96 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -4303,7 +4303,7 @@ static void test_unsupported_formats(void)
     DestroyWindow(window);
 }
 
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
 {
     PALETTEENTRY palette_entries[256];
     IDirectDrawPalette *palette;
@@ -4519,9 +4519,9 @@ static void test_rt_caps(void)
     window = create_window();
     ddraw = create_ddraw();
     ok(!!ddraw, "Failed to create a ddraw object.\n");
-    if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL)))
+    if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid)))
     {
-        skip("Failed to create a 3D device, skipping test.\n");
+        skip("Failed to create a (%s) 3D device, skipping test.\n", device_name);
         IDirectDraw2_Release(ddraw);
         DestroyWindow(window);
         return;
@@ -4564,33 +4564,33 @@ static void test_rt_caps(void)
         surface_desc.dwHeight = 480;
         hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
         ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail),
-                "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+                "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
         if (FAILED(hr))
             continue;
 
         memset(&surface_desc, 0, sizeof(surface_desc));
         surface_desc.dwSize = sizeof(surface_desc);
         hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
         ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
-                "Test %u: Got unexpected caps %#x, expected %#x.\n",
-                i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+                "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+                device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
 
-        hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
-        ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].create_device_hr);
+        hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
+        ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].create_device_hr);
         if (FAILED(hr))
         {
             if (hr == DDERR_NOPALETTEATTACHED)
             {
                 hr = IDirectDrawSurface_SetPalette(surface, palette);
-                ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
-                hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
+                ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+                hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
                 if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
-                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
                 else
-                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
             }
             IDirectDrawSurface_Release(surface);
 
@@ -4601,10 +4601,10 @@ static void test_rt_caps(void)
             surface_desc.dwWidth = 640;
             surface_desc.dwHeight = 480;
             hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
 
-            hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+            hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
         }
 
         memset(&surface_desc, 0, sizeof(surface_desc));
@@ -4624,13 +4624,13 @@ static void test_rt_caps(void)
         surface_desc.dwWidth = 640;
         surface_desc.dwHeight = 480;
         hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL);
-        ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
 
         hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0);
         ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
-                "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].set_rt_hr);
+                "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].set_rt_hr);
         if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
             expected_rt = rt;
         else
@@ -4641,19 +4641,21 @@ static void test_rt_caps(void)
         if (hr == DDERR_INVALIDPIXELFORMAT)
         {
             refcount = IDirectDrawSurface_AddRef(rt);
-            ok(refcount == 2, "Test %u: Got unexpected refcount %u.\n", i, refcount);
+            ok(refcount == 2, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount);
         }
 
         hr = IDirect3DDevice2_GetRenderTarget(device, &tmp);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
-        ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+        ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
 
         IDirectDrawSurface_Release(tmp);
         IDirectDrawSurface_Release(rt);
         refcount = IDirect3DDevice2_Release(device);
-        ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
         refcount = IDirectDrawSurface_Release(surface);
-        ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
     }
 
     IDirectDrawPalette_Release(palette);
@@ -4665,6 +4667,11 @@ done:
     DestroyWindow(window);
 }
 
+static void test_rt_caps(void)
+{
+    test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
 static void test_primary_caps(void)
 {
     const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 4e4f21686c..b4b2f15b34 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -5921,7 +5921,7 @@ static void test_unsupported_formats(void)
     DestroyWindow(window);
 }
 
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
 {
     PALETTEENTRY palette_entries[256];
     IDirectDrawPalette *palette;
@@ -6124,7 +6124,7 @@ static void test_rt_caps(void)
     }
 
     memset(&z_fmt, 0, sizeof(z_fmt));
-    hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt);
+    hr = IDirect3D3_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt);
     if (FAILED(hr) || !z_fmt.dwSize)
     {
         skip("No depth buffer formats available, skipping test.\n");
@@ -6154,31 +6154,31 @@ static void test_rt_caps(void)
         surface_desc.dwWidth = 640;
         surface_desc.dwHeight = 480;
         hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-        ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
 
         memset(&surface_desc, 0, sizeof(surface_desc));
         surface_desc.dwSize = sizeof(surface_desc);
         hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
         ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
-                "Test %u: Got unexpected caps %#x, expected %#x.\n",
-                i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+                "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+                device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
 
-        hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
-        ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].create_device_hr);
+        hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
+        ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].create_device_hr);
         if (FAILED(hr))
         {
             if (hr == DDERR_NOPALETTEATTACHED)
             {
                 hr = IDirectDrawSurface4_SetPalette(surface, palette);
-                ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
-                hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
+                ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+                hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
                 if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
-                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
                 else
-                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
             }
             IDirectDrawSurface4_Release(surface);
 
@@ -6189,10 +6189,10 @@ static void test_rt_caps(void)
             surface_desc.dwWidth = 640;
             surface_desc.dwHeight = 480;
             hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
 
-            hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+            hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
         }
 
         memset(&surface_desc, 0, sizeof(surface_desc));
@@ -6207,28 +6207,30 @@ static void test_rt_caps(void)
         surface_desc.dwWidth = 640;
         surface_desc.dwHeight = 480;
         hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL);
-        ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
 
         hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0);
         ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
-                "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].set_rt_hr);
+                "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].set_rt_hr);
         if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
             expected_rt = rt;
         else
             expected_rt = surface;
 
         hr = IDirect3DDevice3_GetRenderTarget(device, &tmp);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
-        ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+        ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
 
         IDirectDrawSurface4_Release(tmp);
         IDirectDrawSurface4_Release(rt);
         refcount = IDirect3DDevice3_Release(device);
-        ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
         refcount = IDirectDrawSurface4_Release(surface);
-        ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
     }
 
     IDirectDrawPalette_Release(palette);
@@ -6240,6 +6242,11 @@ done:
     DestroyWindow(window);
 }
 
+static void test_rt_caps(void)
+{
+    test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
 static void test_primary_caps(void)
 {
     const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 03c109125f..94618c0178 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -5657,13 +5657,12 @@ static void test_unsupported_formats(void)
     DestroyWindow(window);
 }
 
-static void test_rt_caps(void)
+static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
 {
-    const GUID *devtype = &IID_IDirect3DHALDevice;
     PALETTEENTRY palette_entries[256];
     IDirectDrawPalette *palette;
     IDirectDraw7 *ddraw;
-    struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
+    struct { REFCLSID riid; BOOL present; } device_data = { riid, FALSE };
     DDPIXELFORMAT z_fmt;
     IDirect3D7 *d3d;
     unsigned int i;
@@ -5863,11 +5862,15 @@ static void test_rt_caps(void)
 
     hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
     ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
-    if (device_data.present)
-        devtype = device_data.riid;
+    if (!device_data.present)
+    {
+        skip("Failed to enumerate %s device, skipping test.\n", device_name);
+        IDirect3D7_Release(d3d);
+        goto done;
+    }
 
     memset(&z_fmt, 0, sizeof(z_fmt));
-    hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
+    hr = IDirect3D7_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt);
     if (FAILED(hr) || !z_fmt.dwSize)
     {
         skip("No depth buffer formats available, skipping test.\n");
@@ -5897,31 +5900,31 @@ static void test_rt_caps(void)
         surface_desc.dwWidth = 640;
         surface_desc.dwHeight = 480;
         hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-        ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
 
         memset(&surface_desc, 0, sizeof(surface_desc));
         surface_desc.dwSize = sizeof(surface_desc);
         hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr);
         ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out,
-                "Test %u: Got unexpected caps %#x, expected %#x.\n",
-                i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+                "Test %s %u: Got unexpected caps %#x, expected %#x.\n",
+                device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
 
-        hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
-        ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].create_device_hr);
+        hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
+        ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].create_device_hr);
         if (FAILED(hr))
         {
             if (hr == DDERR_NOPALETTEATTACHED)
             {
                 hr = IDirectDrawSurface7_SetPalette(surface, palette);
-                ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr);
-                hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
+                ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr);
+                hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
                 if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
-                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
                 else
-                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr);
+                    ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr);
             }
             IDirectDrawSurface7_Release(surface);
 
@@ -5932,10 +5935,10 @@ static void test_rt_caps(void)
             surface_desc.dwWidth = 640;
             surface_desc.dwHeight = 480;
             hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
 
-            hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device);
-            ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr);
+            hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device);
+            ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr);
         }
 
         memset(&surface_desc, 0, sizeof(surface_desc));
@@ -5950,28 +5953,30 @@ static void test_rt_caps(void)
         surface_desc.dwWidth = 640;
         surface_desc.dwHeight = 480;
         hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL);
-        ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n",
-                i, test_data[i].caps_in, hr);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n",
+                device_name, i, test_data[i].caps_in, hr);
 
         hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0);
         ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr),
-                "Test %u: Got unexpected hr %#x, expected %#x.\n",
-                i, hr, test_data[i].set_rt_hr);
+                "Test %s %u: Got unexpected hr %#x, expected %#x.\n",
+                device_name, i, hr, test_data[i].set_rt_hr);
         if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
             expected_rt = rt;
         else
             expected_rt = surface;
 
         hr = IDirect3DDevice7_GetRenderTarget(device, &tmp);
-        ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr);
-        ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp);
+        ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr);
+        ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
 
         IDirectDrawSurface7_Release(tmp);
         IDirectDrawSurface7_Release(rt);
         refcount = IDirect3DDevice7_Release(device);
-        ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
         refcount = IDirectDrawSurface7_Release(surface);
-        ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount);
+        ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n",
+                device_name, i, refcount);
     }
 
     IDirectDrawPalette_Release(palette);
@@ -5983,6 +5988,12 @@ done:
     DestroyWindow(window);
 }
 
+static void test_rt_caps(void)
+{
+    test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal");
+    test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL");
+}
+
 static void test_primary_caps(void)
 {
     const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
-- 
2.23.0




More information about the wine-devel mailing list