Andrew Eikum : d3d9/tests: Demonstrate that NULL HWNDs don't prevent device creation.

Alexandre Julliard julliard at winehq.org
Thu Jun 2 16:26:08 CDT 2022


Module: wine
Branch: master
Commit: a64ec46e4e33aea801cfbe033e68591abdddfb14
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a64ec46e4e33aea801cfbe033e68591abdddfb14

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Wed Jun  1 13:05:25 2022 -0500

d3d9/tests: Demonstrate that NULL HWNDs don't prevent device creation.

The game Planetary Annihilation: TITANS depends on this.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/tests/d3d9ex.c | 22 ++++++++++++++++++++++
 dlls/d3d9/tests/visual.c | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index fc148aca4a8..86ac7cf5109 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -4925,12 +4925,24 @@ static void test_pinned_buffers(void)
 
 static void test_desktop_window(void)
 {
+    IDirect3DVertexShader9 *shader;
     IDirect3DDevice9Ex *device;
     D3DCOLOR color;
     ULONG refcount;
     HWND window;
     HRESULT hr;
 
+    static const DWORD simple_vs[] =
+    {
+        0xfffe0101,                                     /* vs_1_1             */
+        0x0000001f, 0x80000000, 0x900f0000,             /* dcl_position0 v0   */
+        0x00000009, 0xc0010000, 0x90e40000, 0xa0e40000, /* dp4 oPos.x, v0, c0 */
+        0x00000009, 0xc0020000, 0x90e40000, 0xa0e40001, /* dp4 oPos.y, v0, c1 */
+        0x00000009, 0xc0040000, 0x90e40000, 0xa0e40002, /* dp4 oPos.z, v0, c2 */
+        0x00000009, 0xc0080000, 0x90e40000, 0xa0e40003, /* dp4 oPos.w, v0, c3 */
+        0x0000ffff,                                     /* end                */
+    };
+
     window = create_window();
     if (!(device = create_device(window, NULL)))
     {
@@ -4954,6 +4966,16 @@ static void test_desktop_window(void)
 
     refcount = IDirect3DDevice9Ex_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);
+
+    /* test device with NULL HWND */
+    device = create_device(NULL, NULL);
+    ok(!!device, "Failed to create a D3D device\n");
+
+    hr = IDirect3DDevice9Ex_CreateVertexShader(device, simple_vs, &shader);
+    ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
+    IDirect3DVertexShader9_Release(shader);
+
+    IDirect3DDevice9Ex_Release(device);
 }
 
 START_TEST(d3d9ex)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 5d8fe10fc79..025cd556ee4 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -26202,6 +26202,7 @@ static void test_nrm_instruction(void)
 
 static void test_desktop_window(void)
 {
+    IDirect3DVertexShader9 *shader;
     IDirect3DDevice9 *device;
     IDirect3D9 *d3d;
     D3DCOLOR color;
@@ -26209,6 +26210,17 @@ static void test_desktop_window(void)
     HWND window;
     HRESULT hr;
 
+    static const DWORD simple_vs[] =
+    {
+        0xfffe0101,                                     /* vs_1_1                       */
+        0x0000001f, 0x80000000, 0x900f0000,             /* dcl_position0 v0             */
+        0x00000009, 0xc0010000, 0x90e40000, 0xa0e40000, /* dp4 oPos.x, v0, c0           */
+        0x00000009, 0xc0020000, 0x90e40000, 0xa0e40001, /* dp4 oPos.y, v0, c1           */
+        0x00000009, 0xc0040000, 0x90e40000, 0xa0e40002, /* dp4 oPos.z, v0, c2           */
+        0x00000009, 0xc0080000, 0x90e40000, 0xa0e40003, /* dp4 oPos.w, v0, c3           */
+        0x0000ffff,                                     /* end                          */
+    };
+
     window = create_window();
     d3d = Direct3DCreate9(D3D_SDK_VERSION);
     ok(!!d3d, "Failed to create a D3D object.\n");
@@ -26236,6 +26248,16 @@ static void test_desktop_window(void)
     refcount = IDirect3DDevice9_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);
 
+    /* test device with NULL HWND */
+    device = create_device(d3d, NULL, NULL, TRUE);
+    ok(device != NULL, "Failed to create a D3D device\n");
+
+    hr = IDirect3DDevice9_CreateVertexShader(device, simple_vs, &shader);
+    ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
+    IDirect3DVertexShader9_Release(shader);
+
+    IDirect3DDevice9_Release(device);
+
     IDirect3D9_Release(d3d);
 }
 




More information about the wine-cvs mailing list