wined3d: Remove no longer needed output parameter in wined3d_swapchain_state_set_fullscreen().

struct wined3d_swapchain_desc has already specified a output parameter now.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-05-15 15:46:14 +08:00 committed by Alexandre Julliard
parent b6495fa31d
commit 6089130da4
6 changed files with 19 additions and 31 deletions

View File

@ -160,16 +160,12 @@ HRESULT dxgi_get_output_from_window(IDXGIFactory *factory, HWND window, IDXGIOut
}
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)
{
struct dxgi_output *dxgi_output;
HRESULT hr;
dxgi_output = unsafe_impl_from_IDXGIOutput(output);
wined3d_mutex_lock();
hr = wined3d_swapchain_state_set_fullscreen(state, swapchain_desc,
dxgi_output->wined3d_output, NULL);
hr = wined3d_swapchain_state_set_fullscreen(state, swapchain_desc, NULL);
wined3d_mutex_unlock();
return hr;
@ -441,7 +437,7 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
swapchain_desc.output = dxgi_output->wined3d_output;
swapchain_desc.windowed = !fullscreen;
hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target);
hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc);
wined3d_mutex_unlock();
if (FAILED(hr))
{
@ -897,7 +893,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)))
{
WARN("Failed to set fullscreen state, hr %#x.\n", hr);
IDXGIOutput_Release(swapchain->target);
@ -2268,7 +2264,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);
wined3d_mutex_unlock();
if (FAILED(hr))
goto fail;

View File

@ -5223,7 +5223,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
struct wined3d_swapchain *swapchain;
struct wined3d_view_desc view_desc;
BOOL backbuffer_resized, windowed;
struct wined3d_output *output;
HRESULT hr = WINED3D_OK;
unsigned int i;
@ -5317,12 +5316,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|| swapchain_desc->backbuffer_height != current_desc->backbuffer_height;
windowed = current_desc->windowed;
if (!(output = wined3d_swapchain_get_output(swapchain)))
{
ERR("Failed to get output from swapchain %p.\n", swapchain);
return E_FAIL;
}
if (!swapchain_desc->windowed != !windowed || swapchain->reapply_mode
|| mode || (!swapchain_desc->windowed && backbuffer_resized))
{
@ -5341,7 +5334,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
if (FAILED(hr = wined3d_swapchain_state_set_fullscreen(&swapchain->state,
swapchain_desc, output, mode)))
swapchain_desc, mode)))
return hr;
/* Switch from fullscreen to windowed. */
@ -5358,7 +5351,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
* the window back into the right position. Some applications
* (Battlefield 2, Guild Wars) move it and then call Reset() to clean
* up their mess. Guild Wars also loses the device during that. */
if (FAILED(hr = wined3d_output_get_desc(output, &output_desc)))
if (FAILED(hr = wined3d_output_get_desc(swapchain_desc->output, &output_desc)))
{
ERR("Failed to get output description, hr %#x.\n", hr);
return hr;

View File

@ -1631,15 +1631,14 @@ 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_swapchain_desc *swapchain_desc,
const struct wined3d_display_mode *mode)
{
struct wined3d_display_mode actual_mode;
struct wined3d_output_desc output_desc;
HRESULT hr;
TRACE("state %p, swapchain_desc %p, output %p, mode %p.\n",
state, swapchain_desc, output, mode);
TRACE("state %p, swapchain_desc %p, mode %p.\n", state, swapchain_desc, mode);
if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
{
@ -1654,7 +1653,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
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 = adapter_format_from_backbuffer_format(output->adapter,
actual_mode.format_id = adapter_format_from_backbuffer_format(swapchain_desc->output->adapter,
swapchain_desc->backbuffer_format);
actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
}
@ -1664,7 +1663,8 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
}
}
if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, output, &actual_mode)))
if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, swapchain_desc->output,
&actual_mode)))
return hr;
}
else
@ -1672,7 +1672,8 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
if (mode)
WARN("WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH is not set, ignoring mode.\n");
if (FAILED(hr = wined3d_output_get_display_mode(output, &actual_mode, NULL)))
if (FAILED(hr = wined3d_output_get_display_mode(swapchain_desc->output, &actual_mode,
NULL)))
{
ERR("Failed to get display mode, hr %#x.\n", hr);
return WINED3DERR_INVALIDCALL;
@ -1684,7 +1685,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
unsigned int width = actual_mode.width;
unsigned int height = actual_mode.height;
if (FAILED(hr = wined3d_output_get_desc(output, &output_desc)))
if (FAILED(hr = wined3d_output_get_desc(swapchain_desc->output, &output_desc)))
{
ERR("Failed to get output description, hr %#x.\n", hr);
return hr;
@ -1720,7 +1721,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st
wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect);
}
state->desc.output = output;
state->desc.output = swapchain_desc->output;
state->desc.windowed = swapchain_desc->windowed;
return WINED3D_OK;

View File

@ -284,7 +284,7 @@
@ cdecl wined3d_swapchain_state_create(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_set_fullscreen(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)

View File

@ -605,8 +605,7 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam
break;
}
swapchain_desc.output = output;
wined3d_swapchain_state_set_fullscreen(&swapchain->state, &swapchain_desc, output,
NULL);
wined3d_swapchain_state_set_fullscreen(&swapchain->state, &swapchain_desc, NULL);
wined3d_wndproc_mutex_unlock();

View File

@ -2774,8 +2774,7 @@ void __cdecl wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *sta
HRESULT __cdecl wined3d_swapchain_state_resize_target(struct wined3d_swapchain_state *state,
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_swapchain_desc *desc, const struct wined3d_display_mode *mode);
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region);