Clean-up patch for configure / D3D

Lionel Ulmer lionel.ulmer at free.fr
Wed Jul 11 16:09:41 CDT 2001


Hi all,

This patch removes the check for OSMesa and all the OSMesa-related code from
the D3D code (who runs anyway Wine's D3D code :-) ? ).

I removed that as it appears that it could lead to problems on some users'
systems without any gain (as we did NOT use OSMesa at all).

Alexandre, you will have to regenerate configure and config.h.

Changelog:
 - removed unused OSMesa linking
 - removed OSMesa code

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: wine/configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.215
diff -u -r1.215 configure.in
--- wine/configure.in	2001/07/08 22:30:50	1.215
+++ wine/configure.in	2001/07/11 20:49:21
@@ -322,17 +322,6 @@
 				OPENGL32_DLL=opengl32
 			fi
 
-                        AC_CHECK_HEADERS(GL/osmesa.h,
-                            [ dnl *** If GL/osmesa.h exists...
-                                AC_CHECK_LIB(GL, OSMesaCreateContext,
-                                  X_PRE_LIBS="$X_PRE_LIBS -lGL",
-                                  AC_CHECK_LIB(OSMesa, OSMesaCreateContext,
-                                               X_PRE_LIBS="$X_PRE_LIBS -lOSMesa",,
-                                               -lGL $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS),
-                                  $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS
-                                )
-                            ]
-                        )
 		fi
 	        dnl Check for GLU32 library.
 		AC_CHECK_LIB(GLU,glBegin,
Index: wine/include/config.h.in
===================================================================
RCS file: /home/wine/wine/include/config.h.in,v
retrieving revision 1.83
diff -u -r1.83 config.h.in
--- wine/include/config.h.in	2001/07/08 22:30:51	1.83
+++ wine/include/config.h.in	2001/07/11 20:49:29
@@ -178,9 +178,6 @@
 /* Define if you have the <GL/glx.h> header file.  */
 #undef HAVE_GL_GLX_H
 
-/* Define if you have the <GL/osmesa.h> header file.  */
-#undef HAVE_GL_OSMESA_H
-
 /* Define if you have the <X11/XKBlib.h> header file.  */
 #undef HAVE_X11_XKBLIB_H
 
Index: wine/dlls/ddraw/mesa_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/mesa_private.h,v
retrieving revision 1.8
diff -u -r1.8 mesa_private.h
--- wine/dlls/ddraw/mesa_private.h	2001/01/04 22:44:55	1.8
+++ wine/dlls/ddraw/mesa_private.h	2001/07/11 20:49:43
@@ -12,8 +12,6 @@
 #include "wine_gl.h"
 #include "x11drv.h"
 
-#undef USE_OSMESA
-
 /*****************************************************************************
  * IDirect3DLight MESA private structure
  */
@@ -81,12 +79,7 @@
 } RenderState;
 
 typedef struct mesa_d3dd_private {
-#ifdef USE_OSMESA
-    OSMesaContext ctx;
-    unsigned char *buffer;
-#else
     GLXContext ctx;
-#endif
 
     /* The current render state */
     RenderState rs;
Index: wine/dlls/ddraw/d3ddevice/mesa.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3ddevice/mesa.c,v
retrieving revision 1.11
diff -u -r1.11 mesa.c
--- wine/dlls/ddraw/d3ddevice/mesa.c	2001/05/11 00:17:47	1.11
+++ wine/dlls/ddraw/d3ddevice/mesa.c	2001/07/11 20:49:54
@@ -50,17 +50,11 @@
 #if COMPILABLE
     D3DDPRIVATE(This);
 
-#ifdef USE_OSMESA
-    OSMesaMakeCurrent(d3ddpriv->ctx, odev->buffer, GL_UNSIGNED_BYTE,
-		    This->surface->s.surface_desc.dwWidth,
-		    This->surface->s.surface_desc.dwHeight);
-#else
     if (glXMakeCurrent(gdi_display,ddpriv->drawable, odev->ctx) == False) {
 	ERR("Error in setting current context (context %p drawable %ld)!\n",
 	    odev->ctx, ddpriv->drawable);
     }
 #endif
-#endif
 }
 
 static void fill_opengl_primcaps(D3DPRIMCAPS *pc)
@@ -178,11 +172,6 @@
     
     TRACE("Creating OpenGL device for surface %p\n", surface);
     /* Create the OpenGL context */
-#ifdef USE_OSMESA
-    odev->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
-    odev->buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
-			     surface->s.surface_desc.dwWidth * surface->s.surface_desc.dwHeight * 4);
-#else
     /* First get the correct visual */
     ENTER_GL();
     /* Create the context */
@@ -215,7 +204,6 @@
     }
 #endif
 
-#endif
     odev->rs.src = GL_ONE;
     odev->rs.dst = GL_ZERO;
     odev->rs.mag = GL_NEAREST;
@@ -259,13 +247,9 @@
   FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
   
   if (!--(This->ref)) {
-#ifdef USE_OSMESA
-    OSMesaDestroyContext(odev->ctx);
-#else
     ENTER_GL();
     glXDestroyContext(gdi_display, odev->ctx);
     LEAVE_GL();
-#endif
     This->private = NULL;
     HeapFree(GetProcessHeap(),0,This);
     return 0;
@@ -410,52 +394,10 @@
 
 HRESULT WINAPI MESA_IDirect3DDevice2Impl_EndScene(LPDIRECT3DDEVICE2 iface) {
   ICOM_THIS(IDirect3DDevice2Impl,iface);
-#ifdef USE_OSMESA
-  D3DPRIVATE(This);
 
-  LPDIRECTDRAWSURFACE3 surf = (LPDIRECTDRAWSURFACE3) This->surface;
-  DDSURFACEDESC sdesc;
-  int x,y;
-  unsigned char *src;
-  unsigned short *dest;
-#endif
-  
   FIXME("(%p)->(): stub\n", This);
 
-#ifdef USE_OSMESA
-  /* Here we copy back the OpenGL scene to the the DDraw surface */
-  /* First, lock the surface */
-  IDirectDrawSurface3_Lock(surf,NULL,&sdesc,DDLOCK_WRITEONLY,0);
-
-  /* The copy the OpenGL buffer to this surface */
-  
-  /* NOTE : this is only for debugging purpose. I KNOW it is really unoptimal.
-     I am currently working on a set of patches for Mesa to have OSMesa support
-     16 bpp surfaces => we will able to render directly onto the surface, no
-     need to do a bpp conversion */
-  dest = (unsigned short *) sdesc.u2.lpSurface;
-  src = ((unsigned char *) odev->buffer) + 4 * (sdesc.dwWidth * (sdesc.dwHeight - 1));
-  for (y = 0; y < sdesc.dwHeight; y++) {
-    unsigned char *lsrc = src;
-    
-    for (x = 0; x < sdesc.dwWidth ; x++) {
-      unsigned char r =  *lsrc++;
-      unsigned char g =  *lsrc++;
-      unsigned char b =  *lsrc++;
-      lsrc++; /* Alpha */
-      *dest = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
-      
-      dest++;
-    }
-
-    src -= 4 * sdesc.dwWidth;
-  }
-
-  /* Unlock the surface */
-  IDirectDrawSurface3_Unlock(surf,sdesc.u2.lpSurface);
-#else
   /* No need to do anything here... */
-#endif
   
   return DD_OK;
 }
@@ -870,10 +812,8 @@
 {
   if (!memcmp(&IID_D3DDEVICE_OpenGL,rguid,sizeof(IID_D3DDEVICE_OpenGL))) {
     mesa_d3dd_private *odev;
-#ifndef USE_OSMESA
     int attributeList[]={ GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None };
     XVisualInfo *xvis;
-#endif
        
     *device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DDeviceImpl));
     (*device)->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dd_private));
@@ -891,11 +831,6 @@
     TRACE("OpenGL device created \n");
     
     /* Create the OpenGL context */
-#ifdef USE_OSMESA
-    odev->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
-    odev->buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
-			     surface->s.surface_desc.dwWidth * surface->s.surface_desc.dwHeight * 4);
-#else
     /* First get the correct visual */
     /* if (surface->s.backbuffer == NULL)
        attributeList[3] = None; */
@@ -925,7 +860,6 @@
 	      chain->surfaces[i]->s.d3d_device = (void *) odev;
     }
 #endif
-#endif
     odev->rs.src = GL_ONE;
     odev->rs.dst = GL_ZERO;
     odev->rs.mag = GL_NEAREST;
@@ -956,13 +890,9 @@
   
   if (!--(This->ref)) {
     D3DDPRIVATE(This);
-#ifdef USE_OSMESA
-    OSMesaDestroyContext(odev->ctx);
-#else
     ENTER_GL();
     glXDestroyContext(gdi_display, odev->ctx);
     LEAVE_GL();
-#endif    
     This->private = NULL;
     HeapFree(GetProcessHeap(),0,This);
     return 0;
@@ -1000,52 +930,10 @@
 static HRESULT WINAPI MESA_IDirect3DDeviceImpl_EndScene(LPDIRECT3DDEVICE iface)
 {
   ICOM_THIS(IDirect3DDeviceImpl,iface);
-#ifdef USE_OSMESA
-  D3DDPRIVATE(This);
-  LPDIRECTDRAWSURFACE3 surf = (LPDIRECTDRAWSURFACE3) This->surface;
-  DDSURFACEDESC sdesc;
-  int x,y;
-  unsigned char *src;
-  unsigned short *dest;
-#endif
   
   FIXME("(%p)->(): stub\n", This);
 
-#ifdef USE_OSMESA
-  /* Here we copy back the OpenGL scene to the the DDraw surface */
-  /* First, lock the surface */
-  IDirectDrawSurface3_Lock(surf,NULL,&sdesc,DDLOCK_WRITEONLY,0);
-
-  /* The copy the OpenGL buffer to this surface */
-  
-  /* NOTE : this is only for debugging purpose. I KNOW it is really unoptimal.
-     I am currently working on a set of patches for Mesa to have OSMesa support
-     16 bpp surfaces => we will able to render directly onto the surface, no
-     need to do a bpp conversion */
-  dest = (unsigned short *) sdesc.u2.lpSurface;
-  src = ((unsigned char *) odev->buffer) + 4 * (sdesc.dwWidth * (sdesc.dwHeight - 1));
-  for (y = 0; y < sdesc.dwHeight; y++) {
-    unsigned char *lsrc = src;
-    
-    for (x = 0; x < sdesc.dwWidth ; x++) {
-      unsigned char r =  *lsrc++;
-      unsigned char g =  *lsrc++;
-      unsigned char b =  *lsrc++;
-      lsrc++; /* Alpha */
-
-      *dest = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
-      
-      dest++;
-    }
-
-    src -= 4 * sdesc.dwWidth;
-  }
-
-  /* Unlock the surface */
-  IDirectDrawSurface3_Unlock(surf,sdesc.u2.lpSurface);
-#else
   /* No need to do anything here... */
-#endif
   
   return DD_OK;  
 }


More information about the wine-patches mailing list