wined3d: Set display mode to a suitable adapter format.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46792
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Matteo Bruni 2019-03-14 16:30:12 +01:00 committed by Alexandre Julliard
parent e6169ecfef
commit 9fc282d682
2 changed files with 14 additions and 3 deletions

View File

@ -762,6 +762,16 @@ void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const
swapchain->max_frame_latency = device->max_frame_latency >= 2 ? device->max_frame_latency - 1 : 1;
}
static enum wined3d_format_id adapter_format_from_backbuffer_format(struct wined3d_swapchain *swapchain,
enum wined3d_format_id format_id)
{
const struct wined3d_adapter *adapter = swapchain->device->adapter;
const struct wined3d_format *backbuffer_format;
backbuffer_format = wined3d_get_format(adapter, format_id, WINED3D_BIND_RENDER_TARGET);
return pixelformat_for_depth(backbuffer_format->byte_count * CHAR_BIT);
}
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
@ -881,7 +891,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
/* Change the display settings */
swapchain->d3d_mode.width = desc->backbuffer_width;
swapchain->d3d_mode.height = desc->backbuffer_height;
swapchain->d3d_mode.format_id = desc->backbuffer_format;
swapchain->d3d_mode.format_id = adapter_format_from_backbuffer_format(swapchain,
desc->backbuffer_format);
swapchain->d3d_mode.refresh_rate = desc->refresh_rate;
swapchain->d3d_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
@ -1414,7 +1425,8 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
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 = swapchain_desc->backbuffer_format;
actual_mode.format_id = adapter_format_from_backbuffer_format(swapchain,
swapchain_desc->backbuffer_format);
actual_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
}
else

View File

@ -5672,7 +5672,6 @@ void wined3d_format_get_float_color_key(const struct wined3d_format *format,
}
}
/* DirectDraw stuff */
enum wined3d_format_id pixelformat_for_depth(DWORD depth)
{
switch (depth)