1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
|
<?xml version="1.0" encoding="UTF-8"?>
<proposal href="proposals/WEBGL_debug/">
<name>WEBGL_debug</name>
<contact> <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
working group</a> (public_webgl 'at' khronos.org) </contact>
<contributors>
<contributor>Emmanuel Gil Peyrot, Collabora Ltd.</contributor>
<contributor>Members of the WebGL working group</contributor>
</contributors>
<number>NN</number>
<depends>
<api version="1.0"/>
</depends>
<overview id="overview">
<p>
This extension allows the GL to notify applications when various events
occur that may be useful during application development, debugging and
profiling.
</p>
<mirrors href="https://www.opengl.org/registry/specs/KHR/debug.txt"
name="KHR_debug">
<addendum>
References to debug contexts are deleted.
</addendum>
<addendum>
References to the debug message log and callback are deleted, replaced
with DOM events.
</addendum>
<addendum>
The <code>ObjectPtrLabel</code> and <code>GetObjectPtrLabel</code>
functions are replaced with <code>ObjectLabel</code> and
<code>GetObjectLabel</code>.
</addendum>
<addendum>
The <code>count</code> and <code>ids</code> arguments of
<code>DebugMessageControl</code> are replaced with a
<code>sequence<GLuint> ids</code> argument.
</addendum>
<addendum>
The <code>length</code> and <code>buf</code> arguments of
<code>DebugMessageInsert</code> and <code>PushDebugGroup</code> are
replaced with a <code>DOMString message</code> argument.
</addendum>
<addendum>
The <code>identifier</code> and <code>name</code> arguments of
<code>ObjectLabel</code> and <code>GetObjectLabel</code> are replaced
with a <code>WebGLObject object</code> argument.
</addendum>
<addendum>
The <code>length</code> and <code>label</code> arguments of
<code>ObjectLabel</code> are replaced with a <code>DOMString
label</code> argument.
</addendum>
<addendum>
The <code>bufSize</code>, <code>length</code> and <code>label</code>
arguments of <code>GetObjectLabel</code> are replaced with a
<code>DOMString</code> return type.
</addendum>
<addendum>
As per the usual WebGL binding rules, functions don’t keep the KHR
suffix they have in the GLES version, but tokens do.
</addendum>
</mirrors>
<features>
<feature>
The <code>WEBGL_debug</code> extension object is a DOM
<code>EventTarget</code>, obeying the rules of the <a
href="http://www.w3.org/TR/DOM-Level-3-Events/">DOM Level 3 Events</a>,
with a new <code>WebGLDebugMessage</code> event that gets fired
whenever the driver, browser or application emits a debug message.
</feature>
<feature>
<code>debugMessageInsertKHR</code> is exposed to allow the application
to insert debug messages into the WebGL stream.
</feature>
<feature>
<code>objectLabelKHR</code> and <code>getObjectLabelKHR</code> are
exposed, to assign a label to a <code>WebGLObject</code> and retrieve
it.
</feature>
<feature>
<code>pushDebugGroupKHR</code> and <code>popDebugGroupKHR</code> make
it possible to group a list of WebGL calls together.
</feature>
<feature>
<code>debugMessageControlKHR</code> allows the application to enable
and disable the debug messages which emit a
<code>WebGLDebugMessage</code> event. This state is part of the debug
group they are part of, and gets poped on
<code>popDebugGroupKHR</code>.
</feature>
</features>
</overview>
<idl xml:space="preserve"><![CDATA[
[NoInterfaceObject]
interface WEBGL_debug : EventTarget {
const GLenum MAX_DEBUG_MESSAGE_LENGTH_KHR = 0x9143;
const GLenum MAX_DEBUG_GROUP_STACK_DEPTH_KHR = 0x826C;
const GLenum DEBUG_GROUP_STACK_DEPTH_KHR = 0x826D;
const GLenum MAX_LABEL_LENGTH_KHR = 0x82E8;
const GLenum DEBUG_SOURCE_API_KHR = 0x8246;
const GLenum DEBUG_SOURCE_WINDOW_SYSTEM_KHR = 0x8247;
const GLenum DEBUG_SOURCE_SHADER_COMPILER_KHR = 0x8248;
const GLenum DEBUG_SOURCE_THIRD_PARTY_KHR = 0x8249;
const GLenum DEBUG_SOURCE_APPLICATION_KHR = 0x824A;
const GLenum DEBUG_SOURCE_OTHER_KHR = 0x824B;
const GLenum DEBUG_TYPE_ERROR_KHR = 0x824C;
const GLenum DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR = 0x824D;
const GLenum DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR = 0x824E;
const GLenum DEBUG_TYPE_PORTABILITY_KHR = 0x824F;
const GLenum DEBUG_TYPE_PERFORMANCE_KHR = 0x8250;
const GLenum DEBUG_TYPE_OTHER_KHR = 0x8251;
const GLenum DEBUG_TYPE_MARKER_KHR = 0x8268;
const GLenum DEBUG_TYPE_PUSH_GROUP_KHR = 0x8269;
const GLenum DEBUG_TYPE_POP_GROUP_KHR = 0x826A;
const GLenum DEBUG_SEVERITY_HIGH_KHR = 0x9146;
const GLenum DEBUG_SEVERITY_MEDIUM_KHR = 0x9147;
const GLenum DEBUG_SEVERITY_LOW_KHR = 0x9148;
const GLenum DEBUG_SEVERITY_NOTIFICATION_KHR = 0x826B;
const GLenum STACK_UNDERFLOW_KHR = 0x0504;
const GLenum STACK_OVERFLOW_KHR = 0x0503;
void debugMessageControlKHR(GLenum source, GLenum type, GLenum severity, sequence<GLuint> ids, boolean enabled);
void debugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, DOMString buf);
void pushDebugGroupKHR(GLenum source, GLuint id, DOMString message);
void popDebugGroupKHR();
void objectLabelKHR(WebGLObject? object, DOMString label);
DOMString getObjectLabelKHR(WebGLObject? object);
}; // interface WEBGL_debug
[NoInterfaceObject]
interface WebGLDebugMessage : Event {
readonly attribute GLenum source;
readonly attribute GLenum type;
readonly attribute GLuint id;
readonly attribute GLenum severity;
readonly attribute DOMString message;
}; // interface WebGLDebugMessage
]]></idl>
<newfun>
<p>On <code>WEBGL_debug</code>:</p>
<function name="debugMessageControlKHR" type="void">
<param name="source" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="severity" type="GLenum"/>
<param name="ids" type="sequence<GLuint>"/>
<param name="enabled" type="boolean"/>
Enables or disables the reporting of <code>WebGLDebugMessage</code>
events for the specified messages.
</function>
<function name="debugMessageInsertKHR" type="void">
<param name="source" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="severity" type="GLenum"/>
<param name="message" type="DOMString"/>
Inserts a custom message into the debug log.
</function>
<function name="pushDebugGroupKHR" type="void">
<param name="source" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="message" type="DOMString"/>
Pushes a debug group on the stack.
</function>
<function name="popDebugGroupKHR" type="void">
Closes a group opened with <code>pushDebugGroupKHR</code>.
</function>
<function name="objectLabelKHR" type="void">
<param name="object" type="WebGLObject?"/>
<param name="label" type="DOMString"/>
Assigns a label to a <code>WebGLObject</code>.
</function>
<function name="getObjectLabelKHR" type="DOMString">
<param name="object" type="WebGLObject?"/>
Retrieves the label associated with a <code>WebGLObject</code>.
</function>
<function name="addEventListener" type="void">
<param name="type" type="DOMString"/>
<param name="listener" type="EventListener"/>
Register an event handler of a specific event type on the EventTarget.
</function>
<function name="removeEventListener" type="void">
<param name="type" type="DOMString"/>
<param name="listener" type="EventListener"/>
Removes an event listener from the EventTarget.
</function>
<function name="dispatchEvent" type="boolean">
<param name="event" type="Event"/>
Dispatch an event to this EventTarget.
</function>
</newfun>
<samplecode><div class="example">
Common initialization of the extension, with an example of debug message
reporting.
<pre xml:space="preserve"><![CDATA[
function init(gl) {
...
var ext = gl.getExtension('WEBGL_debug');
ext.addEventListener('message', function(evt) {
console.log(evt.source, evt.type, evt.id, evt.severity, evt.message);
});
...
}]]></pre></div></samplecode>
<samplecode><div class="example">
Skip a section of the code.
<pre xml:space="preserve"><![CDATA[
function draw(gl, ext) {
...
// Setup of the default active debug group: Filter everything in
ext.debugMessageControlKHR(gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], true);
// Generate a debug marker debug output message
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 1");
// Push debug group 1
ext.pushDebugGroupKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
1,
"Message 2");
// Setup of the debug group 1: Filter everything out
ext.debugMessageControlKHR(gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], false);
// This message won't appear in the debug output log of
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 3");
// Pop debug group 1, restore the volume control of the default debug group.
ext.popDebugGroupKHR();
// Generate a debug marker debug output message
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_MARKER_KHR, 100,
ext.DEBUG_SEVERITY_NOTIFICATION_KHR,
"Message 5");
...
// Expected debug output in the JS console:
// Message 1
// Message 2
// Message 2
// Message 5
}]]></pre></div></samplecode>
<samplecode><div class="example">
Only output a subsection of the code and disable some messages for the
entire application.
<pre xml:space="preserve"><![CDATA[
function draw(gl, ext) {
...
// Setup the control of the debug output for the default debug group
ext.debugMessageControlKHR(
gl.DONT_CARE, gl.DONT_CARE, gl.DONT_CARE, [], false);
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_THIRD_PARTY_KHR, gl.DONT_CARE, gl.DONT_CARE, [], false);
var messages = [1234, 2345, 3456, 4567];
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, gl.DEBUG_TYPE_OTHER, gl.DONT_CARE,
messages, false);
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_PORTABILITY_KHR, gl.DONT_CARE,
messages, false);
// Push debug group 1
// Inherit the default debug group debug output volume control
// Filtered out by ext.debugMessageControlKHR
ext.pushDebugGroupKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
1,
"Message 1");
// In this section of the code, we are interested in performances.
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_PERFORMANCE_KHR, gl.DONT_CARE, [], true);
// But we already identify that some messages are not really useful for us.
ext.debugMessageControlKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR, ext.DEBUG_TYPE_OTHER_KHR, gl.DONT_CARE,
[5678, 6789], false);
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_APPLICATION_KHR,
ext.DEBUG_TYPE_PERFORMANCE_KHR, 1357,
ext.DEBUG_SEVERITY_MEDIUM_KHR,
"Message 2");
ext.debugMessageInsertKHR(
ext.DEBUG_SOURCE_THIRD_PARTY_KHR, // We still filter out these messages.
ext.DEBUG_TYPE_OTHER_KHR, 3579,
ext.DEBUG_SEVERITY_MEDIUM_KHR,
"Message 3");
ext.popDebugGroupKHR();
...
// Expected debug output in the JS console:
// Message 2
}]]></pre></div></samplecode>
<history>
<revision date="2015/09/18">
<change>Initial revision.</change>
</revision>
</history>
</proposal>
|