d3d9: Implement d3d9_device_ResetEx().

This commit is contained in:
Henri Verbeet 2012-07-08 16:06:37 +02:00 committed by Alexandre Julliard
parent 3543e1d198
commit 73eceafb17
6 changed files with 52 additions and 22 deletions

View File

@ -598,7 +598,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
wined3d_mutex_lock();
wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters);
if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, reset_enum_callback)))
if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback)))
{
hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
device->lost = FALSE;

View File

@ -583,7 +583,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if
wined3d_mutex_lock();
wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters);
hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, reset_enum_callback);
hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback);
if (FAILED(hr))
device->not_reset = TRUE;
else
@ -2954,9 +2954,33 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex
static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface,
D3DPRESENT_PARAMETERS *present_parameters, D3DDISPLAYMODEEX *mode)
{
FIXME("iface %p, present_parameters %p, mode %p stub!\n", iface, present_parameters, mode);
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct wined3d_swapchain_desc swapchain_desc;
struct wined3d_display_mode wined3d_mode;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, present_parameters %p, mode %p.\n", iface, present_parameters, mode);
if (mode)
{
wined3d_mode.width = mode->Width;
wined3d_mode.height = mode->Height;
wined3d_mode.refresh_rate = mode->RefreshRate;
wined3d_mode.format_id = wined3dformat_from_d3dformat(mode->Format);
wined3d_mode.scanline_ordering = mode->ScanLineOrdering;
}
wined3d_mutex_lock();
wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters);
hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
mode ? &wined3d_mode : NULL, reset_enum_callback);
if (FAILED(hr))
device->not_reset = TRUE;
else
device->not_reset = FALSE;
wined3d_mutex_unlock();
return hr;
}
static HRESULT WINAPI d3d9_device_GetDisplayModeEx(IDirect3DDevice9Ex *iface,

View File

@ -3020,7 +3020,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
swapchain_desc.backbuffer_format = mode.format_id;
hr = wined3d_device_reset(ddraw->wined3d_device,
&swapchain_desc, ddraw_reset_enum_callback);
&swapchain_desc, NULL, ddraw_reset_enum_callback);
if (FAILED(hr))
{
ERR("Failed to reset device.\n");

View File

@ -5136,18 +5136,18 @@ err:
/* Do not call while under the GL lock. */
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
const struct wined3d_swapchain_desc *swapchain_desc,
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode,
wined3d_device_reset_cb callback)
{
struct wined3d_resource *resource, *cursor;
struct wined3d_swapchain *swapchain;
struct wined3d_display_mode mode;
struct wined3d_display_mode m;
BOOL DisplayModeChanged = FALSE;
BOOL update_desc = FALSE;
unsigned int i;
HRESULT hr;
TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback);
if (FAILED(hr = wined3d_device_get_swapchain(device, 0, &swapchain)))
{
@ -5254,21 +5254,26 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (swapchain_desc->enable_auto_depth_stencil)
wined3d_device_set_depth_stencil(device, device->auto_depth_stencil);
if (swapchain_desc->windowed)
if (mode)
{
mode.width = swapchain->orig_width;
mode.height = swapchain->orig_height;
mode.refresh_rate = 0;
mode.format_id = swapchain->desc.backbuffer_format;
mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
DisplayModeChanged = TRUE;
m = *mode;
}
else if (swapchain_desc->windowed)
{
m.width = swapchain->orig_width;
m.height = swapchain->orig_height;
m.refresh_rate = 0;
m.format_id = swapchain->desc.backbuffer_format;
m.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
}
else
{
mode.width = swapchain_desc->backbuffer_width;
mode.height = swapchain_desc->backbuffer_height;
mode.refresh_rate = swapchain_desc->refresh_rate;
mode.format_id = swapchain_desc->backbuffer_format;
mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
m.width = swapchain_desc->backbuffer_width;
m.height = swapchain_desc->backbuffer_height;
m.refresh_rate = swapchain_desc->refresh_rate;
m.format_id = swapchain_desc->backbuffer_format;
m.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;
}
/* Should Width == 800 && Height == 0 set 800x600? */
@ -5339,7 +5344,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (!swapchain_desc->windowed != !swapchain->desc.windowed
|| DisplayModeChanged)
{
if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, device->adapter->ordinal, &mode)))
if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, device->adapter->ordinal, &m)))
{
WARN("Failed to set display mode, hr %#x.\n", hr);
wined3d_swapchain_decref(swapchain);

View File

@ -101,7 +101,7 @@
@ cdecl wined3d_device_present(ptr ptr ptr ptr ptr long)
@ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long)
@ cdecl wined3d_device_release_focus_window(ptr)
@ cdecl wined3d_device_reset(ptr ptr ptr)
@ cdecl wined3d_device_reset(ptr ptr ptr ptr)
@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr)
@ cdecl wined3d_device_set_base_vertex_index(ptr long)
@ cdecl wined3d_device_set_clip_plane(ptr long ptr)

View File

@ -2188,7 +2188,8 @@ HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device,
const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf);
void __cdecl wined3d_device_release_focus_window(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device,
const struct wined3d_swapchain_desc *swapchain_desc, wined3d_device_reset_cb callback);
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode,
wined3d_device_reset_cb callback);
void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window);
HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index);
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device,