WebGL WEBGL_debug_shaders Khronos Ratified Extension Specification
Name
WEBGL_debug_shaders
Contact
zmo@chromium.org
Contributors
Members of the WebGL working group
Version
Last modified date: July 15, 2014
Revision: 8
Number
WebGL extension #7
Dependencies
Written against the WebGL API 1.0 specification.
Overview
WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these shaders to the host platform's native language (HLSL, GLSL, and even GLSL ES). For debugging purpose, it is useful to be able to examine the shader after translation. This extension exposes a new function getTranslatedShaderSource
for such purposes.
IDL
[Exposed=(Window,Worker), LegacyNoInterfaceObject]
interface WEBGL_debug_shaders {
DOMString getTranslatedShaderSource(WebGLShader shader);
};
New Functions
- DOMString getTranslatedShaderSource(WebGLShader shader)
-
If no source has been defined,
compileShader()
has not been called, or the translation has failed for shader
, an empty string is returned; otherwise, return the translated source.
Issues
1) Should this extension be made available on ordinary web pages?
- Earlier versions of this extension noted the following concerns:
- The precise pattern of how the original shader is translated may yield personally-identifiable information to the web page about the kind of graphics card in the user's computer.
User agents (web browsers) should carefully consider whether or not to expose this extension in non-privileged settings due to these concerns.
- On the other hand, benefits of exposing this information to general web pages include:
- Tools for WebGL developers can provide more detailed information about how the input shader is translated to run on the graphics card, potentially helping the developers make their applications run faster.
Revision History
Revision 1, 2011/10/03
Revision 2, 2011/10/14
- Assigned WebGL extension number.
Revision 3, 2011/10/18
- Clarify the meaning of "privileged".
Revision 4, 2011/12/07
- Fixed mistake where extension still indicated draft status.
- Renamed "New Functions and Methods" section to "New Functions".
Revision 5, 2012/01/03
- Removed webgl module per changes to Web IDL spec.
Revision 6, 2013/05/15
- Ratified by Khronos Board of Promoters.
Revision 7, 2014/01/28
- Added issue on privacy considerations, replacing security section.
Revision 8, 2014/07/15
- Added NoInterfaceObject extended attribute.