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