Commit fdb85423 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Lie about the display format in wined3d_get_adapter_display_mode().

parent 2a0463ac
...@@ -3029,15 +3029,18 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada ...@@ -3029,15 +3029,18 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx,
struct wined3d_display_mode *mode) struct wined3d_display_mode *mode)
{ {
const struct wined3d_adapter *adapter;
TRACE("wined3d %p, adapter_idx %u, display_mode %p.\n", wined3d, adapter_idx, mode); TRACE("wined3d %p, adapter_idx %u, display_mode %p.\n", wined3d, adapter_idx, mode);
if (!mode || adapter_idx >= wined3d->adapter_count) if (!mode || adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
adapter = &wined3d->adapters[adapter_idx];
if (!adapter_idx) if (!adapter_idx)
{ {
DEVMODEW DevModeW; DEVMODEW DevModeW;
unsigned int bpp;
ZeroMemory(&DevModeW, sizeof(DevModeW)); ZeroMemory(&DevModeW, sizeof(DevModeW));
DevModeW.dmSize = sizeof(DevModeW); DevModeW.dmSize = sizeof(DevModeW);
...@@ -3045,11 +3048,22 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI ...@@ -3045,11 +3048,22 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI
EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &DevModeW, 0); EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &DevModeW, 0);
mode->width = DevModeW.dmPelsWidth; mode->width = DevModeW.dmPelsWidth;
mode->height = DevModeW.dmPelsHeight; mode->height = DevModeW.dmPelsHeight;
bpp = DevModeW.dmBitsPerPel;
mode->refresh_rate = DEFAULT_REFRESH_RATE; mode->refresh_rate = DEFAULT_REFRESH_RATE;
if (DevModeW.dmFields & DM_DISPLAYFREQUENCY) if (DevModeW.dmFields & DM_DISPLAYFREQUENCY)
mode->refresh_rate = DevModeW.dmDisplayFrequency; mode->refresh_rate = DevModeW.dmDisplayFrequency;
mode->format_id = pixelformat_for_depth(bpp); mode->format_id = pixelformat_for_depth(DevModeW.dmBitsPerPel);
/* Lie about the format. X11 can't change the color depth, and some
* apps are pretty angry if they SetDisplayMode from 24 to 16 bpp and
* find out that GetDisplayMode still returns 24 bpp. This should
* probably be handled in winex11 instead. */
if (adapter->screen_format && adapter->screen_format != mode->format_id)
{
WARN("Overriding format %s with stored format %s.\n",
debug_d3dformat(mode->format_id),
debug_d3dformat(adapter->screen_format));
mode->format_id = adapter->screen_format;
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment