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@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2022-06-01 13:05:25 -05:00 committed by Alexandre Julliard
parent de61c58308
commit a64ec46e4e
2 changed files with 44 additions and 0 deletions

View file

@ -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)

View file

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