ddraw: Update DefaultSurfaceType if we had to fallback to a wined3d object without 3D support.

This commit is contained in:
Henri Verbeet 2013-01-16 08:51:48 +01:00 committed by Alexandre Julliard
parent f3dbbba48e
commit 56b256cb77
2 changed files with 16 additions and 4 deletions

View File

@ -5243,6 +5243,7 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
{
DWORD flags;
HRESULT hr;
ddraw->IDirectDraw7_iface.lpVtbl = &ddraw7_vtbl;
@ -5257,15 +5258,20 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
ddraw->numIfaces = 1;
ddraw->ref7 = 1;
if (!(ddraw->wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS)))
flags = WINED3D_LEGACY_DEPTH_BIAS;
if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
flags |= WINED3D_NO3D;
if (!(ddraw->wined3d = wined3d_create(7, flags)))
{
if (!(ddraw->wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D)))
if ((flags & WINED3D_NO3D) || !(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D)))
{
WARN("Failed to create a wined3d object.\n");
return E_FAIL;
}
WARN("Created a wined3d object without 3D support.\n");
DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI;
}
hr = wined3d_device_create(ddraw->wined3d, WINED3DADAPTER_DEFAULT, device_type,

View File

@ -371,6 +371,7 @@ HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA callback, void *context)
HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *context, DWORD flags)
{
struct wined3d *wined3d;
DWORD wined3d_flags;
TRACE("callback %p, context %p, flags %#x.\n", callback, context, flags);
@ -382,16 +383,21 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
if (flags)
FIXME("flags 0x%08x not handled\n", flags);
wined3d_flags = WINED3D_LEGACY_DEPTH_BIAS;
if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
wined3d_flags |= WINED3D_NO3D;
TRACE("Enumerating ddraw interfaces\n");
if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS)))
if (!(wined3d = wined3d_create(7, wined3d_flags)))
{
if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D)))
if ((wined3d_flags & WINED3D_NO3D) || !(wined3d = wined3d_create(7, wined3d_flags | WINED3D_NO3D)))
{
WARN("Failed to create a wined3d object.\n");
return E_FAIL;
}
WARN("Created a wined3d object without 3D support.\n");
DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI;
}
__TRY