15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_shader_clock
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_shader_clock
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Timothy Lottes (timothy.lottes 'at' amd.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Timothy Lottes, AMD
165bd8deadSopenharmony_ci    Graham Sellers, AMD
175bd8deadSopenharmony_ci    Daniel Rakos, AMD
185bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright (c) 2015 The Khronos Group Inc. Copyright terms at
235bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciSpecification Update Policy
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
285bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
295bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
305bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
315bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
325bd8deadSopenharmony_ci    described in more detail at
335bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciStatus
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    Complete. Approved by the ARB on June 26, 2015.
385bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on August 7, 2015.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciVersion
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Last Modified Date: 10/29/2019
435bd8deadSopenharmony_ci    Revision: 5
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciNumber
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    ARB Extension #184
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciDependencies
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension is written against version 4.50 of the OpenGL Shading
525bd8deadSopenharmony_ci    Language Specification.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This interacts with GL_ARB_gpu_shader_int64.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ciOverview
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    This extension exposes a 64-bit monotonically incrementing shader
595bd8deadSopenharmony_ci    counter which may be used to derive local timing information within
605bd8deadSopenharmony_ci    a single shader invocation.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    Mapping to SPIR-V
635bd8deadSopenharmony_ci    -----------------
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    For informational purposes (non-specification), the following is an
665bd8deadSopenharmony_ci    expected way for an implementation to map GLSL constructs to SPIR-V
675bd8deadSopenharmony_ci    constructs:
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci        clock2x32ARB -> OpReadClockKHR with a Scope of Subgroup, Result type of uvec2
705bd8deadSopenharmony_ci        clockARB -> OpReadClockKHR with a Scope of Subgroup, Result type of uitn64_t
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ciNew Procedures and Functions
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    None.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew Tokens
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    None.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciIP Status
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    None.
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.50
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
875bd8deadSopenharmony_ci    language features described in this extension:
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci      #extension GL_ARB_shader_clock : <behavior>
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    New preprocessor #defines are added to the OpenGL Shading Language:
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci      #define GL_ARB_shader_clock               1
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL Shading Language Specification
985bd8deadSopenharmony_ci(Built-in Functions)
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci    Add New Section 8.19, "Timing Functions"
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    Syntax:
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        uvec2 clock2x32ARB(void);
1055bd8deadSopenharmony_ci        uint64_t clockARB(void);
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci    The clockARB() function returns a 64-bit value representing the current
1085bd8deadSopenharmony_ci    execution clock as seen by the shader processor. clock2x32ARB() returns
1095bd8deadSopenharmony_ci    the same value encoded as a two-component vector of 32-bit unsigned integers
1105bd8deadSopenharmony_ci    with the first component containing the 32 least significant bits and the
1115bd8deadSopenharmony_ci    second component containing the 32 most significant bits. Time monotonically
1125bd8deadSopenharmony_ci    increments as the processor executes instructions. The returned time will
1135bd8deadSopenharmony_ci    wrap after it exceeds the maximum value representable in 64 bits. The
1145bd8deadSopenharmony_ci    units of time are not defined and need not be constant. Time is not
1155bd8deadSopenharmony_ci    guaranteed to be dynamically uniform across either a work group or a
1165bd8deadSopenharmony_ci    invocations of a single draw or dispatch. However time is guaranteed to
1175bd8deadSopenharmony_ci    be dynamically uniform across a single sub-group but only in a given
1185bd8deadSopenharmony_ci    shader stage (where sub-group is implementation dependent and may be just
1195bd8deadSopenharmony_ci    one invocation). The clockARB() and clock2x32ARB() functions serve as a code
1205bd8deadSopenharmony_ci    motion barriers.
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ciDependencies on GL_ARB_gpu_shader_int64
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    If GL_ARB_gpu_shader_int64 is not supported, remove clockARB() and any
1255bd8deadSopenharmony_ci    reference to the uint64 type.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ciIssues
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    1) Why do we have two functions? What's clock2x32ARB for?
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    It's to allow implementations that don't have full 64-bit integer support
1325bd8deadSopenharmony_ci    to expose support for this extension.
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    2) Do we need to expose a "clock width" query, or is everyone okay with
1355bd8deadSopenharmony_ci       wrapping at 64-bits? Spec language currently mandates 64-bit, which
1365bd8deadSopenharmony_ci       would preclude implementations from exposing a 32-bit timer.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    UNRESOLVED.
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ciRevision History
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Rev  Date        Author    Changes
1435bd8deadSopenharmony_ci    ---  ----------  --------  ---------------------------------------------
1445bd8deadSopenharmony_ci      1  03/09/2015  tlottes   Initial revision based on AMD_gcn_shader
1455bd8deadSopenharmony_ci      2  04/20/2015  tlottes   Now uint64, noted code motion barrier.
1465bd8deadSopenharmony_ci      3  04/22/2015  gsellers  Add clock2x32ARB. Add interaction with gpu_shader_64.
1475bd8deadSopenharmony_ci      4  06/17/2015  gsellers  General tidyment. Add issue 2.
1485bd8deadSopenharmony_ci      5  10/28/2019  dgkoch    Add mapping to SPIR-V section.
149