#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;
}
}
+ /**
+ * 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,
return;
if (ctx->Debug.Callback) {
+ GLenum gl_type = debug_type_enums[type];
+ GLenum gl_severity = debug_severity_enums[severity];
+
+ if (ctx->Debug.ARBCallback) {
+ gl_severity = remap_severity(gl_severity);
+ gl_type = remap_type(gl_type);
+ }
ctx->Debug.Callback(debug_source_enums[source],
- debug_type_enums[type],
+ gl_type,
id,
- debug_severity_enums[severity],
+ gl_severity,
len, buf, ctx->Debug.CallbackData);
return;
}
*/
static GLsizei
_mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
- GLuint *id, GLenum *severity, GLsizei bufSize, char *buf)
+ GLuint *id, GLenum *severity, GLsizei bufSize, char *buf,
+ unsigned caller)
{
struct gl_debug_msg *msg;
GLsizei length;
if (bufSize < length && buf != NULL)
return 0;
- if (severity)
+ if (severity) {
*severity = debug_severity_enums[msg->severity];
+ if (caller == MESSAGE_LOG_ARB)
+ *severity = remap_severity(*severity);
+ }
if (source)
*source = debug_source_enums[msg->source];
- if (type)
+ if (type) {
*type = debug_type_enums[msg->type];
+ if (caller == MESSAGE_LOG_ARB)
+ *type = remap_type(*type);
+ }
if (id)
*id = msg->id;
GLsizei* lengths, GLchar* messageLog,
unsigned caller, const char *callerstr)
{
-#define MESSAGE_LOG 1
-#define MESSAGE_LOG_ARB 2
GET_CURRENT_CONTEXT(ctx);
GLuint ret;
for (ret = 0; ret < count; ret++) {
GLsizei written = _mesa_get_msg(ctx, sources, types, ids, severities,
- logSize, messageLog);
+ logSize, messageLog, caller);
if (!written)
break;
GET_CURRENT_CONTEXT(ctx);
ctx->Debug.Callback = callback;
ctx->Debug.CallbackData = userParam;
+ ctx->Debug.ARBCallback = GL_FALSE;
}
void GLAPIENTRY
GET_CURRENT_CONTEXT(ctx);
ctx->Debug.Callback = callback;
ctx->Debug.CallbackData = userParam;
+ ctx->Debug.ARBCallback = GL_TRUE;
}
void