On 08/26/2013 04:43 AM, Timothy Arceri wrote:
[...]
@@ -722,13 +769,112 @@ void GLAPIENTRY
  _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
                       const GLchar *message)
  {
+   const char *callerstr = "glPushDebugGroup";
+   int s, t, sev;
+   GLint prevStackDepth;
+   GLint currStackDepth;
+   struct gl_debug_msg *emptySlot;

+   GET_CURRENT_CONTEXT(ctx);
+
+   if (ctx->Debug.GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) {
+      _mesa_error( ctx, GL_STACK_OVERFLOW, callerstr );
+      return;
+   }
+
+   switch(source) {
+   case GL_DEBUG_SOURCE_APPLICATION:
+   case GL_DEBUG_SOURCE_THIRD_PARTY:
+      break;
+   default:
+      _mesa_error(ctx, GL_INVALID_ENUM, "bad value passed to %s"
+                  "(source=0x%x)", callerstr, source);
+      return;
+   }
+
+   message_insert(source, GL_DEBUG_TYPE_PUSH_GROUP, id,
+                  GL_DEBUG_SEVERITY_NOTIFICATION, length,
+                  message, callerstr);
+
+   prevStackDepth = ctx->Debug.GroupStackDepth;
+   ctx->Debug.GroupStackDepth++;
+   currStackDepth = ctx->Debug.GroupStackDepth;
+
+   /* pop reuses the message details from push so we store this */
+   if (length < 0)
+      length = strlen(message);
+   emptySlot = &ctx->Debug.DebugGroupMsgs[ctx->Debug.GroupStackDepth];
+   store_message_details(emptySlot, gl_enum_to_debug_source(source),
+                         gl_enum_to_debug_source(GL_DEBUG_TYPE_PUSH_GROUP),
+                         id,
+                   gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION),
+                         length, message);
+
+   /* inherit the control volume of the debug group previously residing on
+    * the top of the debug group stack
+    */
+   for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++)
+      for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) {
+         /* copy id settings */
+         ctx->Debug.Namespaces[currStackDepth][s][t].IDs =
+            _mesa_HashClone(ctx->Debug.Namespaces[prevStackDepth][s][t].IDs);
+
+         for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) {
+            struct gl_debug_severity *entry, *prevEntry;
+            struct simple_node *node;
+
+            /* copy default settings for unknown ids */
+            ctx->Debug.Defaults[currStackDepth][sev][s][t] = 
ctx->Debug.Defaults[prevStackDepth][sev][s][t];
+
+            /* copy know id severity settings */

s/know/known/


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to