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