[PATCH 4/5] ddraw: Update DefaultSurfaceType if we had to fallback to a wined3d object without 3D support.
Henri Verbeet
hverbeet at codeweavers.com
Wed Jan 16 01:51:48 CST 2013
---
dlls/ddraw/ddraw.c | 10 ++++++++--
dlls/ddraw/main.c | 10 ++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index a04de34..32f9c5a 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -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,
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index e79b471..819dc7f 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -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
--
1.7.12.4
More information about the wine-patches
mailing list