[PATCH 3/4] ddraw: Link directly to wined3d.

Henri Verbeet hverbeet at codeweavers.com
Thu Jan 27 13:11:12 CST 2011


I guess the lazy loading was originally introduced to avoid an OpenGL
dependency for applications doing only 2D drawing, but that should now all be
handled by wined3d itself. Even then, I doubt there are a lot of legitimate
setups without at least software GL though.
---
 dlls/ddraw/Makefile.in     |    2 +-
 dlls/ddraw/clipper.c       |    2 +-
 dlls/ddraw/ddraw.c         |   14 +-------------
 dlls/ddraw/ddraw_private.h |    4 ----
 dlls/ddraw/main.c          |   28 ----------------------------
 5 files changed, 3 insertions(+), 47 deletions(-)

diff --git a/dlls/ddraw/Makefile.in b/dlls/ddraw/Makefile.in
index 8ef4542..1d49e79 100644
--- a/dlls/ddraw/Makefile.in
+++ b/dlls/ddraw/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = ddraw.dll
 IMPORTLIB = ddraw
-IMPORTS   = dxguid uuid ole32 user32 gdi32 advapi32
+IMPORTS   = dxguid uuid wined3d user32 gdi32 advapi32
 
 C_SRCS = \
 	clipper.c \
diff --git a/dlls/ddraw/clipper.c b/dlls/ddraw/clipper.c
index b4c493c..905f006 100644
--- a/dlls/ddraw/clipper.c
+++ b/dlls/ddraw/clipper.c
@@ -307,7 +307,7 @@ HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper)
 {
     clipper->lpVtbl = &ddraw_clipper_vtbl;
     clipper->ref = 1;
-    clipper->wineD3DClipper = pWineDirect3DCreateClipper();
+    clipper->wineD3DClipper = WineDirect3DCreateClipper();
     if (!clipper->wineD3DClipper)
     {
         WARN("Failed to create wined3d clipper.\n");
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 6aa3af6..f148e29 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3964,12 +3964,6 @@ DirectDrawCreateClipper(DWORD Flags,
         return CLASS_E_NOAGGREGATION;
     }
 
-    if (!LoadWineD3D())
-    {
-        LeaveCriticalSection(&ddraw_cs);
-        return DDERR_NODIRECTDRAWSUPPORT;
-    }
-
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                      sizeof(IDirectDrawClipperImpl));
     if (object == NULL)
@@ -6016,13 +6010,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
     ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN);
     ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN);
 
-    if (!LoadWineD3D())
-    {
-        ERR("Failed to load wined3d - broken OpenGL setup?\n");
-        return DDERR_NODIRECTDRAWSUPPORT;
-    }
-
-    ddraw->wineD3D = pWineDirect3DCreate(7, &ddraw->IDirectDraw7_iface);
+    ddraw->wineD3D = WineDirect3DCreate(7, &ddraw->IDirectDraw7_iface);
     if (!ddraw->wineD3D)
     {
         WARN("Failed to create a wined3d object.\n");
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 56df02d..1fea09f 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -187,10 +187,6 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) DEC
 /* The default surface type */
 extern WINED3DSURFTYPE DefaultSurfaceType DECLSPEC_HIDDEN;
 
-extern typeof(WineDirect3DCreateClipper) *pWineDirect3DCreateClipper DECLSPEC_HIDDEN;
-extern typeof(WineDirect3DCreate) *pWineDirect3DCreate DECLSPEC_HIDDEN;
-
-
 /*****************************************************************************
  * IDirectDrawSurface implementation structure
  *****************************************************************************/
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index 89a8680..757d9c4 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -39,9 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
 /* The configured default surface */
 WINED3DSURFTYPE DefaultSurfaceType = SURFACE_UNKNOWN;
 
-typeof(WineDirect3DCreateClipper) *pWineDirect3DCreateClipper DECLSPEC_HIDDEN;
-typeof(WineDirect3DCreate) *pWineDirect3DCreate DECLSPEC_HIDDEN;
-
 /* DDraw list and critical section */
 static struct list global_ddraw_list = LIST_INIT(global_ddraw_list);
 
@@ -170,31 +167,6 @@ void *ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_ha
     return entry->object;
 }
 
-/*
- * Helper Function for DDRAW_Create and DirectDrawCreateClipper for
- * lazy loading of the Wine D3D driver.
- *
- * Returns
- *  TRUE on success
- *  FALSE on failure.
- */
-
-BOOL LoadWineD3D(void)
-{
-    static HMODULE hWineD3D = (HMODULE) -1;
-    if (hWineD3D == (HMODULE) -1)
-    {
-        hWineD3D = LoadLibraryA("wined3d");
-        if (hWineD3D)
-        {
-            pWineDirect3DCreate = (typeof(WineDirect3DCreate) *)GetProcAddress(hWineD3D, "WineDirect3DCreate");
-            pWineDirect3DCreateClipper = (typeof(WineDirect3DCreateClipper) *) GetProcAddress(hWineD3D, "WineDirect3DCreateClipper");
-            return TRUE;
-        }
-    }
-    return hWineD3D != NULL;
-}
-
 /***********************************************************************
  *
  * Helper function for DirectDrawCreate and friends
-- 
1.7.3.4




More information about the wine-patches mailing list