1Name 2 3 ANGLE_translated_shader_source 4 5Name Strings 6 7 GL_ANGLE_translated_shader_source 8 9Contributors 10 11 Daniel Koch, TransGaming Inc. 12 Gregg Tavares, Google Inc. 13 Kenneth Russell, Google Inc. 14 Zhenyao Mo, Google Inc. 15 16Contact 17 18 Zhenyao Mo, Google Inc. (zmo 'at' google 'dot' com) 19 20Status 21 22 Implemented in ANGLE ES2 23 24Version 25 26 Last Modified Date: October 5, 2011 27 Author Revision: 2 28 29Number 30 31 OpenGL ES Extension #113 32 33Dependencies 34 35 OpenGL ES 2.0 is required. 36 37 The extension is written against the OpenGL ES 2.0 specification. 38 39Overview 40 41 WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these 42 shaders to the host platform's native language (HLSL, GLSL, and even GLSL 43 ES). For debugging purposes, it is useful to be able to examine the shader 44 after translation. 45 46 This extension addes a new function to query the translated shader source, 47 and adds a new enum for GetShaderiv's <pname> parameter to query the 48 translated shader source length. 49 50IP Status 51 52 No known IP claims. 53 54New Types 55 56 None 57 58New Procedures and Functions 59 60 void GetTranslatedShaderSourceANGLE(uint shader, sizei bufsize, 61 sizei* length, char* source); 62 63New Tokens 64 65 Accepted by the <pname> parameter of GetShaderiv: 66 67 TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 68 69Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State 70Requests) 71 72 Append in the end of the fourth paragraph of section 6.1.8 (Shader and 73 Program Queries): 74 75 " If <pname> is TRANSLATED_SHADER_LENGTH_ANGLE, the length of the translated 76 source string, including a null terminator, is returned. If no source has 77 been defined, CompileShader has not been called, or the translation has 78 failed for <shader>, zero is returned." 79 80 Append after the last paragraph of section 6.1.8 (Shader and Program 81 Queries): 82 83 "The command 84 85 void GetTranslatedShaderSourceANGLE( uint shader, sizei bufSize, 86 sizei *length, char *source ); 87 88 returns in <source> the string making up the translated source code for 89 the shader object <shader>. The string <source> will be null terminated. 90 The actual number of characters written into <source>, excluding the null 91 terminator, is returned in <length>. If <length> is NULL, no length is 92 returned. The maximum number of characters that may be written into 93 <source>, including the null terminator, is specified by <bufSize>. The 94 string <source> is the translated string of a concatenation of the strings 95 passed to the GL using ShaderSource. The length of this translated string 96 is given by TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, which can be queried 97 with GetShaderiv. 98 99 If no source has been defined, CompileShader has not been called, or the 100 translation has failed for <shader>, zero is returned for <length>, and 101 an empty string is returned for <source>. 102 103 If the value of SHADER_COMPILER is not TRUE, then the error INVALID_- 104 OPERATION is generated." 105 106Issues 107 108 1) What enum value should be used for TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE? 109 110 RESOLVED: The first draft used a temporary enum value. This been replaced 111 with a enum allocated from the ANGLE range of GL enums. 112 113Revision History 114 115 Revision 1, 2011/09/29, zmo 116 - first draft 117 Revision 2, 2011/10/05, dgkoch 118 - assigned enum 119