Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- 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 12d172b0e06..c094464412d 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1401,14 +1401,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();
@@ -1428,7 +1429,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; @@ -1437,7 +1438,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 bb82a6121a4..a2ec923dd97 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -314,7 +314,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 edd350e11a4..906d0e39408 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2815,7 +2815,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);