- fixed the OpenGL32 spec file (and the make_opengl_spec tool)
- prevent HalfLife from crashing when it frees three times the same rendering context
This commit is contained in:
parent
3be104e0ef
commit
1113706c10
|
@ -22,7 +22,7 @@ type win32
|
|||
@ stdcall wglShareLists(long long) wglShareLists
|
||||
@ stdcall wglSwapLayerBuffers(long long) wglSwapLayerBuffers
|
||||
@ stdcall wglUseFontBitmapsA(long long long long) wglUseFontBitmapsA
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long) wglUseFontOutlinesA
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr) wglUseFontOutlinesA
|
||||
@ stub glGetLevelParameterfv
|
||||
@ stub glGetLevelParameteriv
|
||||
@ stub wglUseFontBitmapsW
|
||||
|
@ -63,7 +63,8 @@ while ($line = <INC>) {
|
|||
print "ptr ";
|
||||
} elsif ($_ =~ /[a-zA-Z]/) {
|
||||
($type) = ($_ =~ /^ *(.*) +.*/);
|
||||
if ($type =~ /double/) {
|
||||
if (($type =~ /double/) ||
|
||||
($type =~ /clampd/)) {
|
||||
print "double ";
|
||||
} elsif ($type !~ /void/) {
|
||||
print "long ";
|
||||
|
|
|
@ -17,7 +17,7 @@ type win32
|
|||
@ stdcall wglShareLists(long long) wglShareLists
|
||||
@ stdcall wglSwapLayerBuffers(long long) wglSwapLayerBuffers
|
||||
@ stdcall wglUseFontBitmapsA(long long long long) wglUseFontBitmapsA
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long) wglUseFontOutlinesA
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr) wglUseFontOutlinesA
|
||||
@ stub glGetLevelParameterfv
|
||||
@ stub glGetLevelParameteriv
|
||||
@ stub wglUseFontBitmapsW
|
||||
|
@ -70,10 +70,10 @@ type win32
|
|||
@ stdcall glFinish() wine_glFinish
|
||||
@ stdcall glFlush() wine_glFlush
|
||||
@ stdcall glHint(long long ) wine_glHint
|
||||
@ stdcall glClearDepth(long ) wine_glClearDepth
|
||||
@ stdcall glClearDepth(double ) wine_glClearDepth
|
||||
@ stdcall glDepthFunc(long ) wine_glDepthFunc
|
||||
@ stdcall glDepthMask(long ) wine_glDepthMask
|
||||
@ stdcall glDepthRange(long long ) wine_glDepthRange
|
||||
@ stdcall glDepthRange(double double ) wine_glDepthRange
|
||||
@ stdcall glClearAccum(long long long long ) wine_glClearAccum
|
||||
@ stdcall glAccum(long long ) wine_glAccum
|
||||
@ stdcall glMatrixMode(long ) wine_glMatrixMode
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wine/exception.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "debugtools.h"
|
||||
#include "gdi.h"
|
||||
#include "dc.h"
|
||||
#include "windef.h"
|
||||
#include "winerror.h"
|
||||
#include "wine_gl.h"
|
||||
#include "x11drv.h"
|
||||
#include "x11font.h"
|
||||
|
@ -19,6 +22,17 @@
|
|||
|
||||
DEFAULT_DEBUG_CHANNEL(opengl);
|
||||
|
||||
static int XGLErrorFlag = 0;
|
||||
static int XGLErrorHandler(Display *dpy, XErrorEvent *event) {
|
||||
XGLErrorFlag = 1;
|
||||
return 0;
|
||||
}
|
||||
/* filter for page-fault exceptions */
|
||||
static WINE_EXCEPTION_FILTER(page_fault)
|
||||
{
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglCreateContext
|
||||
*/
|
||||
|
@ -78,13 +92,36 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc,
|
|||
* wglDeleteContext
|
||||
*/
|
||||
BOOL WINAPI wglDeleteContext(HGLRC hglrc) {
|
||||
int (*WineXHandler)(Display *, XErrorEvent *);
|
||||
BOOL ret = TRUE;
|
||||
|
||||
TRACE("(%p)\n", hglrc);
|
||||
|
||||
ENTER_GL();
|
||||
/* A game (Half Life not to name it) deletes twice the same context. To prevent
|
||||
crashes, run with our own error function enabled */
|
||||
XSync(display, False);
|
||||
XGLErrorFlag = 0;
|
||||
WineXHandler = XSetErrorHandler(XGLErrorHandler);
|
||||
__TRY {
|
||||
glXDestroyContext(display, (GLXContext) hglrc);
|
||||
XSync(display, False);
|
||||
XFlush(display);
|
||||
}
|
||||
__EXCEPT(page_fault) {
|
||||
XGLErrorFlag = 1;
|
||||
}
|
||||
__ENDTRY
|
||||
|
||||
XSetErrorHandler(WineXHandler);
|
||||
if (XGLErrorFlag) {
|
||||
TRACE("Error deleting context !\n");
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
ret = FALSE;
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -220,25 +257,35 @@ void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
|||
*/
|
||||
BOOL WINAPI wglMakeCurrent(HDC hdc,
|
||||
HGLRC hglrc) {
|
||||
DC * dc = DC_GetDCPtr( hdc );
|
||||
X11DRV_PDEVICE *physDev;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%08x,%p)\n", hdc, hglrc);
|
||||
|
||||
if (hglrc == NULL) {
|
||||
ENTER_GL();
|
||||
ret = glXMakeCurrent(display,
|
||||
None,
|
||||
NULL);
|
||||
LEAVE_GL();
|
||||
} else {
|
||||
DC * dc = DC_GetDCPtr( hdc );
|
||||
|
||||
if (dc == NULL) {
|
||||
ERR("Null DC !!!\n");
|
||||
return FALSE;
|
||||
}
|
||||
ret = FALSE;
|
||||
} else {
|
||||
X11DRV_PDEVICE *physDev;
|
||||
|
||||
physDev =(X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
ENTER_GL();
|
||||
ret = glXMakeCurrent(display,
|
||||
(hglrc == NULL ? None : physDev->drawable),
|
||||
physDev->drawable,
|
||||
(GLXContext) hglrc);
|
||||
LEAVE_GL();
|
||||
|
||||
}
|
||||
}
|
||||
TRACE("Returning %s\n", (ret ? "True" : "False"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue