-
Notifications
You must be signed in to change notification settings - Fork 102
/
GL_EXT_shader_realtime_clock.txt
127 lines (78 loc) · 3.35 KB
/
GL_EXT_shader_realtime_clock.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Name
EXT_shader_realtime_clock
Name Strings
GL_EXT_shader_realtime_clock
Contact
Aaron Hagan (aaron.hagan 'at' amd.com)
Contributors
Aaron Hagan, AMD
Daniel Rakos, AMD
Timothy Lottes, AMD
Graham Sellers, AMD
Status
Complete
Version
Last Modified Date: 10/29/2019
Revision: 2
Number
OpenGL Extension #
Dependencies
This extension is written against Revision 8 of the version 4.40 of the
OpenGL Shading Language Specification, dated June 16, 2014.
This extension builds upon features introduced by the
GL_ARB_shader_clock extension.
This extension interacts with GL_ARB_gpu_shader_int64.
Overview
This extension exposes a real-time counter which may be used
to derive timing information within a shader.
Mapping to SPIR-V
-----------------
For informational purposes (non-specification), the following is an
expected way for an implementation to map GLSL constructs to SPIR-V
constructs:
clockRealtime2x32EXT -> OpReadClockKHR with a Scope of Device, Result type of uvec2
clockRealtimeEXT -> OpReadClockKHR with a Scope of Device, Result type of uint64_t
New Procedures and Functions
None.
New Tokens
None.
IP Status
None.
Modifications to the OpenGL Shading Language Specification, Version 4.50
Including the following line in a shader can be used to control the
language features described in this extension:
#extension GL_EXT_shader_realtime_clock : <behavior>
where <behavior> is as specified in section 3.3.
New preprocessor #defines are added to the OpenGL Shading Language:
#define GL_EXT_shader_realtime_clock 1
Additions to Chapter 8 of the OpenGL Shading Language Specification
(Built-in Functions)
Add New Section 8.19, "Timing Functions"
Syntax:
uvec2 clockRealtime2x32EXT(void);
uint64_t clockRealtimeEXT(void);
The clockRealtimeEXT() function returns a 64-bit value representing a
real-time clock that is globally coherent by all invocations on the GPU.
clockRealtime2x32EXT() returns the same value encoded as a two-component
vector of 32-bit unsigned integers with the first component containing
the 32 least significant bits and the second component containing the
32 most significant bits.
The units of time are not defined for either of these operations and will
wrap after exceeding the maximum value representable in 64 bits. These
functions serve as code motion barriers.
Dependencies on GL_ARB_gpu_shader_int64:
This extension depends on GL_ARB_gpu_shader_int64 for 64-bit integer values.
If GL_ARB_gpu_shader_int64 is not supported, remove clockRealtimeEXT() and any
reference to the uint64 type.
IP Status
None.
Issues
1. What is the difference between EXT_shader_realtime_clock and ARB_shader_clock ?
RESOLUTION: The main difference between these extensions is locality,
EXT_shader_realtime_clock is a clock value that is coherent across all invocations
of the GPU, while ARB_shader_clock times are local to single workgroup.
Revision History
Rev Date Author Changes
--- ---------- -------- ---------------------------------------------
1 10/02/2018 ahagan Initial revision based on ARB_shader_clock.
2 10/29/2019 dgkoch Add mapping to SPIR-V section, mark complete.