15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_debug_output 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_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 Bruce Merry, ARM 195bd8deadSopenharmony_ci Daniel Koch, TransGaming 205bd8deadSopenharmony_ci Jon Leech, Independent 215bd8deadSopenharmony_ci Pat Brown, NVIDIA 225bd8deadSopenharmony_ci Greg Roth, NVIDIA 235bd8deadSopenharmony_ci Yaki Tebeka, Graphic Remedy 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciNotice 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Copyright (c) 2010-2013 The Khronos Group Inc. Copyright terms at 285bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciSpecification Update Policy 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 335bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 345bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 355bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 365bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 375bd8deadSopenharmony_ci described in more detail at 385bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciStatus 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Complete. Approved by the ARB on June 9, 2010. 435bd8deadSopenharmony_ci Approved by the Khronos Board of Promoters on July 23, 2010. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ciVersion 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci Last Modified Date: July 8, 2013 485bd8deadSopenharmony_ci Author Revision: 17 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciNumber 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci ARB Extension #104 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciDependencies 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci OpenGL 1.1 is required. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci The extension is written against the OpenGL 4.0 Core specification 595bd8deadSopenharmony_ci (March 11, 2010). 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci The extension interacts with OpenGL 4.0 Compatibility specification 625bd8deadSopenharmony_ci and other specifications that provide display list support. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci The extension interacts with OpenGL 4.0 Compatibility specification 655bd8deadSopenharmony_ci and other specifications that provide the GetPointerv entry point. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciOverview 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci This extension allows the GL to notify applications when various 705bd8deadSopenharmony_ci events occur that may be useful during application development and 715bd8deadSopenharmony_ci debugging. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci These events are represented in the form of enumerable messages with 745bd8deadSopenharmony_ci a human-readable string representation. Examples of debug events 755bd8deadSopenharmony_ci include incorrect use of the GL, warnings of undefined behavior, and 765bd8deadSopenharmony_ci performance warnings. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci A message is uniquely identified by a source, a type and an 795bd8deadSopenharmony_ci implementation-dependent ID within the source and type pair. 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci A message's source identifies the origin of the message and can 825bd8deadSopenharmony_ci either describe components of the GL, the window system, 835bd8deadSopenharmony_ci third-party external sources such as external debuggers, or even 845bd8deadSopenharmony_ci the application itself. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci The type of the message roughly identifies the nature of the event 875bd8deadSopenharmony_ci that caused the message. Examples include errors, performance 885bd8deadSopenharmony_ci warnings, or warnings about undefined behavior. 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci A message's ID for a given source and type further 915bd8deadSopenharmony_ci distinguishes messages within those groups. For example, an error 925bd8deadSopenharmony_ci caused by a negative parameter value or an invalid internal 935bd8deadSopenharmony_ci texture format are both errors generated by the API, but would 945bd8deadSopenharmony_ci likely have different message IDs. 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Each message is also assigned to a severity level that denotes 975bd8deadSopenharmony_ci roughly how "important" that message is in comparison to other 985bd8deadSopenharmony_ci messages across all sources and types. For example, notification 995bd8deadSopenharmony_ci of a GL error would likely have a higher severity than a performance 1005bd8deadSopenharmony_ci warning due to redundant state changes. 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Finally, every message contains an implementation-dependent string 1035bd8deadSopenharmony_ci representation that provides a useful description of the event. 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Messages are communicated to the application through an application- 1065bd8deadSopenharmony_ci defined callback function that is called by the GL implementation on 1075bd8deadSopenharmony_ci each debug message. The motivation for the callback routine is to 1085bd8deadSopenharmony_ci free application developers from actively having to query whether 1095bd8deadSopenharmony_ci a GL error, or any other debuggable event has happened after each 1105bd8deadSopenharmony_ci call to a GL function. With a callback, developers can keep their 1115bd8deadSopenharmony_ci code free of debug checks, and only have to react to messages as 1125bd8deadSopenharmony_ci they occur. In situations where using a callback is not possible, 1135bd8deadSopenharmony_ci a message log is also provided that stores copies of recent messages 1145bd8deadSopenharmony_ci until they are actively queried. 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci To control the volume of debug output, messages can be disabled 1175bd8deadSopenharmony_ci either individually by ID, or entire groups of messages can be 1185bd8deadSopenharmony_ci turned off based on combination of source and type. 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci The only requirement on the minimum quantity and type of messages 1215bd8deadSopenharmony_ci that implementations of this extension must support is that some 1225bd8deadSopenharmony_ci sort of message must be sent notifying the application whenever any 1235bd8deadSopenharmony_ci GL error occurs. Any further messages are left to the 1245bd8deadSopenharmony_ci implementation. Implementations do not have to output messages from 1255bd8deadSopenharmony_ci all sources nor do they have to use all types of messages listed 1265bd8deadSopenharmony_ci by this extension, and both new sources and types can be added by 1275bd8deadSopenharmony_ci other extensions. 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci For performance reasons it is recommended, but not required, that 1305bd8deadSopenharmony_ci implementations restrict supporting this extension only to 1315bd8deadSopenharmony_ci contexts created using the debug flag as provided by 1325bd8deadSopenharmony_ci WGL_create_context or GLX_create_context. This extension places no 1335bd8deadSopenharmony_ci limits on any other functionality provided by debug contexts through 1345bd8deadSopenharmony_ci other extensions. 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ciIP Status 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci No known IP claims. 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ciNew Procedures and Functions 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci void DebugMessageControlARB(enum source, 1435bd8deadSopenharmony_ci enum type, 1445bd8deadSopenharmony_ci enum severity, 1455bd8deadSopenharmony_ci sizei count, 1465bd8deadSopenharmony_ci const uint* ids, 1475bd8deadSopenharmony_ci boolean enabled); 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci void DebugMessageInsertARB(enum source, 1505bd8deadSopenharmony_ci enum type, 1515bd8deadSopenharmony_ci uint id, 1525bd8deadSopenharmony_ci enum severity, 1535bd8deadSopenharmony_ci sizei length, 1545bd8deadSopenharmony_ci const char* buf); 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci void DebugMessageCallbackARB(DEBUGPROCARB callback, 1575bd8deadSopenharmony_ci const void* userParam); 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci uint GetDebugMessageLogARB(uint count, 1605bd8deadSopenharmony_ci sizei bufSize, 1615bd8deadSopenharmony_ci enum* sources, 1625bd8deadSopenharmony_ci enum* types, 1635bd8deadSopenharmony_ci uint* ids, 1645bd8deadSopenharmony_ci enum* severities, 1655bd8deadSopenharmony_ci sizei* lengths, 1665bd8deadSopenharmony_ci char* messageLog); 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci void GetPointerv(enum pname, 1695bd8deadSopenharmony_ci void** params); 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ciNew Types 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci The callback function that applications can define, and 1745bd8deadSopenharmony_ci is accepted by DebugMessageCallbackARB, is defined as: 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci typedef void (APIENTRY *DEBUGPROCARB)(enum source, 1775bd8deadSopenharmony_ci enum type, 1785bd8deadSopenharmony_ci uint id, 1795bd8deadSopenharmony_ci enum severity, 1805bd8deadSopenharmony_ci sizei length, 1815bd8deadSopenharmony_ci const char* message, 1825bd8deadSopenharmony_ci const void* userParam); 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Note that this function pointer is defined as having the 1855bd8deadSopenharmony_ci same calling convention as the GL functions. 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ciNew Tokens 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci Tokens accepted by the <target> parameters of Enable, Disable, 1905bd8deadSopenharmony_ci and IsEnabled: 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci Tokens accepted by the <value> parameters of GetBooleanv, 1955bd8deadSopenharmony_ci GetIntegerv, GetFloatv, and GetDoublev: 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 1985bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 1995bd8deadSopenharmony_ci DEBUG_LOGGED_MESSAGES_ARB 0x9145 2005bd8deadSopenharmony_ci DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci Tokens accepted by the <pname> parameter of GetPointerv: 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci DEBUG_CALLBACK_FUNCTION_ARB 0x8244 2055bd8deadSopenharmony_ci DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci Tokens accepted or provided by the <source> parameters of 2085bd8deadSopenharmony_ci DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, 2095bd8deadSopenharmony_ci and the <sources> parameter of GetDebugMessageLogARB: 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci DEBUG_SOURCE_API_ARB 0x8246 2125bd8deadSopenharmony_ci DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 2135bd8deadSopenharmony_ci DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 2145bd8deadSopenharmony_ci DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 2155bd8deadSopenharmony_ci DEBUG_SOURCE_APPLICATION_ARB 0x824A 2165bd8deadSopenharmony_ci DEBUG_SOURCE_OTHER_ARB 0x824B 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Tokens accepted or provided by the <type> parameters of 2195bd8deadSopenharmony_ci DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, 2205bd8deadSopenharmony_ci and the <types> parameter of GetDebugMessageLogARB: 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci DEBUG_TYPE_ERROR_ARB 0x824C 2235bd8deadSopenharmony_ci DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D 2245bd8deadSopenharmony_ci DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E 2255bd8deadSopenharmony_ci DEBUG_TYPE_PORTABILITY_ARB 0x824F 2265bd8deadSopenharmony_ci DEBUG_TYPE_PERFORMANCE_ARB 0x8250 2275bd8deadSopenharmony_ci DEBUG_TYPE_OTHER_ARB 0x8251 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci Tokens accepted or provided by the <severity> parameters of 2305bd8deadSopenharmony_ci DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB 2315bd8deadSopenharmony_ci callback functions, and the <severities> parameter of 2325bd8deadSopenharmony_ci GetDebugMessageLogARB: 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci DEBUG_SEVERITY_HIGH_ARB 0x9146 2355bd8deadSopenharmony_ci DEBUG_SEVERITY_MEDIUM_ARB 0x9147 2365bd8deadSopenharmony_ci DEBUG_SEVERITY_LOW_ARB 0x9148 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.0 Core Specification 2395bd8deadSopenharmony_ci(OpenGL Operation) 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci In section 2.5 - GL Errors: 2425bd8deadSopenharmony_ci Add to the end of the section (pg 19): 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci "When an error is generated, the GL will also generate a debug 2455bd8deadSopenharmony_ci output message describing its cause (see section 5.5). The message 2465bd8deadSopenharmony_ci has the source DEBUG_SOURCE_API_ARB and the type 2475bd8deadSopenharmony_ci DEBUG_TYPE_ERROR_ARB, and an implementation-dependent ID." 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.0 Core Specification 2505bd8deadSopenharmony_ci(Rasterization) 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci None. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.0 Core Specification 2555bd8deadSopenharmony_ci(Per-Fragment Operations and the Frame Buffer) 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci None. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.0 Core Specification 2605bd8deadSopenharmony_ci(Special Functions) 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci After section 5.4 - Hints (pg. 300), add new section: 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci "5.5 - Debug Output 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci Application developers can obtain more information from the GL 2675bd8deadSopenharmony_ci runtime in the form of debug output. This information can include 2685bd8deadSopenharmony_ci details about GL errors, undefined behavior, implementation- 2695bd8deadSopenharmony_ci dependent performance warnings, or other useful hints. 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci This information is communicated through a stream of debug 2725bd8deadSopenharmony_ci messages that are generated as GL commands are executed. The 2735bd8deadSopenharmony_ci application can choose to receive these messages either through a 2745bd8deadSopenharmony_ci callback routine, or by querying for them from a message log. 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci Controls are provided for disabling messages that the 2775bd8deadSopenharmony_ci application does not care about, and for inserting application- 2785bd8deadSopenharmony_ci generated messages into the stream. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci 5.5.1 - Debug Messages 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci A debug message is uniquely identified by the source that generated 2835bd8deadSopenharmony_ci it, a type within that source, and an unsigned integer ID 2845bd8deadSopenharmony_ci identifying the message within that type. The message source is 2855bd8deadSopenharmony_ci one of the symbolic constants listed in Table 5.3. The message 2865bd8deadSopenharmony_ci type is one of the symbolic constants listed in Table 5.4. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci Debug Output Message Source Messages Generated by 2895bd8deadSopenharmony_ci --------------------------- --------------------- 2905bd8deadSopenharmony_ci DEBUG_SOURCE_API_ARB The GL 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci DEBUG_SOURCE_SHADER_COMPILER_ARB The GLSL shader compiler or compilers for 2935bd8deadSopenharmony_ci other extension-provided languages 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci DEBUG_SOURCE_WINDOW_SYSTEM_ARB The window system, such as WGL or GLX 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci DEBUG_SOURCE_THIRD_PARTY_ARB External debuggers or third-party middleware 2985bd8deadSopenharmony_ci libraries 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ci DEBUG_SOURCE_APPLICATION_ARB The application 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci DEBUG_SOURCE_OTHER_ARB Sources that do not fit to any of the ones listed above 3035bd8deadSopenharmony_ci ---------------------------------------------------------------------------- 3045bd8deadSopenharmony_ci Table 5.3: Sources of debug output messages. Each message must originate 3055bd8deadSopenharmony_ci from a source listed in this table. 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci Debug Output Message Type Informs about 3095bd8deadSopenharmony_ci ------------------------- ------------- 3105bd8deadSopenharmony_ci DEBUG_TYPE_ERROR_ARB Events that generated an error 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB Behavior that has been marked for 3135bd8deadSopenharmony_ci deprecation 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB Behavior that is undefined according to 3165bd8deadSopenharmony_ci the specification 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci DEBUG_TYPE_PERFORMANCE_ARB Implementation-dependent performance 3195bd8deadSopenharmony_ci warnings 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci DEBUG_TYPE_PORTABILITY_ARB Use of extensions or shaders in a way that 3225bd8deadSopenharmony_ci is highly vendor-specific 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci DEBUG_TYPE_OTHER_ARB Types of events that do not fit any of 3255bd8deadSopenharmony_ci the ones listed above 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci ---------------------------------------------------------------------------- 3285bd8deadSopenharmony_ci Table 5.4: Types of debug output messages. Each message is associated with 3295bd8deadSopenharmony_ci one of these types that describes the nature of the message. 3305bd8deadSopenharmony_ci 3315bd8deadSopenharmony_ci Each message source and type pair contains its own namespace of 3325bd8deadSopenharmony_ci messages with every message being associated with an ID. The 3335bd8deadSopenharmony_ci assignment of IDs to messages within a namespace is implementation- 3345bd8deadSopenharmony_ci dependent. There can potentially be overlap between the namespaces 3355bd8deadSopenharmony_ci of two different pairs of source and type, so messages can only be 3365bd8deadSopenharmony_ci uniquely distinguished from each other by the full combination of 3375bd8deadSopenharmony_ci source, type and ID. 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci Each message is also assigned a severity level that roughly 3405bd8deadSopenharmony_ci describes its importance across all sources and types along a 3415bd8deadSopenharmony_ci single global axis. The severity of a message is one of the 3425bd8deadSopenharmony_ci symbolic constants defined in Table 5.5. Because messages can be 3435bd8deadSopenharmony_ci disabled by their severity, this allows for quick control the global 3445bd8deadSopenharmony_ci volume of debug output. 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci Severity Level Token Suggested examples of messages 3475bd8deadSopenharmony_ci -------------------- ------------------------------ 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci DEBUG_SEVERITY_HIGH_ARB Any GL error; dangerous undefined behavior; 3505bd8deadSopenharmony_ci any GLSL or ARB shader compiler and 3515bd8deadSopenharmony_ci linker errors; 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci DEBUG_SEVERITY_MEDIUM_ARB Severe performance warnings; GLSL 3545bd8deadSopenharmony_ci or other shader compiler and linker 3555bd8deadSopenharmony_ci warnings; use of currently deprecated 3565bd8deadSopenharmony_ci behavior 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci DEBUG_SEVERITY_LOW_ARB Performance warnings from redundant 3595bd8deadSopenharmony_ci state changes; trivial undefined behavior 3605bd8deadSopenharmony_ci ---------------------------------------------------------------------------- 3615bd8deadSopenharmony_ci Table 5.5: Severity levels of messages. Each debug output message is 3625bd8deadSopenharmony_ci associated with one of these severity levels. 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci Every message also has a null-terminated string representation that 3665bd8deadSopenharmony_ci is used to describe the message. The contents of the string can 3675bd8deadSopenharmony_ci change slightly between different instances of the same message 3685bd8deadSopenharmony_ci (e.g. which parameter value caused a specific GL error to occur). 3695bd8deadSopenharmony_ci The format of a message string is left as implementation-dependent, 3705bd8deadSopenharmony_ci although it should at least represent a concise description of the 3715bd8deadSopenharmony_ci event that caused the message to be generated. Messages with 3725bd8deadSopenharmony_ci different IDs should also have sufficiently distinguishable string 3735bd8deadSopenharmony_ci representations to warrant their separation. 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci The lengths of all messages, including their null terminators, must 3765bd8deadSopenharmony_ci be guaranteed to be less or equal to the implementation-dependent 3775bd8deadSopenharmony_ci constant MAX_DEBUG_MESSAGE_LENGTH_ARB. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci Messages can be either enabled or disabled. Messages that are 3805bd8deadSopenharmony_ci disabled will not be generated. All messages are initially enabled 3815bd8deadSopenharmony_ci unless their assigned severity is DEBUG_SEVERITY_LOW_ARB. The 3825bd8deadSopenharmony_ci enabled state of messages can be changed using the command 3835bd8deadSopenharmony_ci DebugMessageControlARB. 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci 5.5.2 - Debug Message Callback 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci Applications can provide a callback function for receiving debug 3885bd8deadSopenharmony_ci messages using the command 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci void DebugMessageCallbackARB(DEBUGPROCARB callback, 3915bd8deadSopenharmony_ci const void* userParam); 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci with <callback> storing the address of the callback function. This 3945bd8deadSopenharmony_ci function's prototype must follow the type definition of 3955bd8deadSopenharmony_ci DEBUGPROCARB including its platform-dependent calling convention. 3965bd8deadSopenharmony_ci Anything else will result in undefined behavior. Only one debug 3975bd8deadSopenharmony_ci callback can be specified for the current context, and further calls 3985bd8deadSopenharmony_ci overwrite the previous callback. Specifying NULL as the value of 3995bd8deadSopenharmony_ci <callback> clears the current callback and disables message output 4005bd8deadSopenharmony_ci through callbacks. Applications can provide user-specified data 4015bd8deadSopenharmony_ci through the pointer <userParam>. The context will store this 4025bd8deadSopenharmony_ci pointer and will include it as one of the parameters in each call to 4035bd8deadSopenharmony_ci the callback function. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci If the application has specified a callback function for receiving 4065bd8deadSopenharmony_ci debug output, the implementation will call that function whenever 4075bd8deadSopenharmony_ci any enabled message is generated. The source, type, ID, and 4085bd8deadSopenharmony_ci severity of the message are specified by the DEBUGPROCARB parameters 4095bd8deadSopenharmony_ci <source>, <type>, <id>, and <severity>, respectively. The string 4105bd8deadSopenharmony_ci representation of the message is stored in <message> and its length 4115bd8deadSopenharmony_ci (excluding the null-terminator) is stored in <length>. The 4125bd8deadSopenharmony_ci parameter <userParam> is the user-specified parameter that was given 4135bd8deadSopenharmony_ci when calling DebugMessageCallbackARB. 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci Applications can query the current callback function and 4165bd8deadSopenharmony_ci the current user-specified parameter by obtaining the values of 4175bd8deadSopenharmony_ci DEBUG_CALLBACK_FUNCTION_ARB and DEBUG_CALLBACK_USER_PARAM_ARB, 4185bd8deadSopenharmony_ci respectively. 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci Applications that specify a callback function must be aware of 4215bd8deadSopenharmony_ci certain special conditions when executing code inside a callback 4225bd8deadSopenharmony_ci when it is called by the GL, regardless of the debug source. 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci The memory for <message> is owned and managed by the GL, and should 4255bd8deadSopenharmony_ci only be considered valid for the duration of the function call. 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci The behavior of calling any GL or window system function 4285bd8deadSopenharmony_ci from within the callback function is undefined and may lead to 4295bd8deadSopenharmony_ci program termination. 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ci Care must also be taken in securing debug callbacks for use with 4325bd8deadSopenharmony_ci asynchronous debug output by multi-threaded GL implementations. 4335bd8deadSopenharmony_ci Section 5.5.6 describes this in further detail. 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci 5.5.3 - Debug Message Log 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci If DEBUG_CALLBACK_FUNCTION_ARB is NULL, then debug messages are 4385bd8deadSopenharmony_ci instead stored in an internal message log up to some maximum number 4395bd8deadSopenharmony_ci of messages as defined by the value of 4405bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_ARB. 4415bd8deadSopenharmony_ci 4425bd8deadSopenharmony_ci Each context stores its own message log and will only store messages 4435bd8deadSopenharmony_ci generated by commands operating in that context. If the message log 4445bd8deadSopenharmony_ci fills up, then any subsequently generated messages will not be 4455bd8deadSopenharmony_ci placed in the log until the message log is cleared, and will instead 4465bd8deadSopenharmony_ci be discarded. 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci Applications can query the number of messages currently in the 4495bd8deadSopenharmony_ci log by obtaining the value of DEBUG_LOGGED_MESSAGES_ARB, and the 4505bd8deadSopenharmony_ci string length (including its null terminator) of the oldest message 4515bd8deadSopenharmony_ci in the log through the value of 4525bd8deadSopenharmony_ci DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB. 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci To fetch message data stored in the log, the command 4555bd8deadSopenharmony_ci GetDebugMessageLogARB can be used. 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci If DEBUG_CALLBACK_FUNCTION_ARB is not NULL, no generated messages 4585bd8deadSopenharmony_ci will be stored in the log but will instead be passed to the 4595bd8deadSopenharmony_ci debug callback routine as described in section 5.5.2. 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci 5.5.4 - Controlling Debug Messages 4625bd8deadSopenharmony_ci 4635bd8deadSopenharmony_ci Applications can control the volume of debug output by disabling 4645bd8deadSopenharmony_ci specific or groups of messages with the command: 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci void DebugMessageControlARB(enum source, 4675bd8deadSopenharmony_ci enum type, 4685bd8deadSopenharmony_ci enum severity, 4695bd8deadSopenharmony_ci sizei count, 4705bd8deadSopenharmony_ci const uint* ids, 4715bd8deadSopenharmony_ci boolean enabled); 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci If <enabled> is TRUE, the referenced subset of messages will be 4745bd8deadSopenharmony_ci enabled. If FALSE, then those messages will be disabled. 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci This command can reference different subsets of messages by first 4775bd8deadSopenharmony_ci considering the set of all messages, and filtering out messages 4785bd8deadSopenharmony_ci based on the following ways: 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci - If <source> is not DONT_CARE, then all messages whose source 4815bd8deadSopenharmony_ci does not match <source> will not be referenced. 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci - If <type> is not DONT_CARE, then all messages whose type does 4845bd8deadSopenharmony_ci not match <type> will not be referenced. 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci - If <severity> is not DONT_CARE, then all messages whose 4875bd8deadSopenharmony_ci severity level does not match <severity> will not be 4885bd8deadSopenharmony_ci referenced. 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci - If <count> is greater than zero, then <ids> is an array of 4915bd8deadSopenharmony_ci <count> message IDs for the specified combination of 4925bd8deadSopenharmony_ci <source> and <type>. In this case, if <source> or <type> 4935bd8deadSopenharmony_ci is DONT_CARE, or <severity> is not DONT_CARE, the error 4945bd8deadSopenharmony_ci INVALID_OPERATION is generated. If <count> is zero, the 4955bd8deadSopenharmony_ci value if <ids> is ignored. 4965bd8deadSopenharmony_ci 4975bd8deadSopenharmony_ci In addition, if any of <source>, <type>, and <severity> is not 4985bd8deadSopenharmony_ci DONT_CARE and is not one of the symbols from, respectively, Table 4995bd8deadSopenharmony_ci 5.3, Table 5.4, and Table 5.5, the error INVALID_ENUM is 5005bd8deadSopenharmony_ci generated. If <count> is negative, the error INVALID_VALUE is 5015bd8deadSopenharmony_ci generated. 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci Although messages are grouped into an implicit hierarchy by their 5045bd8deadSopenharmony_ci sources and types, there is no explicit per-source, per-type or 5055bd8deadSopenharmony_ci per-severity enabled state. Instead, the enabled state is stored 5065bd8deadSopenharmony_ci individually for each message. There is no difference between 5075bd8deadSopenharmony_ci disabling all messages from one source in a single call, and 5085bd8deadSopenharmony_ci individually disabling all messages from that source using their 5095bd8deadSopenharmony_ci types and IDs. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci 5.5.5 - Externally Generated Messages 5125bd8deadSopenharmony_ci 5135bd8deadSopenharmony_ci To support applications and third-party libraries generating their 5145bd8deadSopenharmony_ci own messages, such as ones containing timestamp information or 5155bd8deadSopenharmony_ci signals about specific render system events, the following function 5165bd8deadSopenharmony_ci can be called 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci void DebugMessageInsertARB(enum source, 5195bd8deadSopenharmony_ci enum type, 5205bd8deadSopenharmony_ci uint id, 5215bd8deadSopenharmony_ci enum severity, 5225bd8deadSopenharmony_ci int length, 5235bd8deadSopenharmony_ci const char* buf); 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci The value of <id> specifies the ID for the message and <severity> 5265bd8deadSopenharmony_ci indicates its severity level as defined by the caller. If 5275bd8deadSopenharmony_ci <severity> is not one of the severity levels listed in Table 5.5, 5285bd8deadSopenharmony_ci the error INVALID_ENUM will be generated. The value of <type> 5295bd8deadSopenharmony_ci must be one of the values from Table 5.4 and the value of <source> 5305bd8deadSopenharmony_ci must be either DEBUG_SOURCE_APPLICATION_ARB or 5315bd8deadSopenharmony_ci DEBUG_SOURCE_THIRD_PARTY_ARB, or the error INVALID_ENUM will be 5325bd8deadSopenharmony_ci generated. The string <buf> contains the string representation of 5335bd8deadSopenharmony_ci the message. The parameter <length> contains the number of 5345bd8deadSopenharmony_ci characters in <buf>. If <length> is negative, it is implied that 5355bd8deadSopenharmony_ci <buf> contains a null terminated string. The error INVALID_VALUE 5365bd8deadSopenharmony_ci will be generated if the number of characters in <buf>, excluding 5375bd8deadSopenharmony_ci the null terminator when <length> is negative, is not less than 5385bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_ARB. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci 5.5.6 - Asynchronous and Synchronous Debug Output 5415bd8deadSopenharmony_ci 5425bd8deadSopenharmony_ci The behavior of how and when the GL driver is allowed to generate 5435bd8deadSopenharmony_ci debug messages, and subsequently either call back to the application 5445bd8deadSopenharmony_ci or place the message in the debug message log, is affected by 5455bd8deadSopenharmony_ci the state DEBUG_OUTPUT_SYNCHRONOUS_ARB. This state can be modified 5465bd8deadSopenharmony_ci by the Enable and Disable commands. Its initial value is FALSE. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci When DEBUG_OUTPUT_SYNCHRONOUS_ARB is disabled, the 5495bd8deadSopenharmony_ci driver is optionally allowed to concurrently call the debug callback 5505bd8deadSopenharmony_ci routine from potentially multiple threads, including threads that 5515bd8deadSopenharmony_ci the context that generated the message is not currently bound to. 5525bd8deadSopenharmony_ci The implementation may also call the callback routine asynchronously 5535bd8deadSopenharmony_ci after the GL command that generated the message has already 5545bd8deadSopenharmony_ci returned. The application is fully responsible for ensuring thread 5555bd8deadSopenharmony_ci safety due to debug callbacks under these circumstances. In this 5565bd8deadSopenharmony_ci situation the <userParam> value may be helpful in identifying which 5575bd8deadSopenharmony_ci application thread's command originally generated the debug 5585bd8deadSopenharmony_ci callback. 5595bd8deadSopenharmony_ci 5605bd8deadSopenharmony_ci When DEBUG_OUTPUT_SYNCHRONOUS_ARB is enabled, the 5615bd8deadSopenharmony_ci driver guarantees synchronous calls to the callback routine 5625bd8deadSopenharmony_ci by the context. When synchronous callbacks are enabled, 5635bd8deadSopenharmony_ci all calls to the callback routine will be made by the thread 5645bd8deadSopenharmony_ci that owns the current context; all such calls will be made 5655bd8deadSopenharmony_ci serially by the current context; and each call will be made 5665bd8deadSopenharmony_ci before the GL command that generated the debug message is allowed to 5675bd8deadSopenharmony_ci return. 5685bd8deadSopenharmony_ci 5695bd8deadSopenharmony_ci When no callback is specified and DEBUG_OUTPUT_SYNCHRONOUS_ARB 5705bd8deadSopenharmony_ci is disabled, the driver can still asynchronously place messages 5715bd8deadSopenharmony_ci in the debug message log, even after the context thread has 5725bd8deadSopenharmony_ci returned from the GL function that generated those messages. When 5735bd8deadSopenharmony_ci DEBUG_OUTPUT_SYNCHRONOUS_ARB is enabled, the driver guarantees that 5745bd8deadSopenharmony_ci all messages are added to the log before the GL function returns. 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci Enabling synchronous debug output greatly simplifies the 5775bd8deadSopenharmony_ci responsibilities of the application for making its callback 5785bd8deadSopenharmony_ci functions thread-safe, but may potentially result in drastically 5795bd8deadSopenharmony_ci reduced driver performance. 5805bd8deadSopenharmony_ci 5815bd8deadSopenharmony_ci The DEBUG_OUTPUT_SYNCHRONOUS_ARB only guarantees 5825bd8deadSopenharmony_ci intra-context synchronization for the callbacks of messages 5835bd8deadSopenharmony_ci generated by that context, and does not guarantee synchronization 5845bd8deadSopenharmony_ci across multiple contexts. If multiple contexts are concurrently 5855bd8deadSopenharmony_ci used by the application, it is allowed for those contexts to 5865bd8deadSopenharmony_ci also concurrently call their designated callbacks, and the 5875bd8deadSopenharmony_ci application is responsible for handling thread safety in that 5885bd8deadSopenharmony_ci situation even if DEBUG_OUTPUT_SYNCHRONOUS_ARB is enabled 5895bd8deadSopenharmony_ci in all contexts." 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.0 Core Specification 5925bd8deadSopenharmony_ci(State and State Requests) 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Modify the title of Section 6.1.6 - String Queries to read 5955bd8deadSopenharmony_ci "Section 6.1.6 - Pointer and String Queries", and insert to the 5965bd8deadSopenharmony_ci beginning of the section: 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ci The command 5995bd8deadSopenharmony_ci 6005bd8deadSopenharmony_ci void GetPointerv(enum pname, void** params); 6015bd8deadSopenharmony_ci 6025bd8deadSopenharmony_ci obtains the pointer or pointers named <pname> in the array <params>. 6035bd8deadSopenharmony_ci The possible values for <pname> are DEBUG_CALLBACK_FUNCTION_ARB and 6045bd8deadSopenharmony_ci DEBUG_CALLBACK_USER_PARAM_ARB, which respectively return the current 6055bd8deadSopenharmony_ci debug output callback function pointer and its application-specified 6065bd8deadSopenharmony_ci user parameter. Each <pname> returns a single pointer value. 6075bd8deadSopenharmony_ci 6085bd8deadSopenharmony_ci After Section 6.1.14 - Renderbuffer Object Queries (pg 324): 6095bd8deadSopenharmony_ci Add new Section 6.1.15 - Debug Object Queries: 6105bd8deadSopenharmony_ci 6115bd8deadSopenharmony_ci 6.1.15 - Debug Output Queries 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci When no debug callback is set, debug messages are stored in 6145bd8deadSopenharmony_ci a debug message log as described in section 5.5.3. Messages can 6155bd8deadSopenharmony_ci be queried from the log by calling 6165bd8deadSopenharmony_ci 6175bd8deadSopenharmony_ci uint GetDebugMessageLogARB(uint count, 6185bd8deadSopenharmony_ci sizei bufSize, 6195bd8deadSopenharmony_ci enum* sources, 6205bd8deadSopenharmony_ci enum* types, 6215bd8deadSopenharmony_ci uint* ids, 6225bd8deadSopenharmony_ci enum* severities, 6235bd8deadSopenharmony_ci sizei* lengths, 6245bd8deadSopenharmony_ci char* messageLog); 6255bd8deadSopenharmony_ci 6265bd8deadSopenharmony_ci This function fetches a maximum of <count> messages from the message 6275bd8deadSopenharmony_ci log, and will return the number of messages successfully fetched. 6285bd8deadSopenharmony_ci 6295bd8deadSopenharmony_ci Messages will be fetched from the log in order of oldest to 6305bd8deadSopenharmony_ci newest. Those messages that were fetched will be removed from the 6315bd8deadSopenharmony_ci log. 6325bd8deadSopenharmony_ci 6335bd8deadSopenharmony_ci The sources, types, severities, IDs, and string lengths of 6345bd8deadSopenharmony_ci fetched messages will be stored in the application-provided arrays 6355bd8deadSopenharmony_ci <sources>, <types>, <severities>, <ids>, and <lengths>, 6365bd8deadSopenharmony_ci respectively. The application is responsible for allocating enough 6375bd8deadSopenharmony_ci space for each array to hold up to <count> elements. The string 6385bd8deadSopenharmony_ci representations of all fetched messages are stored in the 6395bd8deadSopenharmony_ci <messageLog> array. If multiple messages are fetched, their strings 6405bd8deadSopenharmony_ci are concatenated into the same <messageLog> array and will be 6415bd8deadSopenharmony_ci separated by single null terminators. The last string in the array 6425bd8deadSopenharmony_ci will also be null-terminated. The maximum size of <messageLog>, 6435bd8deadSopenharmony_ci including the space used by all null terminators, is given by 6445bd8deadSopenharmony_ci <bufSize>. If <bufSize> is less than zero, the error INVALID_VALUE 6455bd8deadSopenharmony_ci will be generated. If a message's string, including its null 6465bd8deadSopenharmony_ci terminator, can not fully fit within the <messageLog> array's 6475bd8deadSopenharmony_ci remaining space, then that message and any subsequent messages will 6485bd8deadSopenharmony_ci not be fetched and will remain in the log. The string lengths 6495bd8deadSopenharmony_ci stored in the array <lengths> include the space for the null 6505bd8deadSopenharmony_ci terminator of each string. 6515bd8deadSopenharmony_ci 6525bd8deadSopenharmony_ci Any or all of the arrays <sources>, <types>, <ids>, <severities>, 6535bd8deadSopenharmony_ci <lengths> and <messageLog> can also be null pointers, which causes 6545bd8deadSopenharmony_ci the attributes for such arrays to be discarded when messages 6555bd8deadSopenharmony_ci are fetched, however those messages will still be removed from the 6565bd8deadSopenharmony_ci log. Thus to simply delete up to <count> messages from the message 6575bd8deadSopenharmony_ci log while ignoring their attributes, the application can call the 6585bd8deadSopenharmony_ci function with null pointers for all attribute arrays. If 6595bd8deadSopenharmony_ci <messageLog> is NULL, the value of <bufSize> is ignored. 6605bd8deadSopenharmony_ci 6615bd8deadSopenharmony_ciAdditions to the OpenGL / GLX / GLX Protocol Specifications 6625bd8deadSopenharmony_ci 6635bd8deadSopenharmony_ci None. 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ciAdditions to the WGL Specification 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci None. 6685bd8deadSopenharmony_ci 6695bd8deadSopenharmony_ciDependencies on GL and ES profiles, versions, and other extensions 6705bd8deadSopenharmony_ci 6715bd8deadSopenharmony_ci Dependencies on OpenGL 4.0 Compatibility specification and any other 6725bd8deadSopenharmony_ci versions or extensions that already provide the GetPointerv entry 6735bd8deadSopenharmony_ci point as provided by the OpenGL 4.0 Compatibility specification 6745bd8deadSopenharmony_ci 6755bd8deadSopenharmony_ci - Remove the modifications to Section 6.1.6 from this 6765bd8deadSopenharmony_ci specification with the exception that GetPointerv will still 6775bd8deadSopenharmony_ci accept DEBUG_CALLBACK_FUNCTION_ARB and 6785bd8deadSopenharmony_ci DEBUG_CALLBACK_USER_PARAM_ARB as valid values for <pname>, 6795bd8deadSopenharmony_ci and will return the same values as described in Chapter 6. 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ci Dependencies on OpenGL 4.0 Compatibility specification and any other 6825bd8deadSopenharmony_ci versions that support display lists 6835bd8deadSopenharmony_ci 6845bd8deadSopenharmony_ci - DebugMessageControlARB, DebugMessageInsertARB, 6855bd8deadSopenharmony_ci DebugMessageCallbackARB, and GetDebugMessageLogARB are 6865bd8deadSopenharmony_ci not compiled into display lists. 6875bd8deadSopenharmony_ci 6885bd8deadSopenharmony_ci Add the following to section 5.5.1 of the OpenGL 4.0 6895bd8deadSopenharmony_ci Compatibility specification, after the paragraph beginning 6905bd8deadSopenharmony_ci with "GL command stream management" (pg 414): 6915bd8deadSopenharmony_ci 6925bd8deadSopenharmony_ci "Debug output: DebugMessageControlARB, 6935bd8deadSopenharmony_ci DebugMessageInsertARB, DebugMessageCallbackARB, and 6945bd8deadSopenharmony_ci GetDebugMessageLogARB" 6955bd8deadSopenharmony_ci 6965bd8deadSopenharmony_ci Add the same language to corresponding sections of other 6975bd8deadSopenharmony_ci specifications. 6985bd8deadSopenharmony_ci 6995bd8deadSopenharmony_ciErrors 7005bd8deadSopenharmony_ci 7015bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageControlARB 7025bd8deadSopenharmony_ci if <source> is not DONT_CARE or one of the debug output sources 7035bd8deadSopenharmony_ci listed in Table 5.3. 7045bd8deadSopenharmony_ci 7055bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageControlARB 7065bd8deadSopenharmony_ci if <type> is not DONT_CARE or one of the debug output types listed 7075bd8deadSopenharmony_ci in Table 5.4. 7085bd8deadSopenharmony_ci 7095bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageControlARB 7105bd8deadSopenharmony_ci if <severity> is not DONT_CARE or one of the severity levels listed 7115bd8deadSopenharmony_ci in Table 5.5. 7125bd8deadSopenharmony_ci 7135bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageControlARB 7145bd8deadSopenharmony_ci if <count> is less than zero. 7155bd8deadSopenharmony_ci 7165bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by 7175bd8deadSopenharmony_ci DebugMessageControlARB when <count> is greater than zero and 7185bd8deadSopenharmony_ci <source> is DONT_CARE. 7195bd8deadSopenharmony_ci 7205bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by 7215bd8deadSopenharmony_ci DebugMessageControlARB when <count> is greater than zero and 7225bd8deadSopenharmony_ci <type> is DONT_CARE. 7235bd8deadSopenharmony_ci 7245bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by 7255bd8deadSopenharmony_ci DebugMessageControlARB when <count> is greater than zero and 7265bd8deadSopenharmony_ci and <severity> is not DONT_CARE. 7275bd8deadSopenharmony_ci 7285bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by GetDebugMessageLogARB 7295bd8deadSopenharmony_ci if the value of <count> is less than zero. 7305bd8deadSopenharmony_ci 7315bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by GetDebugMessageLogARB 7325bd8deadSopenharmony_ci if <bufSize> is less than zero. 7335bd8deadSopenharmony_ci 7345bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageInsertARB if 7355bd8deadSopenharmony_ci the value of <source> is not DEBUG_SOURCE_APPLICATION_ARB or 7365bd8deadSopenharmony_ci DEBUG_SOURCE_THIRD_PARTY_ARB. 7375bd8deadSopenharmony_ci 7385bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageInsertARB if 7395bd8deadSopenharmony_ci the value of <type> is not one of the values from Table 5.4. 7405bd8deadSopenharmony_ci 7415bd8deadSopenharmony_ci The error INVALID_ENUM will be generated by DebugMessageInsertARB if 7425bd8deadSopenharmony_ci <severity> is not a valid debug severity level listed in Table 5.5. 7435bd8deadSopenharmony_ci 7445bd8deadSopenharmony_ci The error INVALID_VALUE will be generated by DebugMessageInsertARB 7455bd8deadSopenharmony_ci if the number of characters in <buf>, excluding the null terminator 7465bd8deadSopenharmony_ci when <length> is negative, is not less than 7475bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_ARB. 7485bd8deadSopenharmony_ci 7495bd8deadSopenharmony_ciNew State 7505bd8deadSopenharmony_ci 7515bd8deadSopenharmony_ci Add new table 6.55 after p.376 (Debug Output): 7525bd8deadSopenharmony_ci 7535bd8deadSopenharmony_ci Initial 7545bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 7555bd8deadSopenharmony_ci -------------------------- ---- ----------- ----- ------------------------- ------ --------- 7565bd8deadSopenharmony_ci DEBUG_CALLBACK_FUNCTION_ARB Y GetPointerv NULL The current debug output 5.5.2 - 7575bd8deadSopenharmony_ci callback function pointer 7585bd8deadSopenharmony_ci 7595bd8deadSopenharmony_ci DEBUG_CALLBACK_USER_PARAM_ARB Y GetPointerv NULL The current debug output 5.5.2 - 7605bd8deadSopenharmony_ci callback user parameter 7615bd8deadSopenharmony_ci 7625bd8deadSopenharmony_ci DEBUG_LOGGED_MESSAGES_ARB Z+ GetIntegerv 0 The number of messages 5.5.3 - 7635bd8deadSopenharmony_ci currently in the debug 7645bd8deadSopenharmony_ci message log 7655bd8deadSopenharmony_ci 7665bd8deadSopenharmony_ci DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB Z+ GetIntegerv 0 The string length of the 5.5.3 - 7675bd8deadSopenharmony_ci oldest debug message in 7685bd8deadSopenharmony_ci the debug message log 7695bd8deadSopenharmony_ci 7705bd8deadSopenharmony_ci DEBUG_OUTPUT_SYNCHRONOUS_ARB B IsEnabled FALSE The enabled state for 5.5.6 7715bd8deadSopenharmony_ci synchronous debug message 7725bd8deadSopenharmony_ci callbacks 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ciNew Implementation Dependent State 7755bd8deadSopenharmony_ci 7765bd8deadSopenharmony_ci Add new table 6.56 after table 6.55 (Implementation Dependent Debug Output Values): 7775bd8deadSopenharmony_ci Minimum 7785bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec Attribute 7795bd8deadSopenharmony_ci -------------------------------- -- ----------- ----- ------------------------- ------ --------- 7805bd8deadSopenharmony_ci MAX_DEBUG_MESSAGE_LENGTH_ARB Z+ GetIntegerv 1 The maximum length of a 5.5.1 - 7815bd8deadSopenharmony_ci debug message string, 7825bd8deadSopenharmony_ci including its null 7835bd8deadSopenharmony_ci terminator 7845bd8deadSopenharmony_ci 7855bd8deadSopenharmony_ci MAX_DEBUG_LOGGED_MESSAGES_ARB Z+ GetIntegerv 1 The maximum number of 5.5.3 - 7865bd8deadSopenharmony_ci messages stored in the 7875bd8deadSopenharmony_ci debug message log 7885bd8deadSopenharmony_ci 7895bd8deadSopenharmony_ciIssues 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci 01) Should we reserve tokens for arbitrary vendor-specific 7925bd8deadSopenharmony_ci categories (e.g. DEBUG_CATEGORY_VENDOR0)? 7935bd8deadSopenharmony_ci 7945bd8deadSopenharmony_ci RESOLVED: No. Since this is an ARB extension, there is no 7955bd8deadSopenharmony_ci reason to do this now in the current version. 7965bd8deadSopenharmony_ci 7975bd8deadSopenharmony_ci 7985bd8deadSopenharmony_ci 02) Should we allow explicit controls for printing to stderr or 7995bd8deadSopenharmony_ci through OutputDebugString instead of the callback? 8005bd8deadSopenharmony_ci 8015bd8deadSopenharmony_ci RESOLVED: No. It is up to the application to setup this 8025bd8deadSopenharmony_ci behavior itself using the provided functionality. 8035bd8deadSopenharmony_ci 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci 03) How do the different filtering rules interact? If a category is 8065bd8deadSopenharmony_ci filtered, but a message in that same category is set to be 8075bd8deadSopenharmony_ci unfiltered by ID or severity level, should that message still be 8085bd8deadSopenharmony_ci filtered? If I specifically filter a category and then unfilter 8095bd8deadSopenharmony_ci all messages globally with a later command, should that category 8105bd8deadSopenharmony_ci still be filtered? 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ci RESOLVED: Message enable state is stored individually for each 8135bd8deadSopenharmony_ci message. There is no explicit group-wise enable 8145bd8deadSopenharmony_ci state or different ordered levels of "enabledness" in 8155bd8deadSopenharmony_ci the implied hierarchy of messages. Operations on 8165bd8deadSopenharmony_ci groups of messages affect all messages within 8175bd8deadSopenharmony_ci that group individually, and overwrite the previous 8185bd8deadSopenharmony_ci and individual state of those messages. 8195bd8deadSopenharmony_ci 8205bd8deadSopenharmony_ci 04) Should applications be allowed to insert their own messages 8215bd8deadSopenharmony_ci through a custom category? How would this be done? 8225bd8deadSopenharmony_ci 8235bd8deadSopenharmony_ci RESOLVED: Yes. A new category will be provided for 8245bd8deadSopenharmony_ci application-specific messages and an entry point will 8255bd8deadSopenharmony_ci be provided to write messages in that category. 8265bd8deadSopenharmony_ci 8275bd8deadSopenharmony_ci 05) Should we provide a mechanism to ensure synchronized calls of 8285bd8deadSopenharmony_ci the debug output callback by the implementation? 8295bd8deadSopenharmony_ci 8305bd8deadSopenharmony_ci RESOLVED: Yes. This is useful for the application to observe 8315bd8deadSopenharmony_ci which GL function caused a specific message to be 8325bd8deadSopenharmony_ci generated by observing the debugger call stack. 8335bd8deadSopenharmony_ci 8345bd8deadSopenharmony_ci It will also simplify the application's 8355bd8deadSopenharmony_ci responsibility for creating a thread-safe callback 8365bd8deadSopenharmony_ci routine at the understood price of potential reduced 8375bd8deadSopenharmony_ci driver performance when the debug layer is active. 8385bd8deadSopenharmony_ci 8395bd8deadSopenharmony_ci A new state 8405bd8deadSopenharmony_ci DEBUG_OUTPUT_SYNCHRONOUS_CALLBACK_ARB will be 8415bd8deadSopenharmony_ci provided that can be enabled by the application to 8425bd8deadSopenharmony_ci provide this functionality. 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci 06) Is it possible that multi-threaded drivers that generate 8455bd8deadSopenharmony_ci messages asynchronously into the message log can cause a 8465bd8deadSopenharmony_ci race condition where a message is inserted between the time 8475bd8deadSopenharmony_ci an application queries DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 8485bd8deadSopenharmony_ci and the attempted fetch of the oldest message? 8495bd8deadSopenharmony_ci 8505bd8deadSopenharmony_ci RESOLVED: Yes. When the message log is full, the oldest 8515bd8deadSopenharmony_ci message would be bumped out by the new message which 8525bd8deadSopenharmony_ci would make the queried value incorrect. A solution 8535bd8deadSopenharmony_ci to this is to make the message log discard messages 8545bd8deadSopenharmony_ci when it has filled up but otherwise preserve its 8555bd8deadSopenharmony_ci contents. 8565bd8deadSopenharmony_ci 8575bd8deadSopenharmony_ci A similar race condition can still occur when 8585bd8deadSopenharmony_ci querying DEBUG_LOGGED_MESSAGES_ARB when the message 8595bd8deadSopenharmony_ci log is not full. However in this case the value at 8605bd8deadSopenharmony_ci the time of the fetch can only either be equal or 8615bd8deadSopenharmony_ci greater than at the time of the query, and neither 8625bd8deadSopenharmony_ci case will result in lost information. 8635bd8deadSopenharmony_ci 8645bd8deadSopenharmony_ci The synchronous callback toggle has also been 8655bd8deadSopenharmony_ci modified to also explicitly affect the placing of 8665bd8deadSopenharmony_ci messages into the message log. 8675bd8deadSopenharmony_ci 8685bd8deadSopenharmony_ciRevision History 8695bd8deadSopenharmony_ci 8705bd8deadSopenharmony_ci (v17, 2013-07-08, Jon Leech) 8715bd8deadSopenharmony_ci - Change type of userParam parameter to DebugMessageCallbackARB and 8725bd8deadSopenharmony_ci GLDEBUGPROCARB from 'void *' to 'const void *' to match GL core 8735bd8deadSopenharmony_ci and KHR_debug (Bug 10083). 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ci (v16, 2013-04-16, Jon Leech) 8765bd8deadSopenharmony_ci - Fix type of <ids> parameter in GetDebugMessageLog body (Bug 10083) 8775bd8deadSopenharmony_ci 8785bd8deadSopenharmony_ci (v15, 2012-06-22, Piers Daniell) 8795bd8deadSopenharmony_ci - Restored the ARB suffixes removed by mistake. 8805bd8deadSopenharmony_ci 8815bd8deadSopenharmony_ci (v14, 2012-06-19, Jon Leech) 8825bd8deadSopenharmony_ci - Change logSize parameter to bufSize 8835bd8deadSopenharmony_ci 8845bd8deadSopenharmony_ci (v13, 2012-04-19, pdaniell) 8855bd8deadSopenharmony_ci - Remove ARB suffixs to make the extension ready for OpenGL 4.3. 8865bd8deadSopenharmony_ci 8875bd8deadSopenharmony_ci (v12, 2010-06-01, jkontti) 8885bd8deadSopenharmony_ci - Added DEBUG_TYPE_PORTABILITY_ARB 8895bd8deadSopenharmony_ci - Renamed DEBUG_OUTPUT_SYNCHRONOUS_CALLBACK_ARB to 8905bd8deadSopenharmony_ci DEBUG_OUTPUT_SYNCHRONOUS_ARB and made it explicitly affect 8915bd8deadSopenharmony_ci not just callbacks but also messages in the message log. 8925bd8deadSopenharmony_ci - Moved discussion abotu DEBUG_OUTPUT_SYNCHRONOUS_ARB to its 8935bd8deadSopenharmony_ci own section 5.5.6 8945bd8deadSopenharmony_ci - When the message log fills up, new messages will be discarded 8955bd8deadSopenharmony_ci instead of bumping off old messages (issue 6). 8965bd8deadSopenharmony_ci - Removed restrictions from third-party sources for 8975bd8deadSopenharmony_ci DebugMessageControlARB 8985bd8deadSopenharmony_ci - Removed restrictions on <type> for DebugMessageInsertARB 8995bd8deadSopenharmony_ci 9005bd8deadSopenharmony_ci (v11, 2010-05-28, jkontti) 9015bd8deadSopenharmony_ci - Added DEBUG_OUTPUT_SYNCHRONOUS_CALLBACK_ARB enable state for 9025bd8deadSopenharmony_ci applications to be guaranteed that the debug callback is not 9035bd8deadSopenharmony_ci called asynchronously or concurrently by the implementation 9045bd8deadSopenharmony_ci - Created tables 6.55 and 6.56 for new introduced state and 9055bd8deadSopenharmony_ci implementation-dependent state 9065bd8deadSopenharmony_ci - Moved sections 2.21.x to 5.5.x 9075bd8deadSopenharmony_ci - Moved tables 2.15 to 5.3, 2.16 to 5.4, and 2.17 to 5.5 9085bd8deadSopenharmony_ci - Changed minimum value of MAX_DEBUG_MESSAGE_LENGTH_ARB to 1 9095bd8deadSopenharmony_ci - Renamed DebugMessageEnableARB to DebugMessageControlARB 9105bd8deadSopenharmony_ci - For DebugMessageControlARB, DONT_CARE will now be used as the 9115bd8deadSopenharmony_ci enum to ignore filtered message properties instead of NONE 9125bd8deadSopenharmony_ci 9135bd8deadSopenharmony_ci 9145bd8deadSopenharmony_ci (v10, 2010-05-13, jkontti) 9155bd8deadSopenharmony_ci - Split category attribute to orthogonal source and type. This 9165bd8deadSopenharmony_ci requires all new tokens (currently missing). 9175bd8deadSopenharmony_ci - Table 2.15 now refers to debug output source 9185bd8deadSopenharmony_ci - Table 2.16 now refers to debug output type 9195bd8deadSopenharmony_ci - New table 2.17 that now contains debug output severity 9205bd8deadSopenharmony_ci 9215bd8deadSopenharmony_ci (v9, 2010-05-11, jkontti) 9225bd8deadSopenharmony_ci - Rewrote against OpenGL 4.0 Core specification: Section 2.20 9235bd8deadSopenharmony_ci renamed to 2.21 and tables 2.12 and 2.13 are now 2.15 and 2.16 9245bd8deadSopenharmony_ci - Added missing sections for changes to Chapters 3-6. 9255bd8deadSopenharmony_ci - Removed explicit language about contexts created using the 9265bd8deadSopenharmony_ci debug flag. Instead, implementations can choose, but are 9275bd8deadSopenharmony_ci not required to, only support this extension in contexts 9285bd8deadSopenharmony_ci created with the debug flag. 9295bd8deadSopenharmony_ci - Added Dependencies section to discuss behavior of the 9305bd8deadSopenharmony_ci debug output entry points when used inside display lists. 9315bd8deadSopenharmony_ci - Added new entry point GetPointerv since it is missing 9325bd8deadSopenharmony_ci in core profiles. 9335bd8deadSopenharmony_ci - Added new state DEBUG_CALLBACK_FUNCTION_ARB, 9345bd8deadSopenharmony_ci DEBUG_CALLBACK_USER_PARAM_ARB, 9355bd8deadSopenharmony_ci DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB (token values still 9365bd8deadSopenharmony_ci missing). 9375bd8deadSopenharmony_ci - Rewrote sections of GetDebugMessageLog to be clearer and 9385bd8deadSopenharmony_ci changed some of the error generation. 9395bd8deadSopenharmony_ci - DebugMessageInsert parameter <length> can now be negative 9405bd8deadSopenharmony_ci which indicates that the passed-in string is null-terminated. 9415bd8deadSopenharmony_ci - Updated contributors section 9425bd8deadSopenharmony_ci 9435bd8deadSopenharmony_ci (v8, 2010-05-07, jkontti) 9445bd8deadSopenharmony_ci - Removed inconsistent language from New Tokens category for 9455bd8deadSopenharmony_ci tokens that are no longer accepted by DebugMessageEnableARB 9465bd8deadSopenharmony_ci since revision v5. 9475bd8deadSopenharmony_ci - Cleaned up some language and formatting issues. 9485bd8deadSopenharmony_ci 9495bd8deadSopenharmony_ci (v7, 2010-01-21, jkontti) 9505bd8deadSopenharmony_ci - Added user-specifiable parameter to debug message callback 9515bd8deadSopenharmony_ci function. 9525bd8deadSopenharmony_ci 9535bd8deadSopenharmony_ci (v6, 2010-01-15, jkontti) 9545bd8deadSopenharmony_ci - Updated contact section. 9555bd8deadSopenharmony_ci - Updated contributor section. 9565bd8deadSopenharmony_ci - Updated status section. 9575bd8deadSopenharmony_ci - Updated enums. 9585bd8deadSopenharmony_ci 9595bd8deadSopenharmony_ci (v5, 2009-09-17, jkontti) 9605bd8deadSopenharmony_ci - Message ID namespaces are now contained within categories 9615bd8deadSopenharmony_ci instead of being in a single global namespace. 9625bd8deadSopenharmony_ci - Reworked DebugMessageEnable to allow disabling/enabling more 9635bd8deadSopenharmony_ci combinations of messages. 9645bd8deadSopenharmony_ci - Resolved issue 01. 9655bd8deadSopenharmony_ci - Resolved issue 03. 9665bd8deadSopenharmony_ci 9675bd8deadSopenharmony_ci (v4, 2009-09-16, jkontti) 9685bd8deadSopenharmony_ci - Added category as a parameter to DebugMessageInsert for 9695bd8deadSopenharmony_ci future-proofing purposes, 9705bd8deadSopenharmony_ci - Added missing errors to DebugMessageInsert and 9715bd8deadSopenharmony_ci GetDebugMessageLog. 9725bd8deadSopenharmony_ci - Added missing tokens to New Tokens. 9735bd8deadSopenharmony_ci - Renamed DebugMessageFilter to DebugMessageEnable. 9745bd8deadSopenharmony_ci 9755bd8deadSopenharmony_ci (v3, 2009-09-15, myoung) 9765bd8deadSopenharmony_ci - Cleaned up some language 9775bd8deadSopenharmony_ci - Added values using AMD reserved ranges. Values do not overlap 9785bd8deadSopenharmony_ci so can be re-used. 9795bd8deadSopenharmony_ci 9805bd8deadSopenharmony_ci (v2, 2009-09-15, jkontti) 9815bd8deadSopenharmony_ci - Application-generated messages. 9825bd8deadSopenharmony_ci - More categories (window system, deprecation, profile, 9835bd8deadSopenharmony_ci application). 9845bd8deadSopenharmony_ci 9855bd8deadSopenharmony_ci (v1, 2009-09-09, jkontti) 9865bd8deadSopenharmony_ci - Initial revision. 987