We need that in the next patch to have access to swapchain_ops.
This parameter may be NULL if the swapchain is not actually a wined3d swapchain (in the case of d3d12 swapchain).
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dxgi/swapchain.c | 11 ++++++----- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/swapchain.c | 17 +++++++++-------- dlls/wined3d/wined3d.spec | 4 ++-- dlls/wined3d/wined3d_main.c | 2 +- dlls/wined3d/wined3d_private.h | 4 ++-- include/wine/wined3d.h | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index b86a79a94cf..b4497eb257f 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -153,7 +153,8 @@ static HRESULT dxgi_get_output_from_window(IDXGIAdapter *adapter, HWND window, I }
static HRESULT dxgi_swapchain_set_fullscreen_state(struct wined3d_swapchain_state *state, - const struct wined3d_swapchain_desc *swapchain_desc, IDXGIOutput *output) + const struct wined3d_swapchain_desc *swapchain_desc, IDXGIOutput *output, + struct wined3d_swapchain *swapchain) { struct dxgi_output *dxgi_output; HRESULT hr; @@ -162,7 +163,7 @@ static HRESULT dxgi_swapchain_set_fullscreen_state(struct wined3d_swapchain_stat
wined3d_mutex_lock(); hr = wined3d_swapchain_state_set_fullscreen(state, swapchain_desc, - dxgi_output->wined3d_output, NULL); + dxgi_output->wined3d_output, NULL, swapchain); wined3d_mutex_unlock();
return hr; @@ -431,7 +432,7 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain); wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc); swapchain_desc.windowed = !fullscreen; - hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target); + hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target, swapchain->wined3d_swapchain); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -899,7 +900,7 @@ HRESULT d3d11_swapchain_init(struct d3d11_swapchain *swapchain, struct dxgi_devi goto cleanup; }
- if (FAILED(hr = dxgi_swapchain_set_fullscreen_state(state, desc, swapchain->target))) + if (FAILED(hr = dxgi_swapchain_set_fullscreen_state(state, desc, swapchain->target, swapchain->wined3d_swapchain))) { WARN("Failed to set fullscreen state, hr %#x.\n", hr); IDXGIOutput_Release(swapchain->target); @@ -2237,7 +2238,7 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreen goto fail; wined3d_mutex_lock(); wined3d_desc.windowed = !fullscreen; - hr = dxgi_swapchain_set_fullscreen_state(swapchain->state, &wined3d_desc, target); + hr = dxgi_swapchain_set_fullscreen_state(swapchain->state, &wined3d_desc, target, NULL); wined3d_mutex_unlock(); if (FAILED(hr)) goto fail; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 407dd20469e..4bd34938117 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5156,7 +5156,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, return E_FAIL; } if (FAILED(hr = wined3d_swapchain_state_set_fullscreen(&swapchain->state, - swapchain_desc, output, mode))) + swapchain_desc, output, mode, swapchain))) return hr;
/* Switch from fullscreen to windowed. */ @@ -5174,7 +5174,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, swapchain_state->style = 0; swapchain_state->exstyle = 0; wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain_state->device_window, - swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height); + swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height, swapchain); swapchain_state->style = style; swapchain_state->exstyle = exstyle; } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index c0eb25ffb66..65c5d34def7 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -80,13 +80,14 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT) { wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, - swapchain->state.device_window, &swapchain->state.original_window_rect); + swapchain->state.device_window, &swapchain->state.original_window_rect, swapchain); wined3d_device_release_focus_window(swapchain->device); } } else { - wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL); + wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL, + swapchain); } } } @@ -923,7 +924,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc else { wined3d_swapchain_state_setup_fullscreen(&swapchain->state, - window, desc->backbuffer_width, desc->backbuffer_height); + window, desc->backbuffer_width, desc->backbuffer_height, swapchain); } swapchain->state.desc = *desc; wined3d_swapchain_apply_sample_count_override(swapchain, swapchain->state.desc.backbuffer_format, @@ -1534,7 +1535,7 @@ static LONG fullscreen_exstyle(LONG exstyle) }
HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state, - HWND window, unsigned int w, unsigned int h) + HWND window, unsigned int w, unsigned int h, struct wined3d_swapchain *swapchain) { LONG style, exstyle; BOOL filter; @@ -1574,7 +1575,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state }
void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state, - HWND window, const RECT *window_rect) + HWND window, const RECT *window_rect, struct wined3d_swapchain *swapchain) { unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE; LONG style, exstyle; @@ -1627,7 +1628,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_state *state, const struct wined3d_swapchain_desc *swapchain_desc, struct wined3d_output *output, - const struct wined3d_display_mode *mode) + const struct wined3d_display_mode *mode, struct wined3d_swapchain *swapchain) { struct wined3d_display_mode actual_mode; HRESULT hr; @@ -1681,7 +1682,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st if (state->desc.windowed) { /* Switch from windowed to fullscreen */ - if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state, state->device_window, width, height))) + if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state, state->device_window, width, height, swapchain))) return hr; } else @@ -1703,7 +1704,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st RECT *window_rect = NULL; if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT) window_rect = &state->original_window_rect; - wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect); + wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect, swapchain); }
state->desc.windowed = swapchain_desc->windowed; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 51745e24183..3960d702d34 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -282,8 +282,8 @@
@ cdecl wined3d_swapchain_state_create(ptr ptr ptr ptr) @ cdecl wined3d_swapchain_state_destroy(ptr) -@ cdecl wined3d_swapchain_state_resize_target(ptr ptr ptr) -@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr 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) @ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long) diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index e681ac1b61b..942c030ae69 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -571,7 +571,7 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam break; } wined3d_swapchain_state_set_fullscreen(&swapchain->state, &swapchain_desc, output, - NULL); + NULL, swapchain);
wined3d_wndproc_mutex_unlock();
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5c00883d413..25c4c2dcb26 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4449,9 +4449,9 @@ struct wined3d_swapchain_state };
void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state, - HWND window, const RECT *window_rect) DECLSPEC_HIDDEN; + HWND window, const RECT *window_rect, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state, - HWND window, unsigned int w, unsigned int h) DECLSPEC_HIDDEN; + HWND window, unsigned int w, unsigned int h, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
struct wined3d_swapchain_ops { diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 6fc3a1aaa85..c04d865ca8b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2765,7 +2765,7 @@ HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_s 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_output *output, - const struct wined3d_display_mode *mode); + const struct wined3d_display_mode *mode, struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region);