15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci KHR_parallel_shader_compile 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_KHR_parallel_shader_compile 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Geoff Lang, (geofflang 'at' google.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Timothy Lottes, AMD 165bd8deadSopenharmony_ci Graham Sellers, AMD 175bd8deadSopenharmony_ci Eric Werness, NVIDIA 185bd8deadSopenharmony_ci Geoff Lang, Google 195bd8deadSopenharmony_ci Daniel Koch, NVIDIA 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciNotice 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Copyright (c) 2015 The Khronos Group Inc. Copyright terms at 245bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciSpecification Update Policy 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 295bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL and OpenGL ES Working Groups. For 305bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 315bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 325bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 335bd8deadSopenharmony_ci described in more detail at 345bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ciStatus 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Complete 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciVersion 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Last Modified Date: 2017-04-24 435bd8deadSopenharmony_ci Revision: 2 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ciNumber 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci ARB Extension #192 485bd8deadSopenharmony_ci OpenGL ES Extension #288 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciDependencies 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension is written against OpenGL 4.5 (CoreProfile) dated 535bd8deadSopenharmony_ci May 28 2015. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci OpenGL ES 2.0 is required (for mobile). 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciOverview 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci Compiling GLSL into implementation-specific code can be a time consuming 605bd8deadSopenharmony_ci process, so a GL implementation may wish to perform the compilation in a 615bd8deadSopenharmony_ci separate CPU thread. This extension provides a mechanism for the application 625bd8deadSopenharmony_ci to provide a hint to limit the number of threads it wants to be used to 635bd8deadSopenharmony_ci compile shaders, as well as a query to determine if the compilation process 645bd8deadSopenharmony_ci is complete. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciNew Procedures and Functions 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci void MaxShaderCompilerThreadsKHR(uint count); 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ciNew Tokens 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 735bd8deadSopenharmony_ci GetInteger64v, GetFloatv, and GetDoublev: 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci Accepted as part of the <pname> parameter to GetShaderiv and 785bd8deadSopenharmony_ci accepted as part of the <pname> parameter to GetProgramiv: 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci COMPLETION_STATUS_KHR 0x91B1 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciIP Status 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci None. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciAdditions to Chapter 7 "Programs and Shaders", 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci Append to the end of 7.1 "Shader Objects", 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci Applications may use the following to hint to the driver the maximum 915bd8deadSopenharmony_ci number background threads it would like to be used in the process of 925bd8deadSopenharmony_ci compiling shaders or linking programs, 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci void MaxShaderCompilerThreadsKHR(uint count); 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci where <count> is the number of background threads. A <count> of zero 975bd8deadSopenharmony_ci specifies a request for no parallel compiling or linking and a <count> of 985bd8deadSopenharmony_ci 0xFFFFFFFF requests an implementation-specific maximum. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci An implementation may combine the maximum compiler thread request from 1015bd8deadSopenharmony_ci multiple contexts in a share group in an implementation-specific way. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci An application can query the current MaxShaderCompilerThreadsKHR <count> 1045bd8deadSopenharmony_ci by calling GetIntegerv with <pname> set to MAX_SHADER_COMPILER_THREADS_KHR, 1055bd8deadSopenharmony_ci which returns the value of the current state (Table 23.51). 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Add to 7.13 "Shader, Program, and Program Pipeline Queries" under the 1095bd8deadSopenharmony_ci descriptions for "pname" for "GetShaderiv", 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci If <pname> is COMPLETION_STATUS_KHR, TRUE is returned if the shader 1125bd8deadSopenharmony_ci compilation has completed, FALSE otherwise. 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Add to 7.13 "Shader, Program, and Program Pipeline Queries" under the 1155bd8deadSopenharmony_ci descriptions for "pname" for "GetProgramiv", 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci If <pname> is COMPLETION_STATUS_KHR, TRUE is returned if the program 1185bd8deadSopenharmony_ci linking has completed, FALSE otherwise. 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ciNew State 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci Add to Table 23.51: Hints 1235bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec 1245bd8deadSopenharmony_ci ------------------------------- ---- ------------ ------------- -------------------- ---- 1255bd8deadSopenharmony_ci MAX_SHADER_COMPILER_THREADS_KHR Z+ GetIntegerv 0xFFFFFFFF Max compile threads 7.13 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci Add to Table 23.32: Program Object State 1285bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec 1295bd8deadSopenharmony_ci ---------------------- ---- ------------ ------------- -------------------- ---- 1305bd8deadSopenharmony_ci COMPLETION_STATUS_KHR B GetProgramiv TRUE Program linking has 7.13 1315bd8deadSopenharmony_ci completed 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci Add to Table 23.30: Shader Object State 1345bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec 1355bd8deadSopenharmony_ci --------------------- ---- ------------ ------------- -------------------- ---- 1365bd8deadSopenharmony_ci COMPLETION_STATUS_KHR B GetShaderiv TRUE Shader compilation 7.13 1375bd8deadSopenharmony_ci has completed 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ciInteractions with OpenGL ES 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci If implemented in OpenGL ES ignore all references to GetDoublev. 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci If the supported ES version is less than 3.0, ignore all references to 1445bd8deadSopenharmony_ci GetInteger64v. 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ciIssues 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci 1) Where should the hint state be stored? 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci UNRESOLVED: Each context has its own value which may be specified and 1515bd8deadSopenharmony_ci queried, but an implementation may choose to combine the hints from multiple 1525bd8deadSopenharmony_ci contexts in an implmentation-specific manner. There isn't really any 1535bd8deadSopenharmony_ci precedent for per-share group state. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci 2) Can we make the requirements more strict? 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci RESOLVED: We could, but making sure all of the error behavior is correct and 1585bd8deadSopenharmony_ci fully specified would likely take more time than we have. This spec allows 1595bd8deadSopenharmony_ci an application to clearly request its intent even if there aren't guarantees 1605bd8deadSopenharmony_ci that the implementation will exactly obey the request. 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci 3) Does glGetIntegerv(MAX_SHADER_COMPILER_THREADS_KHR) just return the 1635bd8deadSopenharmony_ci value set by MaxShaderCompilerThreadsKHR? Or, if the state is 0xFFFFFFFF 1645bd8deadSopenharmony_ci ("do something implementation specific"), does it return the number of 1655bd8deadSopenharmony_ci threads the implementation has actually chosen to use? 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci RESOLVED: As with other state queries, this returns the value that was last 1685bd8deadSopenharmony_ci set, or if no value was set by the application it returns the default state 1695bd8deadSopenharmony_ci value (0xFFFFFFFF). 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ciRevision History 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci Rev Date Author Changes 1745bd8deadSopenharmony_ci --- ---------- -------- --------------------------------------------- 1755bd8deadSopenharmony_ci 1 2017-03-23 glang Cast as KHR based on v6 of 1765bd8deadSopenharmony_ci ARB_parallel_shader_compile. 1775bd8deadSopenharmony_ci 2 2017-04-24 dgkoch Spec clarifications, add issue 3. 178