mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Polymer: support for creating a debugging context in winlayer
This also fixes a warning when building for Windows. git-svn-id: https://svn.eduke32.com/eduke32@2067 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a0b928583b
commit
f08610b6c8
5 changed files with 32 additions and 6 deletions
|
@ -319,6 +319,7 @@ extern int32_t (WINAPI * bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMAT
|
|||
extern int32_t (WINAPI * bwglGetPixelFormat)(HDC);
|
||||
extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
|
||||
extern BOOL (WINAPI * bwglSwapIntervalEXT)(int32_t);
|
||||
extern HGLRC (WINAPI * bwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
|
||||
//////// glGenTextures/glDeleteTextures debugging ////////
|
||||
|
|
|
@ -373,7 +373,7 @@ static void polymer_prepareshadows(void);
|
|||
// RENDER TARGETS
|
||||
static void polymer_initrendertargets(int32_t count);
|
||||
// DEBUG OUTPUT
|
||||
static void polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
|
||||
void PR_CALLBACK polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
|
||||
|
||||
#define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]*5) : (((i+n)%p->vertcount)*5))
|
||||
|
||||
|
|
|
@ -287,6 +287,7 @@ int32_t (WINAPI *bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPT
|
|||
int32_t (WINAPI *bwglGetPixelFormat)(HDC);
|
||||
BOOL (WINAPI *bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR *);
|
||||
BOOL (WINAPI *bwglSwapIntervalEXT)(int32_t);
|
||||
HGLRC (WINAPI * bwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
|
||||
static HANDLE hGLDLL, hGLUDLL;
|
||||
#else
|
||||
|
@ -625,6 +626,7 @@ int32_t loadglextensions(void)
|
|||
|
||||
#ifdef RENDERTYPEWIN
|
||||
bwglSwapIntervalEXT = GETPROCEXTSOFT("wglSwapIntervalEXT");
|
||||
bwglCreateContextAttribsARB = GETPROCEXTSOFT("wglCreateContextAttribsARB");
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -5662,7 +5662,7 @@ static void polymer_initrendertargets(int32_t count)
|
|||
}
|
||||
|
||||
// DEBUG OUTPUT
|
||||
void polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam)
|
||||
void PR_CALLBACK polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(source);
|
||||
UNREFERENCED_PARAMETER(type);
|
||||
|
|
|
@ -2803,6 +2803,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
|
|||
}
|
||||
|
||||
hGLRC = bwglCreateContext(hDC);
|
||||
|
||||
if (!hGLRC)
|
||||
{
|
||||
ReleaseOpenGL();
|
||||
|
@ -2817,6 +2818,32 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
loadglextensions();
|
||||
|
||||
// We should really be checking for the new WGL extension string instead
|
||||
// Enable this to leverage ARB_debug_output
|
||||
if (bwglCreateContextAttribsARB && 0) {
|
||||
HGLRC debuggingContext = hGLRC;
|
||||
|
||||
// This corresponds to WGL_CONTEXT_FLAGS_ARB set to WGL_CONTEXT_DEBUG_BIT_ARB
|
||||
// I'm too lazy to get a new wglext.h
|
||||
int attribs[] = {
|
||||
0x2094, 0x1,
|
||||
0
|
||||
};
|
||||
|
||||
debuggingContext = bwglCreateContextAttribsARB(hDC, NULL, attribs);
|
||||
|
||||
if (debuggingContext) {
|
||||
bwglDeleteContext(hGLRC);
|
||||
bwglMakeCurrent(hDC, debuggingContext);
|
||||
hGLRC = debuggingContext;
|
||||
|
||||
// This should be able to get the ARB_debug_output symbols
|
||||
loadglextensions();
|
||||
}
|
||||
}
|
||||
|
||||
polymost_glreset();
|
||||
|
||||
bglEnable(GL_TEXTURE_2D);
|
||||
|
@ -3234,10 +3261,6 @@ static BOOL CreateAppWindow(int32_t modenum)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (bitspp > 8) loadglextensions();
|
||||
#endif
|
||||
|
||||
xres = width;
|
||||
yres = height;
|
||||
bpp = bitspp;
|
||||
|
|
Loading…
Reference in a new issue