Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Update todo_wine().
dlls/d3d9/tests/d3d9ex.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 7f46ced137d..306241a7118 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -3519,10 +3519,12 @@ static void test_window_style(void) }
style = GetWindowLongA(device_window, GWL_STYLE); - todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + todo_wine ok((style & ~WS_OVERLAPPEDWINDOW) == (device_style & ~WS_OVERLAPPEDWINDOW), + "Expected device window style %#x, got %#x, i=%u.\n", device_style, style, i); style = GetWindowLongA(device_window, GWL_EXSTYLE); - todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + todo_wine ok((style & ~WS_EX_OVERLAPPEDWINDOW) == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW), + "Expected device window extended style %#x, got %#x, i=%u.\n", device_exstyle, style, i);
style = GetWindowLongA(focus_window, GWL_STYLE); @@ -3540,7 +3542,8 @@ static void test_window_style(void) ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s, i=%u.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r), i); GetClientRect(device_window, &r2); - todo_wine ok(!EqualRect(&r, &r2), "Client rect and window rect are equal, i=%u.\n", i); + if (!(device_style & WS_OVERLAPPEDWINDOW)) + ok(!EqualRect(&r, &r2), "Client rect and window rect are equal, i=%u.\n", i); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected %s, got %s, i=%u.\n", wine_dbgstr_rect(&focus_rect), wine_dbgstr_rect(&r), i); @@ -3589,11 +3592,14 @@ static void test_window_style(void) ok(!!device, "Failed to create a D3D device.\n"); style = GetWindowLongA(device_window, GWL_STYLE); expected_style = device_style | tests[i].create2_style; - todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + todo_wine ok((style & ~WS_OVERLAPPEDWINDOW) == (expected_style & ~WS_OVERLAPPEDWINDOW), + "Expected device window style %#x, got %#x, i=%u.\n", expected_style, style, i); expected_style = device_exstyle | tests[i].create2_exstyle; style = GetWindowLongA(device_window, GWL_EXSTYLE); - todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n", + todo_wine_if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) + ok((style & ~WS_EX_OVERLAPPEDWINDOW) == (expected_style & ~WS_EX_OVERLAPPEDWINDOW), + "Expected device window extended style %#x, got %#x, i=%u.\n", expected_style, style, i);
style = GetWindowLongA(focus_window, GWL_STYLE);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46792 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/swapchain.c | 16 ++++++++++++++-- dlls/wined3d/utils.c | 1 - 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index f7fc05f8ef3..724ea160c96 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -762,6 +762,16 @@ void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const swapchain->max_frame_latency = device->max_frame_latency >= 2 ? device->max_frame_latency - 1 : 1; }
+static enum wined3d_format_id adapter_format_from_backbuffer_format(struct wined3d_swapchain *swapchain, + enum wined3d_format_id format_id) +{ + const struct wined3d_adapter *adapter = swapchain->device->adapter; + const struct wined3d_format *backbuffer_format; + + backbuffer_format = wined3d_get_format(adapter, format_id, WINED3D_BIND_RENDER_TARGET); + return pixelformat_for_depth(backbuffer_format->byte_count * CHAR_BIT); +} + static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -881,7 +891,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 /* Change the display settings */ swapchain->d3d_mode.width = desc->backbuffer_width; swapchain->d3d_mode.height = desc->backbuffer_height; - swapchain->d3d_mode.format_id = desc->backbuffer_format; + swapchain->d3d_mode.format_id = adapter_format_from_backbuffer_format(swapchain, + desc->backbuffer_format); swapchain->d3d_mode.refresh_rate = desc->refresh_rate; swapchain->d3d_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
@@ -1414,7 +1425,8 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha actual_mode.width = swapchain_desc->backbuffer_width; actual_mode.height = swapchain_desc->backbuffer_height; actual_mode.refresh_rate = swapchain_desc->refresh_rate; - actual_mode.format_id = swapchain_desc->backbuffer_format; + actual_mode.format_id = adapter_format_from_backbuffer_format(swapchain, + swapchain_desc->backbuffer_format); actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; } else diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 469ce1bdacf..a800527e222 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5672,7 +5672,6 @@ void wined3d_format_get_float_color_key(const struct wined3d_format *format, } }
-/* DirectDraw stuff */ enum wined3d_format_id pixelformat_for_depth(DWORD depth) { switch (depth)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Note that I haven't tested this on a multimonitor setup (I don't have one in handy right now), the test might break there.
dlls/d3d9/tests/device.c | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index d119b639d32..705deab7de5 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -13315,6 +13315,82 @@ static void test_vertex_buffer_read_write(void) DestroyWindow(window); }
+static void test_get_display_mode(void) +{ + IDirect3DSwapChain9 *swapchain; + IDirect3DDevice9 *device; + struct device_desc desc; + D3DDISPLAYMODE mode; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_GetDisplayMode(device, 0, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3D9_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + hr = IDirect3DDevice9_GetSwapChain(device, 0, &swapchain); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DSwapChain9_GetDisplayMode(swapchain, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3DSwapChain9_Release(swapchain); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + desc.device_window = window; + desc.width = 640; + desc.height = 480; + desc.flags = CREATE_DEVICE_FULLSCREEN; + if (!(device = create_device(d3d, window, &desc))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_GetDisplayMode(device, 0, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Width == 640, "Unexpected width %u.\n", mode.Width); + ok(mode.Height == 480, "Unexpected width %u.\n", mode.Height); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3D9_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Width == 640, "Unexpected width %u.\n", mode.Width); + ok(mode.Height == 480, "Unexpected width %u.\n", mode.Height); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + hr = IDirect3DDevice9_GetSwapChain(device, 0, &swapchain); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DSwapChain9_GetDisplayMode(swapchain, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Width == 640, "Unexpected width %u.\n", mode.Width); + ok(mode.Height == 480, "Unexpected width %u.\n", mode.Height); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3DSwapChain9_Release(swapchain); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { WNDCLASSA wc = {0}; @@ -13441,6 +13517,7 @@ START_TEST(device) test_resource_access(); test_multiply_transform(); test_vertex_buffer_read_write(); + test_get_display_mode();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49368
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/tests/device.c | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index b9a999e30fa..90b90e99e89 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9630,6 +9630,67 @@ todo_wine { DestroyWindow(window); }
+static void test_get_display_mode(void) +{ + IDirect3DDevice8 *device; + struct device_desc desc; + D3DDISPLAYMODE mode; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice8_GetDisplayMode(device, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3D8_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + desc.device_window = window; + desc.width = 640; + desc.height = 480; + desc.flags = CREATE_DEVICE_FULLSCREEN; + if (!(device = create_device(d3d, window, &desc))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice8_GetDisplayMode(device, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Width == 640, "Unexpected width %u.\n", mode.Width); + ok(mode.Height == 480, "Unexpected width %u.\n", mode.Height); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + IDirect3D8_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &mode); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(mode.Width == 640, "Unexpected width %u.\n", mode.Width); + ok(mode.Height == 480, "Unexpected width %u.\n", mode.Height); + ok(mode.Format == D3DFMT_X8R8G8B8, "Unexpected format %#x.\n", mode.Format); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -9744,6 +9805,7 @@ START_TEST(device) test_resource_access(); test_multiply_transform(); test_draw_primitive(); + test_get_display_mode();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49369
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/adapter_gl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 686f4f06cbb..e7dd0dac961 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -1880,7 +1880,7 @@ card_vendor_table[] = };
static enum wined3d_pci_device wined3d_guess_card(enum wined3d_feature_level feature_level, - DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, + const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor) { /* A Direct3D device object contains the PCI id (vendor + device) of the @@ -3857,8 +3857,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, vendor = wined3d_guess_card_vendor(gl_vendor_str, gl_renderer_str); TRACE("Guessed vendor PCI ID 0x%04x.\n", vendor);
- device = wined3d_guess_card(d3d_info->feature_level, gl_info->glsl_version, - gl_renderer_str, &gl_vendor, &vendor); + device = wined3d_guess_card(d3d_info->feature_level, gl_renderer_str, &gl_vendor, &vendor); TRACE("Guessed device PCI ID 0x%04x.\n", device);
if (!(gpu_description = wined3d_get_gpu_description(vendor, device)))
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49366
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)