1Name 2 3 ARB_parallel_shader_compile 4 5Name Strings 6 7 GL_ARB_parallel_shader_compile 8 9Contact 10 11 Timothy Lottes (timothy.lottes 'at' amd.com) 12 13Contributors 14 15 Timothy Lottes, AMD 16 Graham Sellers, AMD 17 Eric Werness, NVIDIA 18 Daniel Koch, NVIDIA 19 20Notice 21 22 Copyright (c) 2015 The Khronos Group Inc. Copyright terms at 23 http://www.khronos.org/registry/speccopyright.html 24 25Specification Update Policy 26 27 Khronos-approved extension specifications are updated in response to 28 issues and bugs prioritized by the Khronos OpenGL Working Group. For 29 extensions which have been promoted to a core Specification, fixes will 30 first appear in the latest version of that core Specification, and will 31 eventually be backported to the extension document. This policy is 32 described in more detail at 33 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 34 35Status 36 37 Complete. Approved by the ARB on June 26, 2015. 38 Ratified by the Khronos Board of Promoters on August 7, 2015. 39 40Version 41 42 Last Modified Date: 2017-04-24 43 Revision: 7 44 45Number 46 47 ARB Extension #179 48 49Dependencies 50 51 This extension is written against OpenGL 4.5 (CoreProfile) dated 52 May 28 2015. 53 54Overview 55 56 Compiling GLSL into implementation-specific code can be a time consuming 57 process, so a GL implementation may wish to perform the compilation in a 58 separate CPU thread. This extension provides a mechanism for the application 59 to provide a hint to limit the number of threads it wants to be used to 60 compile shaders, as well as a query to determine if the compilation process 61 is complete. 62 63New Procedures and Functions 64 65 void MaxShaderCompilerThreadsARB(uint count); 66 67New Tokens 68 69 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 70 GetInteger64v, GetFloatv, and GetDoublev: 71 72 MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 73 74 Accepted as part of the <pname> parameter to GetShaderiv and 75 accepted as part of the <pname> parameter to GetProgramiv: 76 77 COMPLETION_STATUS_ARB 0x91B1 78 79IP Status 80 81 None. 82 83Additions to Chapter 7 "Programs and Shaders", 84 85 Append to the end of 7.1 "Shader Objects", 86 87 Applications may use the following to hint to the driver the maximum 88 number background threads it would like to be used in the process of 89 compiling shaders or linking programs, 90 91 void MaxShaderCompilerThreadsARB(uint count); 92 93 where <count> is the number of background threads. A <count> of zero 94 specifies a request for no parallel compiling or linking and a <count> of 95 0xFFFFFFFF requests an implementation-specific maximum. 96 97 An implementation may combine the maximum compiler thread request from 98 multiple contexts in a share group in an implementation-specific way. 99 100 An application can query the current MaxShaderCompilerThreadsARB <count> 101 by calling GetIntegerv with <pname> set to MAX_SHADER_COMPILER_THREADS_ARB, 102 which returns the value of the current state (Table 23.51). 103 104 105 Add to 7.13 "Shader, Program, and Program Pipeline Queries" under the 106 descriptions for "pname" for "GetShaderiv", 107 108 If <pname> is COMPLETION_STATUS_ARB, TRUE is returned if the shader 109 compilation has completed, FALSE otherwise. 110 111 Add to 7.13 "Shader, Program, and Program Pipeline Queries" under the 112 descriptions for "pname" for "GetProgramiv", 113 114 If <pname> is COMPLETION_STATUS_ARB, TRUE is returned if the program 115 linking has completed, FALSE otherwise. 116 117New State 118 119 Add to Table 23.51: Hints 120 Get Value Type Get Command Initial Value Description Sec 121 ------------------------------- ---- ------------ ------------- -------------------- ---- 122 MAX_SHADER_COMPILER_THREADS_ARB Z+ GetIntegerv 0xFFFFFFFF Max compile threads 7.13 123 124 Add to Table 23.32: Program Object State 125 Get Value Type Get Command Initial Value Description Sec 126 --------------------- ---- ------------ ------------- -------------------- ---- 127 COMPLETION_STATUS_ARB B GetProgramiv TRUE Program linking has 7.13 128 completed 129 130 Add to Table 23.30: Shader Object State 131 Get Value Type Get Command Initial Value Description Sec 132 --------------------- ---- ------------ ------------- -------------------- ---- 133 COMPLETION_STATUS_ARB B GetShaderiv TRUE Shader compilation 7.13 134 has completed 135Issues 136 137 1) Where should the hint state be stored? 138 139 UNRESOLVED: Each context has its own value which may be specified and 140 queried, but an implementation may choose to combine the hints from multiple 141 contexts in an implmentation-specific manner. There isn't really any 142 precedent for per-share group state. 143 144 2) Can we make the requirements more strict? 145 146 RESOLVED: We could, but making sure all of the error behavior is correct and 147 fully specified would likely take more time than we have. This spec allows 148 an application to clearly request its intent even if there aren't guarantees 149 that the implementation will exactly obey the request. 150 151 3) Does glGetIntegerv(MAX_SHADER_COMPILER_THREADS_ARB) just return the 152 value set by MaxShaderCompilerThreadsARB? Or, if the state is 0xFFFFFFFF 153 ("do something implementation specific"), does it return the number of 154 threads the implementation has actually chosen to use? 155 156 RESOLVED: As with other state queries, this returns the value that was last 157 set, or if no value was set by the application it returns the default state 158 value (0xFFFFFFFF). 159 160Revision History 161 162 Rev Date Author Changes 163 --- ---------- -------- --------------------------------------------- 164 1 2015-03-22 tlottes Initial revision 165 2 2015-03-23 tlottes Added way to get MAX_SHADER_COMPILER_THREADS 166 3 2015-04-20 tlottes Updated tokens and functions 167 4 2015-06-18 tlottes Added New State, noted per context, issues 168 5 2016-06-23 ewerness Clarify the spec is a hint, other language fixes 169 6 2015-09-01 pdaniell Fix the functions that can be used to query 170 MAX_SHADER_COMPILER_THREADS_ARB. 171 7 2017-04-24 dgkoch Spec clarifications, add issue 3. 172