Module: wine Branch: stable Commit: d08c25cfc2ea3b437c4b890d560e2c18c03a354d URL: https://source.winehq.org/git/wine.git/?a=commit;h=d08c25cfc2ea3b437c4b890d5...
Author: Matteo Bruni mbruni@codeweavers.com Date: Thu Mar 14 16:30:12 2019 +0100
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 (cherry picked from commit 9fc282d682cfef466a3ee341b901f7081c0959e0) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/wined3d/swapchain.c | 16 ++++++++++++++-- dlls/wined3d/utils.c | 1 - 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index f7fc05f..724ea16 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -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 diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index dd70d3f..b80d776 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -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)