wined3d: Specify a wined3d output for swapchain creation.
As tests showed, DirectDraw, Direct3D 8 and 9 always use the adapter specified in the device creation parameters regardless of the device window position when creating a swapchain. Whereas DXGI uses the device window position to determine which DXGI output to use. 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:
parent
97fce0b3af
commit
d3e088cc00
|
@ -262,8 +262,8 @@ static enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTIS
|
||||||
return (enum wined3d_multisample_type)type;
|
return (enum wined3d_multisample_type)type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc,
|
static BOOL wined3d_swapchain_desc_from_d3d8(struct wined3d_swapchain_desc *swapchain_desc,
|
||||||
const D3DPRESENT_PARAMETERS *present_parameters)
|
struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters)
|
||||||
{
|
{
|
||||||
if (!present_parameters->SwapEffect || present_parameters->SwapEffect > D3DSWAPEFFECT_COPY_VSYNC)
|
if (!present_parameters->SwapEffect || present_parameters->SwapEffect > D3DSWAPEFFECT_COPY_VSYNC)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +293,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swapchain_desc->output = output;
|
||||||
swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
|
swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
|
||||||
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
|
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
|
||||||
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
|
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
|
||||||
|
@ -846,6 +847,7 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
|
||||||
struct wined3d_swapchain_desc desc;
|
struct wined3d_swapchain_desc desc;
|
||||||
struct d3d8_swapchain *object;
|
struct d3d8_swapchain *object;
|
||||||
unsigned int swap_interval;
|
unsigned int swap_interval;
|
||||||
|
unsigned int output_idx;
|
||||||
unsigned int i, count;
|
unsigned int i, count;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -876,7 +878,9 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
|
||||||
}
|
}
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters))
|
output_idx = device->adapter_ordinal;
|
||||||
|
if (!wined3d_swapchain_desc_from_d3d8(&desc, device->d3d_parent->wined3d_outputs[output_idx],
|
||||||
|
present_parameters))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
swap_interval = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval);
|
swap_interval = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval);
|
||||||
if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, swap_interval, &object)))
|
if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, swap_interval, &object)))
|
||||||
|
@ -941,6 +945,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
|
||||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||||
struct wined3d_swapchain_desc swapchain_desc;
|
struct wined3d_swapchain_desc swapchain_desc;
|
||||||
struct d3d8_swapchain *implicit_swapchain;
|
struct d3d8_swapchain *implicit_swapchain;
|
||||||
|
unsigned int output_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
|
TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
|
||||||
|
@ -950,7 +955,9 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
|
||||||
WARN("App not active, returning D3DERR_DEVICELOST.\n");
|
WARN("App not active, returning D3DERR_DEVICELOST.\n");
|
||||||
return D3DERR_DEVICELOST;
|
return D3DERR_DEVICELOST;
|
||||||
}
|
}
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters))
|
output_idx = device->adapter_ordinal;
|
||||||
|
if (!wined3d_swapchain_desc_from_d3d8(&swapchain_desc,
|
||||||
|
device->d3d_parent->wined3d_outputs[output_idx], present_parameters))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
|
swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
|
||||||
|
|
||||||
|
@ -3718,6 +3725,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
|
||||||
struct wined3d_swapchain_desc swapchain_desc;
|
struct wined3d_swapchain_desc swapchain_desc;
|
||||||
struct wined3d_swapchain *wined3d_swapchain;
|
struct wined3d_swapchain *wined3d_swapchain;
|
||||||
struct wined3d_adapter *wined3d_adapter;
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
|
struct wined3d_output *wined3d_output;
|
||||||
struct d3d8_swapchain *d3d_swapchain;
|
struct d3d8_swapchain *d3d_swapchain;
|
||||||
struct wined3d_caps caps;
|
struct wined3d_caps caps;
|
||||||
unsigned int output_idx;
|
unsigned int output_idx;
|
||||||
|
@ -3750,7 +3758,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
|
||||||
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_adapter = wined3d_output_get_adapter(parent->wined3d_outputs[output_idx]);
|
wined3d_output = parent->wined3d_outputs[output_idx];
|
||||||
|
wined3d_adapter = wined3d_output_get_adapter(wined3d_output);
|
||||||
if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type),
|
if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type),
|
||||||
focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels),
|
focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels),
|
||||||
&device->device_parent, &device->wined3d_device)))
|
&device->device_parent, &device->wined3d_device)))
|
||||||
|
@ -3792,7 +3801,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
|
||||||
if (flags & D3DCREATE_MULTITHREADED)
|
if (flags & D3DCREATE_MULTITHREADED)
|
||||||
wined3d_device_set_multithreaded(device->wined3d_device);
|
wined3d_device_set_multithreaded(device->wined3d_device);
|
||||||
|
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, parameters))
|
if (!wined3d_swapchain_desc_from_d3d8(&swapchain_desc, wined3d_output, parameters))
|
||||||
{
|
{
|
||||||
wined3d_device_release_focus_window(device->wined3d_device);
|
wined3d_device_release_focus_window(device->wined3d_device);
|
||||||
wined3d_device_decref(device->wined3d_device);
|
wined3d_device_decref(device->wined3d_device);
|
||||||
|
|
|
@ -300,8 +300,9 @@ static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc,
|
static BOOL wined3d_swapchain_desc_from_d3d9(struct wined3d_swapchain_desc *swapchain_desc,
|
||||||
const D3DPRESENT_PARAMETERS *present_parameters, BOOL extended)
|
struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters,
|
||||||
|
BOOL extended)
|
||||||
{
|
{
|
||||||
D3DSWAPEFFECT highest_swapeffect = extended ? D3DSWAPEFFECT_FLIPEX : D3DSWAPEFFECT_COPY;
|
D3DSWAPEFFECT highest_swapeffect = extended ? D3DSWAPEFFECT_FLIPEX : D3DSWAPEFFECT_COPY;
|
||||||
UINT highest_bb_count = extended ? 30 : 3;
|
UINT highest_bb_count = extended ? 30 : 3;
|
||||||
|
@ -332,6 +333,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swapchain_desc->output = output;
|
||||||
swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
|
swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
|
||||||
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
|
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
|
||||||
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
|
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
|
||||||
|
@ -887,6 +889,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
|
||||||
struct wined3d_swapchain_desc desc;
|
struct wined3d_swapchain_desc desc;
|
||||||
struct d3d9_swapchain *object;
|
struct d3d9_swapchain *object;
|
||||||
unsigned int swap_interval;
|
unsigned int swap_interval;
|
||||||
|
unsigned int output_idx;
|
||||||
unsigned int i, count;
|
unsigned int i, count;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -917,8 +920,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
|
||||||
}
|
}
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters,
|
output_idx = device->adapter_ordinal;
|
||||||
device->d3d_parent->extended))
|
if (!wined3d_swapchain_desc_from_d3d9(&desc, device->d3d_parent->wined3d_outputs[output_idx],
|
||||||
|
present_parameters, device->d3d_parent->extended))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
swap_interval = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval);
|
swap_interval = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval);
|
||||||
if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, swap_interval, &object)))
|
if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, swap_interval, &object)))
|
||||||
|
@ -1042,6 +1046,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
|
||||||
struct wined3d_display_mode wined3d_mode;
|
struct wined3d_display_mode wined3d_mode;
|
||||||
struct wined3d_rendertarget_view *rtv;
|
struct wined3d_rendertarget_view *rtv;
|
||||||
struct d3d9_swapchain *d3d9_swapchain;
|
struct d3d9_swapchain *d3d9_swapchain;
|
||||||
|
unsigned int output_idx;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -1060,7 +1065,9 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
|
||||||
wined3d_mode.scanline_ordering = wined3d_scanline_ordering_from_d3d(mode->ScanLineOrdering);
|
wined3d_mode.scanline_ordering = wined3d_scanline_ordering_from_d3d(mode->ScanLineOrdering);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters, extended))
|
output_idx = device->adapter_ordinal;
|
||||||
|
if (!wined3d_swapchain_desc_from_d3d9(&swapchain_desc,
|
||||||
|
device->d3d_parent->wined3d_outputs[output_idx], present_parameters, extended))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
|
swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
|
||||||
|
|
||||||
|
@ -4763,8 +4770,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc[i], ¶meters[i],
|
if (!wined3d_swapchain_desc_from_d3d9(&swapchain_desc[i],
|
||||||
parent->extended))
|
parent->wined3d_outputs[output_idx + i], ¶meters[i], parent->extended))
|
||||||
{
|
{
|
||||||
wined3d_device_release_focus_window(device->wined3d_device);
|
wined3d_device_release_focus_window(device->wined3d_device);
|
||||||
wined3d_device_decref(device->wined3d_device);
|
wined3d_device_decref(device->wined3d_device);
|
||||||
|
|
|
@ -563,6 +563,7 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window,
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
|
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
|
||||||
|
swapchain_desc.output = ddraw->wined3d_output;
|
||||||
swapchain_desc.backbuffer_width = mode.width;
|
swapchain_desc.backbuffer_width = mode.width;
|
||||||
swapchain_desc.backbuffer_height = mode.height;
|
swapchain_desc.backbuffer_height = mode.height;
|
||||||
swapchain_desc.backbuffer_format = mode.format_id;
|
swapchain_desc.backbuffer_format = mode.format_id;
|
||||||
|
|
|
@ -427,13 +427,37 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_factory_create_swapchain(IWineDX
|
||||||
{
|
{
|
||||||
struct dxgi_device *device = impl_from_IWineDXGISwapChainFactory(iface);
|
struct dxgi_device *device = impl_from_IWineDXGISwapChainFactory(iface);
|
||||||
struct wined3d_swapchain_desc wined3d_desc;
|
struct wined3d_swapchain_desc wined3d_desc;
|
||||||
|
struct IDXGIOutput *containing_output;
|
||||||
struct d3d11_swapchain *object;
|
struct d3d11_swapchain *object;
|
||||||
|
struct IDXGIAdapter *adapter;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, factory %p, window %p, desc %p, fullscreen_desc %p, output %p, swapchain %p.\n",
|
TRACE("iface %p, factory %p, window %p, desc %p, fullscreen_desc %p, output %p, swapchain %p.\n",
|
||||||
iface, factory, window, desc, fullscreen_desc, output, swapchain);
|
iface, factory, window, desc, fullscreen_desc, output, swapchain);
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, desc, fullscreen_desc)))
|
if (FAILED(hr = dxgi_get_output_from_window(factory, window, &containing_output)))
|
||||||
|
{
|
||||||
|
WARN("Failed to get output from window %p, hr %#x.\n", window, hr);
|
||||||
|
|
||||||
|
/* FIXME: As wined3d only supports one output currently, even if a window is on a
|
||||||
|
* non-primary output, the swapchain will use the primary output. Keep this behaviour
|
||||||
|
* until all outputs are correctly enumerated. Otherwise it will create a regression
|
||||||
|
* for applications that specify a device window on a non-primary output */
|
||||||
|
if (FAILED(hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter)))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &containing_output);
|
||||||
|
IDXGIAdapter_Release(adapter);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
FIXME("Using the primary output for the device window that is on a non-primary output.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, containing_output, window, desc,
|
||||||
|
fullscreen_desc);
|
||||||
|
IDXGIOutput_Release(containing_output);
|
||||||
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
|
@ -474,7 +498,10 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
||||||
struct d3d11_swapchain *swapchain;
|
struct d3d11_swapchain *swapchain;
|
||||||
struct dxgi_adapter *dxgi_adapter;
|
struct dxgi_adapter *dxgi_adapter;
|
||||||
struct dxgi_factory *dxgi_factory;
|
struct dxgi_factory *dxgi_factory;
|
||||||
|
struct dxgi_output *dxgi_output;
|
||||||
|
struct IDXGIOutput *output;
|
||||||
void *layer_base;
|
void *layer_base;
|
||||||
|
HWND window;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (!(dxgi_factory = unsafe_impl_from_IDXGIFactory(factory)))
|
if (!(dxgi_factory = unsafe_impl_from_IDXGIFactory(factory)))
|
||||||
|
@ -530,11 +557,25 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window = dxgi_factory_get_device_window(dxgi_factory);
|
||||||
|
if (FAILED(hr = dxgi_get_output_from_window(factory, window, &output)))
|
||||||
|
{
|
||||||
|
ERR("Failed to get output from window %p.\n", window);
|
||||||
|
wined3d_device_decref(device->wined3d_device);
|
||||||
|
IUnknown_Release(device->child_layer);
|
||||||
|
wined3d_private_store_cleanup(&device->private_store);
|
||||||
|
wined3d_mutex_unlock();
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
dxgi_output = unsafe_impl_from_IDXGIOutput(output);
|
||||||
|
|
||||||
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
|
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
|
||||||
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
|
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;
|
||||||
swapchain_desc.device_window = dxgi_factory_get_device_window(dxgi_factory);
|
swapchain_desc.device_window = window;
|
||||||
swapchain_desc.windowed = TRUE;
|
swapchain_desc.windowed = TRUE;
|
||||||
swapchain_desc.flags = WINED3D_SWAPCHAIN_IMPLICIT;
|
swapchain_desc.flags = WINED3D_SWAPCHAIN_IMPLICIT;
|
||||||
|
swapchain_desc.output = dxgi_output->wined3d_output;
|
||||||
|
IDXGIOutput_Release(output);
|
||||||
|
|
||||||
if (!(swapchain = heap_alloc_zero(sizeof(*swapchain))))
|
if (!(swapchain = heap_alloc_zero(sizeof(*swapchain))))
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,8 +96,10 @@ void wined3d_display_mode_from_dxgi1(struct wined3d_display_mode *wined3d_mode,
|
||||||
DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags) DECLSPEC_HIDDEN;
|
DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags) DECLSPEC_HIDDEN;
|
||||||
unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE usage) DECLSPEC_HIDDEN;
|
unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE usage) DECLSPEC_HIDDEN;
|
||||||
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN;
|
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT dxgi_get_output_from_window(IDXGIFactory *factory, HWND window, IDXGIOutput **dxgi_output)
|
||||||
|
DECLSPEC_HIDDEN;
|
||||||
HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc,
|
HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc,
|
||||||
HWND window, const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc,
|
IDXGIOutput *dxgi_containing_output, HWND window, const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc,
|
||||||
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc) DECLSPEC_HIDDEN;
|
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
|
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
|
||||||
|
|
|
@ -111,8 +111,7 @@ BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT dxgi_get_output_from_window(IDXGIFactory *factory, HWND window,
|
HRESULT dxgi_get_output_from_window(IDXGIFactory *factory, HWND window, IDXGIOutput **dxgi_output)
|
||||||
IDXGIOutput **dxgi_output)
|
|
||||||
{
|
{
|
||||||
unsigned int adapter_idx, output_idx;
|
unsigned int adapter_idx, output_idx;
|
||||||
DXGI_OUTPUT_DESC desc;
|
DXGI_OUTPUT_DESC desc;
|
||||||
|
@ -415,6 +414,7 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen
|
||||||
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
|
struct d3d11_swapchain *swapchain = d3d11_swapchain_from_IDXGISwapChain1(iface);
|
||||||
struct wined3d_swapchain_desc swapchain_desc;
|
struct wined3d_swapchain_desc swapchain_desc;
|
||||||
struct wined3d_swapchain_state *state;
|
struct wined3d_swapchain_state *state;
|
||||||
|
struct dxgi_output *dxgi_output;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
|
TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
|
||||||
|
@ -434,10 +434,12 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d11_swapchain_SetFullscreen
|
||||||
WARN("Failed to get target output for swapchain, hr %#x.\n", hr);
|
WARN("Failed to get target output for swapchain, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
dxgi_output = unsafe_impl_from_IDXGIOutput(target);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
|
state = wined3d_swapchain_get_state(swapchain->wined3d_swapchain);
|
||||||
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
|
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
|
||||||
|
swapchain_desc.output = dxgi_output->wined3d_output;
|
||||||
swapchain_desc.windowed = !fullscreen;
|
swapchain_desc.windowed = !fullscreen;
|
||||||
hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target);
|
hr = dxgi_swapchain_set_fullscreen_state(state, &swapchain_desc, target);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
@ -2261,7 +2263,8 @@ static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH d3d12_swapchain_SetFullscreen
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, swapchain_desc, fullscreen_desc)))
|
if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, target, window, swapchain_desc,
|
||||||
|
fullscreen_desc)))
|
||||||
goto fail;
|
goto fail;
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d_desc.windowed = !fullscreen;
|
wined3d_desc.windowed = !fullscreen;
|
||||||
|
@ -2928,6 +2931,7 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
|
||||||
IUnknown *device_parent;
|
IUnknown *device_parent;
|
||||||
VkInstance vk_instance;
|
VkInstance vk_instance;
|
||||||
IDXGIAdapter *adapter;
|
IDXGIAdapter *adapter;
|
||||||
|
IDXGIOutput *output;
|
||||||
VkBool32 supported;
|
VkBool32 supported;
|
||||||
VkDevice vk_device;
|
VkDevice vk_device;
|
||||||
VkFence vk_fence;
|
VkFence vk_fence;
|
||||||
|
@ -2970,8 +2974,29 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
|
||||||
if (FAILED(hr = IUnknown_QueryInterface(device_parent, &IID_IDXGIAdapter, (void **)&adapter)))
|
if (FAILED(hr = IUnknown_QueryInterface(device_parent, &IID_IDXGIAdapter, (void **)&adapter)))
|
||||||
return hr;
|
return hr;
|
||||||
dxgi_adapter = unsafe_impl_from_IDXGIAdapter(adapter);
|
dxgi_adapter = unsafe_impl_from_IDXGIAdapter(adapter);
|
||||||
|
|
||||||
|
if (FAILED(hr = dxgi_get_output_from_window((IDXGIFactory *)factory, window, &output)))
|
||||||
|
{
|
||||||
|
WARN("Failed to get output from window %p, hr %#x.\n", window, hr);
|
||||||
|
|
||||||
|
/* FIXME: As wined3d only supports one output currently, even if a window is on a
|
||||||
|
* non-primary output, the swapchain will use the primary output. Keep this behaviour
|
||||||
|
* until all outputs are correctly enumerated. Otherwise it will create a regression
|
||||||
|
* for applications that specify a device window on a non-primary output */
|
||||||
|
if (FAILED(hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output)))
|
||||||
|
{
|
||||||
|
IDXGIAdapter_Release(adapter);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Using the primary output for the device window that is on a non-primary output.\n");
|
||||||
|
}
|
||||||
IDXGIAdapter_Release(adapter);
|
IDXGIAdapter_Release(adapter);
|
||||||
if (FAILED(hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, window, swapchain_desc, fullscreen_desc)))
|
|
||||||
|
hr = wined3d_swapchain_desc_from_dxgi(&wined3d_desc, output, window, swapchain_desc,
|
||||||
|
fullscreen_desc);
|
||||||
|
IDXGIOutput_Release(output);
|
||||||
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
if (FAILED(hr = wined3d_swapchain_state_create(&wined3d_desc, window,
|
if (FAILED(hr = wined3d_swapchain_state_create(&wined3d_desc, window,
|
||||||
dxgi_adapter->factory->wined3d, &swapchain->state)))
|
dxgi_adapter->factory->wined3d, &swapchain->state)))
|
||||||
|
|
|
@ -561,9 +561,12 @@ static unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
|
||||||
return wined3d_flags;
|
return wined3d_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc, HWND window,
|
HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_desc,
|
||||||
const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc)
|
IDXGIOutput *dxgi_containing_output, HWND window, const DXGI_SWAP_CHAIN_DESC1 *dxgi_desc,
|
||||||
|
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *dxgi_fullscreen_desc)
|
||||||
{
|
{
|
||||||
|
struct dxgi_output *dxgi_output = unsafe_impl_from_IDXGIOutput(dxgi_containing_output);
|
||||||
|
|
||||||
if (dxgi_desc->Scaling != DXGI_SCALING_STRETCH)
|
if (dxgi_desc->Scaling != DXGI_SCALING_STRETCH)
|
||||||
FIXME("Ignoring scaling %#x.\n", dxgi_desc->Scaling);
|
FIXME("Ignoring scaling %#x.\n", dxgi_desc->Scaling);
|
||||||
if (dxgi_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
|
if (dxgi_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
|
||||||
|
@ -592,6 +595,7 @@ HRESULT wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc *wined3d_
|
||||||
return DXGI_ERROR_INVALID_CALL;
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wined3d_desc->output = dxgi_output->wined3d_output;
|
||||||
wined3d_desc->backbuffer_width = dxgi_desc->Width;
|
wined3d_desc->backbuffer_width = dxgi_desc->Width;
|
||||||
wined3d_desc->backbuffer_height = dxgi_desc->Height;
|
wined3d_desc->backbuffer_height = dxgi_desc->Height;
|
||||||
wined3d_desc->backbuffer_format = wined3dformat_from_dxgi_format(dxgi_desc->Format);
|
wined3d_desc->backbuffer_format = wined3dformat_from_dxgi_format(dxgi_desc->Format);
|
||||||
|
|
|
@ -4910,6 +4910,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("New params:\n");
|
TRACE("New params:\n");
|
||||||
|
TRACE("output %p\n", swapchain_desc->output);
|
||||||
TRACE("backbuffer_width %u\n", swapchain_desc->backbuffer_width);
|
TRACE("backbuffer_width %u\n", swapchain_desc->backbuffer_width);
|
||||||
TRACE("backbuffer_height %u\n", swapchain_desc->backbuffer_height);
|
TRACE("backbuffer_height %u\n", swapchain_desc->backbuffer_height);
|
||||||
TRACE("backbuffer_format %s\n", debug_d3dformat(swapchain_desc->backbuffer_format));
|
TRACE("backbuffer_format %s\n", debug_d3dformat(swapchain_desc->backbuffer_format));
|
||||||
|
|
|
@ -873,7 +873,6 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
|
||||||
{
|
{
|
||||||
struct wined3d_resource_desc texture_desc;
|
struct wined3d_resource_desc texture_desc;
|
||||||
struct wined3d_output_desc output_desc;
|
struct wined3d_output_desc output_desc;
|
||||||
struct wined3d_output *output;
|
|
||||||
BOOL displaymode_set = FALSE;
|
BOOL displaymode_set = FALSE;
|
||||||
DWORD texture_flags = 0;
|
DWORD texture_flags = 0;
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
|
@ -934,13 +933,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(output = wined3d_swapchain_get_output(swapchain)))
|
if (FAILED(hr = wined3d_output_get_desc(desc->output, &output_desc)))
|
||||||
{
|
|
||||||
ERR("Failed to get output from swapchain %p.\n", swapchain);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_output_get_desc(output, &output_desc)))
|
|
||||||
{
|
{
|
||||||
ERR("Failed to get output description, hr %#x.\n", hr);
|
ERR("Failed to get output description, hr %#x.\n", hr);
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -996,8 +989,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
|
||||||
if (!desc->windowed && desc->flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
|
if (!desc->windowed && desc->flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
|
||||||
{
|
{
|
||||||
/* Change the display settings */
|
/* Change the display settings */
|
||||||
output = wined3d_swapchain_get_output(swapchain);
|
if (FAILED(hr = wined3d_output_set_display_mode(desc->output,
|
||||||
if (!output || FAILED(hr = wined3d_output_set_display_mode(output,
|
|
||||||
&swapchain->state.d3d_mode)))
|
&swapchain->state.d3d_mode)))
|
||||||
{
|
{
|
||||||
WARN("Failed to set display mode, hr %#x.\n", hr);
|
WARN("Failed to set display mode, hr %#x.\n", hr);
|
||||||
|
@ -1081,7 +1073,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
|
||||||
err:
|
err:
|
||||||
if (displaymode_set)
|
if (displaymode_set)
|
||||||
{
|
{
|
||||||
if (!output || FAILED(wined3d_output_set_display_mode(output,
|
if (FAILED(wined3d_output_set_display_mode(desc->output,
|
||||||
&swapchain->state.original_mode)))
|
&swapchain->state.original_mode)))
|
||||||
ERR("Failed to restore display mode.\n");
|
ERR("Failed to restore display mode.\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1756,6 +1756,7 @@ struct wined3d_adapter_identifier
|
||||||
|
|
||||||
struct wined3d_swapchain_desc
|
struct wined3d_swapchain_desc
|
||||||
{
|
{
|
||||||
|
struct wined3d_output *output;
|
||||||
unsigned int backbuffer_width;
|
unsigned int backbuffer_width;
|
||||||
unsigned int backbuffer_height;
|
unsigned int backbuffer_height;
|
||||||
enum wined3d_format_id backbuffer_format;
|
enum wined3d_format_id backbuffer_format;
|
||||||
|
|
Loading…
Reference in New Issue