Class AMDDebugOutput
- java.lang.Object
-
- org.lwjgl.opengl.AMDDebugOutput
-
public class AMDDebugOutput extends java.lang.Object
Native bindings to the AMD_debug_output extension.This extension allows the GL to notify applications when various debug events occur in contexts that have been created with the debug flag, as provided by
WGL_ARB_create_context
andGLX_ARB_create_context
.These events are represented in the form of enumerable messages with an included human-readable translation. Examples of debug events include incorrect use of the GL, warnings of undefined behavior, and performance warnings.
A message is uniquely identified by a category and an implementation-dependent ID within that category. Message categories are general and are used to organize large groups of similar messages together. Examples of categories include GL errors, performance warnings, and deprecated functionality warnings. Each message is also assigned a severity level that denotes roughly how "important" that message is in comparison to other messages across all categories. For example, notification of a GL error would have a higher severity than a performance warning due to redundant state changes.
Messages are communicated to the application through an application-defined callback function that is called by the GL implementation on each debug message. The motivation for the callback routine is to free application developers from actively having to query whether any GL error or other debuggable event has happened after each call to a GL function. With a callback, developers can keep their code free of debug checks, and only have to react to messages as they occur. In order to support indirect rendering, a message log is also provided that stores copies of recent messages until they are actively queried.
To control the volume of debug output, messages can be disabled either individually by ID, or entire groups of messages can be turned off based on category or severity.
The only requirement on the minimum quantity and type of messages that implementations of this extension must support is that a message must be sent notifying the application whenever any GL error occurs. Any further messages are left to the implementation. Implementations do not have to output messages from all categories listed by this extension in order to support this extension, and new categories can be added by other extensions.
This extension places no restrictions or requirements on any additional functionality provided by the debug context flag through other extensions.
Requires
WGL_ARB_create_context
orGLX_ARB_create_context
.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
GL_DEBUG_CATEGORY_API_ERROR_AMD
GL_DEBUG_CATEGORY_APPLICATION_AMD
GL_DEBUG_CATEGORY_DEPRECATION_AMD
GL_DEBUG_CATEGORY_OTHER_AMD
GL_DEBUG_CATEGORY_PERFORMANCE_AMD
GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD
GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD
GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMDTokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, and DEBUGPROCAMD callback function forcategory
.static int
GL_DEBUG_LOGGED_MESSAGES_AMD
Tokens accepted by GetIntegerv.static int
GL_DEBUG_SEVERITY_HIGH_AMD
GL_DEBUG_SEVERITY_LOW_AMD
GL_DEBUG_SEVERITY_MEDIUM_AMDTokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, DebugMessageInsertAMD, and DEBUGPROCAMD callback function forseverity
.static int
GL_MAX_DEBUG_LOGGED_MESSAGES_AMD
GL_MAX_DEBUG_MESSAGE_LENGTH_AMDTokens accepted by GetIntegerv.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
glDebugMessageCallbackAMD(GLDebugMessageAMDCallbackI callback, long userParam)
Specifies a callback to receive debugging messages from the GL.static void
glDebugMessageEnableAMD(int category, int severity, int[] ids, boolean enabled)
Array version of:DebugMessageEnableAMD
static void
glDebugMessageEnableAMD(int category, int severity, int id, boolean enabled)
Allows disabling or enabling generation of subsets of messages.static void
glDebugMessageEnableAMD(int category, int severity, java.nio.IntBuffer ids, boolean enabled)
Allows disabling or enabling generation of subsets of messages.static void
glDebugMessageInsertAMD(int category, int severity, int id, java.nio.ByteBuffer buf)
Injects an application-supplied message into the debug message stream.static void
glDebugMessageInsertAMD(int category, int severity, int id, java.lang.CharSequence buf)
Injects an application-supplied message into the debug message stream.static int
glGetDebugMessageLogAMD(int count, int[] categories, int[] severities, int[] ids, int[] lengths, java.nio.ByteBuffer messageLog)
Array version of:GetDebugMessageLogAMD
static int
glGetDebugMessageLogAMD(int count, java.nio.IntBuffer categories, java.nio.IntBuffer severities, java.nio.IntBuffer ids, java.nio.IntBuffer lengths, java.nio.ByteBuffer messageLog)
Retrieves messages from the debug message log.
-
-
-
Field Detail
-
GL_MAX_DEBUG_MESSAGE_LENGTH_AMD, GL_MAX_DEBUG_LOGGED_MESSAGES_AMD, GL_DEBUG_LOGGED_MESSAGES_AMD
Tokens accepted by GetIntegerv.
-
GL_DEBUG_SEVERITY_HIGH_AMD, GL_DEBUG_SEVERITY_MEDIUM_AMD, GL_DEBUG_SEVERITY_LOW_AMD
Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, DebugMessageInsertAMD, and DEBUGPROCAMD callback function forseverity
.
-
GL_DEBUG_CATEGORY_API_ERROR_AMD, GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD, GL_DEBUG_CATEGORY_DEPRECATION_AMD, GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD, GL_DEBUG_CATEGORY_PERFORMANCE_AMD, GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD, GL_DEBUG_CATEGORY_APPLICATION_AMD, GL_DEBUG_CATEGORY_OTHER_AMD
Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, and DEBUGPROCAMD callback function forcategory
.
-
-
Method Detail
-
glDebugMessageEnableAMD
public static void glDebugMessageEnableAMD(int category, int severity, java.nio.IntBuffer ids, boolean enabled)
Allows disabling or enabling generation of subsets of messages. Ifenabled
isTRUE
, the referenced subset of messages is enabled. IfFALSE
, then those messages are disabled. This command can reference different subsets of messages by varying its parameter values in the following ways:- To reference all messages, let
category
,severity
, andcount
all be zero. The value ofids
is ignored in this case. - To reference all messages across all categories with a specific severity level, let
category
andcount
be zero and letseverity
identify the severity level. The value ofids
is ignored in this case. - To reference all messages within a single category, let
category
identify the referenced category and letseverity
andcount
be zero. The value ofids
is ignored in this case. - To reference all messages within a single category and at a specific severity level, let
category
identify the category andseverity
identify the severity level, and letcount
be zero. The value ofids
is ignored in this case. - To reference specific messages by ID within a single category, let
category
identify the category, letseverity
be zero, letcount
be greater than zero and letids
identify the IDs ofcount
messages within the identified category. Operations on message IDs that are not valid within the category are silently ignored.
In all of the above cases, if
category
is non-zero and specifies an invalid category, the errorINVALID_ENUM
is generated. Similarly ifseverity
is non-zero and is an invalid severity level, the errorINVALID_ENUM
is generated. Ifcount
is less than zero, the errorINVALID_VALUE
is generated. If the parameters do not fall into one of the cases defined above, the errorINVALID_VALUE
is generated. The errorINVALID_OPERATION
is generated if this command is called in a non-debug context.Although messages are grouped into categories and severities, and entire groups of messages can be turned off with a single call, there is no explicit per-category or per-severity enabled state. Instead the enabled state is stored individually for each message. There is no difference between disabling a category of messages with a single call, and enumerating all messages of that category and individually disabling each of them by their ID.
All messages of severity level
DEBUG_SEVERITY_MEDIUM_AMD
andDEBUG_SEVERITY_HIGH_AMD
in all categories are initially enabled, and all messages atDEBUG_SEVERITY_LOW_AMD
are initially disabled.- Parameters:
category
- the message category. One of:severity
- the message severity. One of:DEBUG_SEVERITY_HIGH_AMD
DEBUG_SEVERITY_MEDIUM_AMD
DEBUG_SEVERITY_LOW_AMD
ids
- an array of message idsenabled
- whether to enable or disable the referenced subset of messages
- To reference all messages, let
-
glDebugMessageEnableAMD
public static void glDebugMessageEnableAMD(int category, int severity, int id, boolean enabled)
Allows disabling or enabling generation of subsets of messages. Ifenabled
isTRUE
, the referenced subset of messages is enabled. IfFALSE
, then those messages are disabled. This command can reference different subsets of messages by varying its parameter values in the following ways:- To reference all messages, let
category
,severity
, andcount
all be zero. The value ofids
is ignored in this case. - To reference all messages across all categories with a specific severity level, let
category
andcount
be zero and letseverity
identify the severity level. The value ofids
is ignored in this case. - To reference all messages within a single category, let
category
identify the referenced category and letseverity
andcount
be zero. The value ofids
is ignored in this case. - To reference all messages within a single category and at a specific severity level, let
category
identify the category andseverity
identify the severity level, and letcount
be zero. The value ofids
is ignored in this case. - To reference specific messages by ID within a single category, let
category
identify the category, letseverity
be zero, letcount
be greater than zero and letids
identify the IDs ofcount
messages within the identified category. Operations on message IDs that are not valid within the category are silently ignored.
In all of the above cases, if
category
is non-zero and specifies an invalid category, the errorINVALID_ENUM
is generated. Similarly ifseverity
is non-zero and is an invalid severity level, the errorINVALID_ENUM
is generated. Ifcount
is less than zero, the errorINVALID_VALUE
is generated. If the parameters do not fall into one of the cases defined above, the errorINVALID_VALUE
is generated. The errorINVALID_OPERATION
is generated if this command is called in a non-debug context.Although messages are grouped into categories and severities, and entire groups of messages can be turned off with a single call, there is no explicit per-category or per-severity enabled state. Instead the enabled state is stored individually for each message. There is no difference between disabling a category of messages with a single call, and enumerating all messages of that category and individually disabling each of them by their ID.
All messages of severity level
DEBUG_SEVERITY_MEDIUM_AMD
andDEBUG_SEVERITY_HIGH_AMD
in all categories are initially enabled, and all messages atDEBUG_SEVERITY_LOW_AMD
are initially disabled.- Parameters:
category
- the message category. One of:severity
- the message severity. One of:DEBUG_SEVERITY_HIGH_AMD
DEBUG_SEVERITY_MEDIUM_AMD
DEBUG_SEVERITY_LOW_AMD
enabled
- whether to enable or disable the referenced subset of messages
- To reference all messages, let
-
glDebugMessageInsertAMD
public static void glDebugMessageInsertAMD(int category, int severity, int id, java.nio.ByteBuffer buf) public static void glDebugMessageInsertAMD(int category, int severity, int id, java.lang.CharSequence buf)
Injects an application-supplied message into the debug message stream.The value of
id
specifies the ID for the message andseverity
indicates its severity level as defined by the application. Ifseverity
is not a valid severity level, the errorINVALID_ENUM
will be generated. The value ofcategory
must beDEBUG_CATEGORY_APPLICATION_AMD
, or the errorINVALID_ENUM
will be generated. The stringbuf
contains the string representation of the message. The parameterlength
contains the size of the message's string representation, excluding the null-terminator. Iflength
is zero, then its value is derived from the string-length ofbuf
andbuf
must contain a null-terminated string. The errorINVALID_VALUE
will be generated iflength
is less than zero or its derived value is larger than or equal toMAX_DEBUG_MESSAGE_LENGTH_AMD
. The errorINVALID_OPERATION
will be generated if this function is called in a non-debug context.- Parameters:
category
- the message category. Must be:DEBUG_CATEGORY_APPLICATION_AMD
severity
- the message severity. One of:DEBUG_SEVERITY_HIGH_AMD
DEBUG_SEVERITY_MEDIUM_AMD
DEBUG_SEVERITY_LOW_AMD
id
- the message idbuf
- the message characters
-
glDebugMessageCallbackAMD
public static void glDebugMessageCallbackAMD(GLDebugMessageAMDCallbackI callback, long userParam)
Specifies a callback to receive debugging messages from the GL.With
callback
storing the address of the callback function. This function's signature must follow the type definition of DEBUGPROCAMD, and its calling convention must be the same as the calling convention of GL functions. Anything else will result in undefined behavior. Only one debug callback can be specified for the current context, and further calls overwrite the previous callback. Specifying zero as the value ofcallback
clears the current callback and disables message output through callbacks. Applications can specify user-specified data through the pointeruserParam
. The context will store this pointer and will include it as one of the parameters of each call to the callback function. The errorINVALID_OPERATION
will be generated if this function is called for contexts created without the debug flag.If the application has specified a callback function in a debug context, the implementation will call that function whenever any unfiltered message is generated. The ID, category, and severity of the message are specified by the callback parameters
id
,category
andseverity
, respectively. The string representation of the message is stored inmessage
and its length (excluding the null-terminator) is stored inlength
. The parameteruserParam
is the user-specified value that was passed when calling DebugMessageCallbackAMD. The memory formessage
is allocated, owned and released by the implementation, and should only be considered valid for the duration of the callback function call. While it is allowed to concurrently use multiple debug contexts with the same debug callback function, note that it is the application's responsibility to ensure that any work that occurs inside the debug callback function is thread-safe. Furthermore, calling any GL or window layer function from within the callback function results in undefined behavior.If no callback is set, then messages are instead stored in an internal message log up to some maximum number of strings as defined by the implementation-dependent constant
MAX_DEBUG_LOGGED_MESSAGES_AMD
. Each context stores its own message log and will only store messages generated by commands operating in that context. If the message log is full, then the oldest messages will be removed from the log to make room for newer ones. The application can query the number of messages currently in the log by obtaining the value ofDEBUG_LOGGED_MESSAGES_AMD
.- Parameters:
callback
- a callback function that will be called when a debug message is generateduserParam
- a user supplied pointer that will be passed on each invocation ofcallback
-
glGetDebugMessageLogAMD
public static int glGetDebugMessageLogAMD(int count, java.nio.IntBuffer categories, java.nio.IntBuffer severities, java.nio.IntBuffer ids, java.nio.IntBuffer lengths, java.nio.ByteBuffer messageLog)
Retrieves messages from the debug message log.This function will fetch as many messages as possible from the message log up to
count
in order from oldest to newest, and will return the number of messages fetched. Those messages that were fetched will be removed from the log. The value ofcount
must be greater than zero and less thanMAX_DEBUG_LOGGED_MESSAGES_AMD
or otherwise the errorINVALID_VALUE
will be generated. The value ofcount
can be larger than the actual number of messages currently in the log. IfmessageLog
is not a null pointer, then the string representations of all fetched messages will be stored in the buffermessageLog
and will be separated by null-terminators. The maximum size of the buffer (including all null-terminators) is denoted bybufSize
, and strings of messages withincount
that do not fit in the buffer will not be fetched. IfbufSize
is less than zero, the errorINVALID_VALUE
will be generated. IfmessageLog
is a null pointer, then the value ofbufSize
is ignored. The categories, severity levels, IDs, and string representation lengths of all (up tocount
) removed messages will be stored in the arrayscategories
,severities
,ids
, andlengths
, respectively. The counts stored in the arraylengths
include the null-terminator of each string. Any and all of the output arrays, includingmessageLog
, are optional, and no data is returned for those arrays that are specified with a null pointer. To simply delete up tocount
messages from the message log and ignoring, the application can call the function with null pointers for all output arrays. The errorINVALID_OPERATION
will be generated by GetDebugMessageLogAMD if it is called in a non-debug context.- Parameters:
count
- the number of debug messages to retrieve from the logcategories
- an array of variables to receive the categories of the retrieved messagesseverities
- an array of variables to receive the severities of the retrieved messagesids
- an array of variables to receive the ids of the retrieved messageslengths
- an array of variables to receive the lengths of the retrieved messagesmessageLog
- an array of characters that will receive the messages
-
glDebugMessageEnableAMD
public static void glDebugMessageEnableAMD(int category, int severity, int[] ids, boolean enabled)
Array version of:DebugMessageEnableAMD
-
glGetDebugMessageLogAMD
public static int glGetDebugMessageLogAMD(int count, int[] categories, int[] severities, int[] ids, int[] lengths, java.nio.ByteBuffer messageLog)
Array version of:GetDebugMessageLogAMD
-
-