wined3d: Replace wined3d_swapchain_resize_target() with wined3d_swapchain_state_resize_target().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d51e825443
commit
71e8a32479
|
@ -148,6 +148,7 @@ struct dxgi_output
|
|||
};
|
||||
|
||||
HRESULT dxgi_output_create(struct dxgi_adapter *adapter, struct dxgi_output **output) DECLSPEC_HIDDEN;
|
||||
struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* IDXGIAdapter */
|
||||
struct dxgi_adapter
|
||||
|
|
|
@ -522,6 +522,14 @@ static const struct IDXGIOutput4Vtbl dxgi_output_vtbl =
|
|||
dxgi_output_CheckOverlayColorSpaceSupport,
|
||||
};
|
||||
|
||||
struct dxgi_output *unsafe_impl_from_IDXGIOutput(IDXGIOutput *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == (IDXGIOutputVtbl *)&dxgi_output_vtbl);
|
||||
return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput4_iface);
|
||||
}
|
||||
|
||||
static void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter)
|
||||
{
|
||||
output->IDXGIOutput4_iface.lpVtbl = &dxgi_output_vtbl;
|
||||
|
|
|
@ -520,7 +520,12 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget(IDXGISwapChain1 *i
|
|||
const DXGI_MODE_DESC *target_mode_desc)
|
||||
{
|
||||
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
|
||||
struct wined3d_swapchain_state *state;
|
||||
struct wined3d_display_mode mode;
|
||||
struct dxgi_output *dxgi_output;
|
||||
struct dxgi_adapter *adapter;
|
||||
IDXGIOutput *output;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
|
||||
|
||||
|
@ -530,14 +535,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_swapchain_ResizeTarget(IDXGISwapChain1 *i
|
|||
return DXGI_ERROR_INVALID_CALL;
|
||||
}
|
||||
|
||||
if (FAILED(hr = IDXGISwapChain1_GetContainingOutput(iface, &output)))
|
||||
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));
|
||||
|
||||
if (target_mode_desc->Scaling)
|
||||
FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
|
||||
|
||||
state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
|
||||
wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
|
||||
|
||||
return wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode);
|
||||
return wined3d_swapchain_state_resize_target(state, adapter->factory->wined3d, adapter->ordinal, &mode);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d11_swapchain_GetContainingOutput(IDXGISwapChain1 *iface, IDXGIOutput **output)
|
||||
|
|
|
@ -5404,7 +5404,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
TRACE("Changing the device window from %p to %p.\n",
|
||||
current_desc->device_window, swapchain_desc->device_window);
|
||||
current_desc->device_window = swapchain_desc->device_window;
|
||||
swapchain->device_window = swapchain_desc->device_window;
|
||||
swapchain_state->device_window = swapchain_desc->device_window;
|
||||
wined3d_swapchain_set_window(swapchain, NULL);
|
||||
}
|
||||
|
||||
|
@ -5421,7 +5421,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
HWND focus_window = device->create_parms.focus_window;
|
||||
|
||||
if (!focus_window)
|
||||
focus_window = swapchain->device_window;
|
||||
focus_window = swapchain->state.device_window;
|
||||
if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
|
||||
{
|
||||
ERR("Failed to acquire focus window, hr %#x.\n", hr);
|
||||
|
@ -5445,7 +5445,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
* up their mess. Guild Wars also loses the device during that. */
|
||||
swapchain_state->style = 0;
|
||||
swapchain_state->exstyle = 0;
|
||||
wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain->device_window,
|
||||
wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain_state->device_window,
|
||||
swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height);
|
||||
swapchain_state->style = style;
|
||||
swapchain_state->exstyle = exstyle;
|
||||
|
|
|
@ -86,13 +86,13 @@ static void 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->device_window, &swapchain->original_window_rect);
|
||||
swapchain->state.device_window, &swapchain->original_window_rect);
|
||||
wined3d_device_release_focus_window(swapchain->device);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->device_window, NULL);
|
||||
wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch
|
|||
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
|
||||
{
|
||||
if (!window)
|
||||
window = swapchain->device_window;
|
||||
window = swapchain->state.device_window;
|
||||
if (window == swapchain->win_handle)
|
||||
return;
|
||||
|
||||
|
@ -261,6 +261,11 @@ HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain
|
|||
swapchain->device->adapter->ordinal, raster_status);
|
||||
}
|
||||
|
||||
struct wined3d_swapchain_state * CDECL wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain)
|
||||
{
|
||||
return &swapchain->state;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
|
||||
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
|
||||
{
|
||||
|
@ -302,9 +307,9 @@ HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *s
|
|||
if (flags)
|
||||
FIXME("Ignoring flags %#x.\n", flags);
|
||||
|
||||
dc = GetDCEx(swapchain->device_window, 0, DCX_USESTYLE | DCX_CACHE);
|
||||
dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
|
||||
SetDeviceGammaRamp(dc, (void *)ramp);
|
||||
ReleaseDC(swapchain->device_window, dc);
|
||||
ReleaseDC(swapchain->state.device_window, dc);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -325,9 +330,9 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s
|
|||
|
||||
TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);
|
||||
|
||||
dc = GetDCEx(swapchain->device_window, 0, DCX_USESTYLE | DCX_CACHE);
|
||||
dc = GetDCEx(swapchain->state.device_window, 0, DCX_USESTYLE | DCX_CACHE);
|
||||
GetDeviceGammaRamp(dc, ramp);
|
||||
ReleaseDC(swapchain->device_window, dc);
|
||||
ReleaseDC(swapchain->state.device_window, dc);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -776,7 +781,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
|
|||
swapchain->parent_ops = parent_ops;
|
||||
swapchain->ref = 1;
|
||||
swapchain->win_handle = window;
|
||||
swapchain->device_window = window;
|
||||
swapchain->state.device_window = window;
|
||||
swapchain->swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT;
|
||||
swapchain_set_max_frame_latency(swapchain, device);
|
||||
|
||||
|
@ -1150,7 +1155,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
|
|||
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
|
||||
{
|
||||
struct wined3d_device *device = swapchain->device;
|
||||
HWND window = swapchain->device_window;
|
||||
HWND window = swapchain->state.device_window;
|
||||
BOOL focus_messages, filter;
|
||||
|
||||
/* This code is not protected by the wined3d mutex, so it may run while
|
||||
|
@ -1243,7 +1248,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
|
|||
if (!desc->windowed)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
if (!GetClientRect(swapchain->device_window, &client_rect))
|
||||
if (!GetClientRect(swapchain->state.device_window, &client_rect))
|
||||
{
|
||||
ERR("Failed to get client rect, last error %#x.\n", GetLastError());
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -1309,23 +1314,20 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT wined3d_swapchain_set_display_mode(struct wined3d_swapchain *swapchain,
|
||||
struct wined3d_display_mode *mode)
|
||||
static HRESULT wined3d_swapchain_state_set_display_mode(struct wined3d_swapchain_state *state,
|
||||
struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_display_mode *mode)
|
||||
{
|
||||
struct wined3d_device *device = swapchain->device;
|
||||
HRESULT hr;
|
||||
|
||||
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE)
|
||||
if (state->desc.flags & WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE)
|
||||
{
|
||||
if (FAILED(hr = wined3d_find_closest_matching_adapter_mode(device->wined3d,
|
||||
device->adapter->ordinal, mode)))
|
||||
if (FAILED(hr = wined3d_find_closest_matching_adapter_mode(wined3d, adapter_idx, mode)))
|
||||
{
|
||||
WARN("Failed to find closest matching mode, hr %#x.\n", hr);
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d,
|
||||
device->adapter->ordinal, mode)))
|
||||
if (FAILED(hr = wined3d_set_adapter_display_mode(wined3d, adapter_idx, mode)))
|
||||
{
|
||||
WARN("Failed to set display mode, hr %#x.\n", hr);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -1334,22 +1336,19 @@ static HRESULT wined3d_swapchain_set_display_mode(struct wined3d_swapchain *swap
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
|
||||
const struct wined3d_display_mode *mode)
|
||||
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_swapchain_state *state = &swapchain->state;
|
||||
struct wined3d_display_mode actual_mode;
|
||||
RECT original_window_rect, window_rect;
|
||||
struct wined3d_device *device;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("swapchain %p, mode %p.\n", swapchain, mode);
|
||||
TRACE("state %p, wined3d %p, adapter_idx %u, mode %p.\n", state, wined3d, adapter_idx, mode);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
device = swapchain->device;
|
||||
window = swapchain->device_window;
|
||||
window = state->device_window;
|
||||
|
||||
if (state->desc.windowed)
|
||||
{
|
||||
|
@ -1365,7 +1364,7 @@ HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchai
|
|||
else if (state->desc.flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
|
||||
{
|
||||
actual_mode = *mode;
|
||||
if (FAILED(hr = wined3d_swapchain_set_display_mode(swapchain, &actual_mode)))
|
||||
if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state, wined3d, adapter_idx, &actual_mode)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
return hr;
|
||||
|
@ -1374,8 +1373,7 @@ HRESULT CDECL wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchai
|
|||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal,
|
||||
&actual_mode, NULL)))
|
||||
if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &actual_mode, NULL)))
|
||||
{
|
||||
ERR("Failed to get display mode, hr %#x.\n", hr);
|
||||
wined3d_mutex_unlock();
|
||||
|
@ -1535,7 +1533,8 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
|||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_swapchain_set_display_mode(swapchain, &actual_mode)))
|
||||
if (FAILED(hr = wined3d_swapchain_state_set_display_mode(state,
|
||||
device->wined3d, device->adapter->ordinal, &actual_mode)))
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
|
@ -1560,12 +1559,12 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
|||
{
|
||||
/* Switch from windowed to fullscreen */
|
||||
if (FAILED(hr = wined3d_swapchain_state_setup_fullscreen(state,
|
||||
swapchain->device_window, width, height)))
|
||||
state->device_window, width, height)))
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWND window = swapchain->device_window;
|
||||
HWND window = swapchain->state.device_window;
|
||||
BOOL filter;
|
||||
|
||||
/* Fullscreen -> fullscreen mode change */
|
||||
|
@ -1582,7 +1581,7 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
|||
RECT *window_rect = NULL;
|
||||
if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
|
||||
window_rect = &swapchain->original_window_rect;
|
||||
wined3d_swapchain_state_restore_from_fullscreen(state, swapchain->device_window, window_rect);
|
||||
wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect);
|
||||
}
|
||||
|
||||
state->desc.windowed = swapchain_desc->windowed;
|
||||
|
|
|
@ -269,15 +269,17 @@
|
|||
@ cdecl wined3d_swapchain_get_parent(ptr)
|
||||
@ cdecl wined3d_swapchain_get_desc(ptr ptr)
|
||||
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
|
||||
@ cdecl wined3d_swapchain_get_state(ptr)
|
||||
@ cdecl wined3d_swapchain_incref(ptr)
|
||||
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long long)
|
||||
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
|
||||
@ cdecl wined3d_swapchain_resize_target(ptr ptr)
|
||||
@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
|
||||
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
|
||||
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
|
||||
@ cdecl wined3d_swapchain_set_window(ptr ptr)
|
||||
|
||||
@ cdecl wined3d_swapchain_state_resize_target(ptr ptr long ptr)
|
||||
|
||||
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
|
||||
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
|
||||
@ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
|
||||
|
|
|
@ -555,7 +555,7 @@ static LRESULT CALLBACK wined3d_hook_proc(int code, WPARAM wparam, LPARAM lparam
|
|||
{
|
||||
swapchain = hook_table.swapchains[i].swapchain;
|
||||
|
||||
if (swapchain->device_window != msg->hwnd)
|
||||
if (swapchain->state.device_window != msg->hwnd)
|
||||
continue;
|
||||
|
||||
if ((entry = wined3d_find_wndproc(msg->hwnd, swapchain->device->wined3d))
|
||||
|
@ -747,7 +747,7 @@ void wined3d_hook_swapchain(struct wined3d_swapchain *swapchain)
|
|||
|
||||
swapchain_entry = &hook_table.swapchains[hook_table.swapchain_count++];
|
||||
swapchain_entry->swapchain = swapchain;
|
||||
swapchain_entry->thread_id = GetWindowThreadProcessId(swapchain->device_window, NULL);
|
||||
swapchain_entry->thread_id = GetWindowThreadProcessId(swapchain->state.device_window, NULL);
|
||||
|
||||
if ((hook = wined3d_find_hook(swapchain_entry->thread_id)))
|
||||
{
|
||||
|
|
|
@ -4181,6 +4181,7 @@ struct wined3d_swapchain_state
|
|||
/* Window styles to restore when switching fullscreen mode. */
|
||||
LONG style;
|
||||
LONG exstyle;
|
||||
HWND device_window;
|
||||
};
|
||||
|
||||
void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
|
||||
|
@ -4222,7 +4223,6 @@ struct wined3d_swapchain
|
|||
|
||||
struct wined3d_swapchain_state state;
|
||||
HWND win_handle;
|
||||
HWND device_window;
|
||||
|
||||
HDC backup_dc;
|
||||
HWND backup_wnd;
|
||||
|
|
|
@ -2127,6 +2127,7 @@ struct wined3d_shader;
|
|||
struct wined3d_shader_resource_view;
|
||||
struct wined3d_stateblock;
|
||||
struct wined3d_swapchain;
|
||||
struct wined3d_swapchain_state;
|
||||
struct wined3d_texture;
|
||||
struct wined3d_unordered_access_view;
|
||||
struct wined3d_vertex_declaration;
|
||||
|
@ -2676,14 +2677,13 @@ void __cdecl wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchai
|
|||
struct wined3d_swapchain_desc *desc);
|
||||
HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
|
||||
struct wined3d_raster_status *raster_status);
|
||||
struct wined3d_swapchain_state * __cdecl wined3d_swapchain_get_state(struct wined3d_swapchain *swapchain);
|
||||
ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain);
|
||||
HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect,
|
||||
const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags);
|
||||
HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
|
||||
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
|
||||
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality);
|
||||
HRESULT __cdecl wined3d_swapchain_resize_target(struct wined3d_swapchain *swapchain,
|
||||
const struct wined3d_display_mode *mode);
|
||||
HRESULT __cdecl wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain,
|
||||
const struct wined3d_swapchain_desc *desc, const struct wined3d_display_mode *mode);
|
||||
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
|
||||
|
@ -2691,6 +2691,9 @@ HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain
|
|||
void __cdecl wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette);
|
||||
void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window);
|
||||
|
||||
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);
|
||||
|
||||
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
|
||||
UINT layer, const struct wined3d_box *dirty_region);
|
||||
HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
|
||||
|
|
Loading…
Reference in New Issue