Polymer: preliminary support for GL_ARB_debug_output

This won't actually do anything until the a debug bit is added when
creating the context, but that requires support for GLX_create_context
which SDL doesn't support. I'll add support for WGL_create_context to
winlayer in a bit as a stopgap.

Also updates our local copy of glext.h with a fresh one from the
Khronos registry.

git-svn-id: https://svn.eduke32.com/eduke32@2056 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-10-02 05:56:35 +00:00
parent e7c735418f
commit 93b4d6182e
9 changed files with 5541 additions and 1279 deletions

View file

@ -65,6 +65,7 @@ struct glinfo_t {
char sm4;
char occlusionqueries;
char glsl;
char debugoutput;
char dumped;
};

View file

@ -283,6 +283,10 @@ extern void (APIENTRY * bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLc
extern void (APIENTRY * bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
extern GLint (APIENTRY * bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
// Debug Output
extern void (APIENTRY * bglDebugMessageControlARB)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
extern void (APIENTRY * bglDebugMessageCallbackARB)(GLDEBUGPROCARB callback, const GLvoid *userParam);
// GLU
extern void (APIENTRY * bgluTessBeginContour) (GLUtesselator* tess);
extern void (APIENTRY * bgluTessBeginPolygon) (GLUtesselator* tess, GLvoid* data);

File diff suppressed because it is too large Load diff

View file

@ -372,6 +372,8 @@ static inline void polymer_culllight(int16_t lighti);
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);
#define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]*5) : (((i+n)%p->vertcount)*5))

View file

@ -135,6 +135,7 @@ struct glinfo_t glinfo =
0, // Shader Model 4 support
0, // Occlusion Queries
0, // GLSL
0, // Debug Output
0, // GL info dumped
};
#endif
@ -247,6 +248,7 @@ int32_t osdcmd_glinfo(const osdfuncparm_t *parm)
" Shader Model 4: %s\n"
" Occlusion queries: %s\n"
" GLSL: %s\n"
" Debug Output: %s\n"
" Extensions:\n",
glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)",
glinfo.bgra ? "supported": "not supported",
@ -265,7 +267,8 @@ int32_t osdcmd_glinfo(const osdfuncparm_t *parm)
glinfo.vbos ? "supported": "not supported",
glinfo.sm4 ? "supported": "not supported",
glinfo.occlusionqueries ? "supported": "not supported",
glinfo.glsl ? "supported": "not supported"
glinfo.glsl ? "supported": "not supported",
glinfo.debugoutput ? "supported": "not supported"
);
s = Bstrdup(glinfo.extensions);

View file

@ -250,6 +250,10 @@ void (APIENTRY *bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *
void (APIENTRY *bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
GLint(APIENTRY *bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
// Debug Output
void (APIENTRY * bglDebugMessageControlARB)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
void (APIENTRY * bglDebugMessageCallbackARB)(GLDEBUGPROCARB callback, const GLvoid *userParam);
// GLU
void (APIENTRY *bgluTessBeginContour)(GLUtesselator *tess);
void (APIENTRY *bgluTessBeginPolygon)(GLUtesselator *tess, GLvoid *data);
@ -615,6 +619,10 @@ int32_t loadglextensions(void)
bglGetActiveAttribARB = GETPROCEXTSOFT("glGetActiveAttribARB");
bglGetAttribLocationARB = GETPROCEXTSOFT("glGetAttribLocationARB");
// Debug Output
bglDebugMessageControlARB = GETPROCEXTSOFT("glDebugMessageControlARB");
bglDebugMessageCallbackARB = GETPROCEXTSOFT("glDebugMessageCallbackARB");
#ifdef RENDERTYPEWIN
bwglSwapIntervalEXT = GETPROCEXTSOFT("wglSwapIntervalEXT");
#endif

View file

@ -730,6 +730,12 @@ int32_t polymer_init(void)
i++;
}
if (glinfo.debugoutput) {
// Enable everything.
bglDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
bglDebugMessageCallbackARB(polymer_debugoutputcallback, NULL);
}
if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete in %d ms.\n", getticks()-t);
return (1);
@ -1514,7 +1520,7 @@ void polymer_definehighpalookup(char basepalnum, char palnum, cha
Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE);
}
int32_t polymer_havehighpalookup(int32_t basepalnum, int32_t palnum)
int32_t polymer_havehighpalookup(int32_t basepalnum, int32_t palnum)
{
if ((uint32_t)basepalnum >= MAXBASEPALS || (uint32_t)palnum >= MAXPALOOKUPS)
return 0;
@ -5633,4 +5639,17 @@ 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)
{
UNREFERENCED_PARAMETER(source);
UNREFERENCED_PARAMETER(type);
UNREFERENCED_PARAMETER(id);
UNREFERENCED_PARAMETER(severity);
UNREFERENCED_PARAMETER(length);
UNREFERENCED_PARAMETER(userParam);
OSD_Printf("PR : Received OpenGL debug message: %s\n", message);
}
#endif

View file

@ -1269,6 +1269,10 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
{
glinfo.glsl = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_debug_output"))
{
glinfo.debugoutput = 1;
}
}
Bfree(p);

View file

@ -2978,6 +2978,10 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
{
glinfo.glsl = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_debug_output"))
{
glinfo.debugoutput = 1;
}
}
Bfree(p);
}