On 03/03/2014 01:33 AM, Timothy Arceri wrote:
The spec doesn't mention how ARB_debug_output and KHR_debug should
  interact but testing with Nvidia and AMD shows this is how they both
  treat these functions

Signed-off-by: Timothy Arceri <t_arc...@yahoo.com.au>
---
  src/mapi/glapi/gen/ARB_debug_output.xml |   8 +-
  src/mesa/main/errors.c                  | 293 ++++++++------------------------
  src/mesa/main/errors.h                  |  15 --
  src/mesa/main/mtypes.h                  |   1 -
  4 files changed, 78 insertions(+), 239 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_debug_output.xml 
b/src/mapi/glapi/gen/ARB_debug_output.xml
index 11f268d..0468d57 100644
--- a/src/mapi/glapi/gen/ARB_debug_output.xml
+++ b/src/mapi/glapi/gen/ARB_debug_output.xml
@@ -52,7 +52,7 @@
      <enum name="DEBUG_SEVERITY_LOW_ARB"                    value="0x9148"/>


-    <function name="DebugMessageControlARB" offset="assign">
+    <function name="DebugMessageControlARB" alias="DebugMessageControl">
          <param name="source" type="GLenum"/>
          <param name="type" type="GLenum"/>
          <param name="severity" type="GLenum"/>
@@ -61,7 +61,7 @@
          <param name="enabled" type="GLboolean"/>
      </function>

-    <function name="DebugMessageInsertARB" offset="assign">
+    <function name="DebugMessageInsertARB" alias="DebugMessageInsert">
          <param name="source" type="GLenum"/>
          <param name="type" type="GLenum"/>
          <param name="id" type="GLuint"/>
@@ -70,12 +70,12 @@
          <param name="buf" type="const GLcharARB *"/>
      </function>

-    <function name="DebugMessageCallbackARB" offset="assign">
+    <function name="DebugMessageCallbackARB" alias="DebugMessageCallback">
          <param name="callback" type="GLDEBUGPROCARB"/>
          <param name="userParam" type="const GLvoid *"/>
      </function>

-    <function name="GetDebugMessageLogARB" offset="assign">
+    <function name="GetDebugMessageLogARB" alias="GetDebugMessageLog">
          <return type="GLuint"/>
          <param name="count" type="GLuint"/>
          <param name="bufsize" type="GLsizei"/>
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 5f4eac6..003d0d4 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -39,9 +39,6 @@
  #include "hash_table.h"
  #include "glapi/glthread.h"

-#define MESSAGE_LOG 1
-#define MESSAGE_LOG_ARB 2
-
  _glthread_DECLARE_STATIC_MUTEX(DynamicIDMutex);
  static GLuint NextDynamicID = 1;

@@ -374,40 +371,6 @@ store_message_details(struct gl_debug_msg *emptySlot,


  /**
- * Remap any type exclusive to KHR_debug to something suitable
- * for ARB_debug_output
- */
-inline static int
-remap_type(GLenum type) {
-
-   switch(type) {
-   case GL_DEBUG_TYPE_MARKER:
-   case GL_DEBUG_TYPE_PUSH_GROUP:
-   case GL_DEBUG_TYPE_POP_GROUP:
-      type = GL_DEBUG_TYPE_OTHER;
-   default:
-      ;
-   }
-
-  return type;
-}
-
-
-/**
- * Remap severity exclusive to KHR_debug to something suitable
- * for ARB_debug_output
- */
-inline static int
-remap_severity(GLenum severity) {
-
-   if (GL_DEBUG_SEVERITY_NOTIFICATION == severity)
-      severity = GL_DEBUG_SEVERITY_LOW;
-
-   return severity;
-}
-
-
-/**
   * 'buf' is not necessarily a null-terminated string. When logging, copy
   * 'len' characters from it, store them in a new, null-terminated string,
   * and remember the number of bytes used by that string, *including*
@@ -434,10 +397,6 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source 
source,
         GLenum gl_type = debug_type_enums[type];
         GLenum gl_severity = debug_severity_enums[severity];

-       if (debug->ARBCallback) {
-          gl_severity = remap_severity(gl_severity);
-          gl_type = remap_type(gl_type);
-      }
        debug->Callback(debug_source_enums[source], gl_type, id, gl_severity,
                        len, buf, debug->CallbackData);
        return;
@@ -471,8 +430,7 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source 
source,
   */
  static GLsizei
  get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
-        GLuint *id, GLenum *severity, GLsizei bufSize, char *buf,
-        unsigned caller)
+        GLuint *id, GLenum *severity, GLsizei bufSize, char *buf)
  {
     struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
     struct gl_debug_msg *msg;
@@ -491,8 +449,6 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum 
*type,

     if (severity) {
        *severity = debug_severity_enums[msg->severity];
-      if (caller == MESSAGE_LOG_ARB)
-         *severity = remap_severity(*severity);
     }

     if (source) {
@@ -501,8 +457,6 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum 
*type,

     if (type) {
        *type = debug_type_enums[msg->type];
-      if (caller == MESSAGE_LOG_ARB)
-         *type = remap_type(*type);
     }

     if (id) {
@@ -530,12 +484,9 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum 
*type,

  /**
   * Verify that source, type, and severity are valid enums.
- * glDebugMessageInsertARB only accepts two values for 'source',
- * and glDebugMessageControlARB will additionally accept GL_DONT_CARE
- * in any parameter, so handle those cases specially.
   *
- * There is also special cases for handling values available in
- * GL_KHR_debug that are not avaliable in GL_ARB_debug_output
+ * The 'caller' param is used for handling values available
+ * only in glDebugMessageInsert or glDebugMessageControl
   */
  static GLboolean
  validate_params(struct gl_context *ctx, unsigned caller,
@@ -544,8 +495,6 @@ validate_params(struct gl_context *ctx, unsigned caller,
  {
  #define INSERT 1
  #define CONTROL 2
-#define INSERT_ARB 3
-#define CONTROL_ARB 4
     switch(source) {
     case GL_DEBUG_SOURCE_APPLICATION_ARB:
     case GL_DEBUG_SOURCE_THIRD_PARTY_ARB:
@@ -554,10 +503,10 @@ validate_params(struct gl_context *ctx, unsigned caller,
     case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB:
     case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB:
     case GL_DEBUG_SOURCE_OTHER_ARB:
-      if (caller != INSERT || caller == INSERT_ARB)
+      if (caller != INSERT)
           break;

else goto error;  ?


     case GL_DONT_CARE:
-      if (caller == CONTROL || caller == CONTROL_ARB)
+      if (caller == CONTROL)
           break;

else goto error;  ?

and more casese below...


     default:
        goto error;
@@ -570,13 +519,10 @@ validate_params(struct gl_context *ctx, unsigned caller,
     case GL_DEBUG_TYPE_PERFORMANCE_ARB:
     case GL_DEBUG_TYPE_PORTABILITY_ARB:
     case GL_DEBUG_TYPE_OTHER_ARB:
-      break;
     case GL_DEBUG_TYPE_MARKER:
-      /* this value is only valid for GL_KHR_debug functions */
-      if (caller == CONTROL || caller == INSERT)
-         break;
+      break;
     case GL_DONT_CARE:
-      if (caller == CONTROL || caller == CONTROL_ARB)
+      if (caller == CONTROL)
           break;
     default:
        goto error;
@@ -586,13 +532,10 @@ validate_params(struct gl_context *ctx, unsigned caller,
     case GL_DEBUG_SEVERITY_HIGH_ARB:
     case GL_DEBUG_SEVERITY_MEDIUM_ARB:
     case GL_DEBUG_SEVERITY_LOW_ARB:
-      break;
     case GL_DEBUG_SEVERITY_NOTIFICATION:
-      /* this value is only valid for GL_KHR_debug functions */
-      if (caller == CONTROL || caller == INSERT)
-         break;
+      break;
     case GL_DONT_CARE:
-      if (caller == CONTROL || caller == CONTROL_ARB)
+      if (caller == CONTROL)
           break;
     default:
        goto error;
@@ -707,44 +650,6 @@ control_app_messages(struct gl_context *ctx, GLenum 
esource, GLenum etype,
[...]

Otherwise, the series looks OK to me.

Reviewed-by: Brian Paul <bri...@vmware.com>


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

Reply via email to