Permalink
Browse files

GL_EXT_debug_marker - GLEW support, extension string, extension query.

  • Loading branch information...
1 parent 68bfbc8 commit db681bcbe7dd9e8a210e9763d8a94cbd4c577b0f @nigels-com nigels-com committed Jul 30, 2012
@@ -64,16 +64,32 @@ int main(int argc, const char *argv[])
RegalSetErrorCallback(myError);
- // Exercise REGAL_extension_query extension, just 'coz
+ // Exercise REGAL_extension_query extension
- if (!glIsSupportedREGAL("GL_EXT_framebuffer_object"))
- printf("GL_EXT_framebuffer_object is not supported.\n");
-
- if (!glIsSupportedREGAL("GL_EXT_direct_state_access"))
- printf("GL_EXT_direct_state_access is not supported.\n");
-
- if (!glIsSupportedREGAL("GL_NV_path_rendering"))
- printf("GL_NV_path_rendering is not supported.\n");
+ if (glIsSupportedREGAL("GL_REGAL_extension_query"))
+ {
+ printf("GL_REGAL_extension_query is supported.\n");
+
+ if (glIsSupportedREGAL("GL_EXT_debug_marker"))
+ printf("GL_EXT_debug_marker is supported.\n");
+ else
+ printf("GL_EXT_debug_marker is not supported.\n");
+
+ if (glIsSupportedREGAL("GL_EXT_framebuffer_object"))
+ printf("GL_EXT_framebuffer_object is supported.\n");
+ else
+ printf("GL_EXT_framebuffer_object is not supported.\n");
+
+ if (glIsSupportedREGAL("GL_EXT_direct_state_access"))
+ printf("GL_EXT_direct_state_access is supported.\n");
+ else
+ printf("GL_EXT_direct_state_access is not supported.\n");
+
+ if (glIsSupportedREGAL("GL_NV_path_rendering"))
+ printf("GL_NV_path_rendering is supported.\n");
+ else
+ printf("GL_NV_path_rendering is not supported.\n");
+ }
glutTimerFunc(16, myTick, 0);
glutDisplayFunc(myDisplay);
@@ -246,14 +246,19 @@ int main(int argc, char **argv)
}
glutCreateWindow("Classic PostScript tiger NV_path_rendering example");
-
+
// Regal workaround for OSX GLUT
#ifdef __APPLE__
extern void *CGLGetCurrentContext(void);
RegalMakeCurrent(CGLGetCurrentContext());
#endif
+ status = glewInit();
+ if (status != GLEW_OK) {
+ fatalError("OpenGL Extension Wrangler (GLEW) failed to initialize");
+ }
+
printf("vendor: %s\n", glGetString(GL_VENDOR));
printf("version: %s\n", glGetString(GL_VERSION));
printf("renderer: %s\n", glGetString(GL_RENDERER));
@@ -282,10 +287,12 @@ int main(int argc, char **argv)
glutAddMenuEntry("[Esc] Quit", 27);
glutAttachMenu(GLUT_RIGHT_BUTTON);
- status = glewInit();
- if (status != GLEW_OK) {
- fatalError("OpenGL Extension Wrangler (GLEW) failed to initialize");
- }
+ if (!glewIsSupported("GL_REGAL_extension_query"))
+ printf("GL_REGAL_extension_query is not supported.\n");
+
+ if (!glewIsSupported("GL_EXT_debug_marker"))
+ printf("GL_EXT_debug_marker is not supported.\n");
+
hasDSA = glewIsSupported("GL_EXT_direct_state_access");
if (!hasDSA) {
fatalError("OpenGL implementation doesn't support GL_EXT_direct_state_access (you should be using NVIDIA GPUs...)");
@@ -7183,6 +7183,23 @@ typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat*
#endif /* GL_EXT_cull_vertex */
+/* -------------------------- GL_EXT_debug_marker -------------------------- */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+
+typedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker);
+typedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void);
+typedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker);
+
+#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT)
+#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT)
+#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT)
+
+#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker)
+
+#endif /* GL_EXT_debug_marker */
+
/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */
#ifndef GL_EXT_depth_bounds_test
@@ -14674,6 +14691,10 @@ GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT;
GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT;
GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT;
+GLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT;
+GLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT;
+GLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT;
+
GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT;
GLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT;
@@ -16015,6 +16036,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex;
+GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2;
@@ -7183,6 +7183,23 @@ typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat*
#endif /* GL_EXT_cull_vertex */
+/* -------------------------- GL_EXT_debug_marker -------------------------- */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+
+typedef void (GLAPIENTRY * PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar* marker);
+typedef void (GLAPIENTRY * PFNGLPOPGROUPMARKEREXTPROC) (void);
+typedef void (GLAPIENTRY * PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar* marker);
+
+#define glInsertEventMarkerEXT GLEW_GET_FUN(__glewInsertEventMarkerEXT)
+#define glPopGroupMarkerEXT GLEW_GET_FUN(__glewPopGroupMarkerEXT)
+#define glPushGroupMarkerEXT GLEW_GET_FUN(__glewPushGroupMarkerEXT)
+
+#define GLEW_EXT_debug_marker GLEW_GET_VAR(__GLEW_EXT_debug_marker)
+
+#endif /* GL_EXT_debug_marker */
+
/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */
#ifndef GL_EXT_depth_bounds_test
@@ -14674,6 +14691,10 @@ GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT;
GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT;
GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT;
+GLEW_FUN_EXPORT PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT;
+GLEW_FUN_EXPORT PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT;
+GLEW_FUN_EXPORT PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT;
+
GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT;
GLEW_FUN_EXPORT PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT;
@@ -16015,6 +16036,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex;
+GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access;
GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2;
View
@@ -1384,6 +1384,10 @@ PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT = NULL;
PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT = NULL;
PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT = NULL;
+PFNGLINSERTEVENTMARKEREXTPROC __glewInsertEventMarkerEXT = NULL;
+PFNGLPOPGROUPMARKEREXTPROC __glewPopGroupMarkerEXT = NULL;
+PFNGLPUSHGROUPMARKEREXTPROC __glewPushGroupMarkerEXT = NULL;
+
PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT = NULL;
PFNGLBINDMULTITEXTUREEXTPROC __glewBindMultiTextureEXT = NULL;
@@ -2724,6 +2728,7 @@ GLboolean __GLEW_EXT_convolution = GL_FALSE;
GLboolean __GLEW_EXT_coordinate_frame = GL_FALSE;
GLboolean __GLEW_EXT_copy_texture = GL_FALSE;
GLboolean __GLEW_EXT_cull_vertex = GL_FALSE;
+GLboolean __GLEW_EXT_debug_marker = GL_FALSE;
GLboolean __GLEW_EXT_depth_bounds_test = GL_FALSE;
GLboolean __GLEW_EXT_direct_state_access = GL_FALSE;
GLboolean __GLEW_EXT_draw_buffers2 = GL_FALSE;
@@ -5597,6 +5602,21 @@ static GLboolean _glewInit_GL_EXT_cull_vertex (GLEW_CONTEXT_ARG_DEF_INIT)
#endif /* GL_EXT_cull_vertex */
+#ifdef GL_EXT_debug_marker
+
+static GLboolean _glewInit_GL_EXT_debug_marker (GLEW_CONTEXT_ARG_DEF_INIT)
+{
+ GLboolean r = GL_FALSE;
+
+ r = ((glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glInsertEventMarkerEXT")) == NULL) || r;
+ r = ((glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPopGroupMarkerEXT")) == NULL) || r;
+ r = ((glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)glewGetProcAddress((const GLubyte*)"glPushGroupMarkerEXT")) == NULL) || r;
+
+ return r;
+}
+
+#endif /* GL_EXT_debug_marker */
+
#ifdef GL_EXT_depth_bounds_test
static GLboolean _glewInit_GL_EXT_depth_bounds_test (GLEW_CONTEXT_ARG_DEF_INIT)
@@ -9241,6 +9261,10 @@ GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
CONST_CAST(GLEW_EXT_cull_vertex) = _glewSearchExtension("GL_EXT_cull_vertex", extStart, extEnd);
if (glewExperimental || GLEW_EXT_cull_vertex) CONST_CAST(GLEW_EXT_cull_vertex) = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT);
#endif /* GL_EXT_cull_vertex */
+#ifdef GL_EXT_debug_marker
+ CONST_CAST(GLEW_EXT_debug_marker) = _glewSearchExtension("GL_EXT_debug_marker", extStart, extEnd);
+ if (glewExperimental || GLEW_EXT_debug_marker) CONST_CAST(GLEW_EXT_debug_marker) = !_glewInit_GL_EXT_debug_marker(GLEW_CONTEXT_ARG_VAR_INIT);
+#endif /* GL_EXT_debug_marker */
#ifdef GL_EXT_depth_bounds_test
CONST_CAST(GLEW_EXT_depth_bounds_test) = _glewSearchExtension("GL_EXT_depth_bounds_test", extStart, extEnd);
if (glewExperimental || GLEW_EXT_depth_bounds_test) CONST_CAST(GLEW_EXT_depth_bounds_test) = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT);
@@ -13597,6 +13621,13 @@ GLboolean GLEWAPIENTRY glewIsSupported (const char* name)
continue;
}
#endif
+#ifdef GL_EXT_debug_marker
+ if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12))
+ {
+ ret = GLEW_EXT_debug_marker;
+ continue;
+ }
+#endif
#ifdef GL_EXT_depth_bounds_test
if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17))
{
@@ -2998,6 +2998,19 @@ static void _glewInfo_GL_EXT_cull_vertex (void)
#endif /* GL_EXT_cull_vertex */
+#ifdef GL_EXT_debug_marker
+
+static void _glewInfo_GL_EXT_debug_marker (void)
+{
+ glewPrintExt("GL_EXT_debug_marker", GLEW_EXT_debug_marker, glewIsSupported("GL_EXT_debug_marker"), glewGetExtension("GL_EXT_debug_marker"));
+
+ glewInfoFunc("glInsertEventMarkerEXT", glInsertEventMarkerEXT == NULL);
+ glewInfoFunc("glPopGroupMarkerEXT", glPopGroupMarkerEXT == NULL);
+ glewInfoFunc("glPushGroupMarkerEXT", glPushGroupMarkerEXT == NULL);
+}
+
+#endif /* GL_EXT_debug_marker */
+
#ifdef GL_EXT_depth_bounds_test
static void _glewInfo_GL_EXT_depth_bounds_test (void)
@@ -8189,6 +8202,9 @@ static void glewInfo (void)
#ifdef GL_EXT_cull_vertex
_glewInfo_GL_EXT_cull_vertex();
#endif /* GL_EXT_cull_vertex */
+#ifdef GL_EXT_debug_marker
+ _glewInfo_GL_EXT_debug_marker();
+#endif /* GL_EXT_debug_marker */
#ifdef GL_EXT_depth_bounds_test
_glewInfo_GL_EXT_depth_bounds_test();
#endif /* GL_EXT_depth_bounds_test */
View
@@ -44,6 +44,8 @@ REGAL_GLOBAL_BEGIN
#include "RegalState.h"
#include "RegalHelper.h"
+#include "RegalMarker.h"
+
void RegalMakeCurrent( RegalSystemContext ctx )
{
::REGAL_NAMESPACE_INTERNAL::RegalPrivateMakeCurrent( ctx );
@@ -31463,6 +31465,11 @@ REGAL_DECL void REGAL_CALL glInsertEventMarkerEXT(GLsizei length, const GLchar *
RegalAssert(rCtx->dsp->curr);
RegalAssert(rCtx->dsp->curr->glInsertEventMarkerEXT);
RegalAssert(rCtx->dsp->curr->glInsertEventMarkerEXT != glInsertEventMarkerEXT);
+ if (rCtx->marker) {
+ rCtx->marker->InsertEventMarker( rCtx, length, marker );
+ RegalAssert(rCtx->info);
+ if (!rCtx->info->gl_ext_debug_marker) return;
+ }
rCtx->dsp->curr->glInsertEventMarkerEXT(length, marker);
}
@@ -31476,6 +31483,11 @@ REGAL_DECL void REGAL_CALL glPushGroupMarkerEXT(GLsizei length, const GLchar *ma
RegalAssert(rCtx->dsp->curr);
RegalAssert(rCtx->dsp->curr->glPushGroupMarkerEXT);
RegalAssert(rCtx->dsp->curr->glPushGroupMarkerEXT != glPushGroupMarkerEXT);
+ if (rCtx->marker) {
+ rCtx->marker->PushGroupMarker( rCtx, length, marker );
+ RegalAssert(rCtx->info);
+ if (!rCtx->info->gl_ext_debug_marker) return;
+ }
rCtx->dsp->curr->glPushGroupMarkerEXT(length, marker);
}
@@ -31489,6 +31501,11 @@ REGAL_DECL void REGAL_CALL glPopGroupMarkerEXT(void)
RegalAssert(rCtx->dsp->curr);
RegalAssert(rCtx->dsp->curr->glPopGroupMarkerEXT);
RegalAssert(rCtx->dsp->curr->glPopGroupMarkerEXT != glPopGroupMarkerEXT);
+ if (rCtx->marker) {
+ rCtx->marker->PopGroupMarker( rCtx );
+ RegalAssert(rCtx->info);
+ if (!rCtx->info->gl_ext_debug_marker) return;
+ }
rCtx->dsp->curr->glPopGroupMarkerEXT();
}
@@ -43,8 +43,8 @@ REGAL_GLOBAL_BEGIN
#include "RegalDispatchState.h"
#include "RegalDebugInfo.h"
#include "RegalContextInfo.h"
-#include "RegalObj.h"
#include "RegalMarker.h"
+#include "RegalObj.h"
#include "RegalPpa.h"
#include "RegalBin.h"
#include "RegalDsa.h"
@@ -61,8 +61,8 @@ RegalContext::RegalContext()
: dsp(new DispatchState()),
dbg(NULL),
info(NULL),
- obj(NULL),
marker(NULL),
+ obj(NULL),
ppa(NULL),
bin(NULL),
dsa(NULL),
@@ -94,16 +94,20 @@ RegalContext::Init()
if
(
Config::forceEmulation ||
- Config::enableEmulation &&
(
- info->core ||
- info->gles ||
- info->compat && !info->gl_ext_direct_state_access
+ Config::enableEmulation &&
+ (
+ info->core ||
+ info->gles ||
+ ( info->compat && !info->gl_ext_direct_state_access )
+ )
)
)
#endif
{
- emuLevel = 8;
+ marker = new Marker;
+ // emu
+ emuLevel = 7;
#if REGAL_EMU_VAO
if (Config::enableEmuVao)
{
@@ -144,14 +148,11 @@ RegalContext::Init()
ppa->Init( this );
}
#endif /* REGAL_EMU_PPA */
- marker = new RegalMarker;
- marker->emuLevel = 6;
- marker->Init( this );
#if REGAL_EMU_OBJ
if (Config::enableEmuObj)
{
obj = new RegalObj;
- obj->emuLevel = 8;
+ obj->emuLevel = 7;
obj->Init( this );
}
#endif /* REGAL_EMU_OBJ */
@@ -164,9 +165,9 @@ RegalContext::~RegalContext()
ITrace("RegalContext::~RegalContext");
delete dsp;
delete info;
+ delete marker;
// emu
delete obj;
- delete marker;
delete ppa;
delete bin;
delete dsa;
Oops, something went wrong. Retry.

0 comments on commit db681bc

Please sign in to comment.