15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_shader_subroutine 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_shader_subroutine 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Barthold Lichtenbelt, NVIDIA 165bd8deadSopenharmony_ci Bill Licea-Kane, AMD 175bd8deadSopenharmony_ci Bruce Merry, ARM 185bd8deadSopenharmony_ci Eric Werness, NVIDIA 195bd8deadSopenharmony_ci Graham Sellers, AMD 205bd8deadSopenharmony_ci Greg Roth, NVIDIA 215bd8deadSopenharmony_ci Nick Haemel, AMD 225bd8deadSopenharmony_ci Pat Brown, NVIDIA 235bd8deadSopenharmony_ci Pierre Boudier, AMD 245bd8deadSopenharmony_ci Piers Daniell, NVIDIA 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciNotice 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Copyright (c) 2010-2014 The Khronos Group Inc. Copyright terms at 295bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciSpecification Update Policy 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 345bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 355bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 365bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 375bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 385bd8deadSopenharmony_ci described in more detail at 395bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciStatus 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci Complete. Approved by the ARB at the 2010/01/22 F2F meeting. 445bd8deadSopenharmony_ci Approved by the Khronos Board of Promoters on March 10, 2010. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciVersion 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci Last Modified Date: 02/28/2014 495bd8deadSopenharmony_ci Revision: 19 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciNumber 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci ARB Extension #90 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciDependencies 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension is written against the OpenGL 3.2 core specification and 585bd8deadSopenharmony_ci version 1.50 of the GLSL specification. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci ARB_gpu_shader5 is required. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension interacts with NV_gpu_program5. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci This extension interacts trivially with EXT_separate_shader_objects. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciOverview 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci This extension adds support to shaders for "indirect subroutine calls", 695bd8deadSopenharmony_ci where a single shader can include many subroutines and dynamically select 705bd8deadSopenharmony_ci through the API which subroutine is called from each call site. 715bd8deadSopenharmony_ci Switching subroutines dynamically in this fashion can avoid the cost of 725bd8deadSopenharmony_ci recompiling and managing multiple shaders, while still retaining most of 735bd8deadSopenharmony_ci the performance of specialized shaders. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciIP Status 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci No known IP claims. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciNew Procedures and Functions 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci int GetSubroutineUniformLocation(uint program, enum shadertype, 825bd8deadSopenharmony_ci const char *name); 835bd8deadSopenharmony_ci uint GetSubroutineIndex(uint program, enum shadertype, 845bd8deadSopenharmony_ci const char *name); 855bd8deadSopenharmony_ci void GetActiveSubroutineUniformiv(uint program, enum shadertype, 865bd8deadSopenharmony_ci uint index, enum pname, int *values); 875bd8deadSopenharmony_ci void GetActiveSubroutineUniformName(uint program, enum shadertype, 885bd8deadSopenharmony_ci uint index, sizei bufsize, 895bd8deadSopenharmony_ci sizei *length, char *name); 905bd8deadSopenharmony_ci void GetActiveSubroutineName(uint program, enum shadertype, uint index, 915bd8deadSopenharmony_ci sizei bufsize, sizei *length, char *name); 925bd8deadSopenharmony_ci void UniformSubroutinesuiv(enum shadertype, sizei count, 935bd8deadSopenharmony_ci const uint *indices); 945bd8deadSopenharmony_ci void GetUniformSubroutineuiv(enum shadertype, int location, 955bd8deadSopenharmony_ci uint *params); 965bd8deadSopenharmony_ci void GetProgramStageiv(uint program, enum shadertype, 975bd8deadSopenharmony_ci enum pname, int *values); 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciNew Tokens 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramStageiv: 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci ACTIVE_SUBROUTINES 0x8DE5 1045bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 1055bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 1065bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 1075bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 1105bd8deadSopenharmony_ci GetFloatv, GetDoublev, and GetInteger64v: 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci MAX_SUBROUTINES 0x8DE7 1135bd8deadSopenharmony_ci MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES 0x8E4A 1185bd8deadSopenharmony_ci COMPATIBLE_SUBROUTINES 0x8E4B 1195bd8deadSopenharmony_ci UNIFORM_SIZE 1205bd8deadSopenharmony_ci UNIFORM_NAME_LENGTH 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.2 Specification (OpenGL Operation) 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci Add a section "Subroutine Uniform Variables" after Section 2.11.4, 1265bd8deadSopenharmony_ci "Uniform Variables" 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci Subroutine uniform variables are similar to uniform variables, except they 1295bd8deadSopenharmony_ci are context state rather than program state. Having subroutine uniforms be 1305bd8deadSopenharmony_ci context state allows them to have different values if the program is used 1315bd8deadSopenharmony_ci in multiple contexts simultaneously. There is a set of subroutine 1325bd8deadSopenharmony_ci uniforms for each shader stage. 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci The command 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci int GetSubroutineUniformLocation(uint program, enum shadertype, 1375bd8deadSopenharmony_ci const char *name); 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci will return the location of the subroutine uniform variable <name> in the 1405bd8deadSopenharmony_ci shader stage of type <shadertype> attached to <program>, with behavior otherwise 1415bd8deadSopenharmony_ci identical to GetUniformLocation. The value -1 will be returned if <name> 1425bd8deadSopenharmony_ci is not the name of an active subroutine uniform. Active subroutine 1435bd8deadSopenharmony_ci locations are assigned using consecutive integers in the range from zero 1445bd8deadSopenharmony_ci to the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one for the shader 1455bd8deadSopenharmony_ci stage. There is an implementation-dependent limit on the number of active 1465bd8deadSopenharmony_ci subroutine uniform locations in each shader stage; a program will fail to 1475bd8deadSopenharmony_ci link if the number of subroutine uniform locations required is greater 1485bd8deadSopenharmony_ci than the value of MAX_SUBROUTINE_UNIFORM_LOCATIONS. If <program> has not 1495bd8deadSopenharmony_ci been successfully linked, the error INVALID_OPERATION will be generated. 1505bd8deadSopenharmony_ci For active subroutine uniforms declared as arrays, the declared array 1515bd8deadSopenharmony_ci elements are assigned consecutive locations. 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci Each function in a shader associated with a subroutine type is considered 1545bd8deadSopenharmony_ci an active subroutine, unless the compiler conclusively determines that the 1555bd8deadSopenharmony_ci function could never be assigned to an active subroutine uniform. Each 1565bd8deadSopenharmony_ci active subroutine will be assigned an unsigned integer subroutine index 1575bd8deadSopenharmony_ci that is unique to the shader stage. This index can be queried with the 1585bd8deadSopenharmony_ci command 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci uint GetSubroutineIndex(uint program, enum shadertype, 1615bd8deadSopenharmony_ci const char *name); 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci where <name> is the null-terminated name of a function in the shader stage 1645bd8deadSopenharmony_ci of type <shadertype> attached to <program>. Subroutine indices are assigned using 1655bd8deadSopenharmony_ci consecutive integers in the range from zero to the value of 1665bd8deadSopenharmony_ci ACTIVE_SUBROUTINES minus one for the shader stage. The value INVALID_INDEX will 1675bd8deadSopenharmony_ci be returned if <name> is not the name of an active subroutine in the 1685bd8deadSopenharmony_ci shader stage. After the program has been linked, the subroutine index 1695bd8deadSopenharmony_ci will not change unless the program is re-linked. 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci There is an implementation-dependent limit on the number of active 1725bd8deadSopenharmony_ci subroutines in each shader stage; a program will fail to link if the 1735bd8deadSopenharmony_ci number of subroutines is greater than the maximum subroutine count 1745bd8deadSopenharmony_ci (the value of MAX_SUBROUTINES). 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci Information about active subroutine uniforms can be obtained by calling 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci void GetActiveSubroutineUniformiv(uint program, enum shadertype, 1795bd8deadSopenharmony_ci uint index, enum pname, int *values); 1805bd8deadSopenharmony_ci void GetActiveSubroutineUniformName(uint program, enum shadertype, 1815bd8deadSopenharmony_ci uint index, sizei bufsize, 1825bd8deadSopenharmony_ci sizei *length, char *name); 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci <program> and <shadertype> specify the program and shader stage. <index> 1855bd8deadSopenharmony_ci must be an active subroutine uniform index in the range from zero to the 1865bd8deadSopenharmony_ci value of ACTIVE_SUBROUTINE_UNIFORMS minus one for the shader stage. If <index> 1875bd8deadSopenharmony_ci is greater than or equal to the value of ACTIVE_SUBROUTINE_UNIFORMS, the 1885bd8deadSopenharmony_ci error INVALID_VALUE is generated. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci For GetActiveSubroutineUniformiv, <pname> identifies a property of the 1915bd8deadSopenharmony_ci active subroutine uniform being queried. If <pname> is 1925bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES, a single integer indicating the number of 1935bd8deadSopenharmony_ci subroutines that can be assigned to the uniform is returned in <values>. 1945bd8deadSopenharmony_ci If <pname> is COMPATIBLE_SUBROUTINES, an array of integers is returned in 1955bd8deadSopenharmony_ci <values>, with each integer specifying the index of an active subroutine 1965bd8deadSopenharmony_ci that can be assigned to the selected subroutine uniform. The number of 1975bd8deadSopenharmony_ci integers returned is the same as the value returned for 1985bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES. If <pname> is UNIFORM_SIZE, a single integer 1995bd8deadSopenharmony_ci is returned in <values>. If the selected subroutine uniform is an array, 2005bd8deadSopenharmony_ci the declared size of the array is returned; otherwise, one is returned. 2015bd8deadSopenharmony_ci If <pname> is UNIFORM_NAME_LENGTH, a single integer specifying the length 2025bd8deadSopenharmony_ci of the subroutine uniform name (including the terminating null character) 2035bd8deadSopenharmony_ci is returned in <values>. 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci For GetActiveSubroutineUniformName, the uniform name is returned as a 2065bd8deadSopenharmony_ci null-terminated string in <name>. The actual number of characters written 2075bd8deadSopenharmony_ci into <name>, excluding the null terminator is returned in <length>. If 2085bd8deadSopenharmony_ci <length> is NULL, no length is returned. The maximum number of characters 2095bd8deadSopenharmony_ci that may be written into <name>, including the null terminator, is 2105bd8deadSopenharmony_ci specified by <bufsize>. The length of the longest subroutine uniform name 2115bd8deadSopenharmony_ci in <program> and <shadertype> is given by the value of 2125bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH, which can be queried with 2135bd8deadSopenharmony_ci GetProgramStageiv. 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci The name of an active subroutine can be queried given its subroutine 2165bd8deadSopenharmony_ci index with the command: 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci void GetActiveSubroutineName(uint program, enum shadertype, 2195bd8deadSopenharmony_ci uint index, sizei bufsize, 2205bd8deadSopenharmony_ci sizei *length, char *name); 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci <program> and <shadertype> specify the program and shader stage. <index> 2235bd8deadSopenharmony_ci must be an active subroutine index in the range from zero to the value of 2245bd8deadSopenharmony_ci ACTIVE_SUBROUTINES minus one for the shader stage. If <index> is greater than 2255bd8deadSopenharmony_ci or equal to the value of ACTIVE_SUBROUTINES, the error INVALID_VALUE is 2265bd8deadSopenharmony_ci generated. The name of the selected subroutine is returned as a 2275bd8deadSopenharmony_ci null-terminated string in <name>. The actual number of characters written 2285bd8deadSopenharmony_ci into <name>, excluding the null terminator, is returned in <length>. If 2295bd8deadSopenharmony_ci <length> is NULL, no length is returned. The maximum number of characters 2305bd8deadSopenharmony_ci that may be written into <name>, including the null terminator, is 2315bd8deadSopenharmony_ci specified by <bufsize>. The length of the longest subroutine name in 2325bd8deadSopenharmony_ci <program> and <shadertype> is given by the value of 2335bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_MAX_LENGTH, which can be queried with GetProgramStageiv. 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci The command 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci void UniformSubroutinesuiv(enum shadertype, sizei count, 2385bd8deadSopenharmony_ci const uint *indices); 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci will load all active subroutine uniforms for shader stage <shadertype> 2415bd8deadSopenharmony_ci with subroutine indices from <indices>, storing <indices>[i] into the 2425bd8deadSopenharmony_ci uniform at location i. If <count> is not equal to the value of 2435bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS for the program currently in use at 2445bd8deadSopenharmony_ci shader stage <shadertype>, or if any value in <indices> is greater than or 2455bd8deadSopenharmony_ci equal to the value of ACTIVE_SUBROUTINES for the shader stage, the error 2465bd8deadSopenharmony_ci INVALID_VALUE is generated. If, for any subroutine index being loaded to 2475bd8deadSopenharmony_ci a particular uniform location, the function corresponding to the 2485bd8deadSopenharmony_ci subroutine index was not associated (as defined in Section 6.1.2 of the 2495bd8deadSopenharmony_ci GLSL spec) with the type of the subroutine variable at that location, then 2505bd8deadSopenharmony_ci the error INVALID_OPERATION is generated. If no program is active for 2515bd8deadSopenharmony_ci the shader stage identified by <shadertype>, the error INVALID_OPERATION 2525bd8deadSopenharmony_ci is generated. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci Each subroutine uniform must have at least one subroutine to assign to the 2555bd8deadSopenharmony_ci uniform. A program will fail to link if any stage has one or more 2565bd8deadSopenharmony_ci subroutine uniforms that has no subroutine associated with the subroutine 2575bd8deadSopenharmony_ci type of the uniform. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci When UseProgram is called, the subroutine uniforms for all shader stages 2605bd8deadSopenharmony_ci are reset to arbitrarily chosen default functions with compatible 2615bd8deadSopenharmony_ci subroutine types. When UseShaderProgramEXT is called, the subroutine 2625bd8deadSopenharmony_ci uniforms for the shader stage specified by <type> are reset to arbitrarily 2635bd8deadSopenharmony_ci chosen default functions with compatible subroutine types. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.2 Specification (Rasterization) 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci None. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.2 Specification (Per-Fragment 2715bd8deadSopenharmony_ciOperations and the Frame Buffer) 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci None. 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.2 Specification (Special Functions) 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci None. 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.2 Specification (State and 2805bd8deadSopenharmony_ciState Requests) 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci Add to Section 6.1.15 (Shader and Program Queries) 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci The command 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci void GetUniformSubroutineuiv(enum shadertype, int location, 2875bd8deadSopenharmony_ci uint *params); 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci returns the value of the subroutine uniform at location <location> for 2905bd8deadSopenharmony_ci shader stage <shadertype> of the current program. If <location> is 2915bd8deadSopenharmony_ci greater than or equal to the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 2925bd8deadSopenharmony_ci for the shader currently in use at shader stage <shadertype>, the error 2935bd8deadSopenharmony_ci INVALID_VALUE is generated. If no program is active, the error 2945bd8deadSopenharmony_ci INVALID_OPERATION is generated. 2955bd8deadSopenharmony_ci 2965bd8deadSopenharmony_ci The command 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci void GetProgramStageiv(uint program, enum shadertype, 2995bd8deadSopenharmony_ci enum pname, int *values); 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci returns properties of the program object <program> specific to the 3025bd8deadSopenharmony_ci programmable stage corresponding to <shadertype> in <values>. The 3035bd8deadSopenharmony_ci parameter value to return is specified by <pname>. If <pname> is 3045bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORMS, the number of active subroutine variables in 3055bd8deadSopenharmony_ci the stage is returned. If <pname> is ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS, 3065bd8deadSopenharmony_ci the number of active subroutine variable locations in the stage is 3075bd8deadSopenharmony_ci returned. If <pname> is ACTIVE_SUBROUTINES, the number of active 3085bd8deadSopenharmony_ci subroutines in the stage is returned. If <pname> is 3095bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH or ACTIVE_SUBROUTINE_MAX_LENGTH, the 3105bd8deadSopenharmony_ci length of the longest subroutine uniform or subroutine name, respectively, 3115bd8deadSopenharmony_ci for the stage is returned. The returned name length includes space for a 3125bd8deadSopenharmony_ci null terminator. If there is no shader of type <shadertype> in <program>, 3135bd8deadSopenharmony_ci the values returned will be consistent with a shader with no subroutines 3145bd8deadSopenharmony_ci or subroutine uniforms. 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 1.50 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 3205bd8deadSopenharmony_ci language features described in this extension: 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci #extension GL_ARB_shader_subroutine : <behavior> 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci In section 3.6, p.14 (Keywords) 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci Add subroutine to the list of reserved keywords. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci Modify Section 6.1.1 (Function Calling Conventions) 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci (modify the last paragraph of the section, p. 66, to forbid potential 3335bd8deadSopenharmony_ci recursion via subroutines) Recursion is not allowed, not even statically. 3345bd8deadSopenharmony_ci Static recursion is present if the static function-call graph of a program 3355bd8deadSopenharmony_ci contains cycles. This includes all potential function calls through 3365bd8deadSopenharmony_ci variables declared as subroutine uniform (described below). It is an 3375bd8deadSopenharmony_ci error if a single compilation unit (shader) contains either static 3385bd8deadSopenharmony_ci recursion or the potential for recursion through subroutine variables. 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci Add a new Section 6.1.2 (Subroutines) 3415bd8deadSopenharmony_ci 3425bd8deadSopenharmony_ci Subroutines provide a mechanism allowing shaders to be compiled in a 3435bd8deadSopenharmony_ci manner where the target of one or more function calls can be changed at 3445bd8deadSopenharmony_ci run-time without requiring any shader recompilation. For example, a 3455bd8deadSopenharmony_ci single shader may be compiled with support for multiple illumination 3465bd8deadSopenharmony_ci algorithms to handle different kinds of lights or surface materials. An 3475bd8deadSopenharmony_ci application using such a shader may switch illumination algorithms by 3485bd8deadSopenharmony_ci changing the value of its subroutine uniforms. To use subroutines, a 3495bd8deadSopenharmony_ci subroutine type is declared, one or more functions are associated with 3505bd8deadSopenharmony_ci that subroutine type, and a subroutine variable of that type is declared. 3515bd8deadSopenharmony_ci The function currently assigned to the variable function is then called by 3525bd8deadSopenharmony_ci using function calling syntax replacing a function name with the name of 3535bd8deadSopenharmony_ci the subroutine variable. Subroutine variables are assigned to specific 3545bd8deadSopenharmony_ci functions only through commands (UniformSubroutinesuiv) in the OpenGL API. 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci Subroutine types can be declared using a statement similar to a function 3575bd8deadSopenharmony_ci declaration, as follows: 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci subroutine returnType subroutineTypeName(type0 arg0, type1 arg1, 3605bd8deadSopenharmony_ci ..., typen argn); 3615bd8deadSopenharmony_ci 3625bd8deadSopenharmony_ci Functions may be associated to subroutine types that have a matching 3635bd8deadSopenharmony_ci prototype by prepending the subroutine types to the function definition: 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci subroutine(subroutineTypeName0, ..., subroutineTypeNameN) 3665bd8deadSopenharmony_ci returnType functionName (type0 arg0, type1 arg1, ..., typen argn) 3675bd8deadSopenharmony_ci ... // function body 3685bd8deadSopenharmony_ci 3695bd8deadSopenharmony_ci Subroutine declarations cannot be prototyped. It is an error to prepend 3705bd8deadSopenharmony_ci subroutine(...) to a function declaration. It is an error to declare 3715bd8deadSopenharmony_ci two distinct functions with the same function name within the same shader 3725bd8deadSopenharmony_ci (i.e. overloaded function names) that are both associated to subroutine 3735bd8deadSopenharmony_ci types. 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci Subroutine types share a namespace with standard function names. 3765bd8deadSopenharmony_ci Overloading (section 6.1) is not supported for functions that may be 3775bd8deadSopenharmony_ci associated with subroutine types. A program will fail to link if any 3785bd8deadSopenharmony_ci shader includes two or more functions with the same name, at least one of 3795bd8deadSopenharmony_ci which is associated with a subroutine type. 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci Subroutine variables are required to be "subroutine uniforms", and 3825bd8deadSopenharmony_ci are declared with a specific subroutine type in a subroutine uniform 3835bd8deadSopenharmony_ci variable declaration: 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci subroutine uniform subroutineTypeName subroutineVarName; 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci and are called the same way simple functions are called. Subroutine 3885bd8deadSopenharmony_ci variables may be declared as explicitly-sized arrays, which can be 3895bd8deadSopenharmony_ci dynamically indexed at use. 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci Subroutine variables are associated to functions declared with the 3925bd8deadSopenharmony_ci same subroutine type with the UniformSubroutinesuiv command in the OpenGL 3935bd8deadSopenharmony_ci API. When a subroutine variable (or an element of a subroutine variable 3945bd8deadSopenharmony_ci array) is associated to a particular function, all function calls through 3955bd8deadSopenharmony_ci that variable will call that particular function. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci None. 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ciGLX Protocol 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci None. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ciErrors 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetSubroutineUniformLocation 4085bd8deadSopenharmony_ci if the program object identified by <program> has not been successfully 4095bd8deadSopenharmony_ci linked. 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveSubroutineUniformiv or 4125bd8deadSopenharmony_ci GetActiveSubroutineUniformName if <index> is greater than or equal to the 4135bd8deadSopenharmony_ci value of ACTIVE_SUBROUTINE_UNIFORMS for the shader stage. 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetActiveSubroutineName if <index> 4165bd8deadSopenharmony_ci is greater than or equal to the value of ACTIVE_SUBROUTINES for the shader 4175bd8deadSopenharmony_ci stage. 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci The error INVALID_VALUE is generated by UniformSubroutinesuiv if <count> 4205bd8deadSopenharmony_ci is not equal to the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS for the 4215bd8deadSopenharmony_ci shader stage <shadertype>. 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci The error INVALID_VALUE is generated by UniformSubroutinesuiv if any value 4245bd8deadSopenharmony_ci in <indices> is greater than or equal to the value of ACTIVE_SUBROUTINES 4255bd8deadSopenharmony_ci for the shader stage. 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by UniformSubroutinesuiv if any 4285bd8deadSopenharmony_ci subroutine index in <indices> identifies a subroutine not associated with 4295bd8deadSopenharmony_ci the type of the subroutine uniform variable assigned to the corresponding 4305bd8deadSopenharmony_ci location. 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by UniformSubroutinesuiv if no 4335bd8deadSopenharmony_ci program is active. 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetUniformSubroutineuiv if 4365bd8deadSopenharmony_ci <location> is greater than or equal to the value of 4375bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS for the shader stage. 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetUniformSubroutineuiv if no 4405bd8deadSopenharmony_ci program is active for the shader stage identified by <shadertype>. 4415bd8deadSopenharmony_ci 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ciNew State 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci (add to table 6.28, Program Object State, p. 293) 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ci Initial 4485bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. 4495bd8deadSopenharmony_ci --------------------------- ---------- ----------- ------- --------------------------- ------ 4505bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_ 5xZ+ GetProgram- 0 Number of subroutine unif. 2.11.4 4515bd8deadSopenharmony_ci LOCATIONS Stageiv locations in the shader 4525bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORMS 5xZ+ GetProgram- 0 Number of subroutine unif. 2.11.4 4535bd8deadSopenharmony_ci Stageiv variables in the shader 4545bd8deadSopenharmony_ci ACTIVE_SUBROUTINES 5xZ+ GetProgram- 0 Number of subroutine 2.11.4 4555bd8deadSopenharmony_ci Stageiv functions in the shader 4565bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_UNIFORM_ 5xZ+ GetProgram- 0 Maximum subroutine uniform 2.11.4 4575bd8deadSopenharmony_ci MAX_LENGTH Stageiv name length 4585bd8deadSopenharmony_ci ACTIVE_SUBROUTINE_MAX_LENGTH 5xZ+ GetProgram- 0 Maximum subroutine name 2.11.4 4595bd8deadSopenharmony_ci Stageiv length 4605bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES 5x0*xZ+ GetActiveSub- - Number of subroutines comp- 2.11.4 4615bd8deadSopenharmony_ci routineUniformiv atible with a sub. uniform 4625bd8deadSopenharmony_ci COMPATIBLE_SUBROUTINES 5x0*x0*xZ+ GetActiveSub- - List of subroutines comp- 2.11.4 4635bd8deadSopenharmony_ci routineUniformiv atible with a sub. uniform 4645bd8deadSopenharmony_ci UNIFORM_SIZE 5x0*xZ+ GetActiveSub- - Number of elements in sub. 2.11.4 4655bd8deadSopenharmony_ci routineUniformiv uniform array 4665bd8deadSopenharmony_ci UNIFORM_NAME_LENGTH 5x0*xZ+ GetActiveSub- - Length of sub. uniform name 2.11.4 4675bd8deadSopenharmony_ci routineUniformiv 4685bd8deadSopenharmony_ci - 5x0*xS GetActiveSub- - Sub. uniform name string 2.11.4 4695bd8deadSopenharmony_ci routineUniformName 4705bd8deadSopenharmony_ci - 5x0*xS GetActiveSub- - Length of subroutine name 2.11.4 4715bd8deadSopenharmony_ci routineName 4725bd8deadSopenharmony_ci - 5x0*xS GetActiveSub- - Subroutine name string 2.11.4 4735bd8deadSopenharmony_ci routineName 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci (For the above, the "5" is indicates separate state for each of the five 4765bd8deadSopenharmony_ci shader stages in the program.) 4775bd8deadSopenharmony_ci 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ciNew Implementation Dependent State 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci Minimum 4825bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 4835bd8deadSopenharmony_ci ----------------------------- ---- --------------- ------- --------------------- ------ ------ 4845bd8deadSopenharmony_ci MAX_SUBROUTINES Z+ GetIntegerv 256 Maximum number of 2.14.1 - 4855bd8deadSopenharmony_ci subroutines per 4865bd8deadSopenharmony_ci shader stage 4875bd8deadSopenharmony_ci MAX_SUBROUTINE_UNIFORM_ Z+ GetIntegerv 1024 Maximum number of 2.X.5 - 4885bd8deadSopenharmony_ci LOCATIONS subroutine uniform 4895bd8deadSopenharmony_ci locations per stage 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ciDependencies on NV_gpu_program5: 4935bd8deadSopenharmony_ci 4945bd8deadSopenharmony_ci If NV_gpu_program5 is supported, the following edits are made to extend 4955bd8deadSopenharmony_ci the assembly programming model documented in the NV_gpu_program4 extension 4965bd8deadSopenharmony_ci and extended by NV_gpu_program5. No "OPTION" line is required; the 4975bd8deadSopenharmony_ci following capability is implied by NV_gpu_program5 program headers such as 4985bd8deadSopenharmony_ci "!!NVfp5.0". 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci New Procedures and Functions 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci void ProgramSubroutineParametersuivNV(enum target, sizei count, 5035bd8deadSopenharmony_ci const uint *params); 5045bd8deadSopenharmony_ci void GetProgramSubroutineParameteruivNV(enum target, uint index, 5055bd8deadSopenharmony_ci uint *param); 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci New Tokens 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramivARB: 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 5125bd8deadSopenharmony_ci MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci (Modify "Section 2.14.1" of the ARB_vertex_program specification, 5155bd8deadSopenharmony_ci describing program parameters.) 5165bd8deadSopenharmony_ci 5175bd8deadSopenharmony_ci Each program target has an associated array of program subroutine 5185bd8deadSopenharmony_ci parameters. Unlike program local parameters, program subroutine parameters 5195bd8deadSopenharmony_ci are context state rather than program state. Program subroutine parameters 5205bd8deadSopenharmony_ci are scalar unsigned integer values that correspond to "SUBROUTINENUM" 5215bd8deadSopenharmony_ci declarations in a program. The number of scalars is given by the 5225bd8deadSopenharmony_ci implementation-dependent value MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV. 5235bd8deadSopenharmony_ci The command 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci void ProgramSubroutineParametersuivNV(enum target, sizei count, 5265bd8deadSopenharmony_ci const uint *params); 5275bd8deadSopenharmony_ci 5285bd8deadSopenharmony_ci updates the values of all program subroutine parameters used by the 5295bd8deadSopenharmony_ci currently bound program for the given program target <target>. <params> 5305bd8deadSopenharmony_ci points to an array of <count> values, where the first value is used to 5315bd8deadSopenharmony_ci update the program subroutine parameter numbered zero and the last value 5325bd8deadSopenharmony_ci is used to update the program subroutine parameter numbered <count> - 1. 5335bd8deadSopenharmony_ci The error INVALID_VALUE is generated if <count> is not equal to one plus 5345bd8deadSopenharmony_ci the maximum program subroutine parameter index used in the currently bound 5355bd8deadSopenharmony_ci program. 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci Program subroutine parameters for a given target are reset to arbitrary 5385bd8deadSopenharmony_ci defaults when the program string is respecified, and when BindProgram is 5395bd8deadSopenharmony_ci called to bind a program to that target, even if the specified program is 5405bd8deadSopenharmony_ci already bound. 5415bd8deadSopenharmony_ci 5425bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by 5435bd8deadSopenharmony_ci ProgramSubroutineParametersuivNV if, for any number <i> in [0, <count>), 5445bd8deadSopenharmony_ci program.subroutine[<i>] is a live parameter of a certain SUBROUTINETYPE, 5455bd8deadSopenharmony_ci and <params>[<i>] is not a SUBROUTINENUM that was associated to that 5465bd8deadSopenharmony_ci SUBROUTINETYPE as described in Section 2.X.5. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci Modify Section 2.X.2 of NV_gpu_program4, Program Grammar 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ci If a program begins with a header string defined by GL_NV_gpu_program5, 5515bd8deadSopenharmony_ci the following modifications apply to the program grammar: 5525bd8deadSopenharmony_ci 5535bd8deadSopenharmony_ci <FlowInstruction> ::= <BRAop_instruction> 5545bd8deadSopenharmony_ci | <FLOWCCop_instruction> 5555bd8deadSopenharmony_ci | <IFop_instruction> 5565bd8deadSopenharmony_ci | <REPop_instruction> 5575bd8deadSopenharmony_ci | <ENDFLOWop_instruction> 5585bd8deadSopenharmony_ci | <CALI_instruction> 5595bd8deadSopenharmony_ci 5605bd8deadSopenharmony_ci <namingStatement> ::= <varMods> <ATTRIB_statement> 5615bd8deadSopenharmony_ci | <varMods> <PARAM_statement> 5625bd8deadSopenharmony_ci | <varMods> <TEMP_statement> 5635bd8deadSopenharmony_ci | <varMods> <OUTPUT_statement> 5645bd8deadSopenharmony_ci | <varMods> <BUFFER_statement> 5655bd8deadSopenharmony_ci | <ALIAS_statement> 5665bd8deadSopenharmony_ci | <SUBROUTINETYPE_statement> 5675bd8deadSopenharmony_ci | <SUBROUTINE_statement> 5685bd8deadSopenharmony_ci 5695bd8deadSopenharmony_ci <labelList> ::= <identifier> 5705bd8deadSopenharmony_ci | <identifier> "," <labelList> 5715bd8deadSopenharmony_ci 5725bd8deadSopenharmony_ci <labelInitList> ::= /* empty */ 5735bd8deadSopenharmony_ci | <labelList> 5745bd8deadSopenharmony_ci 5755bd8deadSopenharmony_ci <SUBROUTINETYPE_statement> ::= "SUBROUTINETYPE" <establishName> "{" 5765bd8deadSopenharmony_ci <labelInitList> "}" 5775bd8deadSopenharmony_ci 5785bd8deadSopenharmony_ci <progSubroutineParam> ::= "program" "." "subroutine" <arrayMemAbs> 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci <progSubroutineParams> ::= <progSubroutineParam> 5815bd8deadSopenharmony_ci | "program" "." "subroutine" <arrayRange> 5825bd8deadSopenharmony_ci 5835bd8deadSopenharmony_ci <progSubroutineInitList>::= <progSubroutineParams> 5845bd8deadSopenharmony_ci | <progSubroutineParams> "," 5855bd8deadSopenharmony_ci <progSubroutineInitList> 5865bd8deadSopenharmony_ci 5875bd8deadSopenharmony_ci <SUBROUTINE_statement> ::= "SUBROUTINE" <establishedName> <establishName> 5885bd8deadSopenharmony_ci "=" <progSubroutineParam> 5895bd8deadSopenharmony_ci | "SUBROUTINE" <establishedName> <establishName> 5905bd8deadSopenharmony_ci <optArraySize> "=" "{" <progSubroutineInitList> 5915bd8deadSopenharmony_ci "}" 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci <CALIop> ::= "CALI" 5945bd8deadSopenharmony_ci 5955bd8deadSopenharmony_ci <CALI_instruction> ::= <CALIop> <opModifiers> <subroutineVarName> 5965bd8deadSopenharmony_ci <optArrayMem> <optBranchCond> 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ci <instLabel> ::= <identifier> 5995bd8deadSopenharmony_ci | <identifier> "SUBROUTINENUM" "(" <int> ")" 6005bd8deadSopenharmony_ci 6015bd8deadSopenharmony_ci 6025bd8deadSopenharmony_ci Modify Section 2.X.4, Program Execution Environment 6035bd8deadSopenharmony_ci 6045bd8deadSopenharmony_ci (Update the instruction set table to add CALI) 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci Instr- Modifiers 6075bd8deadSopenharmony_ci uction V F I C S H D Out Inputs Description 6085bd8deadSopenharmony_ci ------- -- - - - - - - --- -------- -------------------------------- 6095bd8deadSopenharmony_ci CALI 50 - - - - - - - c indirect subroutine call 6105bd8deadSopenharmony_ci 6115bd8deadSopenharmony_ci Modify Section 2.X.5 (Program Flow Control) of the NV_gpu_program4 6125bd8deadSopenharmony_ci specification 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci (Add after the description of subroutines) 6155bd8deadSopenharmony_ci 6165bd8deadSopenharmony_ci Subroutines may be called indirectly using the CALI instruction. An 6175bd8deadSopenharmony_ci "indirect" call will transfer control to one of a set of labels, where 6185bd8deadSopenharmony_ci the specific label that is used in a particular program invocation is 6195bd8deadSopenharmony_ci set through a "subroutine" parameter (see Section 2.14.1). 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci Functions that will be used for indirect subroutine calls must all be 6225bd8deadSopenharmony_ci assigned a unique unsigned integer SUBROUTINENUM using the modified 6235bd8deadSopenharmony_ci <instLabel> grammar rule. 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci A <SUBROUTINETYPE_statement> associates one or more subroutine labels with 6265bd8deadSopenharmony_ci a "type". For example: 6275bd8deadSopenharmony_ci 6285bd8deadSopenharmony_ci SUBROUTINETYPE Hero { batman, robin }; 6295bd8deadSopenharmony_ci 6305bd8deadSopenharmony_ci creates a SUBROUTINETYPE named "Hero" (if it does not already exist) and 6315bd8deadSopenharmony_ci adds the subroutines whose labels are "batman" and "robin" to the 6325bd8deadSopenharmony_ci SUBROUTINETYPE. 6335bd8deadSopenharmony_ci 6345bd8deadSopenharmony_ci A "subroutine" parameter is a special type of program parameter whose value 6355bd8deadSopenharmony_ci refers to one of a set of subroutines, selected by the API. A subroutine is 6365bd8deadSopenharmony_ci given a SUBROUTINETYPE when it is declared, and it may refer to any label 6375bd8deadSopenharmony_ci of that type. Continuing this example: 6385bd8deadSopenharmony_ci 6395bd8deadSopenharmony_ci SUBROUTINETYPE Hero { superman, wolverine }; 6405bd8deadSopenharmony_ci SUBROUTINETYPE Hero { batman, robin }; 6415bd8deadSopenharmony_ci SUBROUTINETYPE GothamHero { batman, robin }; 6425bd8deadSopenharmony_ci 6435bd8deadSopenharmony_ci # anyHero may "point to" any Hero 6445bd8deadSopenharmony_ci SUBROUTINE Hero anyHero = program.subroutine[0]; 6455bd8deadSopenharmony_ci # gothamHero may "point to" any GothamHero 6465bd8deadSopenharmony_ci SUBROUTINE GothamHero gothamHero = program.subroutine[1]; 6475bd8deadSopenharmony_ci 6485bd8deadSopenharmony_ci batman SUBROUTINENUM(0): 6495bd8deadSopenharmony_ci ... 6505bd8deadSopenharmony_ci robin SUBROUTINENUM(1): 6515bd8deadSopenharmony_ci ... 6525bd8deadSopenharmony_ci superman SUBROUTINENUM(2): 6535bd8deadSopenharmony_ci ... 6545bd8deadSopenharmony_ci wolverine SUBROUTINENUM(3): 6555bd8deadSopenharmony_ci ... 6565bd8deadSopenharmony_ci 6575bd8deadSopenharmony_ci main: 6585bd8deadSopenharmony_ci # could call any of the four heros 6595bd8deadSopenharmony_ci CALI anyHero; 6605bd8deadSopenharmony_ci # could call either batman or robin 6615bd8deadSopenharmony_ci CALI gothamHero; 6625bd8deadSopenharmony_ci 6635bd8deadSopenharmony_ci Program subroutine parameters are assigned to labels by setting the 6645bd8deadSopenharmony_ci corresponding SUBROUTINENUMs via ProgramSubroutineParametersuivNV. For 6655bd8deadSopenharmony_ci example, 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci uint params[2] = {2, 0}; 6685bd8deadSopenharmony_ci ProgramSubroutineParametersuivNV(target, 2, params); 6695bd8deadSopenharmony_ci 6705bd8deadSopenharmony_ci would assign program.subroutine[0] (and therefore "anyHero") to "superman", 6715bd8deadSopenharmony_ci and program.subroutine[1] (and therefore "gothamHero") to "batman". 6725bd8deadSopenharmony_ci 6735bd8deadSopenharmony_ci All SUBROUTINENUMs must be greater than or equal to zero, and less than the 6745bd8deadSopenharmony_ci value of MAX_PROGRAM_SUBROUTINE_NUM_NV. A label may be assigned to multiple 6755bd8deadSopenharmony_ci SUBROUTINETYPEs. A program subroutine parameter may only be assigned to 6765bd8deadSopenharmony_ci subroutine variables of a single SUBROUTINETYPE. 6775bd8deadSopenharmony_ci 6785bd8deadSopenharmony_ci Programs that may potentially cause infinite recursion through indirect 6795bd8deadSopenharmony_ci calls will fail to compile. 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ci 6825bd8deadSopenharmony_ci Section 2.X.8.Z, CALI: Indirect Subroutine Call 6835bd8deadSopenharmony_ci 6845bd8deadSopenharmony_ci The CALI instruction conditionally transfers control to the instruction 6855bd8deadSopenharmony_ci following some label, as described in CAL. The determination of which 6865bd8deadSopenharmony_ci label is used is described in Section 2.X.5 (Program Flow Control). 6875bd8deadSopenharmony_ci 6885bd8deadSopenharmony_ci Add to Chapter 6 (State and State Requests) 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci The command 6915bd8deadSopenharmony_ci 6925bd8deadSopenharmony_ci void GetProgramSubroutineParameteruivNV(enum target, uint index, 6935bd8deadSopenharmony_ci uint *params); 6945bd8deadSopenharmony_ci 6955bd8deadSopenharmony_ci obtains the current value for the program subroutine parameter numbered 6965bd8deadSopenharmony_ci <index> for the given program target <target>, and places the single 6975bd8deadSopenharmony_ci unsigned integer value in the array <params>. The error INVALID_ENUM is 6985bd8deadSopenharmony_ci generated if <target> specifies a nonexistent program target or a program 6995bd8deadSopenharmony_ci target that does not support program environment parameters. The error 7005bd8deadSopenharmony_ci INVALID_VALUE is generated if <index> is greater than or equal to the 7015bd8deadSopenharmony_ci implementation-dependent number of supported program subroutine parameters 7025bd8deadSopenharmony_ci for the program target. 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci Add various new conditions by which a program string would fail to load. 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci The error INVALID_ENUM is generated by GetProgramSubroutineParameteruivNV 7075bd8deadSopenharmony_ci and ProgramSubroutineParametersuivNV if <target> specifies a nonexistent 7085bd8deadSopenharmony_ci program target. 7095bd8deadSopenharmony_ci 7105bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetProgramSubroutineParameteruivNV 7115bd8deadSopenharmony_ci if <index> is greater than or equal to the max number of program subroutine 7125bd8deadSopenharmony_ci parameters, and by ProgramSubroutineParametersuivNV if <count> is <count> 7135bd8deadSopenharmony_ci is not equal to one plus the maximum program subroutine parameter index used 7145bd8deadSopenharmony_ci in the currently bound program. 7155bd8deadSopenharmony_ci 7165bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by 7175bd8deadSopenharmony_ci ProgramSubroutineParametersuivNV if, for any number <i> in [0, <count>), 7185bd8deadSopenharmony_ci program.subroutine[<i>] is a live parameter of a certain SUBROUTINETYPE, 7195bd8deadSopenharmony_ci and <params>[<i>] is not a SUBROUTINENUM that was associated to that 7205bd8deadSopenharmony_ci SUBROUTINETYPE as described in Section 2.X.5. 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci Add new implementation dependent state 7235bd8deadSopenharmony_ci Minimum 7245bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 7255bd8deadSopenharmony_ci -------------------------------- ---- --------------- ------- --------------------- ------ ------ 7265bd8deadSopenharmony_ci MAX_PROGRAM_SUBROUTINE_ Z+ GetProgramivARB 1024 Maximum number of 2.14.1 - 7275bd8deadSopenharmony_ci PARAMETERS_NV program subroutine 7285bd8deadSopenharmony_ci parameters 7295bd8deadSopenharmony_ci MAX_PROGRAM_SUBROUTINENUM_NV Z+ GetProgramivARB 256 Maximum SUBROUTINENUM 2.X.5 - 7305bd8deadSopenharmony_ci value 7315bd8deadSopenharmony_ci 7325bd8deadSopenharmony_ci 7335bd8deadSopenharmony_ciDependencies on EXT_separate_shader_objects 7345bd8deadSopenharmony_ci 7355bd8deadSopenharmony_ci If EXT_separate_shader_objects is not supported, remove references to 7365bd8deadSopenharmony_ci UseShaderProgramEXT. 7375bd8deadSopenharmony_ci 7385bd8deadSopenharmony_ciIssues 7395bd8deadSopenharmony_ci 7405bd8deadSopenharmony_ci (1) What terms should we use to describe the various data types and 7415bd8deadSopenharmony_ci concepts in this specification? 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci RESOLVED: This extension uses mechanisms similar to function pointers in 7445bd8deadSopenharmony_ci C. We aren't directly exposing function pointers, but are instead using a 7455bd8deadSopenharmony_ci function pointer-like data type. We are using the term "subroutine" to 7465bd8deadSopenharmony_ci qualify various concepts in this extension. The function pointer type is 7475bd8deadSopenharmony_ci referred to as a "subroutine type". Integer indices used to identify 7485bd8deadSopenharmony_ci functions that can be assigned to a function pointer type are referred to 7495bd8deadSopenharmony_ci as "subroutine indices". Uniforms that can hold function pointer values 7505bd8deadSopenharmony_ci are referred to as "subroutine uniforms". 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci We considered using the term "interfaces", but were concerns about 7535bd8deadSopenharmony_ci confusion with object-oriented programming models -- the model we are 7545bd8deadSopenharmony_ci using is not object-oriented. Referring instead to these limited function 7555bd8deadSopenharmony_ci pointers as "subroutines" avoids this confusion and matches its use in 7565bd8deadSopenharmony_ci similar circumstances. The term is not currently used in any GLSL nor 7575bd8deadSopenharmony_ci OpenGL specification. 7585bd8deadSopenharmony_ci 7595bd8deadSopenharmony_ci (2) What happens if you try to link a program that has active subroutines 7605bd8deadSopenharmony_ci that have no subroutines that can be assigned ot them? 7615bd8deadSopenharmony_ci 7625bd8deadSopenharmony_ci RESOLVED: Attempting to link a program that calls a function pointer 7635bd8deadSopenharmony_ci with no potential associations produces a link error. 7645bd8deadSopenharmony_ci 7655bd8deadSopenharmony_ci (3) What happens if the app specifies a bad subroutine index? 7665bd8deadSopenharmony_ci 7675bd8deadSopenharmony_ci RESOLVED: There are two different forms of invalid subroutine indices -- 7685bd8deadSopenharmony_ci ones that correspond to no subroutine, and ones that correspond to a 7695bd8deadSopenharmony_ci subroutine of the wrong type. If the app specifies a number that 7705bd8deadSopenharmony_ci corresponds to no subroutine, an INVALID_VALUE error is generated. If the 7715bd8deadSopenharmony_ci number corresponds to a subroutine of the wrong type, an INVALID_OPERATION 7725bd8deadSopenharmony_ci error is generated. 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ci (4) What happens if the shaders change without reassigning subroutine 7755bd8deadSopenharmony_ci associations? 7765bd8deadSopenharmony_ci 7775bd8deadSopenharmony_ci RESOLVED: The subroutine uniforms will revert to a default function of 7785bd8deadSopenharmony_ci of those associated with it in the shader. The default function chosen 7795bd8deadSopenharmony_ci may be implementation dependent. 7805bd8deadSopenharmony_ci 7815bd8deadSopenharmony_ci (5) How should subroutine parameters be updated? 7825bd8deadSopenharmony_ci 7835bd8deadSopenharmony_ci RESOLVED: UniformSubroutinesuivARB requires sending all subroutine 7845bd8deadSopenharmony_ci parameters at once so they can be validated in a single burst. This is 7855bd8deadSopenharmony_ci similar to D3D which goes as far as to require setting all of them in the 7865bd8deadSopenharmony_ci same operation that binds the shader. 7875bd8deadSopenharmony_ci 7885bd8deadSopenharmony_ci (6) Why is the new "subroutine" state owned by the context rather than 7895bd8deadSopenharmony_ci by the assembly program or GLSL program/shader? 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci RESOLVED: We expect that a common usage of this extension 7925bd8deadSopenharmony_ci would be to create a so-called "uber-shader" -- a program that can 7935bd8deadSopenharmony_ci support many different state configurations. If an application uses 7945bd8deadSopenharmony_ci such a program in multiple contexts, it likely it would not want changes 7955bd8deadSopenharmony_ci to linkage for one context to affect the other context. 7965bd8deadSopenharmony_ci 7975bd8deadSopenharmony_ci (7) Does that mean other types of uniforms also need to be context state? 7985bd8deadSopenharmony_ci 7995bd8deadSopenharmony_ci RESOLVED: Apps can choose to share or not share numeric uniform types at 8005bd8deadSopenharmony_ci their discretion using UBO, however for more "opaque" uniform types like 8015bd8deadSopenharmony_ci samplers it may be desirable to have context state. Such a change is 8025bd8deadSopenharmony_ci beyond the scope of this extension. No effort was made to make subroutine 8035bd8deadSopenharmony_ci uniforms generic enough to support other potential usages. Should such 8045bd8deadSopenharmony_ci emerge, they will define their own unique uniform types. 8055bd8deadSopenharmony_ci 8065bd8deadSopenharmony_ci (8) GLSL allows function name overloading, how can you query a 8075bd8deadSopenharmony_ci subroutine location in that case? 8085bd8deadSopenharmony_ci 8095bd8deadSopenharmony_ci RESOLVED: Disallow overloading of function names used for subroutine 8105bd8deadSopenharmony_ci functions. 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ci (9) What sort of implementation-dependent limits apply to subroutines? 8135bd8deadSopenharmony_ci 8145bd8deadSopenharmony_ci RESOLVED: There is an limit on the number of subroutines per shader stage 8155bd8deadSopenharmony_ci (MAX_SUBROUTINES) and also a limit on the number of subroutine uniform 8165bd8deadSopenharmony_ci locations (MAX_SUBROUTINE_UNIFORM_LOCATIONS). 8175bd8deadSopenharmony_ci 8185bd8deadSopenharmony_ci (10) How many subroutine variables be used? Should they be allowed as 8195bd8deadSopenharmony_ci function parameters, structure members, and arrays? 8205bd8deadSopenharmony_ci 8215bd8deadSopenharmony_ci RESOLVED: Arrays of subroutine uniforms are allowed. The spec does not 8225bd8deadSopenharmony_ci currently permit them as function parameters or structure members, as it 8235bd8deadSopenharmony_ci requires subroutine variables be declared as uniforms. Subroutine 8245bd8deadSopenharmony_ci function parameters can be emulated by declaring a uniform array holding 8255bd8deadSopenharmony_ci all possible subroutines that a shader might want to pass as a parameter 8265bd8deadSopenharmony_ci and then passing an integer index to select a subroutine to call. 8275bd8deadSopenharmony_ci 8285bd8deadSopenharmony_ci (11) Is the "subroutine" keyword necessary when declaring a subroutine 8295bd8deadSopenharmony_ci uniform? 8305bd8deadSopenharmony_ci 8315bd8deadSopenharmony_ci RESOLVED: Yes, "subroutine uniform" in the declaration is required. 8325bd8deadSopenharmony_ci 8335bd8deadSopenharmony_ci (12) Why don't the new tokens and entry points in this extension have 8345bd8deadSopenharmony_ci "ARB" suffixes like other ARB extensions? 8355bd8deadSopenharmony_ci 8365bd8deadSopenharmony_ci RESOLVED: Unlike most ARB extensions, this is a strict subset of 8375bd8deadSopenharmony_ci functionality already approved for the OpenGL core. This extension 8385bd8deadSopenharmony_ci exists only to support that functionality on older hardware that cannot 8395bd8deadSopenharmony_ci implement all the functionality in that OpenGL version. Since there are 8405bd8deadSopenharmony_ci no possible behavior changes between the ARB extension and core features, 8415bd8deadSopenharmony_ci source code compatibility is improved by not using suffixes on the 8425bd8deadSopenharmony_ci extension. 8435bd8deadSopenharmony_ci 8445bd8deadSopenharmony_ci (13) Are compilers permitted to eliminate unreferenced elements at the end 8455bd8deadSopenharmony_ci of an array for subroutine uniforms like they can for regular uniforms? 8465bd8deadSopenharmony_ci 8475bd8deadSopenharmony_ci RESOLVED: No, because of differences in the uniform loading APIs. 8485bd8deadSopenharmony_ci Consider the following example: 8495bd8deadSopenharmony_ci 8505bd8deadSopenharmony_ci uniform float array[10]; 8515bd8deadSopenharmony_ci // shader only references array[0..5] 8525bd8deadSopenharmony_ci 8535bd8deadSopenharmony_ci The GL implementation is permitted to treat "array" as having a size of 8545bd8deadSopenharmony_ci 6, but may also use the declared size of 10. An application may have 8555bd8deadSopenharmony_ci built-in knowledge that "array" has a declared length of 10, and might 8565bd8deadSopenharmony_ci call Uniform1f() with a <count> of 10. The specified behavior for 8575bd8deadSopenharmony_ci Uniform*() APIs is that any values specified that extend beyond the last 8585bd8deadSopenharmony_ci active element of the array are ignored. As a result, passing "extra" 8595bd8deadSopenharmony_ci elements to Uniform*() causes no problems; applications don't need to 8605bd8deadSopenharmony_ci query the active size of a uniform array to get correct behavior. 8615bd8deadSopenharmony_ci 8625bd8deadSopenharmony_ci The subroutine uniform loading API is different, as it accepts a single 8635bd8deadSopenharmony_ci array containing the values for every active uniform. This allows 8645bd8deadSopenharmony_ci applications to specify the values for all subroutine uniforms in a 8655bd8deadSopenharmony_ci single call, instead of multiple calls for regular uniforms. However, 8665bd8deadSopenharmony_ci this approach doesn't provide a mechanism for discarding unused array 8675bd8deadSopenharmony_ci elements. If "array" above was a subroutine uniform and the application 8685bd8deadSopenharmony_ci wrote 10 values into the array it would pass to UniformSubroutinesuiv, 8695bd8deadSopenharmony_ci it might overwrite the values of other subroutines or write off the end 8705bd8deadSopenharmony_ci of the array if the compiler only assigned 6 locations for "array". If 8715bd8deadSopenharmony_ci unused elements could be eliminated, implementations would have to query 8725bd8deadSopenharmony_ci the active size for each subroutine uniform array, even if they knew the 8735bd8deadSopenharmony_ci declared size up-front. To avoid the need to always query lengths, we 8745bd8deadSopenharmony_ci instead specify that all elements of an active subroutine array are 8755bd8deadSopenharmony_ci active. 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ciRevision History 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci Rev. Date Author Changes 8805bd8deadSopenharmony_ci ---- ---------- -------- ---------------------------------------------- 8815bd8deadSopenharmony_ci 19 02/28/2014 Jon Leech Restrict error for UniformSubroutinesuiv to 8825bd8deadSopenharmony_ci the case where no program stage is active for 8835bd8deadSopenharmony_ci the shader stage identified by <shadertype> 8845bd8deadSopenharmony_ci (Bug 11306). 8855bd8deadSopenharmony_ci 8865bd8deadSopenharmony_ci 18 02/10/2011 pbrown Add a clarification to the GLSL spec language 8875bd8deadSopenharmony_ci prohibiting potential recursion via subroutine 8885bd8deadSopenharmony_ci uniforms; a program will fail to link if there 8895bd8deadSopenharmony_ci is any possible combination of subroutine 8905bd8deadSopenharmony_ci uniform values that would result in recursion 8915bd8deadSopenharmony_ci (bug 7327). 8925bd8deadSopenharmony_ci 8935bd8deadSopenharmony_ci 17 03/29/2010 pbrown Update issues (1) and (10). 8945bd8deadSopenharmony_ci 8955bd8deadSopenharmony_ci 16 03/21/2010 pbrown Minor clarification in the NV_gpu_program5 8965bd8deadSopenharmony_ci interaction that no OPTION is required to 8975bd8deadSopenharmony_ci use subroutines in assembly programs. 8985bd8deadSopenharmony_ci 8995bd8deadSopenharmony_ci 15 02/08/2010 Jon Leech Minor wording changes for consistency with 9005bd8deadSopenharmony_ci 4.0 specification. 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci 14 01/30/2010 pbrown Specify that implementations are not permitted 9035bd8deadSopenharmony_ci to chop unreferenced elements off the end of 9045bd8deadSopenharmony_ci a subroutine uniform array like they are with 9055bd8deadSopenharmony_ci regular uniforms (bug 5978). Minor 9065bd8deadSopenharmony_ci clarification on the meaning of "active 9075bd8deadSopenharmony_ci subroutines". 9085bd8deadSopenharmony_ci 9095bd8deadSopenharmony_ci 13 01/26/2010 pbrown Assigned enum values for enums added by most 9105bd8deadSopenharmony_ci recent edits. 9115bd8deadSopenharmony_ci 9125bd8deadSopenharmony_ci 12 01/20/2010 pbrown Update state tables to classify per-subroutine 9135bd8deadSopenharmony_ci and per-subroutine uniform state as "5x" to 9145bd8deadSopenharmony_ci indicate a separate set of values for each 9155bd8deadSopenharmony_ci shader stage. 9165bd8deadSopenharmony_ci 9175bd8deadSopenharmony_ci 11 01/18/2010 pbrown Rename GetActiveSubroutineUniformiv. Add 9185bd8deadSopenharmony_ci enums to query the longest subroutine uniform 9195bd8deadSopenharmony_ci and subroutine names in a stage. Rename enum 9205bd8deadSopenharmony_ci NUM_COMPATIBLE_SUBROUTINES. Change error 9215bd8deadSopenharmony_ci behavior to allow most queries on unlinked 9225bd8deadSopenharmony_ci programs and ones without the specified stage 9235bd8deadSopenharmony_ci (except GetSubroutineUniformLocation). Added 9245bd8deadSopenharmony_ci errors in UniformSubroutines and 9255bd8deadSopenharmony_ci GetUniformSubroutineuiv if no program is 9265bd8deadSopenharmony_ci active. Minor spec language cleanups. All 9275bd8deadSopenharmony_ci based on review comments in bug 5861. 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci 10 01/15/2010 pbrown Significant changes to allow for full 9305bd8deadSopenharmony_ci discoverability of subroutine uniforms, 9315bd8deadSopenharmony_ci subroutines, and their locations (bug 5861). 9325bd8deadSopenharmony_ci Rename the term "subroutine number" to "active 9335bd8deadSopenharmony_ci subroutine index". Rename GetSubroutineIndex 9345bd8deadSopenharmony_ci (was GetSubroutineNumber) and the <indices> 9355bd8deadSopenharmony_ci parameter of UniformSubroutinesuiv. Fix 9365bd8deadSopenharmony_ci prototype of GetSubroutineIndex and other APIs 9375bd8deadSopenharmony_ci to consistently use "uint". Add APIs to query 9385bd8deadSopenharmony_ci properties of active subroutine uniforms 9395bd8deadSopenharmony_ci (name, associated subroutines). Separate the 9405bd8deadSopenharmony_ci notion of subroutine uniform indices and 9415bd8deadSopenharmony_ci locations just like regular uniforms. Arrays 9425bd8deadSopenharmony_ci may have one index but multiple locations. 9435bd8deadSopenharmony_ci Specify that locations are packed in 9445bd8deadSopenharmony_ci consecutive locations. Rename 9455bd8deadSopenharmony_ci GetSubroutineName to GetActiveSubroutineName 9465bd8deadSopenharmony_ci to match other enumeration APIs. Add a query 9475bd8deadSopenharmony_ci for the number of active subroutine uniform 9485bd8deadSopenharmony_ci locations, and change the implementation limit 9495bd8deadSopenharmony_ci to be on active locations instead of indices. 9505bd8deadSopenharmony_ci Clarify that subroutines in a shader need not 9515bd8deadSopenharmony_ci be active if there is no active uniform that 9525bd8deadSopenharmony_ci can call them (bug 5859). Update state tables 9535bd8deadSopenharmony_ci and some issues. 9545bd8deadSopenharmony_ci 9555bd8deadSopenharmony_ci 9 01/14/2010 pbrown Add some more text to the introduction to 9565bd8deadSopenharmony_ci subroutines in the GLSL spec section. 9575bd8deadSopenharmony_ci 9585bd8deadSopenharmony_ci 8 12/10/2009 groth ARBify. 9595bd8deadSopenharmony_ci 9605bd8deadSopenharmony_ci 7 12/10/2009 groth Correct prototypes and clarify/correct errors. 9615bd8deadSopenharmony_ci Fix a few state retrieval typos. 9625bd8deadSopenharmony_ci 9635bd8deadSopenharmony_ci 6 10/29/2009 groth Clarify a number of areas in response to 9645bd8deadSopenharmony_ci feedback from bmerry. 9655bd8deadSopenharmony_ci 9665bd8deadSopenharmony_ci 5 09/24/2009 groth Fix typo in GLSL example. Assign enums. 9675bd8deadSopenharmony_ci 9685bd8deadSopenharmony_ci 4 09/17/2009 pbrown Add implementation-dependent limits on 9695bd8deadSopenharmony_ci subroutines. Document some of these limits 9705bd8deadSopenharmony_ci and restrictions on function overloading and 9715bd8deadSopenharmony_ci subroutine uniforms with no matching function. 9725bd8deadSopenharmony_ci 9735bd8deadSopenharmony_ci 3 09/16/2009 groth Resolve issues. A few clarifications. 9745bd8deadSopenharmony_ci rename interface to subroutine. 9755bd8deadSopenharmony_ci 9765bd8deadSopenharmony_ci 2 09/14/2009 groth EXTify. move asm changes to dependencies. 9775bd8deadSopenharmony_ci 9785bd8deadSopenharmony_ci 1 jbolz Internal revisions. 979