• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_shader_clock
4
5Name Strings
6
7    GL_ARB_shader_clock
8
9Contact
10
11    Timothy Lottes (timothy.lottes 'at' amd.com)
12
13Contributors
14
15    Timothy Lottes, AMD
16    Graham Sellers, AMD
17    Daniel Rakos, AMD
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: 10/29/2019
43    Revision: 5
44
45Number
46
47    ARB Extension #184
48
49Dependencies
50
51    This extension is written against version 4.50 of the OpenGL Shading
52    Language Specification.
53
54    This interacts with GL_ARB_gpu_shader_int64.
55
56Overview
57
58    This extension exposes a 64-bit monotonically incrementing shader
59    counter which may be used to derive local timing information within
60    a single shader invocation.
61
62    Mapping to SPIR-V
63    -----------------
64
65    For informational purposes (non-specification), the following is an
66    expected way for an implementation to map GLSL constructs to SPIR-V
67    constructs:
68
69        clock2x32ARB -> OpReadClockKHR with a Scope of Subgroup, Result type of uvec2
70        clockARB -> OpReadClockKHR with a Scope of Subgroup, Result type of uitn64_t
71
72New Procedures and Functions
73
74    None.
75
76New Tokens
77
78    None.
79
80IP Status
81
82    None.
83
84Modifications to the OpenGL Shading Language Specification, Version 4.50
85
86    Including the following line in a shader can be used to control the
87    language features described in this extension:
88
89      #extension GL_ARB_shader_clock : <behavior>
90
91    where <behavior> is as specified in section 3.3.
92
93    New preprocessor #defines are added to the OpenGL Shading Language:
94
95      #define GL_ARB_shader_clock               1
96
97Additions to Chapter 8 of the OpenGL Shading Language Specification
98(Built-in Functions)
99
100    Add New Section 8.19, "Timing Functions"
101
102    Syntax:
103
104        uvec2 clock2x32ARB(void);
105        uint64_t clockARB(void);
106
107    The clockARB() function returns a 64-bit value representing the current
108    execution clock as seen by the shader processor. clock2x32ARB() returns
109    the same value encoded as a two-component vector of 32-bit unsigned integers
110    with the first component containing the 32 least significant bits and the
111    second component containing the 32 most significant bits. Time monotonically
112    increments as the processor executes instructions. The returned time will
113    wrap after it exceeds the maximum value representable in 64 bits. The
114    units of time are not defined and need not be constant. Time is not
115    guaranteed to be dynamically uniform across either a work group or a
116    invocations of a single draw or dispatch. However time is guaranteed to
117    be dynamically uniform across a single sub-group but only in a given
118    shader stage (where sub-group is implementation dependent and may be just
119    one invocation). The clockARB() and clock2x32ARB() functions serve as a code
120    motion barriers.
121
122Dependencies on GL_ARB_gpu_shader_int64
123
124    If GL_ARB_gpu_shader_int64 is not supported, remove clockARB() and any
125    reference to the uint64 type.
126
127Issues
128
129    1) Why do we have two functions? What's clock2x32ARB for?
130
131    It's to allow implementations that don't have full 64-bit integer support
132    to expose support for this extension.
133
134    2) Do we need to expose a "clock width" query, or is everyone okay with
135       wrapping at 64-bits? Spec language currently mandates 64-bit, which
136       would preclude implementations from exposing a 32-bit timer.
137
138    UNRESOLVED.
139
140Revision History
141
142    Rev  Date        Author    Changes
143    ---  ----------  --------  ---------------------------------------------
144      1  03/09/2015  tlottes   Initial revision based on AMD_gcn_shader
145      2  04/20/2015  tlottes   Now uint64, noted code motion barrier.
146      3  04/22/2015  gsellers  Add clock2x32ARB. Add interaction with gpu_shader_64.
147      4  06/17/2015  gsellers  General tidyment. Add issue 2.
148      5  10/28/2019  dgkoch    Add mapping to SPIR-V section.
149