15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ANGLE_translated_shader_source 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ANGLE_translated_shader_source 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Daniel Koch, TransGaming Inc. 125bd8deadSopenharmony_ci Gregg Tavares, Google Inc. 135bd8deadSopenharmony_ci Kenneth Russell, Google Inc. 145bd8deadSopenharmony_ci Zhenyao Mo, Google Inc. 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ciContact 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ci Zhenyao Mo, Google Inc. (zmo 'at' google 'dot' com) 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciStatus 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Implemented in ANGLE ES2 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciVersion 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Last Modified Date: October 5, 2011 275bd8deadSopenharmony_ci Author Revision: 2 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciNumber 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci OpenGL ES Extension #113 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciDependencies 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci OpenGL ES 2.0 is required. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci The extension is written against the OpenGL ES 2.0 specification. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciOverview 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these 425bd8deadSopenharmony_ci shaders to the host platform's native language (HLSL, GLSL, and even GLSL 435bd8deadSopenharmony_ci ES). For debugging purposes, it is useful to be able to examine the shader 445bd8deadSopenharmony_ci after translation. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci This extension addes a new function to query the translated shader source, 475bd8deadSopenharmony_ci and adds a new enum for GetShaderiv's <pname> parameter to query the 485bd8deadSopenharmony_ci translated shader source length. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciIP Status 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci No known IP claims. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciNew Types 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci None 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ciNew Procedures and Functions 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci void GetTranslatedShaderSourceANGLE(uint shader, sizei bufsize, 615bd8deadSopenharmony_ci sizei* length, char* source); 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ciNew Tokens 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetShaderiv: 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State 705bd8deadSopenharmony_ciRequests) 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci Append in the end of the fourth paragraph of section 6.1.8 (Shader and 735bd8deadSopenharmony_ci Program Queries): 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci " If <pname> is TRANSLATED_SHADER_LENGTH_ANGLE, the length of the translated 765bd8deadSopenharmony_ci source string, including a null terminator, is returned. If no source has 775bd8deadSopenharmony_ci been defined, CompileShader has not been called, or the translation has 785bd8deadSopenharmony_ci failed for <shader>, zero is returned." 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci Append after the last paragraph of section 6.1.8 (Shader and Program 815bd8deadSopenharmony_ci Queries): 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci "The command 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci void GetTranslatedShaderSourceANGLE( uint shader, sizei bufSize, 865bd8deadSopenharmony_ci sizei *length, char *source ); 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci returns in <source> the string making up the translated source code for 895bd8deadSopenharmony_ci the shader object <shader>. The string <source> will be null terminated. 905bd8deadSopenharmony_ci The actual number of characters written into <source>, excluding the null 915bd8deadSopenharmony_ci terminator, is returned in <length>. If <length> is NULL, no length is 925bd8deadSopenharmony_ci returned. The maximum number of characters that may be written into 935bd8deadSopenharmony_ci <source>, including the null terminator, is specified by <bufSize>. The 945bd8deadSopenharmony_ci string <source> is the translated string of a concatenation of the strings 955bd8deadSopenharmony_ci passed to the GL using ShaderSource. The length of this translated string 965bd8deadSopenharmony_ci is given by TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, which can be queried 975bd8deadSopenharmony_ci with GetShaderiv. 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci If no source has been defined, CompileShader has not been called, or the 1005bd8deadSopenharmony_ci translation has failed for <shader>, zero is returned for <length>, and 1015bd8deadSopenharmony_ci an empty string is returned for <source>. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci If the value of SHADER_COMPILER is not TRUE, then the error INVALID_- 1045bd8deadSopenharmony_ci OPERATION is generated." 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ciIssues 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci 1) What enum value should be used for TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE? 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci RESOLVED: The first draft used a temporary enum value. This been replaced 1115bd8deadSopenharmony_ci with a enum allocated from the ANGLE range of GL enums. 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ciRevision History 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Revision 1, 2011/09/29, zmo 1165bd8deadSopenharmony_ci - first draft 1175bd8deadSopenharmony_ci Revision 2, 2011/10/05, dgkoch 1185bd8deadSopenharmony_ci - assigned enum 119