diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 22d3b88512a..62a8e70c3dd 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -421,7 +421,7 @@ static HRESULT WINAPI d3d8_device_GetDisplayMode(IDirect3DDevice8 *iface, D3DDIS TRACE("iface %p, mode %p.\n", iface, mode); wined3d_mutex_lock(); - hr = wined3d_device_get_display_mode(device->wined3d_device, 0, &wined3d_mode); + hr = wined3d_device_get_display_mode(device->wined3d_device, 0, &wined3d_mode, NULL); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 44f64903dc4..d4256fc4711 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -363,7 +363,7 @@ static HRESULT WINAPI d3d9_device_GetDisplayMode(IDirect3DDevice9Ex *iface, UINT TRACE("iface %p, swapchain %u, mode %p.\n", iface, swapchain, mode); wined3d_mutex_lock(); - hr = wined3d_device_get_display_mode(device->wined3d_device, swapchain, &wined3d_mode); + hr = wined3d_device_get_display_mode(device->wined3d_device, swapchain, &wined3d_mode, NULL); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) @@ -2930,12 +2930,34 @@ static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, return E_NOTIMPL; } -static HRESULT WINAPI d3d9_device_GetDisplayModeEx(IDirect3DDevice9Ex *iface, +static HRESULT WINAPI d3d9_device_GetDisplayModeEx(IDirect3DDevice9Ex *iface, UINT swapchain_idx, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation) { - FIXME("iface %p, swapchain_idx %u, mode %p, rotation %p stub!\n", iface, swapchain_idx, mode, rotation); + struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_display_mode wined3d_mode; + HRESULT hr; - return E_NOTIMPL; + TRACE("iface %p, swapchain_idx %u, mode %p, rotation %p.\n", + iface, swapchain_idx, mode, rotation); + + if (mode->Size != sizeof(*mode)) + return D3DERR_INVALIDCALL; + + wined3d_mutex_lock(); + hr = wined3d_device_get_display_mode(device->wined3d_device, swapchain_idx, &wined3d_mode, + (enum wined3d_display_rotation *)rotation); + wined3d_mutex_unlock(); + + if (SUCCEEDED(hr)) + { + mode->Width = wined3d_mode.width; + mode->Height = wined3d_mode.height; + mode->RefreshRate = wined3d_mode.refresh_rate; + mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id); + mode->ScanLineOrdering = wined3d_mode.scanline_ordering; + } + + return hr; } static const struct IDirect3DDevice9ExVtbl d3d9_device_vtbl = diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index b8439a92e1a..d73e6a8b75b 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -175,7 +175,7 @@ static HRESULT WINAPI d3d9_swapchain_GetDisplayMode(IDirect3DSwapChain9 *iface, TRACE("iface %p, mode %p.\n", iface, mode); wined3d_mutex_lock(); - hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode); + hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode, NULL); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index df648007550..8c01184ef34 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3715,17 +3715,18 @@ HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device device->create_parms.device_type, caps); } -HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, - UINT swapchain_idx, struct wined3d_display_mode *mode) +HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, + struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation) { struct wined3d_swapchain *swapchain; HRESULT hr; - TRACE("device %p, swapchain_idx %u, mode %p.\n", device, swapchain_idx, mode); + TRACE("device %p, swapchain_idx %u, mode %p, rotation %p.\n", + device, swapchain_idx, mode, rotation); if (SUCCEEDED(hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) { - hr = wined3d_swapchain_get_display_mode(swapchain, mode); + hr = wined3d_swapchain_get_display_mode(swapchain, mode, rotation); wined3d_swapchain_decref(swapchain); } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index ea6e466bd22..6dbd2d761b3 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -239,7 +239,7 @@ HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain if (!QueryPerformanceCounter(&counter) || !QueryPerformanceFrequency(&freq_per_sec)) return WINED3DERR_INVALIDCALL; - if (FAILED(wined3d_swapchain_get_display_mode(swapchain, &mode))) + if (FAILED(wined3d_swapchain_get_display_mode(swapchain, &mode, NULL))) return WINED3DERR_INVALIDCALL; if (mode.refresh_rate == DEFAULT_REFRESH_RATE) mode.refresh_rate = 60; @@ -261,14 +261,14 @@ HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain } HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, - struct wined3d_display_mode *mode) + struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation) { HRESULT hr; - TRACE("swapchain %p, mode %p.\n", swapchain, mode); + TRACE("swapchain %p, mode %p, rotation %p.\n", swapchain, mode, rotation); hr = wined3d_get_adapter_display_mode(swapchain->device->wined3d, - swapchain->device->adapter->ordinal, mode, NULL); + swapchain->device->adapter->ordinal, mode, rotation); TRACE("Returning w %u, h %u, refresh rate %u, format %s.\n", mode->width, mode->height, mode->refresh_rate, debug_d3dformat(mode->format_id)); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 1c6ef150756..5d4111daeee 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2117,8 +2117,8 @@ HRESULT __cdecl wined3d_device_get_creation_parameters(const struct wined3d_devi HRESULT __cdecl wined3d_device_get_depth_stencil(const struct wined3d_device *device, struct wined3d_surface **depth_stencil); HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps); -HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, - UINT swapchain_idx, struct wined3d_display_mode *mode); +HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, + struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_surface *dst_surface); void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device, @@ -2366,7 +2366,7 @@ HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type, struct wined3d_surface **backbuffer); struct wined3d_device * __cdecl wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain); HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, - struct wined3d_display_mode *mode); + struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_surface *dst_surface); HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,