Commit bedf40b5 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Added support for OpenGL.

parent 6f93bb4f
......@@ -86,6 +86,7 @@ LINTS = $(C_SRCS:.c=.ln)
X_DLLS = \
ddraw \
opengl32 \
x11drv
DLLS = \
......
......@@ -126,6 +126,8 @@ AC_SUBST(X_DLLS)
X_DLLS=""
AC_SUBST(XFILES)
XFILES=""
AC_SUBST(OPENGLFILES)
OPENGLFILES=""
AC_SUBST(DGA_SRCS)
DGA_SRCS=""
AC_SUBST(DGA2_SRCS)
......@@ -195,64 +197,58 @@ then
AC_CHECK_LIB(Xxf86vm,XF86VidModeQueryExtension,AC_DEFINE(HAVE_LIBXXF86VM) X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm",,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
fi
dnl Check for the presence of Mesa
dnl Check for the presence of OpenGL
if test $OPENGL = "yes" -o $OPENGL = "normal"
then
AC_CHECK_HEADERS(GL/gl.h GL/glx.h)
if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes"
AC_CHECK_HEADERS(GL/gl.h GL/glx.h GL/glext.h)
if test "$ac_cv_header_GL_gl_h" = "yes" -a "$ac_cv_header_GL_glx_h" = "yes" -a "$ac_cv_header_GL_glext_h" = "yes"
then
dnl Check for some problems due to old Mesa versions
AC_CACHE_CHECK("for up-to-date OpenGL version", wine_cv_mesa_version_OK,
AC_CACHE_CHECK("for up-to-date OpenGL version", wine_cv_opengl_version_OK,
AC_TRY_COMPILE(
[#include <GL/gl.h>],
[GLenum test = GL_UNSIGNED_SHORT_5_6_5;],
[wine_cv_mesa_version_OK="yes"],
[wine_cv_mesa_version_OK="no"]
[wine_cv_opengl_version_OK="yes"],
[wine_cv_opengl_version_OK="no"]
)
)
dnl Check for the thread-safety of the OpenGL library
AC_CACHE_CHECK("for thread-safe OpenGL version",
wine_cv_mesa_version_threadsafe,
wine_cv_opengl_version_threadsafe,
[saved_libs=$LIBS
LIBS="$X_LIBS -lGL"
AC_TRY_LINK([],[pthread_getspecific();],
[wine_cv_mesa_version_threadsafe="yes"],
[wine_cv_mesa_version_threadsafe="no"])
[wine_cv_opengl_version_threadsafe="yes"],
[wine_cv_opengl_version_threadsafe="no"])
LIBS=$saved_libs]
)
if test "$wine_cv_mesa_version_OK" = "yes" -a \( "$wine_cv_mesa_version_threadsafe" = "no" -o $OPENGL = "yes" \)
if test "$wine_cv_opengl_version_OK" = "yes" -a \( "$wine_cv_opengl_version_threadsafe" = "no" -o $OPENGL = "yes" \)
then
dnl Check for the presense of the library
AC_CHECK_LIB(GL,glXCreateContext,
AC_DEFINE(HAVE_LIBMESAGL)
X_PRE_LIBS="$X_PRE_LIBS -lGL"
MESA_SRCS='$(MESA_SRCS)'
,,
$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
if test "$ac_cv_lib_GL_glXCreateContext" = "no"
if test $ac_cv_lib_GL_glXCreateContext = "yes"
then
AC_CHECK_LIB(MesaGL,glXCreateContext,
AC_DEFINE(HAVE_LIBMESAGL)
X_PRE_LIBS="$X_PRE_LIBS -lMesaGL"
MESA_SRCS='$(MESA_SRCS)'
,,
$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
fi
dnl Check for the Color Table and Paletted Texture extensions
AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
AC_TRY_COMPILE([#include <GL/gl.h>],
[GLenum test = GL_COLOR_INDEX8_EXT;],
[AC_DEFINE(HAVE_GL_COLOR_TABLE)],))
if test "$ac_cv_lib_GL_glXCreateContext" = "no"
then
AC_CHECK_LIB(MesaGL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
else
AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
dnl Check for the Color Table and Paletted Texture extensions
AC_CACHE_CHECK("for the OpenGL Color Index extension",dummy,
AC_TRY_COMPILE([#include <GL/gl.h>],
[GLenum test = GL_COLOR_INDEX8_EXT;],
[AC_DEFINE(HAVE_GL_COLOR_TABLE)],))
AC_CHECK_LIB(GL,glColorTableEXT,AC_DEFINE(HAVE_GL_PALETTED_TEXTURE),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
AC_CHECK_LIB(GL,glXGetProcAddressARB,AC_DEFINE(HAVE_GLX_GETPROCADDRESS),,$X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS)
if test $ac_cv_lib_GL_glXGetProcAddressARB = "yes"
then
AC_DEFINE(HAVE_OPENGL)
OPENGLFILES='$(OPENGLFILES)'
fi
fi
fi
fi
......@@ -994,6 +990,7 @@ dlls/olecli/Makefile
dlls/oledlg/Makefile
dlls/olepro32/Makefile
dlls/olesvr/Makefile
dlls/opengl32/Makefile
dlls/psapi/Makefile
dlls/rasapi32/Makefile
dlls/richedit/Makefile
......@@ -1108,14 +1105,14 @@ then
echo "*** reentrant version of libc."
fi
if test "$wine_cv_mesa_version_OK" = "no"
if test "$wine_cv_opengl_version_OK" = "no"
then
echo
echo "*** Warning: old Mesa headers detected. Wine will be built without Direct3D"
echo "*** support. Consider upgrading your Mesa libraries (http://www.mesa3d.org/)."
fi
if test "$wine_cv_mesa_version_threadsafe" = "yes" -a $OPENGL = "normal"
if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "normal"
then
echo
echo "*** Warning: the OpenGL version you have installed relies on libpthread for"
......@@ -1124,7 +1121,7 @@ then
echo "*** start configure with '--enable-opengl' to force OpenGL support."
fi
if test "$wine_cv_mesa_version_threadsafe" = "yes" -a $OPENGL = "yes"
if test "$wine_cv_opengl_version_threadsafe" = "yes" -a $OPENGL = "yes"
then
echo
echo "*** Warning: you explicitely linked in a thread-safe OpenGL version. If you"
......
......@@ -3,8 +3,12 @@ TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
OPENGLFILES= \
opengl32/libopengl32.@LIBEXT@
XFILES = \
ddraw/libddraw.@LIBEXT@ \
@OPENGLFILES@ \
x11drv/libx11drv.@LIBEXT@
DLLFILES = \
......@@ -118,6 +122,7 @@ SUBDIRS = \
oledlg \
olepro32 \
olesvr \
opengl32 \
psapi \
rasapi32 \
richedit \
......@@ -246,6 +251,9 @@ libolepro32.@LIBEXT@: olepro32/libolepro32.@LIBEXT@
libolesvr32.@LIBEXT@ libolesvr.@LIBEXT@: olesvr/libolesvr32.@LIBEXT@
$(RM) $@ && $(LN_S) olesvr/libolesvr32.@LIBEXT@ $@
libopengl32.@LIBEXT@: opengl32/libopengl32.@LIBEXT@
$(RM) $@ && $(LN_S) opengl32/libopengl32.@LIBEXT@ $@
libpsapi.@LIBEXT@: psapi/libpsapi.@LIBEXT@
$(RM) $@ && $(LN_S) psapi/libpsapi.@LIBEXT@ $@
......@@ -325,6 +333,7 @@ msvideo/libmsvfw32.so: libwinmm.so
oleaut32/liboleaut32.so: libole32.so libcomctl32.so
olecli/libolecli32.so: libolesvr32.so libole32.so
olepro32/libolepro32.so: liboleaut32.so libole32.so
opengl32/libopengl32.so: libx11drv.so libgdi32.so
shell32/libshell32.so: libole32.so
urlmon/liburlmon.so: libole32.so
version/libversion.so: liblz32.so
......
......@@ -14,10 +14,14 @@
#include "x11drv.h"
#include "d3d_private.h"
#include "mesa_private.h"
DEFAULT_DEBUG_CHANNEL(ddraw)
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
#define D3DVPRIVATE(x) mesa_d3dv_private*dvpriv=((mesa_d3dv_private*)x->private)
#define D3DLPRIVATE(x) mesa_d3dl_private*dlpriv=((mesa_d3dl_private*)x->private)
static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable;
......@@ -44,6 +48,7 @@ LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2)
IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1;
ICOM_VTBL(vp) = &viewport2_vtable;
vp->d3d.d3d2 = d3d2;
......@@ -54,7 +59,7 @@ LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2)
vp->lights = NULL;
vp->nextlight = GL_LIGHT0;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT2)vp;
}
......@@ -64,6 +69,7 @@ LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1;
ICOM_VTBL(vp) = &viewport2_vtable;
vp->d3d.d3d1 = d3d1;
......@@ -74,7 +80,7 @@ LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
vp->lights = NULL;
vp->nextlight = GL_LIGHT0;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT) vp;
}
......@@ -83,7 +89,7 @@ LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
* IDirect3DViewport2 methods
*/
static HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(LPDIRECT3DVIEWPORT2 iface,
REFIID riid,
LPVOID* ppvObj)
{
......@@ -96,7 +102,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(LPDIRECT3DVIEWPORT2
static ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
......@@ -106,7 +112,7 @@ static ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
static ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
......@@ -120,7 +126,7 @@ static ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
}
/*** IDirect3DViewport methods ***/
static HRESULT WINAPI IDirect3DViewport2Impl_Initialize(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_Initialize(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3D d3d)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -129,7 +135,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_Initialize(LPDIRECT3DVIEWPORT2 ifac
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT lpvp)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -143,7 +149,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(LPDIRECT3DVIEWPORT2 ifa
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT lpvp)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -167,7 +173,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 ifa
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(LPDIRECT3DVIEWPORT2 iface,
DWORD dwVertexCount,
LPD3DTRANSFORMDATA lpData,
DWORD dwFlags,
......@@ -180,7 +186,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(LPDIRECT3DVIEWPOR
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_LightElements(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_LightElements(LPDIRECT3DVIEWPORT2 iface,
DWORD dwElementCount,
LPD3DLIGHTDATA lpData)
{
......@@ -190,7 +196,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_LightElements(LPDIRECT3DVIEWPORT2 i
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(LPDIRECT3DVIEWPORT2 iface,
D3DMATERIALHANDLE hMat)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -199,7 +205,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(LPDIRECT3DVIEWPORT2 i
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(LPDIRECT3DVIEWPORT2 iface,
LPD3DMATERIALHANDLE lphMat,
LPBOOL lpValid)
{
......@@ -209,7 +215,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(LPDIRECT3DVIEWPORT2 i
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
LPDIRECTDRAWSURFACE lpDDSurface)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -218,7 +224,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(LPDIRECT3DVIEWPO
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
LPDIRECTDRAWSURFACE* lplpDDSurface,
LPBOOL lpValid)
{
......@@ -228,7 +234,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(LPDIRECT3DVIEWPO
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_Clear(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_Clear(LPDIRECT3DVIEWPORT2 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags)
......@@ -257,7 +263,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_Clear(LPDIRECT3DVIEWPORT2 iface,
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -270,6 +276,9 @@ static HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
/* If active, activate the light */
if (This->device.active_device1 != NULL) {
D3DVPRIVATE(This);
D3DLPRIVATE(ilpLight);
/* Get the rendering context */
if (This->use_d3d2)
This->device.active_device2->set_context(This->device.active_device2);
......@@ -277,14 +286,14 @@ static HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
This->device.active_device1->set_context(This->device.active_device1);
/* Activate the light */
ilpLight->light_num = This->nextlight++;
dlpriv->light_num = dvpriv->nextlight++;
ilpLight->activate(ilpLight);
}
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -293,7 +302,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(LPDIRECT3DVIEWPORT2 ifa
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_NextLight(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_NextLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight,
LPDIRECT3DLIGHT* lplpLight,
DWORD dwFlags)
......@@ -305,7 +314,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_NextLight(LPDIRECT3DVIEWPORT2 iface
}
/*** IDirect3DViewport2 methods ***/
static HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT2 lpViewport2)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -319,7 +328,7 @@ static HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(LPDIRECT3DVIEWPORT2 if
return DD_OK;
}
static HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(LPDIRECT3DVIEWPORT2 iface,
HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT2 lpViewport2)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
......@@ -372,7 +381,7 @@ static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable =
IDirect3DViewport2Impl_SetViewport2
};
#else /* HAVE_MESAGL */
#else /* HAVE_OPENGL */
LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1) {
ERR("Should not be called...\n");
......@@ -384,4 +393,4 @@ LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2) {
return NULL;
}
#endif /* HAVE_MESAGL */
#endif /* HAVE_OPENGL */
......@@ -345,7 +345,7 @@ static void fill_caps(LPDDCAPS caps) {
DDSCAPS_FRONTBUFFER | DDSCAPS_LOCALVIDMEM | DDSCAPS_NONLOCALVIDMEM | DDSCAPS_OFFSCREENPLAIN |
/*DDSCAPS_OVERLAY |*/ DDSCAPS_PALETTE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY |
DDSCAPS_VIDEOMEMORY | DDSCAPS_VISIBLE;
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
caps->dwCaps |= DDCAPS_3D | DDCAPS_ZBLTS;
caps->dwCaps2 |= DDCAPS2_NO2DDURING3DSCENE;
caps->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP | DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER;
......
......@@ -553,7 +553,7 @@ static void fill_caps(LPDDCAPS caps) {
DDSCAPS_FRONTBUFFER | DDSCAPS_LOCALVIDMEM | DDSCAPS_NONLOCALVIDMEM | DDSCAPS_OFFSCREENPLAIN |
/*DDSCAPS_OVERLAY |*/ DDSCAPS_PALETTE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY |
DDSCAPS_VIDEOMEMORY | DDSCAPS_VISIBLE;
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
caps->dwCaps |= DDCAPS_3D | DDCAPS_ZBLTS;
caps->dwCaps2 |= DDCAPS2_NO2DDURING3DSCENE;
caps->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP | DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER;
......@@ -650,7 +650,7 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
return S_OK;
}
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
if ( IsEqualGUID( &IID_IDirect3D, refiid ) )
return create_direct3d(obj,This);
if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
......
......@@ -17,7 +17,7 @@
#include "debugtools.h"
#include "x11_private.h"
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
/* for d3d texture stuff */
# include "mesa_private.h"
#endif
......@@ -59,7 +59,7 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_QueryInterface(
TRACE(" Creating IDirectDrawSurface interface (%p)\n", *obj);
return S_OK;
}
#ifdef HAVE_MESAGL
#ifdef HAVE_OPENGL
if ( IsEqualGUID( &IID_IDirect3DTexture2, refiid ) ) {
/* Texture interface */
*obj = d3dtexture2_create(This);
......@@ -74,7 +74,7 @@ HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_QueryInterface(
TRACE(" Creating IDirect3DTexture interface (%p)\n", *obj);
return S_OK;
}
#endif /* HAVE_MESAGL */
#endif /* HAVE_OPENGL */
FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE;
}
......
......@@ -40,14 +40,6 @@ typedef struct mesa_d3dv_private
GLenum nextlight;
} mesa_d3dv_private;
#ifdef USE_OSMESA
# define LEAVE_GL() ;
# define ENTER_GL() ;
#else
# define LEAVE_GL() LeaveCriticalSection( &X11DRV_CritSection )
# define ENTER_GL() EnterCriticalSection( &X11DRV_CritSection )
#endif
/* Matrix copy WITH transposition */
#define conv_mat2(mat,gl_mat) \
{ \
......
*.spec.c
Makefile
libopengl32.so.1.0
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = opengl32
SOVERSION = 1.0
IMPORTS = \
x11drv \
gdi32
SPEC_SRCS = opengl32.spec
C_SRCS = \
wgl.c \
opengl_norm.c \
opengl_ext.c
@MAKE_DLL_RULES@
### Dependencies:
#!/usr/bin/perl -w
print "
/* Auto-generated file... Do not edit ! */
#include \"config.h\"
#include \"wine_gl.h\"
#include \"opengl_ext.h\"
";
#
# First, create a hash-table with all function defined in opengl32.spec
#
%opengl_std = ();
open(SPEC, "dlls/opengl32/opengl32.spec") || die "Could not open spec file";
foreach (<SPEC>) {
if (($_ =~ /@/) && ($_ !~ /wgl/)) {
($name) = ($_ =~ /stdcall (\w*)\(/);
$opengl_std{$name} = 1;
}
}
close(SPEC);
#
# Now, the functions from the include file
#
%opengl_ext = ();
open(INC, "/home/ulmer/OpenGL/glext_proto.h") || die "Could not open GL/glext.h";
while ($line = <INC>) {
if ($line =~ /extern.*APIENTRY/) {
# Start of a function declaration
($ret, $name, $args) = ($line =~ /extern (\w*) APIENTRY *(\w*) *\((.*)\)/);
# Now, remove all function already defined in opengl32.spec
if ($opengl_std{$name}) {
# Do nothing as we already have these functions
} else {
# Now, get the typedef name (the line after)
($typedef_name) = (<INC> =~ /\(APIENTRY *\* *(\w*) *\)/);
# After that, parse the arguments
@args = split /,/, $args;
$args_ref = [];
foreach (@args) {
push @$args_ref, $_;
}
$opengl_ext{$name} = [ $ret, $typedef_name, $args_ref ];
}
}
}
close(INC);
#
# After that, generate the file itself....
#
print "/* These will be filled during a wglGetProcAddress call */\n";
$num = 0;
foreach $name (sort keys(%opengl_ext)) {
$ref = $opengl_ext{$name};
$arg_ref = $$ref[2];
@larg = @$arg_ref;
print "$$ref[0] (*func_$name)(";
$farg = shift @larg;
print "$farg";
foreach (@larg) {
print ", $_";
}
print ") = (void *) 0xdeadbeef;\n";
$num++;
}
print "\n";
print "/* The function prototypes */\n";
foreach $name (sort keys(%opengl_ext)) {
$ref = $opengl_ext{$name};
$arg_ref = $$ref[2];
@larg = @$arg_ref;
print "$$ref[0] WINAPI wine_$name(";
$farg = shift @larg;
print "$farg";
foreach (@larg) {
print ", $_";
}
print ") ;\n";
}
print "\n";
print "/* The table giving the correspondance between names and functions */\n";
print "int extension_registry_size = $num;\n";
print "OpenGL_extension extension_registry[] = {\n";
foreach $name (sort keys(%opengl_ext)) {
$num--;
print " { \"$name\", (void *) wine_$name, (void **) (&func_$name) }";
if ($num) {
print ",";
}
print "\n";
}
print "};\n";
print "\n";
print "/* Now, the function declarations */\n";
foreach $name (sort keys(%opengl_ext)) {
$ref = $opengl_ext{$name};
$arg_ref = $$ref[2];
print "$$ref[0] WINAPI wine_$name(";
$farg = shift @$arg_ref;
$num = 0;
if ($farg !~ /void/) {
print "$farg arg_0";
$num++;
foreach (@$arg_ref) {
print ", $_ arg_$num";
$num++;
}
}
print ") {\n";
if ($$ref[0] !~ /void/) {
print " $$ref[0] ret;\n"
}
print " ENTER_GL();\n";
print " ";
if ($$ref[0] !~ /void/) {
print " ret = ";
}
print "func_$name(";
if ($num > 0) {
print "arg_0";
for ($i = 1; $i < $num; $i++) {
print ", arg_$i";
}
}
print ");\n";
print " LEAVE_GL();\n";
if ($$ref[0] !~ /void/) {
print " return ret;\n"
}
print "}\n\n";
}
#!/usr/bin/perl -w
print "
/* Auto-generated file... Do not edit ! */
#include \"config.h\"
#include \"wine_gl.h\"
";
#
# Now, the functions from the include file
#
open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h";
while ($line = <INC>) {
if ($line =~ /GLAPI.*GLAPIENTRY/) {
# Start of a function declaration
($ret, $name, $args) = ($line =~ /GLAPI (.*) GLAPIENTRY *(.*)\((.*)/);
# Remove all extensions except the multitexture one (see OpenGL ABI)
if (($name !~ /(MESA|PGI|ARB|EXT)/) ||
($name =~ /MultiTexCoord/) ||
($name =~ /ActiveTextureARB/)) {
print "$ret WINAPI wine_$name(";
@rargs = ();
@names = ();
# Now, get the parameters
while (1) {
@args = split /,|\)/, $args;
foreach (@args) {
if ($_ =~ /[a-z,A-Z]/) {
($a) = ($_ =~ /^\s*(.*)\s*$/);
if ($a =~ /\*\*/) {
($var) = ($a =~ /\*\*(\w*)/);
} elsif ($a =~ /\*/) {
($var) = ($a =~ /\*(\w*)/);
} else {
($var) = ($a =~ /\s(\w*)/);
}
@rargs = (@rargs, $a);
if ($var !~ /void/) {
@names = (@names, $var);
}
}
}
if ($args !~ /\)/) {
$args = <INC>;
} else {
last;
}
}
print shift @rargs;
foreach (@rargs) {
print ", $_";
}
print ") {\n";
if ($ret !~ /void/) {
print " $ret ret;\n";
}
print " ENTER_GL();\n";
if ($ret !~ /void/) {
print " ret = ";
} else {
print " ";
}
print "$name(";
$farg = shift @names;
if ($farg) {
print "$farg";
foreach (@names) {
print ", $_";
}
}
print ");\n";
print " LEAVE_GL();\n";
if ($ret !~ /void/) {
print " return ret;\n";
}
print "}\n\n";
}
}
}
close(INC);
#!/usr/bin/perl -w
#
# First, the basics and the wgl functions
#
print "
name opengl32
type win32
@ stdcall wglCreateContext(long) wglCreateContext
@ stdcall wglCreateLayerContext(long long) wglCreateLayerContext
@ stdcall wglCopyContext(long long long) wglCopyContext
@ stdcall wglDeleteContext(long) wglDeleteContext
@ stdcall wglDescribeLayerPlane(long long long long ptr) wglDescribeLayerPlane
@ stdcall wglGetCurrentContext() wglGetCurrentContext
@ stdcall wglGetCurrentDC() wglGetCurrentDC
@ stdcall wglGetLayerPaletteEntries(long long long long ptr) wglGetLayerPaletteEntries
@ stdcall wglGetProcAddress(str) wglGetProcAddress
@ stdcall wglMakeCurrent(long long) wglMakeCurrent
@ stdcall wglRealizeLayerPalette(long long long) wglRealizeLayerPalette
@ stdcall wglSetLayerPaletteEntries(long long long long ptr) wglSetLayerPaletteEntries
@ stdcall wglShareLists(long long) wglShareLists
@ stdcall wglSwapLayerBuffers(long long) wglSwapLayerBuffers
@ stdcall wglUseFontBitmaps(long long long long) wglUseFontBitmaps
@ stdcall wglUseFontOutlines(long long long long long long long) wglUseFontOutlines
@ stub glGetLevelParameterfv
@ stub glGetLevelParameteriv
@ stub wglUseFontBitmapsA
@ stub wglUseFontOutlinesA
@ forward wglChoosePixelFormat GDI32.ChoosePixelFormat
@ forward wglDescribePixelFormat GDI32.DescribePixelFormat
@ forward wglGetPixelFormat GDI32.GetPixelFormat
@ forward wglSetPixelFormat GDI32.SetPixelFormat
@ forward wglSwapBuffers GDI32.SwapBuffers
";
#
# Now, the functions from the include file
#
open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h";
while ($line = <INC>) {
if ($line =~ /GLAPI.*GLAPIENTRY/) {
# Start of a function declaration
($name, $args) = ($line =~ /GLAPIENTRY *(.*)\((.*)/);
# Remove all extensions except the multitexture one (see OpenGL ABI)
if (($name !~ /(MESA|PGI|ARB|EXT)/) ||
($name =~ /MultiTexCoord/) ||
($name =~ /ActiveTextureARB/)) {
print "@ stdcall $name(";
# Now, get the parameters
while (1) {
@args = split /,/, $args;
foreach (@args) {
if ($_ =~ /\)/) {
($_) = ($_ =~ /(.*)\)/);
}
if ($_ =~ /\*/) {
print "ptr ";
} elsif ($_ =~ /[a-zA-Z]/) {
($type) = ($_ =~ /^ *(.*) +.*/);
if ($type =~ /double/) {
print "double ";
} elsif ($type !~ /void/) {
print "long ";
}
}
}
if ($args !~ /\)/) {
$args = <INC>;
} else {
last;
}
}
print ") wine_$name\n";
}
}
}
close(INC);
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Typedefs for extensions loading
Copyright (c) 2000 Lionel Ulmer
*/
#ifndef __DLLS_OPENGL32_OPENGL_EXT_H
#define __DLLS_OPENGL32_OPENGL_EXT_H
typedef struct {
char *name; /* name of the extension */
void *func; /* pointer to the Wine function for this extension */
void **func_ptr; /* where to store the value of glXGetProcAddressARB */
} OpenGL_extension;
extern OpenGL_extension extension_registry[];
extern int extension_registry_size;
#endif /* __DLLS_OPENGL32_OPENGL_EXT_H */
/* Window-specific OpenGL functions implementation.
Copyright (c) 1999 Lionel Ulmer
*/
#include <stdlib.h>
#include "config.h"
#include "debugtools.h"
#include "gdi.h"
#include "dc.h"
#include "windef.h"
#include "wine_gl.h"
#include "x11drv.h"
#include "wgl.h"
#include "opengl_ext.h"
DEFAULT_DEBUG_CHANNEL(opengl)
HGLRC WINAPI wglCreateContext(HDC hdc) {
DC * dc = DC_GetDCPtr( hdc );
X11DRV_PDEVICE *physDev;
XVisualInfo *vis;
GLXContext ret;
TRACE("(%08x)\n", hdc);
if (dc == NULL) {
ERR("Null DC !!!\n");
return NULL;
}
physDev = (X11DRV_PDEVICE *)dc->physDev;
/* First, get the visual for the choosen pixel format */
vis = physDev->visuals[physDev->current_pf - 1];
if (vis == NULL) {
ERR("NULL visual !!!\n");
/* Need to set errors here */
return NULL;
}
ENTER_GL();
ret = glXCreateContext(display, vis, NULL, True);
LEAVE_GL();
return (HGLRC) ret;
}
HGLRC WINAPI wglCreateLayerContext(HDC hdc,
int iLayerPlane) {
FIXME("(%08x,%d): stub !\n", hdc, iLayerPlane);
return NULL;
}
BOOL WINAPI wglCopyContext(HGLRC hglrcSrc,
HGLRC hglrcDst,
UINT mask) {
FIXME("(%p,%p,%d)\n", hglrcSrc, hglrcDst, mask);
return FALSE;
}
BOOL WINAPI wglDeleteContext(HGLRC hglrc) {
FIXME("(%p): stub !\n", hglrc);
return FALSE;
}
BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
int iPixelFormat,
int iLayerPlane,
UINT nBytes,
LPLAYERPLANEDESCRIPTOR plpd) {
FIXME("(%08x,%d,%d,%d,%p)\n", hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
return FALSE;
}
HGLRC WINAPI wglGetCurrentContext(void) {
GLXContext ret;
TRACE("()\n");
ENTER_GL();
ret = glXGetCurrentContext();
LEAVE_GL();
TRACE(" returning %p\n", ret);
return ret;
}
HDC WINAPI wglGetCurrentDC(void) {
GLXContext ret;
ENTER_GL();
ret = glXGetCurrentContext();
LEAVE_GL();
if (ret == NULL) {
TRACE("() no current context -> returning NULL\n");
return 0;
} else {
FIXME("()\n");
return 0;
}
}
int WINAPI wglGetLayerPaletteEntries(HDC hdc,
int iLayerPlane,
int iStart,
int cEntries,
const COLORREF *pcr) {
FIXME("(): stub !\n");
return 0;
}
static int compar(const void *elt_a, const void *elt_b) {
return strcmp(((OpenGL_extension *) elt_a)->name,
((OpenGL_extension *) elt_b)->name);
}
void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
void *local_func;
static HMODULE hm = 0;
TRACE("(%s)\n", lpszProc);
if (hm == 0)
hm = GetModuleHandleA("opengl32");
/* First, look if it's not already defined in the 'standard' OpenGL functions */
if ((local_func = GetProcAddress(hm, lpszProc)) != NULL) {
TRACE("Found function in 'standard' OpenGL functions (%p)\n", local_func);
return local_func;
}
/* After that, look at the extensions defined in the Linux OpenGL library */
if ((local_func = glXGetProcAddressARB(lpszProc)) == NULL) {
char buf[256];
void *ret = NULL;
/* Remove the 3 last letters (EXT, ARB, ...).
I know that some extensions have more than 3 letters (MESA, NV,
INTEL, ...), but this is only a stop-gap measure to fix buggy
OpenGL drivers (moreover, it is only useful for old 1.0 apps
that query the glBindTextureEXT extension).
*/
strncpy(buf, lpszProc, strlen(lpszProc) - 3);
buf[strlen(lpszProc) - 3] = '\0';
TRACE("Extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
ret = GetProcAddress(hm, buf);
if (ret != NULL) {
TRACE("Found function in main OpenGL library (%p) !\n", ret);
}
return ret;
} else {
OpenGL_extension ext;
OpenGL_extension *ret;
ext.name = (char *) lpszProc;
ret = (OpenGL_extension *) bsearch(&ext, extension_registry,
extension_registry_size, sizeof(OpenGL_extension), compar);
if (ret != NULL) {
TRACE("Returning function (%p)\n", ret->func);
*(ret->func_ptr) = local_func;
return ret->func;
} else {
ERR("Extension defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n");
return NULL;
}
}
}
BOOL WINAPI wglMakeCurrent(HDC hdc,
HGLRC hglrc) {
DC * dc = DC_GetDCPtr( hdc );
X11DRV_PDEVICE *physDev;
BOOL ret;
TRACE("(%08x,%p)\n", hdc, hglrc);
if (dc == NULL) {
ERR("Null DC !!!\n");
return FALSE;
}
physDev =(X11DRV_PDEVICE *)dc->physDev;
ENTER_GL();
ret = glXMakeCurrent(display, physDev->drawable, (GLXContext) hglrc);
LEAVE_GL();
return ret;
}
BOOL WINAPI wglRealizeLayerPalette(HDC hdc,
int iLayerPlane,
BOOL bRealize) {
FIXME("()\n");
return FALSE;
}
int WINAPI wglSetLayerPaletteEntries(HDC hdc,
int iLayerPlane,
int iStart,
int cEntries,
const COLORREF *pcr) {
FIXME("(): stub !\n");
return 0;
}
BOOL WINAPI wglShareLists(HGLRC hglrc1,
HGLRC hglrc2) {
FIXME("(): stub !\n");
return FALSE;
}
BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
UINT fuPlanes) {
FIXME("(): stub !\n");
return FALSE;
}
BOOL WINAPI wglUseFontBitmaps(HDC hdc,
DWORD first,
DWORD count,
DWORD listBase) {
FIXME("(): stub !\n");
return FALSE;
}
BOOL WINAPI wglUseFontOutlines(HDC hdc,
DWORD first,
DWORD count,
DWORD listBase,
FLOAT deviation,
FLOAT extrusion,
int format,
LPGLYPHMETRICSFLOAT lpgmf) {
FIXME("(): stub !\n");
return FALSE;
}
/* This is for brain-dead applications that use OpenGL functions before even
creating a rendering context.... */
DECL_GLOBAL_CONSTRUCTOR(OpenGL_create_default_context) {
int num;
XVisualInfo template;
XVisualInfo *vis;
GLXContext cx;
ENTER_GL();
template.visualid = XVisualIDFromVisual(visual);
vis = XGetVisualInfo(display, VisualIDMask, &template, &num);
cx=glXCreateContext(display, vis, 0, GL_TRUE);
glXMakeCurrent(display, X11DRV_GetXRootWindow(), cx);
LEAVE_GL();
}
/* Window-specific OpenGL functions implementation.
Copyright (c) 2000 Lionel Ulmer
*/
#ifndef __DLLS_OPENGL32_WGL_H
#define __DLLS_OPENGL32_WGL_H
#include "gdi.h"
typedef void *HGLRC;
typedef struct {
WORD nSize;
WORD nVersion;
DWORD dwFlags;
BYTE iPixelType;
BYTE cColorBits;
BYTE cRedBits;
BYTE cRedShift;
BYTE cGreenBits;
BYTE cGreenShift;
BYTE cBlueBits;
BYTE cBlueShift;
BYTE cAlphaBits;
BYTE cAlphaShift;
BYTE cAccumBits;
BYTE cAccumRedBits;
BYTE cAccumGreenBits;
BYTE cAccumBlueBits;
BYTE cAccumAlphaBits;
BYTE cDepthBits;
BYTE cStencilBits;
BYTE cAuxBuffers;
BYTE iLayerPlane;
BYTE bReserved;
COLORREF crTransparent;
} LAYERPLANEDESCRIPTOR;
typedef LAYERPLANEDESCRIPTOR* LPLAYERPLANEDESCRIPTOR;
typedef struct {
FLOAT x;
FLOAT y;
} POINTFLOAT;
typedef struct {
FLOAT gmfBlackBoxX;
FLOAT gmfBlackBoxY;
POINTFLOAT gmfptGlyphOrigin;
FLOAT gmfCellIncX;
FLOAT gmfCellIncY;
} GLYPHMETRICSFLOAT;
typedef GLYPHMETRICSFLOAT *LPGLYPHMETRICSFLOAT;
HGLRC WINAPI wglCreateContext(HDC hdc) ;
HGLRC WINAPI wglCreateLayerContext(HDC hdc,
int iLayerPlane) ;
BOOL WINAPI wglCopyContext(HGLRC hglrcSrc,
HGLRC hglrcDst,
UINT mask) ;
BOOL WINAPI wglDeleteContext(HGLRC hglrc) ;
BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
int iPixelFormat,
int iLayerPlane,
UINT nBytes,
LPLAYERPLANEDESCRIPTOR plpd) ;
HGLRC WINAPI wglGetCurrentContext(void) ;
HDC WINAPI wglGetCurrentDC(void) ;
int WINAPI wglGetLayerPaletteEntries(HDC hdc,
int iLayerPlane,
int iStart,
int cEntries,
const COLORREF *pcr) ;
void * WINAPI wglGetProcAddress(LPCSTR lpszProc) ;
BOOL WINAPI wglMakeCurrent(HDC hdc,
HGLRC hglrc) ;
BOOL WINAPI wglRealizeLayerPalette(HDC hdc,
int iLayerPlane,
BOOL bRealize) ;
int WINAPI wglSetLayerPaletteEntries(HDC hdc,
int iLayerPlane,
int iStart,
int cEntries,
const COLORREF *pcr) ;
BOOL WINAPI wglShareLists(HGLRC hglrc1,
HGLRC hglrc2) ;
BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
UINT fuPlanes);
BOOL WINAPI wglUseFontBitmaps(HDC hdc,
DWORD first,
DWORD count,
DWORD listBase) ;
BOOL WINAPI wglUseFontOutlines(HDC hdc,
DWORD first,
DWORD count,
DWORD listBase,
FLOAT deviation,
FLOAT extrusion,
int format,
LPGLYPHMETRICSFLOAT lpgmf) ;
#endif /* __DLLS_OPENGL32_WGL_H */
......@@ -29,6 +29,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_BeginPath, /* pBeginPath */
NULL, /* pBitBlt */
NULL, /* pBitmapBits */
NULL, /* pChoosePixelFormat */
EMFDRV_Chord, /* pChord */
EMFDRV_CloseFigure, /* pCloseFigure */
NULL, /* pCreateBitmap */
......@@ -37,6 +38,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pCreateDIBSection16 */
NULL, /* no implementation */ /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
EMFDRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
......@@ -55,6 +57,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */
NULL, /* no implementation */ /* pGetPixel */
NULL, /* pGetPixelFormat */
NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */
EMFDRV_IntersectClipRect, /* pIntersectClipRect */
......@@ -94,6 +97,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_SetMapMode, /* pSetMapMode */
EMFDRV_SetMapperFlags, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPixelFormat */
EMFDRV_SetPolyFillMode, /* pSetPolyFillMode */
EMFDRV_SetROP2, /* pSetROP2 */
NULL, /* pSetRelAbs */
......@@ -112,6 +116,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pStretchDIBits */
EMFDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
EMFDRV_StrokePath, /* pStrokePath */
NULL, /* pSwapBuffers */
EMFDRV_WidenPath /* pWiddenPath */
};
......
......@@ -27,6 +27,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_BeginPath, /* pBeginPath */
MFDRV_BitBlt, /* pBitBlt */
NULL, /* pBitmapBits */
NULL, /* pChoosePixelFormat */
MFDRV_Chord, /* pChord */
MFDRV_CloseFigure, /* pCloseFigure */
NULL, /* pCreateBitmap */
......@@ -35,6 +36,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pCreateDIBSection16 */
NULL, /* no implementation */ /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
MFDRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
......@@ -53,6 +55,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */
NULL, /* no implementation */ /* pGetPixel */
NULL, /* pGetPixelFormat */
NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */
MFDRV_IntersectClipRect, /* pIntersectClipRect */
......@@ -92,6 +95,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SetMapMode, /* pSetMapMode */
MFDRV_SetMapperFlags, /* pSetMapperFlags */
MFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
MFDRV_SetPolyFillMode, /* pSetPolyFillMode */
MFDRV_SetROP2, /* pSetROP2 */
MFDRV_SetRelAbs, /* pSetRelAbs */
......@@ -110,6 +114,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_StretchDIBits, /* pStretchDIBits */
MFDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
MFDRV_StrokePath, /* pStrokePath */
NULL, /* pSwapBuffers */
MFDRV_WidenPath /* pWidenPath */
};
......
......@@ -404,8 +404,17 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
*/
INT WINAPI ChoosePixelFormat( HDC hdc, const LPPIXELFORMATDESCRIPTOR ppfd )
{
FIXME("(%d,%p): stub\n",hdc,ppfd);
return 1;
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%08x,%p)\n",hdc,ppfd);
if (dc == NULL) return 0;
if (dc->funcs->pChoosePixelFormat == NULL) {
FIXME(" :stub\n");
return 0;
}
return dc->funcs->pChoosePixelFormat(dc,ppfd);
}
......@@ -423,8 +432,16 @@ INT WINAPI ChoosePixelFormat( HDC hdc, const LPPIXELFORMATDESCRIPTOR ppfd )
BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd)
{
FIXME("(%d,%d,%p): stub\n",hdc,iPixelFormat,ppfd);
return TRUE;
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%d,%d,%p)\n",hdc,iPixelFormat,ppfd);
if (dc == NULL) return 0;
if (dc->funcs->pSetPixelFormat == NULL) {
FIXME(" :stub\n");
return 0;
}
return dc->funcs->pSetPixelFormat(dc,iPixelFormat,ppfd);
}
......@@ -441,8 +458,16 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
*/
INT WINAPI GetPixelFormat( HDC hdc )
{
FIXME("(%d): stub\n",hdc);
return 1;
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%08x)\n",hdc);
if (dc == NULL) return 0;
if (dc->funcs->pGetPixelFormat == NULL) {
FIXME(" :stub\n");
return 0;
}
return dc->funcs->pGetPixelFormat(dc);
}
......@@ -463,10 +488,18 @@ INT WINAPI GetPixelFormat( HDC hdc )
INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd )
{
FIXME("(%d,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd);
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%08x,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd);
if (dc == NULL) return 0;
if (dc->funcs->pDescribePixelFormat == NULL) {
FIXME(" :stub\n");
ppfd->nSize = nBytes;
ppfd->nVersion = 1;
return 3;
}
return dc->funcs->pDescribePixelFormat(dc,iPixelFormat,nBytes,ppfd);
}
......@@ -481,8 +514,16 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
*/
BOOL WINAPI SwapBuffers( HDC hdc )
{
FIXME("(%d): stub\n",hdc);
DC * dc = DC_GetDCPtr( hdc );
TRACE("(%08x)\n",hdc);
if (dc == NULL) return 0;
if (dc->funcs->pSwapBuffers == NULL) {
FIXME(" :stub\n");
return TRUE;
}
return dc->funcs->pSwapBuffers(dc);
}
......
......@@ -31,6 +31,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pBeginPath */
NULL, /* pBitBlt */
NULL, /* pBitmapBits */
NULL, /* pChoosePixelFormat */
PSDRV_Chord, /* pChord */
NULL, /* pCloseFigure */
NULL, /* pCreateBitmap */
......@@ -39,6 +40,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pCreateDIBSection16 */
PSDRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
PSDRV_DeviceCapabilities, /* pDeviceCapabilities */
PSDRV_Ellipse, /* pEllipse */
PSDRV_EndDoc, /* pEndDoc */
......@@ -57,6 +59,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
PSDRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */
NULL, /* pGetPixel */
NULL, /* pGetPixelFormat */
PSDRV_GetTextExtentPoint, /* pGetTextExtentPoint */
PSDRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
......@@ -96,6 +99,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pSetMapMode (optional) */
NULL, /* pSetMapperFlags */
PSDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
......@@ -114,6 +118,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
PSDRV_StretchDIBits, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
NULL, /* pSwapBuffers */
NULL /* pWidenPath */
};
......
......@@ -25,6 +25,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
NULL, /* pBeginPath */
TTYDRV_DC_BitBlt, /* pBitBlt */
TTYDRV_DC_BitmapBits,/* pBitmapBits */
NULL, /* pChoosePixelFormat */
TTYDRV_DC_Chord, /* pChord */
NULL, /* pCloseFigure */
TTYDRV_DC_CreateBitmap, /* pCreateBitmap */
......@@ -33,6 +34,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
NULL, /* pCreateDIBSection16 */
TTYDRV_DC_DeleteDC, /* pDeleteDC */
TTYDRV_DC_DeleteObject, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
TTYDRV_DC_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
......@@ -51,6 +53,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
TTYDRV_DC_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */
TTYDRV_DC_GetPixel, /* pGetPixel */
NULL, /* pGetPixelFormat */
TTYDRV_DC_GetTextExtentPoint, /* pGetTextExtentPoint */
TTYDRV_DC_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
......@@ -90,6 +93,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
NULL, /* pSetMapMode (optional) */
NULL, /* pSetMapperFlags */
TTYDRV_DC_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
......@@ -108,6 +112,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
NULL, /* pSwapBuffers */
NULL /* pWidenPath */
};
......
......@@ -53,6 +53,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pBeginPath */
NULL, /* pBitBlt */
NULL, /* pBitmapBits */
NULL, /* pChoosePixelFormat */
NULL, /* pChord */
NULL, /* pCloseFigure */
NULL, /* pCreateBitmap */
......@@ -61,6 +62,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pCreateDIBSection16 */
NULL, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
WIN16DRV_DeviceCapabilities, /* pDeviceCapabilities */
WIN16DRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
......@@ -79,6 +81,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
WIN16DRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */
NULL, /* pGetPixel */
NULL, /* pGetPixelFormat */
WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
......@@ -118,6 +121,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
......@@ -136,6 +140,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
NULL, /* pSwapBuffers */
NULL /* pWidenPath */
};
......
......@@ -15,6 +15,7 @@ C_SRCS = \
init.c \
objects.c \
oembitmap.c \
opengl.c \
palette.c \
pen.c \
text.c \
......
......@@ -38,6 +38,7 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
NULL, /* pBeginPath */
X11DRV_BitBlt, /* pBitBlt */
X11DRV_BitmapBits, /* pBitmapBits */
X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */
X11DRV_Chord, /* pChord */
NULL, /* pCloseFigure */
X11DRV_CreateBitmap, /* pCreateBitmap */
......@@ -46,6 +47,7 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
X11DRV_DIB_CreateDIBSection16, /* pCreateDIBSection16 */
X11DRV_DeleteDC, /* pDeleteDC */
X11DRV_DeleteObject, /* pDeleteObject */
X11DRV_DescribePixelFormat, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
X11DRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
......@@ -64,6 +66,7 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
X11DRV_GetCharWidth, /* pGetCharWidth */
X11DRV_GetDCOrgEx, /* pGetDCOrgEx */
X11DRV_GetPixel, /* pGetPixel */
X11DRV_GetPixelFormat, /* pGetPixelFormat */
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
X11DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
......@@ -103,6 +106,7 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
NULL, /* pSetMapMode (optional) */
NULL, /* pSetMapperFlags */
X11DRV_SetPixel, /* pSetPixel */
X11DRV_SetPixelFormat, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
......@@ -121,6 +125,7 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
X11DRV_SwapBuffers, /* pSwapBuffers */
NULL /* pWidenPath */
};
......@@ -265,6 +270,9 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
dc->w.hVisRgn = CreateRectRgnIndirect( &dc->w.totalExtent );
}
physDev->current_pf = 0;
physDev->used_visuals = 0;
if (!dc->w.hVisRgn)
{
TSXFreeGC( display, physDev->gc );
......@@ -285,6 +293,8 @@ static BOOL X11DRV_DeleteDC( DC *dc )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TSXFreeGC( display, physDev->gc );
while (physDev->used_visuals-- > 0)
TSXFree(physDev->visuals[physDev->used_visuals]);
HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL;
return TRUE;
......
/*
* X11DRV OpenGL functions
*
* Copyright 2000 Lionel Ulmer
*
*/
#include "config.h"
#include "ts_xlib.h"
#include <stdlib.h>
#include <string.h>
#include "debugtools.h"
#include "gdi.h"
#include "x11drv.h"
#include "wine_gl.h"
DEFAULT_DEBUG_CHANNEL(opengl)
#ifdef HAVE_OPENGL
static void dump_PIXELFORMATDESCRIPTOR(PIXELFORMATDESCRIPTOR *ppfd) {
DPRINTF(" - size / version : %d / %d\n", ppfd->nSize, ppfd->nVersion);
DPRINTF(" - dwFlags : ");
#define TEST_AND_DUMP(t,tv) if ((t) & (tv)) DPRINTF(#tv " ")
TEST_AND_DUMP(ppfd->dwFlags, PFD_DEPTH_DONTCARE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_DOUBLEBUFFER);
TEST_AND_DUMP(ppfd->dwFlags, PFD_DOUBLEBUFFER_DONTCARE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_DRAW_TO_WINDOW);
TEST_AND_DUMP(ppfd->dwFlags, PFD_DRAW_TO_BITMAP);
TEST_AND_DUMP(ppfd->dwFlags, PFD_GENERIC_ACCELERATED);
TEST_AND_DUMP(ppfd->dwFlags, PFD_GENERIC_FORMAT);
TEST_AND_DUMP(ppfd->dwFlags, PFD_NEED_PALETTE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_NEED_SYSTEM_PALETTE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_STEREO);
TEST_AND_DUMP(ppfd->dwFlags, PFD_STEREO_DONTCARE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_SUPPORT_GDI);
TEST_AND_DUMP(ppfd->dwFlags, PFD_SUPPORT_OPENGL);
TEST_AND_DUMP(ppfd->dwFlags, PFD_SWAP_COPY);
TEST_AND_DUMP(ppfd->dwFlags, PFD_SWAP_EXCHANGE);
TEST_AND_DUMP(ppfd->dwFlags, PFD_SWAP_LAYER_BUFFERS);
#undef TEST_AND_DUMP
DPRINTF("\n");
DPRINTF(" - iPixelType : ");
switch (ppfd->iPixelType) {
case PFD_TYPE_RGBA: DPRINTF("PFD_TYPE_RGBA"); break;
case PFD_TYPE_COLORINDEX: DPRINTF("PFD_TYPE_COLORINDEX"); break;
}
DPRINTF("\n");
DPRINTF(" - Color : %d\n", ppfd->cColorBits);
DPRINTF(" - Alpha : %d\n", ppfd->cAlphaBits);
DPRINTF(" - Accum : %d\n", ppfd->cAccumBits);
DPRINTF(" - Depth : %d\n", ppfd->cDepthBits);
DPRINTF(" - Stencil : %d\n", ppfd->cStencilBits);
DPRINTF(" - Aux : %d\n", ppfd->cAuxBuffers);
DPRINTF(" - iLayerType : ");
switch (ppfd->iLayerType) {
case PFD_MAIN_PLANE: DPRINTF("PFD_MAIN_PLANE"); break;
case PFD_OVERLAY_PLANE: DPRINTF("PFD_OVERLAY_PLANE"); break;
case PFD_UNDERLAY_PLANE: DPRINTF("PFD_UNDERLAY_PLANE"); break;
}
DPRINTF("\n");
}
/* X11DRV_ChoosePixelFormat
Equivalent of glXChooseVisual
*/
int X11DRV_ChoosePixelFormat(DC *dc,
const PIXELFORMATDESCRIPTOR *ppfd) {
#define TEST_AND_ADD1(t,a) if (t) att_list[att_pos++] = a
#define TEST_AND_ADD2(t,a,b) if (t) { att_list[att_pos++] = a; att_list[att_pos++] = b; }
#define NULL_TEST_AND_ADD2(tv,a,b) att_list[att_pos++] = a; att_list[att_pos++] = ((tv) == 0 ? 0 : b)
#define ADD2(a,b) att_list[att_pos++] = a; att_list[att_pos++] = b
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
int att_list[64];
int att_pos = 0;
XVisualInfo *vis;
if (TRACE_ON(opengl)) {
TRACE("(%p,%p)\n", dc, ppfd);
dump_PIXELFORMATDESCRIPTOR((PIXELFORMATDESCRIPTOR *) ppfd);
}
/* For the moment, we are dumb : we always allocate a new XVisualInfo structure,
we do not try to find an already found that could match */
if (physDev->used_visuals == MAX_PIXELFORMATS) {
ERR("Maximum number of visuals reached !\n");
/* Should SetError here... */
return 0;
}
if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) {
ERR("Flag not supported !\n");
/* Should SetError here... */
return 0;
}
/* Now, build the request to GLX */
TEST_AND_ADD1(ppfd->dwFlags & PFD_DOUBLEBUFFER, GLX_DOUBLEBUFFER);
TEST_AND_ADD1(ppfd->dwFlags & PFD_STEREO, GLX_STEREO);
TEST_AND_ADD1(ppfd->iPixelType == PFD_TYPE_RGBA, GLX_RGBA);
TEST_AND_ADD2(ppfd->iPixelType == PFD_TYPE_COLORINDEX, GLX_BUFFER_SIZE, ppfd->cColorBits);
NULL_TEST_AND_ADD2(ppfd->cDepthBits, GLX_DEPTH_SIZE, 8);
/* These flags are not supported yet...
NULL_TEST_AND_ADD2(ppfd->cAlphaBits, GLX_ALPHA_SIZE, 8);
ADD2(GLX_ACCUM_SIZE, ppfd->cAccumBits);
ADD2(GLX_STENCIL_SIZE, ppfd->cStencilBits);
ADD2(GLX_AUX_BUFFERS, ppfd->cAuxBuffers); */
att_list[att_pos] = None;
ENTER_GL(); {
/*
This command cannot be used as we need to use the default visual...
Let's hope it at least contains some OpenGL functionnalities
vis = glXChooseVisual(display, DefaultScreen(display), att_list);
*/
int num;
XVisualInfo template;
template.visualid = XVisualIDFromVisual(visual);
vis = XGetVisualInfo(display, VisualIDMask, &template, &num);
TRACE("Found visual : %p - returns %d\n", vis, physDev->used_visuals + 1);
}
LEAVE_GL();
if (vis == NULL) {
ERR("No visual found !\n");
/* Should SetError here... */
return 0;
}
physDev->visuals[physDev->used_visuals++] = vis;
return physDev->used_visuals;
}
/* X11DRV_DescribePixelFormat
Get the pixel-format descriptor associated to the given id
*/
int X11DRV_DescribePixelFormat(DC *dc,
int iPixelFormat,
UINT nBytes,
PIXELFORMATDESCRIPTOR *ppfd) {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
XVisualInfo *vis;
int value;
int rb,gb,bb,ab;
TRACE("(%p,%d,%d,%p)\n", dc, iPixelFormat, nBytes, ppfd);
if (nBytes < sizeof(PIXELFORMATDESCRIPTOR)) {
ERR("Wrong structure size !\n");
/* Should set error */
return 0;
}
if ((iPixelFormat > MAX_PIXELFORMATS) ||
(iPixelFormat > physDev->used_visuals + 1) ||
(iPixelFormat <= 0)) {
ERR("Wrong pixel format !\n");
/* Should set error */
return 0;
}
if (iPixelFormat == physDev->used_visuals + 1) {
int dblBuf[]={GLX_RGBA,GLX_DEPTH_SIZE,16,GLX_DOUBLEBUFFER,None};
/* Create a 'standard' X Visual */
ENTER_GL();
vis = glXChooseVisual(display,
DefaultScreen(display),
dblBuf);
LEAVE_GL();
WARN("Uninitialized Visual. Creating standard (%p) !\n", vis);
if (vis == NULL) {
ERR("Could not create standard visual !\n");
/* Should set error */
return 0;
}
physDev->visuals[physDev->used_visuals++] = vis;
}
vis = physDev->visuals[iPixelFormat - 1];
memset(ppfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR);
ppfd->nVersion = 1;
/* These flags are always the same... */
ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED;
/* Now the flags extraced from the Visual */
ENTER_GL();
glXGetConfig(display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER;
glXGetConfig(display, vis, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO;
/* Pixel type */
glXGetConfig(display, vis, GLX_RGBA, &value);
if (value)
ppfd->iPixelType = PFD_TYPE_RGBA;
else
ppfd->iPixelType = PFD_TYPE_COLORINDEX;
/* Color bits */
glXGetConfig(display, vis, GLX_BUFFER_SIZE, &value);
ppfd->cColorBits = value;
/* Red, green, blue and alpha bits / shifts */
if (ppfd->iPixelType == PFD_TYPE_RGBA) {
glXGetConfig(display, vis, GLX_RED_SIZE, &rb);
glXGetConfig(display, vis, GLX_GREEN_SIZE, &gb);
glXGetConfig(display, vis, GLX_BLUE_SIZE, &bb);
glXGetConfig(display, vis, GLX_ALPHA_SIZE, &ab);
ppfd->cRedBits = rb;
ppfd->cRedShift = gb + bb + ab;
ppfd->cBlueBits = bb;
ppfd->cBlueShift = ab;
ppfd->cGreenBits = gb;
ppfd->cGreenShift = bb + ab;
ppfd->cAlphaBits = ab;
ppfd->cAlphaShift = 0;
} else {
ppfd->cRedBits = 0;
ppfd->cRedShift = 0;
ppfd->cBlueBits = 0;
ppfd->cBlueShift = 0;
ppfd->cGreenBits = 0;
ppfd->cGreenShift = 0;
ppfd->cAlphaBits = 0;
ppfd->cAlphaShift = 0;
}
/* Accums : to do ... */
/* Depth bits */
glXGetConfig(display, vis, GLX_DEPTH_SIZE, &value);
ppfd->cDepthBits = value;
LEAVE_GL();
/* Aux, stencil : to do ... */
ppfd->iLayerType = PFD_MAIN_PLANE;
dump_PIXELFORMATDESCRIPTOR(ppfd);
return MAX_PIXELFORMATS;
}
/* X11DRV_GetPixelFormat
Get the pixel-format id used by this DC
*/
int X11DRV_GetPixelFormat(DC *dc) {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE("(%p): returns %d\n", dc, physDev->current_pf);
return physDev->current_pf;
}
/* X11DRV_SetPixelFormat
Set the pixel-format id used by this DC
*/
BOOL X11DRV_SetPixelFormat(DC *dc,
int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd) {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE("(%p,%d,%p)\n", dc, iPixelFormat, ppfd);
physDev->current_pf = iPixelFormat;
return TRUE;
}
/* X11DRV_SwapBuffers
Swap the buffers of this DC
*/
BOOL X11DRV_SwapBuffers(DC *dc) {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE("(%p)\n", dc);
ENTER_GL();
glXSwapBuffers(display, physDev->drawable);
LEAVE_GL();
return TRUE;
}
#else /* defined(HAVE_OPENGL) */
int X11DRV_ChoosePixelFormat(DC *dc,
const PIXELFORMATDESCRIPTOR *ppfd) {
ERR("No OpenGL support compiled in.\n");
return 0;
}
int X11DRV_DescribePixelFormat(DC *dc,
int iPixelFormat,
UINT nBytes,
PIXELFORMATDESCRIPTOR *ppfd) {
ERR("No OpenGL support compiled in.\n");
return 0;
}
int X11DRV_GetPixelFormat(DC *dc) {
ERR("No OpenGL support compiled in.\n");
return 0;
}
BOOL X11DRV_SetPixelFormat(DC *dc,
int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd) {
ERR("No OpenGL support compiled in.\n");
return FALSE;
}
BOOL X11DRV_SwapBuffers(DC *dc) {
ERR("No OpenGL support compiled in.\n");
return FALSE;
}
#endif /* defined(HAVE_OPENGL) */
......@@ -96,8 +96,8 @@
/* Define if IPX includes are taken from Linux kernel */
#undef HAVE_IPX_LINUX
/* Define if Mesa is present on the system or not */
#undef HAVE_LIBMESAGL
/* Define if OpenGL is present on the system or not */
#undef HAVE_OPENGL
/* Define if the system has dynamic link library support with the dl* API */
#undef HAVE_DL_API
......@@ -110,3 +110,6 @@
/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */
#undef HAVE_GL_PALETTED_TEXTURE
/* Define if the OpenGL library supports the glXGetProcAddressARB call */
#undef HAVE_GLX_GETPROCADDRESS
......@@ -128,8 +128,8 @@
/* Define if IPX includes are taken from Linux kernel */
#undef HAVE_IPX_LINUX
/* Define if Mesa is present on the system or not */
#undef HAVE_LIBMESAGL
/* Define if OpenGL is present on the system or not */
#undef HAVE_OPENGL
/* Define if the system has dynamic link library support with the dl* API */
#undef HAVE_DL_API
......@@ -143,6 +143,9 @@
/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */
#undef HAVE_GL_PALETTED_TEXTURE
/* Define if the OpenGL library supports the glXGetProcAddressARB call */
#undef HAVE_GLX_GETPROCADDRESS
/* The number of bytes in a long long. */
#undef SIZEOF_LONG_LONG
......@@ -242,6 +245,9 @@
/* Define if you have the <GL/gl.h> header file. */
#undef HAVE_GL_GL_H
/* Define if you have the <GL/glext.h> header file. */
#undef HAVE_GL_GLEXT_H
/* Define if you have the <GL/glx.h> header file. */
#undef HAVE_GL_GLX_H
......
......@@ -104,6 +104,7 @@ char dbch_nonclient[] = "\003nonclient";
char dbch_ntdll[] = "\003ntdll";
char dbch_odbc[] = "\003odbc";
char dbch_ole[] = "\003ole";
char dbch_opengl[] = "\003opengl";
char dbch_pager[] = "\003pager";
char dbch_palette[] = "\003palette";
char dbch_pidl[] = "\003pidl";
......@@ -171,7 +172,7 @@ char dbch_wnet[] = "\003wnet";
char dbch_x11[] = "\003x11";
char dbch_x11drv[] = "\003x11drv";
#define DEBUG_CHANNEL_COUNT 164
#define DEBUG_CHANNEL_COUNT 165
static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
dbch_accel,
......@@ -272,6 +273,7 @@ static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
dbch_ntdll,
dbch_odbc,
dbch_ole,
dbch_opengl,
dbch_pager,
dbch_palette,
dbch_pidl,
......
......@@ -176,6 +176,7 @@ typedef struct tagDC_FUNCS
BOOL (*pBeginPath)(DC*);
BOOL (*pBitBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,DWORD);
LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD);
INT (*pChoosePixelFormat)(DC*,const PIXELFORMATDESCRIPTOR *);
BOOL (*pChord)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(DC*);
BOOL (*pCreateBitmap)(HBITMAP);
......@@ -186,6 +187,7 @@ typedef struct tagDC_FUNCS
DWORD,DWORD);
BOOL (*pDeleteDC)(DC*);
BOOL (*pDeleteObject)(HGDIOBJ);
INT (*pDescribePixelFormat)(DC *,INT,UINT,PIXELFORMATDESCRIPTOR *);
DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
BOOL (*pEllipse)(DC*,INT,INT,INT,INT);
INT (*pEndDoc)(DC*);
......@@ -206,6 +208,7 @@ typedef struct tagDC_FUNCS
BOOL (*pGetCharWidth)(DC*,UINT,UINT,LPINT);
BOOL (*pGetDCOrgEx)(DC*,LPPOINT);
COLORREF (*pGetPixel)(DC*,INT,INT);
INT (*pGetPixelFormat)(DC*);
BOOL (*pGetTextExtentPoint)(DC*,LPCWSTR,INT,LPSIZE);
BOOL (*pGetTextMetrics)(DC*,TEXTMETRICA*);
INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
......@@ -246,6 +249,7 @@ typedef struct tagDC_FUNCS
INT (*pSetMapMode)(DC*,INT);
DWORD (*pSetMapperFlags)(DC*,DWORD);
COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF);
BOOL (*pSetPixelFormat)(DC*,INT,const PIXELFORMATDESCRIPTOR *);
INT (*pSetPolyFillMode)(DC*,INT);
INT (*pSetROP2)(DC*,INT);
INT (*pSetRelAbs)(DC*,INT);
......@@ -265,6 +269,7 @@ typedef struct tagDC_FUNCS
const void *,const BITMAPINFO *,UINT,DWORD);
BOOL (*pStrokeAndFillPath)(DC*);
BOOL (*pStrokePath)(DC*);
BOOL (*pSwapBuffers)(DC*);
BOOL (*pWidenPath)(DC*);
} DC_FUNCTIONS;
......
......@@ -9,9 +9,13 @@
#include "config.h"
#if defined(HAVE_LIBMESAGL) && defined(HAVE_GL_GLX_H)
#if defined(HAVE_OPENGL)
#define HAVE_MESAGL
#include "x11drv.h"
/* As GLX relies on X, this is needed */
#define ENTER_GL() EnterCriticalSection( &X11DRV_CritSection )
#define LEAVE_GL() LeaveCriticalSection( &X11DRV_CritSection )
#undef APIENTRY
#undef CALLBACK
......@@ -20,6 +24,7 @@
#define XMD_H /* This is to prevent the Xmd.h inclusion bug to happen :-/ */
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glext.h>
#undef XMD_H
#undef APIENTRY
......@@ -31,10 +36,6 @@
#define WINAPI __stdcall
#define APIENTRY WINAPI
#else /* HAVE_LIBMESAGL */
#undef HAVE_MESAGL
#endif /* HAVE_LIBMESAGL */
#endif /* HAVE_OPENGL */
#endif /* __WINE_WINE_GL_H */
......@@ -19,6 +19,7 @@
#include "winbase.h"
#include "windef.h"
#define MAX_PIXELFORMATS 8
struct tagBITMAPOBJ;
struct tagCLASS;
......@@ -67,6 +68,9 @@ typedef struct
X_PHYSBRUSH brush;
int backgroundPixel;
int textPixel;
XVisualInfo *visuals[MAX_PIXELFORMATS];
int used_visuals;
int current_pf;
} X11DRV_PDEVICE;
......@@ -153,6 +157,13 @@ extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap,
LPBITMAPINFO info, UINT coloruse );
extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
/* OpenGL / X11 driver functions */
extern int X11DRV_ChoosePixelFormat(DC *dc, const PIXELFORMATDESCRIPTOR *pppfd) ;
extern int X11DRV_DescribePixelFormat(DC *dc, int iPixelFormat, UINT nBytes, PIXELFORMATDESCRIPTOR *ppfd) ;
extern int X11DRV_GetPixelFormat(DC *dc) ;
extern BOOL X11DRV_SetPixelFormat(DC *dc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) ;
extern BOOL X11DRV_SwapBuffers(DC *dc) ;
/* X11 driver internal functions */
extern BOOL X11DRV_BITMAP_Init(void);
......
......@@ -59,6 +59,7 @@ static struct tagDllOverride {
/* we have to use libglide2x.so instead of glide2x.dll ... */
{"glide2x", "so,native"},
{"odbc32", "builtin"},
{"opengl32", "builtin,native"},
{NULL,NULL},
};
......@@ -482,6 +483,8 @@ module_loadorder_t *MODULE_GetLoadOrder(const char *path)
char *name;
int len;
TRACE("looking for %s\n", path);
assert(path != NULL);
/* Strip path information */
......
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