15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci AMD_debug_output 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_AMD_debug_output 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jaakko Konttinen (jaakko.konttinen 'at' amd.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Graham Sellers, AMD 165bd8deadSopenharmony_ci Mark Young, AMD 175bd8deadSopenharmony_ci Ahmet Oguz Akyuz, AMD 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciStatus 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Experimental 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciVersion 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Last Modified Date: July 21, 2022 265bd8deadSopenharmony_ci Author Revision: 10 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciNumber 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci 395 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci OpenGL 1.1 is required. 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci WGL_ARB_create_context or GLX_ARB_create_context is required. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci The extension is written against the OpenGL 3.0 specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci This extension trivially interacts with ARB_vertex_program and 415bd8deadSopenharmony_ci ARB_fragment_program. 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciOverview 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci This extension allows the GL to notify applications when various 465bd8deadSopenharmony_ci debug events occur in contexts that have been created with the debug 475bd8deadSopenharmony_ci flag, as provided by WGL_ARB_create_context and GLX_ARB_create_context. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci These events are represented in the form of enumerable messages with an 505bd8deadSopenharmony_ci included human-readable translation. Examples of debug events include 515bd8deadSopenharmony_ci incorrect use of the GL, warnings of undefined behavior, and performance 525bd8deadSopenharmony_ci warnings. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci A message is uniquely identified by a category and an implementation- 555bd8deadSopenharmony_ci dependent ID within that category. Message categories are general and are 565bd8deadSopenharmony_ci used to organize large groups of similar messages together. Examples of 575bd8deadSopenharmony_ci categories include GL errors, performance warnings, and deprecated 585bd8deadSopenharmony_ci functionality warnings. Each message is also assigned a severity level 595bd8deadSopenharmony_ci that denotes roughly how "important" that message is in comparison to 605bd8deadSopenharmony_ci other messages across all categories. For example, notification of a GL 615bd8deadSopenharmony_ci error would have a higher severity than a performance warning due to 625bd8deadSopenharmony_ci redundant state changes. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci Messages are communicated to the application through an application-defined 655bd8deadSopenharmony_ci callback function that is called by the GL implementation on each debug 665bd8deadSopenharmony_ci message. The motivation for the callback routine is to free application 675bd8deadSopenharmony_ci developers from actively having to query whether any GL error or other 685bd8deadSopenharmony_ci debuggable event has happened after each call to a GL function. With a 695bd8deadSopenharmony_ci callback, developers can keep their code free of debug checks, and only have 705bd8deadSopenharmony_ci to react to messages as they occur. In order to support indirect rendering, 715bd8deadSopenharmony_ci a message log is also provided that stores copies of recent messages until 725bd8deadSopenharmony_ci they are actively queried. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci To control the volume of debug output, messages can be disabled either 755bd8deadSopenharmony_ci individually by ID, or entire groups of messages can be turned off based 765bd8deadSopenharmony_ci on category or severity. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci The only requirement on the minimum quantity and type of messages that 795bd8deadSopenharmony_ci implementations of this extension must support is that a message must be 805bd8deadSopenharmony_ci sent notifying the application whenever any GL error occurs. Any further 815bd8deadSopenharmony_ci messages are left to the implementation. Implementations do not have 825bd8deadSopenharmony_ci to output messages from all categories listed by this extension 835bd8deadSopenharmony_ci in order to support this extension, and new categories can be added by 845bd8deadSopenharmony_ci other extensions. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci This extension places no restrictions or requirements on any additional 875bd8deadSopenharmony_ci functionality provided by the debug context flag through other extensions. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ciIP Status 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci No known IP claims. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ciNew Procedures and Functions 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci void DebugMessageEnableAMD(enum category, 965bd8deadSopenharmony_ci enum severity, 975bd8deadSopenharmony_ci sizei count, 985bd8deadSopenharmony_ci const uint* ids, 995bd8deadSopenharmony_ci boolean enabled); 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci void DebugMessageInsertAMD(enum category, 1025bd8deadSopenharmony_ci enum severity, 1035bd8deadSopenharmony_ci uint id, 1045bd8deadSopenharmony_ci sizei length, 1055bd8deadSopenharmony_ci const char* buf); 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci void DebugMessageCallbackAMD(DEBUGPROCAMD callback, 1085bd8deadSopenharmony_ci void* userParam); 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci uint GetDebugMessageLogAMD(uint count, 1115bd8deadSopenharmony_ci sizei bufsize, 1125bd8deadSopenharmony_ci enum* categories, 1135bd8deadSopenharmony_ci enum* severities, 1145bd8deadSopenharmony_ci uint* ids, 1155bd8deadSopenharmony_ci sizei* lengths, 1165bd8deadSopenharmony_ci char* message); 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ciNew Types 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci The callback function that applications can define, and 1215bd8deadSopenharmony_ci is accepted by DebugMessageCallbackAMD, is defined as: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, 1245bd8deadSopenharmony_ci GLenum category, 1255bd8deadSopenharmony_ci GLenum severity, 1265bd8deadSopenharmony_ci GLsizei length, 1275bd8deadSopenharmony_ci const GLchar* message, 1285bd8deadSopenharmony_ci GLvoid* userParam); 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci Note that this function pointer is defined as having the 1315bd8deadSopenharmony_ci same calling convention as the GL functions. 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ciNew Tokens 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci Tokens accepted by GetIntegerv: 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 1385bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 1395bd8deadSopenharmony_ci DEBUG_LOGGED_MESSAGES_AMD 0x9145 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, 1425bd8deadSopenharmony_ci DebugMessageInsertAMD, and DEBUGPROCAMD callback function 1435bd8deadSopenharmony_ci for <severity>: 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci DEBUG_SEVERITY_HIGH_AMD 0x9146 1465bd8deadSopenharmony_ci DEBUG_SEVERITY_MEDIUM_AMD 0x9147 1475bd8deadSopenharmony_ci DEBUG_SEVERITY_LOW_AMD 0x9148 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci Tokens accepted by DebugMessageEnableAMD, GetDebugMessageLogAMD, 1505bd8deadSopenharmony_ci and DEBUGPROCAMD callback function for <category>: 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci DEBUG_CATEGORY_API_ERROR_AMD 0x9149 1535bd8deadSopenharmony_ci DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A 1545bd8deadSopenharmony_ci DEBUG_CATEGORY_DEPRECATION_AMD 0x914B 1555bd8deadSopenharmony_ci DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C 1565bd8deadSopenharmony_ci DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D 1575bd8deadSopenharmony_ci DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E 1585bd8deadSopenharmony_ci DEBUG_CATEGORY_APPLICATION_AMD 0x914F 1595bd8deadSopenharmony_ci DEBUG_CATEGORY_OTHER_AMD 0x9150 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.0 Specification (OpenGL Operation) 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci In section 2.5 - GL Errors: 1645bd8deadSopenharmony_ci Add to the end of the section (pg 19): "If an error is generated by a debug 1655bd8deadSopenharmony_ci GL context (Section 2.20), the context will send a message to the application 1665bd8deadSopenharmony_ci that a GL error has occurred. This message may contain more information 1675bd8deadSopenharmony_ci about the nature of the error." 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci After section 2.19 - Primitive Clipping: 1705bd8deadSopenharmony_ci Add new section: 2.20 - Debug Contexts 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci Application developers can obtain more information from the GL runtime using 1735bd8deadSopenharmony_ci a debug-enabled context. This information can include details about 1745bd8deadSopenharmony_ci GL errors, undefined behavior, implementation-dependent performance warnings, 1755bd8deadSopenharmony_ci or other useful hints. This information is communicated through the 1765bd8deadSopenharmony_ci generation of debug messages when GL commands are executed. The application 1775bd8deadSopenharmony_ci can choose to either actively query for these messages, or allow the GL to 1785bd8deadSopenharmony_ci call back to the application on each message via a function pointer. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci 2.20.1 - Debug Messages 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci A debug message is uniquely identified by its category and an unsigned 1835bd8deadSopenharmony_ci integer message ID within that category. The category must be one of the 1845bd8deadSopenharmony_ci symbolic constants listed in Table 2.12. Although every distinct message 1855bd8deadSopenharmony_ci must have a unique number within a category, there is no enforcement by this 1865bd8deadSopenharmony_ci extension for how GL implementations assign numbers to specific messages. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci Each message also has a severity level that roughly describes its 1895bd8deadSopenharmony_ci significance across all categories. The severity level of a message is 1905bd8deadSopenharmony_ci one of the symbolic constants defined in Table 2.13. Because messages 1915bd8deadSopenharmony_ci can be disabled across all categories by severity level, this feature can 1925bd8deadSopenharmony_ci be used to quickly control the volume of debug output by the application. 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci Category Token Informs about 1955bd8deadSopenharmony_ci -------------- ------------- 1965bd8deadSopenharmony_ci DEBUG_CATEGORY_API_ERROR_AMD GL errors caused by invalid API use 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci DEBUG_CATEGORY_WINDOW_SYSTEM_AMD Errors and notices from the 1995bd8deadSopenharmony_ci windowing layer 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci DEBUG_CATEGORY_DEPRECATION_AMD Use of functionality that is either 2025bd8deadSopenharmony_ci deprecated or marked for future 2035bd8deadSopenharmony_ci deprecation 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD Behavior undefined according to 2065bd8deadSopenharmony_ci specification 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci DEBUG_CATEGORY_PERFORMANCE_AMD Implementation-dependent performance 2095bd8deadSopenharmony_ci warnings 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci DEBUG_CATEGORY_SHADER_COMPILER_AMD Information from the GLSL or ARB 2125bd8deadSopenharmony_ci shader compiler and linker 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci DEBUG_CATEGORY_APPLICATION_AMD Application-generated messages 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci DEBUG_CATEGORY_OTHER_AMD Messages that do not fit in any of 2175bd8deadSopenharmony_ci the other categories 2185bd8deadSopenharmony_ci ---------------------------------------------------------------------------- 2195bd8deadSopenharmony_ci Table 2.12: Categories of debug messages. Each message is associated with 2205bd8deadSopenharmony_ci one of these categories. 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci Severity Level Token Suggested examples of messages 2245bd8deadSopenharmony_ci -------------------- ------------------------------ 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci DEBUG_SEVERITY_HIGH_AMD Any GL error; any undefined behavior; 2275bd8deadSopenharmony_ci any GLSL or ARB shader compiler and 2285bd8deadSopenharmony_ci linker errors; 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci DEBUG_SEVERITY_MEDIUM_AMD Severe performance warnings; GLSL 2315bd8deadSopenharmony_ci or ARB shader compiler and linker 2325bd8deadSopenharmony_ci warnings; use of currently deprecated 2335bd8deadSopenharmony_ci behavior 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci DEBUG_SEVERITY_LOW_AMD Performance warnings from redundant 2365bd8deadSopenharmony_ci state changes 2375bd8deadSopenharmony_ci ---------------------------------------------------------------------------- 2385bd8deadSopenharmony_ci Table 2.13: Severity levels of messagse. Each debug message is associated 2395bd8deadSopenharmony_ci with one of these severity levels. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci Every message also has a null-terminated string representation that is used 2435bd8deadSopenharmony_ci to describe the message. The contents of the string can change slightly 2445bd8deadSopenharmony_ci between different instances of the same message (e.g. which parameter value 2455bd8deadSopenharmony_ci caused a specific GL error to occur). The formatting of a message string is 2465bd8deadSopenharmony_ci left as implementation-dependent, although it should give a concise and 2475bd8deadSopenharmony_ci legible description of the message's purpose. Messages with different IDs 2485bd8deadSopenharmony_ci should also have sufficiently distinguishable string representations to 2495bd8deadSopenharmony_ci warrant their separation. 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci 2.20.2 - Receiving Messages 2525bd8deadSopenharmony_ci 2535bd8deadSopenharmony_ci Applications can listen for messages by providing the GL with a callback 2545bd8deadSopenharmony_ci function pointer by calling: 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci void DebugMessageCallbackAMD(DEBUGPROCAMD callback, 2575bd8deadSopenharmony_ci void* userParam); 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci With <callback> storing the address of the callback function. This 2605bd8deadSopenharmony_ci function's signature must follow the type definition of DEBUGPROCAMD, and 2615bd8deadSopenharmony_ci its calling convention must be the same as the calling convention of GL 2625bd8deadSopenharmony_ci functions. Anything else will result in undefined behavior. Only one 2635bd8deadSopenharmony_ci debug callback can be specified for the current context, and further calls 2645bd8deadSopenharmony_ci overwrite the previous callback. Specifying zero as the value of <callback> 2655bd8deadSopenharmony_ci clears the current callback and disables message output through callbacks. 2665bd8deadSopenharmony_ci Applications can specify user-specified data through the pointer 2675bd8deadSopenharmony_ci <userParam>. The context will store this pointer and will include it 2685bd8deadSopenharmony_ci as one of the parameters of each call to the callback function. The error 2695bd8deadSopenharmony_ci INVALID_OPERATION will be generated if this function is called for contexts 2705bd8deadSopenharmony_ci created without the debug flag. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci If the application has specified a callback function in a debug context, 2735bd8deadSopenharmony_ci the implementation will call that function whenever any unfiltered message 2745bd8deadSopenharmony_ci is generated. The ID, category, and severity of the message are specified 2755bd8deadSopenharmony_ci by the callback parameters <id>, <category> and <severity>, respectively. 2765bd8deadSopenharmony_ci The string representation of the message is stored in <message> and its length 2775bd8deadSopenharmony_ci (excluding the null-terminator) is stored in <length>. The parameter 2785bd8deadSopenharmony_ci <userParam> is the user-specified value that was passed when calling 2795bd8deadSopenharmony_ci DebugMessageCallbackAMD. The memory for <message> is allocated, owned and 2805bd8deadSopenharmony_ci released by the implementation, and should only be considered valid for 2815bd8deadSopenharmony_ci the duration of the callback function call. While it is allowed to 2825bd8deadSopenharmony_ci concurrently use multiple debug contexts with the same debug callback function, 2835bd8deadSopenharmony_ci note that it is the application's responsibility to ensure that any work that 2845bd8deadSopenharmony_ci occurs inside the debug callback function is thread-safe. Furthermore, 2855bd8deadSopenharmony_ci calling any GL or window layer function from within the callback function 2865bd8deadSopenharmony_ci results in undefined behavior. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci If no callback is set, then messages are instead stored in an internal 2895bd8deadSopenharmony_ci message log up to some maximum number of strings as defined by the 2905bd8deadSopenharmony_ci implementation-dependent constant MAX_DEBUG_LOGGED_MESSAGES_AMD. Each 2915bd8deadSopenharmony_ci context stores its own message log and will only store messages generated by 2925bd8deadSopenharmony_ci commands operating in that context. If the message log is full, then the 2935bd8deadSopenharmony_ci oldest messages will be removed from the log to make room for newer ones. 2945bd8deadSopenharmony_ci The application can query the number of messages currently in the log by 2955bd8deadSopenharmony_ci obtaining the value of DEBUG_LOGGED_MESSAGES_AMD, and can get the contents 2965bd8deadSopenharmony_ci of those messages using the command: 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci uint GetDebugMessageLogAMD(uint count, 2995bd8deadSopenharmony_ci sizei logSize, 3005bd8deadSopenharmony_ci enum* categories, 3015bd8deadSopenharmony_ci enum* severities, 3025bd8deadSopenharmony_ci uint* ids, 3035bd8deadSopenharmony_ci sizei* lengths, 3045bd8deadSopenharmony_ci char* messageLog); 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci This function will fetch as many messages as possible from the message 3075bd8deadSopenharmony_ci log up to <count> in order from oldest to newest, and will return the 3085bd8deadSopenharmony_ci number of messages fetched. Those messages that were fetched will be 3095bd8deadSopenharmony_ci removed from the log. The value of <count> must be greater than zero and 3105bd8deadSopenharmony_ci less than MAX_DEBUG_LOGGED_MESSAGES_AMD or otherwise the error 3115bd8deadSopenharmony_ci INVALID_VALUE will be generated. The value of <count> can be larger than 3125bd8deadSopenharmony_ci the actual number of messages currently in the log. If <messageLog> is not 3135bd8deadSopenharmony_ci a null pointer, then the string representations of all fetched messages will 3145bd8deadSopenharmony_ci be stored in the buffer <messageLog> and will be separated by null- 3155bd8deadSopenharmony_ci terminators. The maximum size of the buffer (including all null- 3165bd8deadSopenharmony_ci terminators) is denoted by <logSize>, and strings of messages within <count> 3175bd8deadSopenharmony_ci that do not fit in the buffer will not be fetched. If <logSize> is less 3185bd8deadSopenharmony_ci than zero, the error INVALID_VALUE will be generated. If <messageLog> 3195bd8deadSopenharmony_ci is a null pointer, then the value of <logSize> is ignored. The 3205bd8deadSopenharmony_ci categories, severity levels, IDs, and string representation lengths of all 3215bd8deadSopenharmony_ci (up to <count>) removed messages will be stored in the arrays <categories>, 3225bd8deadSopenharmony_ci <severities>, <ids>, and <lengths>, respectively. The counts stored in the 3235bd8deadSopenharmony_ci array <lengths> include the null-terminator of each string. Any and all of 3245bd8deadSopenharmony_ci the output arrays, including <messageLog>, are optional, and no data is returned 3255bd8deadSopenharmony_ci for those arrays that are specified with a null pointer. To simply delete up 3265bd8deadSopenharmony_ci to <count> messages from the message log and ignoring, the application can call 3275bd8deadSopenharmony_ci the function with null pointers for all output arrays. The error 3285bd8deadSopenharmony_ci INVALID_OPERATION will be generated by GetDebugMessageLogAMD if it is 3295bd8deadSopenharmony_ci called in a non-debug context. 3305bd8deadSopenharmony_ci 3315bd8deadSopenharmony_ci 2.20.3 - Controlling Debug Messages 3325bd8deadSopenharmony_ci 3335bd8deadSopenharmony_ci Applications can control which messages are generated by calling 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci void DebugMessageEnableAMD(enum category, 3365bd8deadSopenharmony_ci enum severity, 3375bd8deadSopenharmony_ci sizei count, 3385bd8deadSopenharmony_ci const uint* ids, 3395bd8deadSopenharmony_ci boolean enabled); 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci This command allows disabling or enabling generation of subsets of 3425bd8deadSopenharmony_ci messages. If <enabled> is TRUE, the referenced subset of messages 3435bd8deadSopenharmony_ci is enabled. If FALSE, then those messages are disabled. This 3445bd8deadSopenharmony_ci command can reference different subsets of messages by 3455bd8deadSopenharmony_ci varying its parameter values in the following ways: 3465bd8deadSopenharmony_ci 3475bd8deadSopenharmony_ci 1. To reference all messages, let <category>, <severity>, 3485bd8deadSopenharmony_ci and <count> all be zero. The value of <ids> is ignored 3495bd8deadSopenharmony_ci in this case. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci 2. To reference all messages across all categories with 3525bd8deadSopenharmony_ci a specific severity level, let <category> and <count> 3535bd8deadSopenharmony_ci be zero and let <severity> identify the severity level. 3545bd8deadSopenharmony_ci The value of <ids> is ignored in this case. 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci 3. To reference all messages within a single category, let 3575bd8deadSopenharmony_ci <category> identify the referenced category and let 3585bd8deadSopenharmony_ci <severity> and <count> be zero. The value of <ids> is 3595bd8deadSopenharmony_ci ignored in this case. 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci 4. To reference all messages within a single category and 3625bd8deadSopenharmony_ci at a specific severity level, let <category> identify the 3635bd8deadSopenharmony_ci category and <severity> identify the severity level, 3645bd8deadSopenharmony_ci and let <count> be zero. The value of <ids> is ignored 3655bd8deadSopenharmony_ci in this case. 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci 5. To reference specific messages by ID within a single 3685bd8deadSopenharmony_ci category, let <category> identify the category, let 3695bd8deadSopenharmony_ci <severity> be zero, let <count> be greater than zero 3705bd8deadSopenharmony_ci and let <ids> identify the IDs of <count> messages within 3715bd8deadSopenharmony_ci the identified category. Operations on message IDs that 3725bd8deadSopenharmony_ci are not valid within the category are silently ignored. 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ci In all of the above cases, if <category> is non-zero and specifies 3755bd8deadSopenharmony_ci an invalid category, the error INVALID_ENUM is generated. 3765bd8deadSopenharmony_ci Similarly if <severity> is non-zero and is an invalid severity level, 3775bd8deadSopenharmony_ci the error INVALID_ENUM is generated. If <count> is less than 3785bd8deadSopenharmony_ci zero, the error INVALID_VALUE is generated. If the parameters do 3795bd8deadSopenharmony_ci not fall into one of the cases defined above, the error INVALID_VALUE 3805bd8deadSopenharmony_ci is generated. The error INVALID_OPERATION is generated if this 3815bd8deadSopenharmony_ci command is called in a non-debug context. 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci Although messages are grouped into categories and severities, 3845bd8deadSopenharmony_ci and entire groups of messages can be turned off with a single 3855bd8deadSopenharmony_ci call, there is no explicit per-category or per-severity enabled state. 3865bd8deadSopenharmony_ci Instead the enabled state is stored individually for each message. 3875bd8deadSopenharmony_ci There is no difference between disabling a category of messages with a 3885bd8deadSopenharmony_ci single call, and enumerating all messages of that category and individually 3895bd8deadSopenharmony_ci disabling each of them by their ID. 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci All messages of severity level DEBUG_SEVERITY_MEDIUM_AMD and 3925bd8deadSopenharmony_ci DEBUG_SEVERITY_HIGH_AMD in all categories are initially enabled, and 3935bd8deadSopenharmony_ci all messages at DEBUG_SEVERITY_LOW_AMD are initially disabled. 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci 2.20.4 - Application Messages 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci To easily support custom application timestamps, applications can inject 3985bd8deadSopenharmony_ci their own messages to the debug message stream through the command 3995bd8deadSopenharmony_ci 4005bd8deadSopenharmony_ci void DebugMessageInsertAMD(enum category, 4015bd8deadSopenharmony_ci enum severity, 4025bd8deadSopenharmony_ci uint id, 4035bd8deadSopenharmony_ci sizei length, 4045bd8deadSopenharmony_ci const char* buf); 4055bd8deadSopenharmony_ci 4065bd8deadSopenharmony_ci The value of <id> specifies the ID for the message and <severity> indicates 4075bd8deadSopenharmony_ci its severity level as defined by the application. If <severity> is not a 4085bd8deadSopenharmony_ci valid severity level, the error INVALID_ENUM will be generated. The value 4095bd8deadSopenharmony_ci of <category> must be DEBUG_CATEGORY_APPLICATION_AMD, or the error 4105bd8deadSopenharmony_ci INVALID_ENUM will be generated. The string <buf> contains the string 4115bd8deadSopenharmony_ci representation of the message. The parameter <length> contains the size of 4125bd8deadSopenharmony_ci the message's string representation, excluding the null-terminator. If 4135bd8deadSopenharmony_ci <length> is zero, then its value is derived from the string-length of <buf> 4145bd8deadSopenharmony_ci and <buf> must contain a null-terminated string. The error INVALID_VALUE 4155bd8deadSopenharmony_ci will be generated if <length> is less than zero or its derived value is 4165bd8deadSopenharmony_ci larger than or equal to MAX_DEBUG_MESSAGE_LENGTH_AMD. The error 4175bd8deadSopenharmony_ci INVALID_OPERATION will be generated if this function is called in a 4185bd8deadSopenharmony_ci non-debug context. 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ciAdditions to the OpenGL / GLX / GLX Protocol Specifications 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci None. 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ciAdditions to the WGL Specification 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci None. 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ciErrors 4295bd8deadSopenharmony_ci 4305bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by DebugMessageCallbackAMD if 4315bd8deadSopenharmony_ci the function is called in a non-debug context. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageEnableAMD if 4345bd8deadSopenharmony_ci <category> is non-zero and specifies an invalid category. 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageEnableAMD if 4375bd8deadSopenharmony_ci <severity> is non-zero and an invalid severity level. 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageEnableAMD if 4405bd8deadSopenharmony_ci if <count> is less than zero. 4415bd8deadSopenharmony_ci 4425bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageEnableAMD if 4435bd8deadSopenharmony_ci if the combination of values for <category>, <severity> and <count> do not 4445bd8deadSopenharmony_ci fall within one of the accepted combinations for referencing a subset of 4455bd8deadSopenharmony_ci messages. 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by GetDebugMessageLogAMD if 4485bd8deadSopenharmony_ci it is called in a non-debug context. 4495bd8deadSopenharmony_ci 4505bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by GetDebugMessageLogAMD if the 4515bd8deadSopenharmony_ci value of <count> is zero or greater than the value of 4525bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_AMD. 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by GetDebugMessageLogAMD if 4555bd8deadSopenharmony_ci <logSize> is less than zero. 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageInsertAMD if 4585bd8deadSopenharmony_ci <severity> is not a valid debug severity level. 4595bd8deadSopenharmony_ci 4605bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageInsertAMD if the 4615bd8deadSopenharmony_ci value of <category> is not DEBUG_CATEGORY_APPLICATION_AMD. 4625bd8deadSopenharmony_ci 4635bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageInsertAMD 4645bd8deadSopenharmony_ci if <length> is less than zero. 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageInsertAMD 4675bd8deadSopenharmony_ci if <length> or its derived value is larger than 4685bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_AMD. 4695bd8deadSopenharmony_ci 4705bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by DebugMessageInsertAMD if 4715bd8deadSopenharmony_ci this function is called in a non-debug context. 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ciNew State 4745bd8deadSopenharmony_ci Initial 4755bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 4765bd8deadSopenharmony_ci -------------------------- ---- ----------- ----- ------------------------- ------ --------- 4775bd8deadSopenharmony_ci DEBUG_LOGGED_MESSAGES_AMD Z+ GetIntegerv 0 The number of messages 2.20.2 - 4785bd8deadSopenharmony_ci currently in the debug 4795bd8deadSopenharmony_ci message log 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ciNew Implementation Dependent State 4825bd8deadSopenharmony_ci Minimum 4835bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 4845bd8deadSopenharmony_ci -------------------------------- -- ----------- ----- ------------------------- ------ ---------- 4855bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_AMD Z+ GetIntegerv 80 The maximum length of a 2.20.2 - 4865bd8deadSopenharmony_ci debug message string 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_AMD Z+ GetIntegerv 1 The maximum number of 2.20.2 - 4895bd8deadSopenharmony_ci messages stored in the 4905bd8deadSopenharmony_ci debug message log 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ciIssues 4935bd8deadSopenharmony_ci 4945bd8deadSopenharmony_ci 01) Should we reserve tokens for arbitrary vendor-specific categories (e.g. 4955bd8deadSopenharmony_ci DEBUG_CATEGORY_VENDOR0)? 4965bd8deadSopenharmony_ci 4975bd8deadSopenharmony_ci RESOLVED: No. Since this is an AMD extension, there is no 4985bd8deadSopenharmony_ci reason to do this now in the current version. 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci 02) Should we allow explicit controls for printing to stderr or through 5015bd8deadSopenharmony_ci OutputDebugString instead of the callback? 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci RESOLVED: No. It is up to the application to setup this 5045bd8deadSopenharmony_ci behavior itself using the provided functionality. 5055bd8deadSopenharmony_ci 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci 03) How do the different filtering rules interact? If a category is 5085bd8deadSopenharmony_ci filtered, but a message in that same category is set to be unfiltered by 5095bd8deadSopenharmony_ci ID or severity level, should that message still be filtered? If I 5105bd8deadSopenharmony_ci specifically filter a category and then unfilter all messages globally 5115bd8deadSopenharmony_ci with a later command, should that category still be filtered? 5125bd8deadSopenharmony_ci 5135bd8deadSopenharmony_ci RESOLVED: Message enable state is stored individually for each 5145bd8deadSopenharmony_ci message. There is no explicit group-wise enable state 5155bd8deadSopenharmony_ci or different ordered levels of "enabledness" in the 5165bd8deadSopenharmony_ci implied hierarchy of messages. Operations on groups 5175bd8deadSopenharmony_ci of messages affect all messages within 5185bd8deadSopenharmony_ci that group individually, and overwrite the previous 5195bd8deadSopenharmony_ci and individual state of those messages. 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci 04) Should applications be allowed to insert their own messages through 5225bd8deadSopenharmony_ci a custom category? How would this be done? 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci RESOLVED: Yes. A new category will be provided for application- 5255bd8deadSopenharmony_ci specific messages and an entry point will be provided to 5265bd8deadSopenharmony_ci write messages in that category. 5275bd8deadSopenharmony_ci 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci 5305bd8deadSopenharmony_ciRevision History 5315bd8deadSopenharmony_ci 5325bd8deadSopenharmony_ci (v10 2022-07-21, jhager) 5335bd8deadSopenharmony_ci - Changed type of argument "severities" from uint to enum in GetDebugMessageLogAMD. 5345bd8deadSopenharmony_ci 5355bd8deadSopenharmony_ci (v9, 2010-05-07, jkontti) 5365bd8deadSopenharmony_ci - Removed inconsistent language from New Tokens category for tokens 5375bd8deadSopenharmony_ci that are no longer accepted by DebugMessageEnableAMD since 5385bd8deadSopenharmony_ci revision v5. 5395bd8deadSopenharmony_ci - Cleaned up some language and formatting issues. 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci (v8, 2010-04-09, jkontti) 5425bd8deadSopenharmony_ci - Renamed extension string from AMDX to AMD. 5435bd8deadSopenharmony_ci - Renamed new function, type and token suffixes from AMDX to AMD. 5445bd8deadSopenharmony_ci - No changes in functionality between AMDX and AMD versions. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci (v7, 2010-01-21, jkontti) 5475bd8deadSopenharmony_ci - Added user-specifiable parameter to debug message callback function 5485bd8deadSopenharmony_ci 5495bd8deadSopenharmony_ci (v6, 2010-01-15, jkontti) 5505bd8deadSopenharmony_ci - Updated contact section 5515bd8deadSopenharmony_ci - Updated contributor section 5525bd8deadSopenharmony_ci - Updated status section 5535bd8deadSopenharmony_ci - Updated enums 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci (v5, 2009-09-17, jkontti) 5565bd8deadSopenharmony_ci - Message ID namespaces are now contained within categories instead of 5575bd8deadSopenharmony_ci being in a single global namespace 5585bd8deadSopenharmony_ci - Reworked DebugMessageEnable to allow disabling/enabling more 5595bd8deadSopenharmony_ci combinations of messages 5605bd8deadSopenharmony_ci - Resolved issue 01 5615bd8deadSopenharmony_ci - Resolved issue 03 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci (v4, 2009-09-16, jkontti) 5645bd8deadSopenharmony_ci - Added category as a parameter to DebugMessageInsert for 5655bd8deadSopenharmony_ci future-proofing purposes 5665bd8deadSopenharmony_ci - Added missing errors to DebugMessageInsert and GetDebugMessageLog 5675bd8deadSopenharmony_ci - Added missing tokens to New Tokens 5685bd8deadSopenharmony_ci - Renamed DebugMessageFilter to DebugMessageEnable 5695bd8deadSopenharmony_ci 5705bd8deadSopenharmony_ci (v3, 2009-09-15, myoung) 5715bd8deadSopenharmony_ci - Cleaned up some language 5725bd8deadSopenharmony_ci - Added values using AMD reserved ranges. Values do not overlap so can 5735bd8deadSopenharmony_ci be re-used. 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci (v2, 2009-09-15, jkontti) 5765bd8deadSopenharmony_ci - Application-generated messages 5775bd8deadSopenharmony_ci - More categories (window system, deprecation, profile, application) 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci (v1, 2009-09-09, jkontti) 5805bd8deadSopenharmony_ci - Initial revision 581