Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- v2: Supersede 180261,180265 and 180268~180270. Fixed a silly build error in 3/5.
dlls/dxgi/swapchain.c | 6 ++++-- dlls/wined3d/swapchain.c | 9 +++++---- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index 603cf171e27..25e994c5fe8 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -189,7 +189,6 @@ static HRESULT dxgi_swapchain_resize_target(IDXGISwapChain1 *swapchain, return hr; dxgi_output = unsafe_impl_from_IDXGIOutput(output); adapter = dxgi_output->adapter; - IDXGIOutput_Release(output);
TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
@@ -198,7 +197,10 @@ static HRESULT dxgi_swapchain_resize_target(IDXGISwapChain1 *swapchain,
wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
- return wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, adapter->ordinal, &mode); + hr = wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, + dxgi_output->wined3d_output, &mode); + IDXGIOutput_Release(output); + return hr; }
static HWND d3d11_swapchain_get_hwnd(struct d3d11_swapchain *swapchain) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index be41cc385e7..312e8f2d24d 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1452,14 +1452,15 @@ static HRESULT wined3d_swapchain_state_set_display_mode(struct wined3d_swapchain }
HRESULT CDECL wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state, - struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode) + struct wined3d *wined3d, struct wined3d_output *output, + const struct wined3d_display_mode *mode) { struct wined3d_display_mode actual_mode; RECT original_window_rect, window_rect; HWND window; HRESULT hr;
- TRACE("state %p, wined3d %p, adapter_idx %u, mode %p.\n", state, wined3d, adapter_idx, mode); + TRACE("state %p, wined3d %p, output %p, mode %p.\n", state, wined3d, output, mode);
wined3d_mutex_lock();
@@ -1479,7 +1480,7 @@ HRESULT CDECL wined3d_swapchain_state_resize_target(struct wined3d_swapchain_sta else if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH) { actual_mode = *mode; - if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, adapter_idx, &actual_mode))) + if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, 0, &actual_mode))) { wined3d_mutex_unlock(); return hr; @@ -1488,7 +1489,7 @@ HRESULT CDECL wined3d_swapchain_state_resize_target(struct wined3d_swapchain_sta } else { - if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &actual_mode, NULL))) + if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, 0, &actual_mode, NULL))) { ERR("Failed to get display mode, hr %#x.\n", hr); wined3d_mutex_unlock(); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 5c3efbdc8b6..2dbb394444d 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -282,7 +282,7 @@
@ cdecl wined3d_swapchain_state_create(ptr ptr ptr long ptr) @ cdecl wined3d_swapchain_state_destroy(ptr) -@ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr) +@ cdecl wined3d_swapchain_state_resize_target(ptr ptr ptr ptr) @ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr ptr ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index cb8f19981aa..b14db420838 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2759,7 +2759,8 @@ HRESULT __cdecl wined3d_swapchain_state_create(const struct wined3d_swapchain_de HWND window, struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_swapchain_state **state); void __cdecl wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state); HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state, - struct wined3d *wined3d, unsigned int adapter_idx, const struct wined3d_display_mode *mode); + struct wined3d *wined3d, struct wined3d_output *output, + const struct wined3d_display_mode *mode); HRESULT __cdecl wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state, const struct wined3d_swapchain_desc *desc, struct wined3d *wined3d, struct wined3d_output *output, const struct wined3d_display_mode *mode);