Commit 56ab2b3e authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Load OpenGL library dynamically from x11drv.

parent d09b9ccb
...@@ -305,7 +305,7 @@ ac_includes_default="\ ...@@ -305,7 +305,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LIBEXT OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC DLLTOOL LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LIBEXT OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC DLLTOOL LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
# Initialize some variables set by options. # Initialize some variables set by options.
...@@ -5761,6 +5761,8 @@ XFILES="" ...@@ -5761,6 +5761,8 @@ XFILES=""
OPENGLFILES="" OPENGLFILES=""
GLU32FILES="" GLU32FILES=""
OPENGL_LIBS=""
if test "$have_x" = "yes" if test "$have_x" = "yes"
then then
XLIB="-lXext -lX11" XLIB="-lXext -lX11"
...@@ -7013,7 +7015,7 @@ fi ...@@ -7013,7 +7015,7 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glXCreateContext" >&5 echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glXCreateContext" >&5
echo "${ECHO_T}$ac_cv_lib_GL_glXCreateContext" >&6 echo "${ECHO_T}$ac_cv_lib_GL_glXCreateContext" >&6
if test $ac_cv_lib_GL_glXCreateContext = yes; then if test $ac_cv_lib_GL_glXCreateContext = yes; then
X_PRE_LIBS="$X_PRE_LIBS -lGL" OPENGL_LIBS="-lGL"
fi fi
...@@ -7149,7 +7151,7 @@ if test "${ac_cv_lib_GLU_gluLookAt+set}" = set; then ...@@ -7149,7 +7151,7 @@ if test "${ac_cv_lib_GLU_gluLookAt+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lGLU $X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS LIBS="-lGLU $OPENGL_LIBS $X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS
$LIBS" $LIBS"
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure" #line $LINENO "configure"
...@@ -7194,7 +7196,7 @@ fi ...@@ -7194,7 +7196,7 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_GLU_gluLookAt" >&5 echo "$as_me:$LINENO: result: $ac_cv_lib_GLU_gluLookAt" >&5
echo "${ECHO_T}$ac_cv_lib_GLU_gluLookAt" >&6 echo "${ECHO_T}$ac_cv_lib_GLU_gluLookAt" >&6
if test $ac_cv_lib_GLU_gluLookAt = yes; then if test $ac_cv_lib_GLU_gluLookAt = yes; then
X_PRE_LIBS="$X_PRE_LIBS -lGLU" OPENGL_LIBS="$OPENGL_LIBS -lGLU"
GLU32FILES='$(GLU32FILES)' GLU32FILES='$(GLU32FILES)'
fi fi
...@@ -10689,6 +10691,66 @@ cat >>confdefs.h <<_ACEOF ...@@ -10689,6 +10691,66 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
fi fi
echo "$as_me:$LINENO: checking for -lGL soname" >&5
echo $ECHO_N "checking for -lGL soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_GL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_get_soname_save_LIBS=$LIBS
LIBS="-lGL $X_LIBS $X_EXTRA_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char glXQueryExtension ();
int
main ()
{
glXQueryExtension ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest$ac_exeext | grep libGL\\.so | sed 's/^[ ]*\([^ ]*\)[ ]*=>.*$/\1/'`
if test "x$ac_cv_lib_soname_GL" = "x"
then
ac_cv_lib_soname_GL="libGL.so"
fi
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_lib_soname_GL="libGL.so"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_get_soname_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_soname_GL" >&5
echo "${ECHO_T}$ac_cv_lib_soname_GL" >&6
if test "x$ac_cv_lib_soname_GL" != xNONE
then
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBGL "$ac_cv_lib_soname_GL"
_ACEOF
fi
echo "$as_me:$LINENO: checking for -lcups soname" >&5 echo "$as_me:$LINENO: checking for -lcups soname" >&5
echo $ECHO_N "checking for -lcups soname... $ECHO_C" >&6 echo $ECHO_N "checking for -lcups soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_cups+set}" = set; then if test "${ac_cv_lib_soname_cups+set}" = set; then
...@@ -14433,6 +14495,7 @@ s,@XLIB@,$XLIB,;t t ...@@ -14433,6 +14495,7 @@ s,@XLIB@,$XLIB,;t t
s,@XFILES@,$XFILES,;t t s,@XFILES@,$XFILES,;t t
s,@OPENGLFILES@,$OPENGLFILES,;t t s,@OPENGLFILES@,$OPENGLFILES,;t t
s,@GLU32FILES@,$GLU32FILES,;t t s,@GLU32FILES@,$GLU32FILES,;t t
s,@OPENGL_LIBS@,$OPENGL_LIBS,;t t
s,@NASLIBS@,$NASLIBS,;t t s,@NASLIBS@,$NASLIBS,;t t
s,@CURSESLIBS@,$CURSESLIBS,;t t s,@CURSESLIBS@,$CURSESLIBS,;t t
s,@sane_devel@,$sane_devel,;t t s,@sane_devel@,$sane_devel,;t t
......
...@@ -139,6 +139,8 @@ AC_SUBST(OPENGLFILES) ...@@ -139,6 +139,8 @@ AC_SUBST(OPENGLFILES)
OPENGLFILES="" OPENGLFILES=""
AC_SUBST(GLU32FILES) AC_SUBST(GLU32FILES)
GLU32FILES="" GLU32FILES=""
AC_SUBST(OPENGL_LIBS)
OPENGL_LIBS=""
if test "$have_x" = "yes" if test "$have_x" = "yes"
then then
XLIB="-lXext -lX11" XLIB="-lXext -lX11"
...@@ -280,7 +282,7 @@ This prevents linking to OpenGL. Delete the file and restart configure.]) ...@@ -280,7 +282,7 @@ This prevents linking to OpenGL. Delete the file and restart configure.])
then then
dnl Check for the presence of the library dnl Check for the presence of the library
AC_CHECK_LIB(GL,glXCreateContext, AC_CHECK_LIB(GL,glXCreateContext,
X_PRE_LIBS="$X_PRE_LIBS -lGL" OPENGL_LIBS="-lGL"
,, ,,
$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS) $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
...@@ -317,10 +319,10 @@ This prevents linking to OpenGL. Delete the file and restart configure.]) ...@@ -317,10 +319,10 @@ This prevents linking to OpenGL. Delete the file and restart configure.])
fi fi
dnl Check for GLU32 library. dnl Check for GLU32 library.
AC_CHECK_LIB(GLU,gluLookAt, AC_CHECK_LIB(GLU,gluLookAt,
[X_PRE_LIBS="$X_PRE_LIBS -lGLU" [OPENGL_LIBS="$OPENGL_LIBS -lGLU"
GLU32FILES='$(GLU32FILES)'] GLU32FILES='$(GLU32FILES)']
,, ,,
$X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS $OPENGL_LIBS $X_LIBS $X_PRE_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS
) )
fi fi
fi fi
...@@ -845,6 +847,7 @@ then ...@@ -845,6 +847,7 @@ then
WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS]) WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS]) WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS])
WINE_GET_SONAME(GL,glXQueryExtension,[$X_LIBS $X_EXTRA_LIBS])
WINE_GET_SONAME(cups,cupsGetDefault) WINE_GET_SONAME(cups,cupsGetDefault)
fi fi
......
...@@ -5,7 +5,7 @@ VPATH = @srcdir@ ...@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = d3d8.dll MODULE = d3d8.dll
IMPORTS = user32 gdi32 kernel32 IMPORTS = user32 gdi32 kernel32
EXTRAINCL = @X_CFLAGS@ EXTRAINCL = @X_CFLAGS@
EXTRALIBS = $(LIBUUID) @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ EXTRALIBS = $(LIBUUID) @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_LIBS@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o
......
...@@ -5,7 +5,7 @@ VPATH = @srcdir@ ...@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = ddraw.dll MODULE = ddraw.dll
IMPORTS = user32 gdi32 kernel32 IMPORTS = user32 gdi32 kernel32
EXTRAINCL = @X_CFLAGS@ EXTRAINCL = @X_CFLAGS@
EXTRALIBS = $(LIBUUID) @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ EXTRALIBS = $(LIBUUID) @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_LIBS@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o
......
...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@ ...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = glu32.dll MODULE = glu32.dll
EXTRAINCL = @X_CFLAGS@ EXTRAINCL = @X_CFLAGS@
EXTRALIBS = @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ EXTRALIBS = @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_LIBS@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o
......
...@@ -5,7 +5,7 @@ VPATH = @srcdir@ ...@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = opengl32.dll MODULE = opengl32.dll
IMPORTS = user32 gdi32 kernel32 IMPORTS = user32 gdi32 kernel32
EXTRAINCL = @X_CFLAGS@ EXTRAINCL = @X_CFLAGS@
EXTRALIBS = @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ EXTRALIBS = @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_LIBS@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o
......
...@@ -68,6 +68,7 @@ int client_side_antialias_with_render = 1; ...@@ -68,6 +68,7 @@ int client_side_antialias_with_render = 1;
unsigned int X11DRV_server_startticks; unsigned int X11DRV_server_startticks;
static BOOL synchronous; /* run in synchronous mode? */ static BOOL synchronous; /* run in synchronous mode? */
static BOOL desktop_dbl_buf;
static char *desktop_geometry; static char *desktop_geometry;
static XVisualInfo *desktop_vi; static XVisualInfo *desktop_vi;
...@@ -268,6 +269,9 @@ static void setup_options(void) ...@@ -268,6 +269,9 @@ static void setup_options(void)
if (!get_config_key( hkey, appkey, "ClientSideAntiAliasWithRender", buffer, sizeof(buffer) )) if (!get_config_key( hkey, appkey, "ClientSideAntiAliasWithRender", buffer, sizeof(buffer) ))
client_side_antialias_with_render = IS_OPTION_TRUE( buffer[0] ); client_side_antialias_with_render = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "DesktopDoubleBuffered", buffer, sizeof(buffer) ))
desktop_dbl_buf = IS_OPTION_TRUE( buffer[0] );
if (appkey) RegCloseKey( appkey ); if (appkey) RegCloseKey( appkey );
RegCloseKey( hkey ); RegCloseKey( hkey );
} }
...@@ -313,8 +317,11 @@ static void process_attach(void) ...@@ -313,8 +317,11 @@ static void process_attach(void)
} }
else screen_depth = DefaultDepthOfScreen( screen ); else screen_depth = DefaultDepthOfScreen( screen );
/* Initialize OpenGL */
X11DRV_OpenGL_Init(display);
/* If OpenGL is available, change the default visual, etc as necessary */ /* If OpenGL is available, change the default visual, etc as necessary */
if ((desktop_vi = X11DRV_setup_opengl_visual( display ))) if (desktop_dbl_buf && (desktop_vi = X11DRV_setup_opengl_visual( display )))
{ {
visual = desktop_vi->visual; visual = desktop_vi->visual;
screen = ScreenOfDisplay(display, desktop_vi->screen); screen = ScreenOfDisplay(display, desktop_vi->screen);
...@@ -352,10 +359,6 @@ static void process_attach(void) ...@@ -352,10 +359,6 @@ static void process_attach(void)
/* initialize DGA2 */ /* initialize DGA2 */
X11DRV_XF86DGA2_Init(); X11DRV_XF86DGA2_Init();
#endif #endif
#ifdef HAVE_OPENGL
/* initialize GLX */
/*X11DRV_GLX_Init();*/
#endif
/* load display.dll */ /* load display.dll */
LoadLibrary16( "display" ); LoadLibrary16( "display" );
...@@ -385,10 +388,6 @@ static void thread_detach(void) ...@@ -385,10 +388,6 @@ static void thread_detach(void)
*/ */
static void process_detach(void) static void process_detach(void)
{ {
#ifdef HAVE_OPENGL
/* cleanup GLX */
/*X11DRV_GLX_Cleanup();*/
#endif
#ifdef HAVE_LIBXXF86DGA2 #ifdef HAVE_LIBXXF86DGA2
/* cleanup DGA2 */ /* cleanup DGA2 */
X11DRV_XF86DGA2_Cleanup(); X11DRV_XF86DGA2_Cleanup();
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include "ts_xlib.h" #include "ts_xlib.h"
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(opengl); WINE_DEFAULT_DEBUG_CHANNEL(opengl);
#ifdef HAVE_OPENGL #if defined(HAVE_GL_GL_H) && defined(HAVE_GL_GLX_H)
#undef APIENTRY #undef APIENTRY
#undef CALLBACK #undef CALLBACK
...@@ -105,6 +106,50 @@ static void dump_PIXELFORMATDESCRIPTOR(PIXELFORMATDESCRIPTOR *ppfd) { ...@@ -105,6 +106,50 @@ static void dump_PIXELFORMATDESCRIPTOR(PIXELFORMATDESCRIPTOR *ppfd) {
DPRINTF("\n"); DPRINTF("\n");
} }
/* No need to load any other libraries as according to the ABI, libGL should be self-sufficient and
include all dependencies
*/
#ifndef SONAME_LIBGL
#define SONAME_LIBGL "libGL.so"
#endif
static void *opengl_handle;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f;
MAKE_FUNCPTR(glXChooseVisual)
MAKE_FUNCPTR(glXGetConfig)
MAKE_FUNCPTR(glXSwapBuffers)
MAKE_FUNCPTR(glXQueryExtension)
#undef MAKE_FUNCPTR
void X11DRV_OpenGL_Init(Display *display) {
int error_base, event_base;
opengl_handle = wine_dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL, NULL, 0);
if (opengl_handle == NULL) return;
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(opengl_handle, #f, NULL, 0)) == NULL) goto sym_not_found;
LOAD_FUNCPTR(glXChooseVisual)
LOAD_FUNCPTR(glXGetConfig)
LOAD_FUNCPTR(glXSwapBuffers)
LOAD_FUNCPTR(glXQueryExtension)
#undef LOAD_FUNCPTR
wine_tsx11_lock();
if (pglXQueryExtension(display, &event_base, &error_base) == True) {
TRACE("GLX is up and running error_base = %d\n", error_base);
} else {
wine_dlclose(opengl_handle, NULL, 0);
opengl_handle = NULL;
}
wine_tsx11_unlock();
return;
sym_not_found:
wine_dlclose(opengl_handle, NULL, 0);
opengl_handle = NULL;
}
/* X11DRV_ChoosePixelFormat /* X11DRV_ChoosePixelFormat
Equivalent of glXChooseVisual Equivalent of glXChooseVisual
...@@ -121,6 +166,11 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -121,6 +166,11 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
XVisualInfo *vis; XVisualInfo *vis;
int i; int i;
if (opengl_handle == NULL) {
ERR("No libGL on this box - disabling OpenGL support !\n");
return 0;
}
if (TRACE_ON(opengl)) { if (TRACE_ON(opengl)) {
TRACE("(%p,%p)\n", physDev, ppfd); TRACE("(%p,%p)\n", physDev, ppfd);
...@@ -200,6 +250,11 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -200,6 +250,11 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
int value; int value;
int rb,gb,bb,ab; int rb,gb,bb,ab;
if (opengl_handle == NULL) {
ERR("No libGL on this box - disabling OpenGL support !\n");
return 0;
}
TRACE("(%p,%d,%d,%p)\n", physDev, iPixelFormat, nBytes, ppfd); TRACE("(%p,%d,%d,%p)\n", physDev, iPixelFormat, nBytes, ppfd);
if (ppfd == NULL) { if (ppfd == NULL) {
...@@ -225,7 +280,7 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -225,7 +280,7 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
/* Create a 'standard' X Visual */ /* Create a 'standard' X Visual */
wine_tsx11_lock(); wine_tsx11_lock();
vis = glXChooseVisual(gdi_display, DefaultScreen(gdi_display), dblBuf); vis = pglXChooseVisual(gdi_display, DefaultScreen(gdi_display), dblBuf);
wine_tsx11_unlock(); wine_tsx11_unlock();
WARN("Uninitialized Visual. Creating standard (%p) !\n", vis); WARN("Uninitialized Visual. Creating standard (%p) !\n", vis);
...@@ -248,26 +303,26 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -248,26 +303,26 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED; ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED;
/* Now the flags extraced from the Visual */ /* Now the flags extraced from the Visual */
wine_tsx11_lock(); wine_tsx11_lock();
glXGetConfig(gdi_display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER; pglXGetConfig(gdi_display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER;
glXGetConfig(gdi_display, vis, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO; pglXGetConfig(gdi_display, vis, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO;
/* Pixel type */ /* Pixel type */
glXGetConfig(gdi_display, vis, GLX_RGBA, &value); pglXGetConfig(gdi_display, vis, GLX_RGBA, &value);
if (value) if (value)
ppfd->iPixelType = PFD_TYPE_RGBA; ppfd->iPixelType = PFD_TYPE_RGBA;
else else
ppfd->iPixelType = PFD_TYPE_COLORINDEX; ppfd->iPixelType = PFD_TYPE_COLORINDEX;
/* Color bits */ /* Color bits */
glXGetConfig(gdi_display, vis, GLX_BUFFER_SIZE, &value); pglXGetConfig(gdi_display, vis, GLX_BUFFER_SIZE, &value);
ppfd->cColorBits = value; ppfd->cColorBits = value;
/* Red, green, blue and alpha bits / shifts */ /* Red, green, blue and alpha bits / shifts */
if (ppfd->iPixelType == PFD_TYPE_RGBA) { if (ppfd->iPixelType == PFD_TYPE_RGBA) {
glXGetConfig(gdi_display, vis, GLX_RED_SIZE, &rb); pglXGetConfig(gdi_display, vis, GLX_RED_SIZE, &rb);
glXGetConfig(gdi_display, vis, GLX_GREEN_SIZE, &gb); pglXGetConfig(gdi_display, vis, GLX_GREEN_SIZE, &gb);
glXGetConfig(gdi_display, vis, GLX_BLUE_SIZE, &bb); pglXGetConfig(gdi_display, vis, GLX_BLUE_SIZE, &bb);
glXGetConfig(gdi_display, vis, GLX_ALPHA_SIZE, &ab); pglXGetConfig(gdi_display, vis, GLX_ALPHA_SIZE, &ab);
ppfd->cRedBits = rb; ppfd->cRedBits = rb;
ppfd->cRedShift = gb + bb + ab; ppfd->cRedShift = gb + bb + ab;
...@@ -290,11 +345,11 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -290,11 +345,11 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
/* Accums : to do ... */ /* Accums : to do ... */
/* Depth bits */ /* Depth bits */
glXGetConfig(gdi_display, vis, GLX_DEPTH_SIZE, &value); pglXGetConfig(gdi_display, vis, GLX_DEPTH_SIZE, &value);
ppfd->cDepthBits = value; ppfd->cDepthBits = value;
/* stencil bits */ /* stencil bits */
glXGetConfig( gdi_display, vis, GLX_STENCIL_SIZE, &value ); pglXGetConfig( gdi_display, vis, GLX_STENCIL_SIZE, &value );
ppfd->cStencilBits = value; ppfd->cStencilBits = value;
wine_tsx11_unlock(); wine_tsx11_unlock();
...@@ -339,10 +394,15 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev, ...@@ -339,10 +394,15 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
Swap the buffers of this DC Swap the buffers of this DC
*/ */
BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) { BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) {
if (opengl_handle == NULL) {
ERR("No libGL on this box - disabling OpenGL support !\n");
return 0;
}
TRACE("(%p)\n", physDev); TRACE("(%p)\n", physDev);
wine_tsx11_lock(); wine_tsx11_lock();
glXSwapBuffers(gdi_display, physDev->drawable); pglXSwapBuffers(gdi_display, physDev->drawable);
wine_tsx11_unlock(); wine_tsx11_unlock();
return TRUE; return TRUE;
...@@ -357,22 +417,19 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) { ...@@ -357,22 +417,19 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) {
*/ */
XVisualInfo *X11DRV_setup_opengl_visual( Display *display ) XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
{ {
int err_base, evt_base;
XVisualInfo *visual = NULL; XVisualInfo *visual = NULL;
int dblBuf[]={GLX_RGBA,GLX_DEPTH_SIZE,16,GLX_DOUBLEBUFFER,None};
/* In order to support OpenGL or D3D, we require a double-buffered if (opengl_handle == NULL) return NULL;
* visual */
/* In order to support OpenGL or D3D, we require a double-buffered visual */
wine_tsx11_lock(); wine_tsx11_lock();
if (glXQueryExtension(display, &err_base, &evt_base) == True) visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf);
{
int dblBuf[]={GLX_RGBA,GLX_DEPTH_SIZE,16,GLX_DOUBLEBUFFER,None};
visual = glXChooseVisual(display, DefaultScreen(display), dblBuf);
}
wine_tsx11_unlock(); wine_tsx11_unlock();
return visual; return visual;
} }
#else /* defined(HAVE_OPENGL) */ #else /* no OpenGL includes */
int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
const PIXELFORMATDESCRIPTOR *ppfd) { const PIXELFORMATDESCRIPTOR *ppfd) {
......
...@@ -692,6 +692,9 @@ ...@@ -692,6 +692,9 @@
/* Define to the soname of the libfreetype library. */ /* Define to the soname of the libfreetype library. */
#undef SONAME_LIBFREETYPE #undef SONAME_LIBFREETYPE
/* Define to the soname of the libGL library. */
#undef SONAME_LIBGL
/* Define to the soname of the libX11 library. */ /* Define to the soname of the libX11 library. */
#undef SONAME_LIBX11 #undef SONAME_LIBX11
......
...@@ -226,6 +226,9 @@ extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UIN ...@@ -226,6 +226,9 @@ extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UIN
UINT count, const INT *lpDx); UINT count, const INT *lpDx);
extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev); extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
extern void X11DRV_OpenGL_Init(Display *display);
extern XVisualInfo *X11DRV_setup_opengl_visual(Display *display);
/* exported dib functions for now */ /* exported dib functions for now */
/* Additional info for DIB section objects */ /* Additional info for DIB section objects */
...@@ -440,6 +443,5 @@ extern void X11DRV_sync_window_style( Display *display, WND *win ); ...@@ -440,6 +443,5 @@ extern void X11DRV_sync_window_style( Display *display, WND *win );
extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder ); extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zorder );
extern int X11DRV_sync_client_window_position( Display *display, WND *win ); extern int X11DRV_sync_client_window_position( Display *display, WND *win );
extern void X11DRV_set_wm_hints( Display *display, WND *win ); extern void X11DRV_set_wm_hints( Display *display, WND *win );
extern XVisualInfo *X11DRV_setup_opengl_visual( Display *display );
#endif /* __WINE_X11DRV_H */ #endif /* __WINE_X11DRV_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment