Commit 1870353c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Replace "DirectDraw stuff" with per-adapter screen information.

parent e7f61b8c
...@@ -1627,7 +1627,8 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device) ...@@ -1627,7 +1627,8 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device, HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device,
UINT swapchain_idx, const WINED3DDISPLAYMODE *mode) UINT swapchain_idx, const WINED3DDISPLAYMODE *mode)
{ {
const struct wined3d_format *format = wined3d_get_format(&device->adapter->gl_info, mode->Format); struct wined3d_adapter *adapter = device->adapter;
const struct wined3d_format *format = wined3d_get_format(&adapter->gl_info, mode->Format);
DEVMODEW devmode; DEVMODEW devmode;
LONG ret; LONG ret;
RECT clip_rc; RECT clip_rc;
...@@ -1653,8 +1654,8 @@ HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device, ...@@ -1653,8 +1654,8 @@ HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device,
devmode.dmFields |= DM_DISPLAYFREQUENCY; devmode.dmFields |= DM_DISPLAYFREQUENCY;
/* Only change the mode if necessary */ /* Only change the mode if necessary */
if (device->ddraw_width == mode->Width && device->ddraw_height == mode->Height if (adapter->screen_size.cx == mode->Width && adapter->screen_size.cy == mode->Height
&& device->ddraw_format == mode->Format && !mode->RefreshRate) && adapter->screen_format == mode->Format && !mode->RefreshRate)
return WINED3D_OK; return WINED3D_OK;
ret = ChangeDisplaySettingsExW(NULL, &devmode, NULL, CDS_FULLSCREEN, NULL); ret = ChangeDisplaySettingsExW(NULL, &devmode, NULL, CDS_FULLSCREEN, NULL);
...@@ -1673,9 +1674,9 @@ HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device, ...@@ -1673,9 +1674,9 @@ HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device,
} }
/* Store the new values */ /* Store the new values */
device->ddraw_width = mode->Width; adapter->screen_size.cx = mode->Width;
device->ddraw_height = mode->Height; adapter->screen_size.cy = mode->Height;
device->ddraw_format = mode->Format; adapter->screen_format = mode->Format;
/* And finally clip mouse to our screen */ /* And finally clip mouse to our screen */
SetRect(&clip_rc, 0, 0, mode->Width, mode->Height); SetRect(&clip_rc, 0, 0, mode->Width, mode->Height);
...@@ -3939,6 +3940,8 @@ HRESULT CDECL wined3d_device_get_display_mode(struct wined3d_device *device, ...@@ -3939,6 +3940,8 @@ HRESULT CDECL wined3d_device_get_display_mode(struct wined3d_device *device,
} }
else else
{ {
const struct wined3d_adapter *adapter = device->adapter;
/* Don't read the real display mode, but return the stored mode /* Don't read the real display mode, but return the stored mode
* instead. X11 can't change the color depth, and some apps are * instead. X11 can't change the color depth, and some apps are
* pretty angry if they SetDisplayMode from 24 to 16 bpp and find out * pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
...@@ -3946,9 +3949,9 @@ HRESULT CDECL wined3d_device_get_display_mode(struct wined3d_device *device, ...@@ -3946,9 +3949,9 @@ HRESULT CDECL wined3d_device_get_display_mode(struct wined3d_device *device,
* *
* Also don't relay to the swapchain because with ddraw it's possible * Also don't relay to the swapchain because with ddraw it's possible
* that there isn't a swapchain at all. */ * that there isn't a swapchain at all. */
mode->Width = device->ddraw_width; mode->Width = adapter->screen_size.cx;
mode->Height = device->ddraw_height; mode->Height = adapter->screen_size.cy;
mode->Format = device->ddraw_format; mode->Format = adapter->screen_format;
mode->RefreshRate = 0; mode->RefreshRate = 0;
hr = WINED3D_OK; hr = WINED3D_OK;
} }
...@@ -5291,12 +5294,12 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device ...@@ -5291,12 +5294,12 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
} }
/* MSDN: Cursor must be smaller than the display mode */ /* MSDN: Cursor must be smaller than the display mode */
if (cursor_image->resource.width > device->ddraw_width if (cursor_image->resource.width > device->adapter->screen_size.cx
|| cursor_image->resource.height > device->ddraw_height) || cursor_image->resource.height > device->adapter->screen_size.cy)
{ {
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n", WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
cursor_image, cursor_image->resource.width, cursor_image->resource.height, cursor_image, cursor_image->resource.width, cursor_image->resource.height,
device->ddraw_width, device->ddraw_height); device->adapter->screen_size.cx, device->adapter->screen_size.cy);
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
...@@ -6190,9 +6193,9 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, ...@@ -6190,9 +6193,9 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
wined3d_decref(device->wined3d); wined3d_decref(device->wined3d);
return hr; return hr;
} }
device->ddraw_width = mode.Width; adapter->screen_size.cx = mode.Width;
device->ddraw_height = mode.Height; adapter->screen_size.cy = mode.Height;
device->ddraw_format = mode.Format; adapter->screen_format = mode.Format;
/* Save the creation parameters. */ /* Save the creation parameters. */
device->createParms.AdapterOrdinal = adapter_idx; device->createParms.AdapterOrdinal = adapter_idx;
......
...@@ -1509,7 +1509,11 @@ struct wined3d_adapter ...@@ -1509,7 +1509,11 @@ struct wined3d_adapter
{ {
UINT ordinal; UINT ordinal;
BOOL opengl; BOOL opengl;
POINT monitorPoint;
POINT monitorPoint;
SIZE screen_size;
enum wined3d_format_id screen_format;
struct wined3d_gl_info gl_info; struct wined3d_gl_info gl_info;
struct wined3d_driver_info driver_info; struct wined3d_driver_info driver_info;
WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */
...@@ -1729,10 +1733,6 @@ struct wined3d_device ...@@ -1729,10 +1733,6 @@ struct wined3d_device
UINT dummy_texture_3d[MAX_COMBINED_SAMPLERS]; UINT dummy_texture_3d[MAX_COMBINED_SAMPLERS];
UINT dummy_texture_cube[MAX_COMBINED_SAMPLERS]; UINT dummy_texture_cube[MAX_COMBINED_SAMPLERS];
/* DirectDraw stuff */
DWORD ddraw_width, ddraw_height;
enum wined3d_format_id ddraw_format;
/* With register combiners we can skip junk texture stages */ /* With register combiners we can skip junk texture stages */
DWORD texUnitMap[MAX_COMBINED_SAMPLERS]; DWORD texUnitMap[MAX_COMBINED_SAMPLERS];
DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS]; DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS];
......
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