15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_bindless_texture
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_bindless_texture
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
125bd8deadSopenharmony_ci    Pat Brown, NVIDIA Coproration (pbrown 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Graham Sellers, AMD
175bd8deadSopenharmony_ci    Pierre Boudier, AMD
185bd8deadSopenharmony_ci    Daniel Koch, NVIDIA
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright (c) 2013 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 3, 2013.
385bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on July 19, 2013.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciVersion
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Last Modified Date:   February 13, 2017
435bd8deadSopenharmony_ci    Author Revision:      5
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciNumber
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    ARB Extension #152
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciDependencies
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.0 (Compatibility Profile)
525bd8deadSopenharmony_ci    and OpenGL Shading Language 4.00 Specifications.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    OpenGL 4.0 or later versions is required.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    This extension interacts with OpenGL 4.0 (Core Profile).
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    This extension interacts with OpenGL 3.3 and ARB_sampler_objects.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    This extension interacts with OpenGL 4.2, ARB_shader_image_load_store, and
615bd8deadSopenharmony_ci    EXT_shader_image_load_store.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension interacts with NV_vertex_attrib_integer_64bit.
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci    This extension interacts with NV_gpu_shader5.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    This extension interacts with EXT_direct_state_access.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    This extension interacts with ARB_seamless_cube_map and
705bd8deadSopenharmony_ci    AMD_seamless_cubemap_per_texture.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    This extension interacts with NV_gpu_program4, NV_gpu_program5, and
735bd8deadSopenharmony_ci    EXT_shader_image_load_store.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    This extension interacts with GLSL 4.20.
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    This extension interacts with NV_bindless_texture.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ciOverview
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    This extension allows OpenGL applications to access texture objects in
835bd8deadSopenharmony_ci    shaders without first binding each texture to one of a limited number of
845bd8deadSopenharmony_ci    texture image units.  Using this extension, an application can query a
855bd8deadSopenharmony_ci    64-bit unsigned integer texture handle for each texture that it wants to
865bd8deadSopenharmony_ci    access and then use that handle directly in GLSL or assembly-based
875bd8deadSopenharmony_ci    shaders.  The ability to access textures without having to bind and/or
885bd8deadSopenharmony_ci    re-bind them is similar to the capability provided by the
895bd8deadSopenharmony_ci    NV_shader_buffer_load extension that allows shaders to access buffer
905bd8deadSopenharmony_ci    objects without binding them.  In both cases, these extensions
915bd8deadSopenharmony_ci    significantly reduce the amount of API and internal GL driver overhead
925bd8deadSopenharmony_ci    needed to manage resource bindings.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    This extension also provides similar capability for the image load, store,
955bd8deadSopenharmony_ci    and atomic functionality provided by OpenGL 4.2 and the
965bd8deadSopenharmony_ci    ARB_shader_image_load_store and EXT_shader_image_load_store extensions,
975bd8deadSopenharmony_ci    where a texture can be accessed without first binding it to an image unit.
985bd8deadSopenharmony_ci    An image handle can be extracted from a texture object using an API with a
995bd8deadSopenharmony_ci    set of parameters similar to those for BindImageTextureEXT.
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    This extension adds no new data types to GLSL.  Instead, it uses existing
1025bd8deadSopenharmony_ci    sampler and image data types and allows them to be populated with texture
1035bd8deadSopenharmony_ci    and image handles.  This extension does permit sampler and image data
1045bd8deadSopenharmony_ci    types to be used in more contexts than in unextended GLSL 4.00.  In
1055bd8deadSopenharmony_ci    particular, sampler and image types may be used as shader inputs/outputs,
1065bd8deadSopenharmony_ci    temporary variables, and uniform block members, and may be assigned to by
1075bd8deadSopenharmony_ci    shader code.  Constructors are provided to convert unsigned integer values
1085bd8deadSopenharmony_ci    to and from sampler and image data types.  Additionally, new APIs are
1095bd8deadSopenharmony_ci    provided to load values for sampler and image uniforms with 64-bit
1105bd8deadSopenharmony_ci    handle inputs.  The use of existing integer-based Uniform* APIs is still
1115bd8deadSopenharmony_ci    permitted, in which case the integer specified will identify a texture
1125bd8deadSopenharmony_ci    image or image unit.  For samplers and images with values specified as
1135bd8deadSopenharmony_ci    texture image or image units, the GL implemenation will translate the unit
1145bd8deadSopenharmony_ci    number to an internal handle as required.
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci    To access texture or image resources using handles, the handles must first
1175bd8deadSopenharmony_ci    be made resident.  Accessing a texture or image by handle without first
1185bd8deadSopenharmony_ci    making it resident can result in undefined results, including program
1195bd8deadSopenharmony_ci    termination.  Since the amount of texture memory required by an
1205bd8deadSopenharmony_ci    application may exceed the amount of memory available to the system, this
1215bd8deadSopenharmony_ci    extension provides API calls allowing applications to manage overall
1225bd8deadSopenharmony_ci    texture memory consumption by making a texture resident and non-resident
1235bd8deadSopenharmony_ci    as required.
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ciNew Procedures and Functions
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    uint64 GetTextureHandleARB(uint texture);
1295bd8deadSopenharmony_ci    uint64 GetTextureSamplerHandleARB(uint texture, uint sampler);
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    void MakeTextureHandleResidentARB(uint64 handle);
1325bd8deadSopenharmony_ci    void MakeTextureHandleNonResidentARB(uint64 handle);
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    uint64 GetImageHandleARB(uint texture, int level, boolean layered,
1355bd8deadSopenharmony_ci                             int layer, enum format);
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    void MakeImageHandleResidentARB(uint64 handle, enum access);
1385bd8deadSopenharmony_ci    void MakeImageHandleNonResidentARB(uint64 handle);
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    void UniformHandleui64ARB(int location, uint64 value);
1415bd8deadSopenharmony_ci    void UniformHandleui64vARB(int location, sizei count, const uint64 *value);
1425bd8deadSopenharmony_ci    void ProgramUniformHandleui64ARB(uint program, int location,
1435bd8deadSopenharmony_ci                                     uint64 value);
1445bd8deadSopenharmony_ci    void ProgramUniformHandleui64vARB(uint program, int location,
1455bd8deadSopenharmony_ci                                      sizei count, const uint64 *values);
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    boolean IsTextureHandleResidentARB(uint64 handle);
1485bd8deadSopenharmony_ci    boolean IsImageHandleResidentARB(uint64 handle);
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    // Inherited from NV_vertex_attrib_integer_64bit:
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    void VertexAttribL1ui64ARB(uint index, uint64EXT x);
1545bd8deadSopenharmony_ci    void VertexAttribL1ui64vARB(uint index, const uint64EXT *v);
1555bd8deadSopenharmony_ci    void GetVertexAttribLui64vARB(uint index, enum pname, uint64EXT *params);
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ciNew Tokens
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    // Inherited from NV_vertex_attrib_integer_64bit:
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Accepted by the <type> parameter of VertexAttribLPointer:
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci        UNSIGNED_INT64_ARB                              0x140F
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.0 (Compatibility Profile) Specification
1685bd8deadSopenharmony_ci(OpenGL Operation)
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    Modify Section 2.7, Vertex Specification, p. 30
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    Replace the paragraph from NV_vertex_attrib_integer_64bit describing the
1735bd8deadSopenharmony_ci    behavior of VertexAttribL*:
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    These commands specify one, two, three or four values.  Note that attribute
1765bd8deadSopenharmony_ci    variables declared with "double" types must be loaded with
1775bd8deadSopenharmony_ci    VertexAttribL*d{v}EXT; loading attributes with VertexAttrib*d{v} will
1785bd8deadSopenharmony_ci    produce undefined results. Similarly, attributes declared with 64-bit
1795bd8deadSopenharmony_ci    integer types, sampler types, or image types must be loaded with
1805bd8deadSopenharmony_ci    VertexAttribL*{i64,ui64}{v}.
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    ...
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    The full set of VertexAttrib* commands specify generic attributes with
1855bd8deadSopenharmony_ci    components one of eight data types:
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci      * floating-point values (VertexAttrib*),
1885bd8deadSopenharmony_ci      * signed or unsigned integers (VertexAttribI*),
1895bd8deadSopenharmony_ci      * double-precision floating-point values (VertexAttribL*d*), and
1905bd8deadSopenharmony_ci      * 64-bit signed or unsigned integers, images, or samplers
1915bd8deadSopenharmony_ci        (VertexAttribL*{i64,ui64}*).
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    Modify Section 2.14.3, Vertex Attributes, p. 94
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    Edit Table X.1 of NV_vertex_attrib_integer_64bit (Scalar and vector
1975bd8deadSopenharmony_ci    vertex attribute types and VertexAttrib* commands used to set the values
1985bd8deadSopenharmony_ci    of the corresponding generic attribute.). Change the line describing
1995bd8deadSopenharmony_ci    VertexAttribL1ui64NV to allow it for sampler and image types.
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci      Data type                         Command
2025bd8deadSopenharmony_ci      -------------------------------   ----------------------------------
2035bd8deadSopenharmony_ci      uint64_t                          VertexAttribL1ui64NV
2045bd8deadSopenharmony_ci      sampler* isampler* usampler*
2055bd8deadSopenharmony_ci      image*   iimage*   uimage*
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    Modify Section 2.14.4, Uniform Variables, p. 97
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    (Modify second paragraph, p. 98) ... uniform components, respectively.  A
2105bd8deadSopenharmony_ci    scalar or vector uniform with double-precision or 64-bit integer
2115bd8deadSopenharmony_ci    components will consume no more than 2n components, where n is 1 for
2125bd8deadSopenharmony_ci    scalars, and the component count for vectors.  A sampler or image uniform
2135bd8deadSopenharmony_ci    will consume no more than two components.  A link error is generated...
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    (Edit Table 2.15, "OpenGL Shading Language type tokens returned by
2175bd8deadSopenharmony_ci    GetActiveUniform and GetActiveUniformsiv...", pp. 104-106.  In particular,
2185bd8deadSopenharmony_ci    add dots to the "Attrib" and "Xfb" columns for all SAMPLER and IMAGE
2195bd8deadSopenharmony_ci    types.)
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    (Edit the subsection "Loading Uniform Variables In The Default Uniform
2235bd8deadSopenharmony_ci     Block", p. 108)
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    (Add the following commands to the list of uniform functions on p. 108.)
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci        void UniformHandleui64ARB(int location, uint64 value);
2285bd8deadSopenharmony_ci        void UniformHandleui64vARB(int location, sizei count,
2295bd8deadSopenharmony_ci                                   const uint64 *value);
2305bd8deadSopenharmony_ci        void ProgramUniformHandleui64ARB(uint program, int location,
2315bd8deadSopenharmony_ci                                         uint64 value);
2325bd8deadSopenharmony_ci        void ProgramUniformHandleui64vARB(uint program, int location,
2335bd8deadSopenharmony_ci                                          sizei count, const uint64 *values);
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    (Delete the sentence: "Only the Uniform1i{v} commands can be used to load
2365bd8deadSopenharmony_ci     sampler values (see below)." from p. 108.)
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    (Insert a new paragarph after the second paragraph, p. 109)
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    The UniformHandleui64{v}ARB commands will load <count> 64-bit unsigned
2415bd8deadSopenharmony_ci    integer handles into a uniform location corresponding to sampler or image
2425bd8deadSopenharmony_ci    variable types.  Only the UniformHandleui64{v}ARB and Uniform1i{v} commands
2435bd8deadSopenharmony_ci    can be used to load sampler and image values as described in Section
2445bd8deadSopenharmony_ci    2.14.6 (Samplers).
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if the UniformHandleui64{v}ARB
2475bd8deadSopenharmony_ci    commands are used on a sampler or image variable with the "bound_sampler"
2485bd8deadSopenharmony_ci    or "bound_image" layout qualifier (see the GLSL spec Section 4.4.6).
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    Edit Subsection "Uniform Buffer Object Storage", p. 110:
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    (Add rules for sampler and image types to the list at the beginning of
2545bd8deadSopenharmony_ci    p. 111.)
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ci      * Members of sampler types are extracted from a buffer object by
2575bd8deadSopenharmony_ci        reading a single 64-bit value at the specified offset.
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci      * Members of image types are extracted from a buffer object by reading
2605bd8deadSopenharmony_ci        a single 64-bit value at the specified offset.
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci    Modify Section 2.14.6, Samplers, p. 117
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci    (Replace the section with the following, adding the ability to use
2665bd8deadSopenharmony_ci    samplers in new places as well as describing the behavior of the new
2675bd8deadSopenharmony_ci    UniformHandleui64{v}ARB APIs.)
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    Samplers are special data types used by the OpenGL Shading Language to
2705bd8deadSopenharmony_ci    identify the texture object used for each texture lookup.  Sampler
2715bd8deadSopenharmony_ci    variables may be used as shader inputs and outputs, uniforms in the
2725bd8deadSopenharmony_ci    default block or in user-defined blocks, or as temporaries.
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    When used as uniforms in the default block, the value of sampler
2755bd8deadSopenharmony_ci    variables may be specified with either Uniform1i{v} or
2765bd8deadSopenharmony_ci    UniformHandleui64{v}ARB.  If a sampler uniform value is specified by
2775bd8deadSopenharmony_ci    Uniform1i{v}, the value passed to Uniform1i{v} indicates a texture image
2785bd8deadSopenharmony_ci    unit that will be accessed, and the value must be in the range from zero
2795bd8deadSopenharmony_ci    to the implementation-dependent maximum supported number of texture image
2805bd8deadSopenharmony_ci    units.  The error INVALID_VALUE is generated if a Uniform1i{v} call is
2815bd8deadSopenharmony_ci    used to set a sampler uniform to a value less than zero or greater than or
2825bd8deadSopenharmony_ci    equal to the value of MAX_TEXTURE_IMAGE_UNITS.  If a sampler uniform value
2835bd8deadSopenharmony_ci    is specified by UniformHandleui64{v}ARB, the value passed to
2845bd8deadSopenharmony_ci    UniformHandleui64{v}ARB directly specifies a texture object by handle, as
2855bd8deadSopenharmony_ci    defined in Section 3.9.X (Bindless Textures).  When a program is linked,
2865bd8deadSopenharmony_ci    all sampler uniforms are initialized to zero and considered to be
2875bd8deadSopenharmony_ci    references to texture image units.  When used as shader inputs, outputs,
2885bd8deadSopenharmony_ci    uniform block members, or temporaries, the value of the sampler is a 64-
2895bd8deadSopenharmony_ci    bit unsigned integer handle and never refers to a texture image unit.
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci    When the value of a sampler indicates a texture image unit, the type of
2925bd8deadSopenharmony_ci    the sampler identifies the target on the texture image unit.  The texture
2935bd8deadSopenharmony_ci    object bound to that texture image unit's target is used for any texture
2945bd8deadSopenharmony_ci    accesses using that sampler.  For example, a variable of type sampler2D
2955bd8deadSopenharmony_ci    selects the target TEXTURE_2D on its texture image unit.  Binding of
2965bd8deadSopenharmony_ci    texture objects to targets is done as usual with BindTexture. Selecting
2975bd8deadSopenharmony_ci    the texture image unit to bind to is done as usual with ActiveTexture.
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    When the value of a sampler indicates a texture handle, the target of the
3005bd8deadSopenharmony_ci    texture referred to by the handle must match the type of the sampler.  For
3015bd8deadSopenharmony_ci    example, a variable of type sampler2D must be used in conjunction with a
3025bd8deadSopenharmony_ci    handle of a texture of target TEXTURE_2D.  If the value of a sampler
3035bd8deadSopenharmony_ci    variable is not a valid texture handle or is not resident (section 3.9.X),
3045bd8deadSopenharmony_ci    the results of using that sampler during shader execution are undefined
3055bd8deadSopenharmony_ci    and may lead to program termination.  If the value of a sampler variable
3065bd8deadSopenharmony_ci    is a valid handle of a texture with a target different from the variable
3075bd8deadSopenharmony_ci    type, the results of using that handle are undefined but may not include
3085bd8deadSopenharmony_ci    program termination.
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ci    It is not allowed to have uniform variables of different sampler types
3115bd8deadSopenharmony_ci    pointing to the same texture image unit within a program object.  This
3125bd8deadSopenharmony_ci    situation can only be detected at the next rendering command issued, and
3135bd8deadSopenharmony_ci    an INVALID_OPERATION error will then be generated.  Sampler uniforms
3145bd8deadSopenharmony_ci    specified using handles do not count as using any texture image unit, even
3155bd8deadSopenharmony_ci    if a texture referred to by a handle is currently bound to one or more
3165bd8deadSopenharmony_ci    texture image units.
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci    Active samplers are those samplers actually being used in a program
3195bd8deadSopenharmony_ci    object.  When a program is linked by LinkProgram, the GL determines
3205bd8deadSopenharmony_ci    whether each sampler is active or not.  There is no limit on the number of
3215bd8deadSopenharmony_ci    active sampler variables that may be used by a program or by any
3225bd8deadSopenharmony_ci    particular shader.  However, restrictions on the use of texture image
3235bd8deadSopenharmony_ci    units imposes an effective limit on the number of non-handle sampler
3245bd8deadSopenharmony_ci    uniforms.  Active samplers used as shader inputs, shader outputs, or
3255bd8deadSopenharmony_ci    uniforms in the default uniform block are counted toward
3265bd8deadSopenharmony_ci    implementation-dependent limits on the total number of input, output, or
3275bd8deadSopenharmony_ci    uniform components supported by the program.  Each active sampler variable
3285bd8deadSopenharmony_ci    may count as two components against such limits.
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    Modify Section 2.14.X, Images, from EXT_shader_image_load_store
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci    (Replace the section with the following, adding the ability to use images
3345bd8deadSopenharmony_ci    in new places as well as describing the behavior of the new
3355bd8deadSopenharmony_ci    UniformHandleui64{v}ARB APIs.)
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci    Images are special data types used in the OpenGL Shading Language to
3385bd8deadSopenharmony_ci    identify a level of a texture to be read or written using image load,
3395bd8deadSopenharmony_ci    store, and atomic built-in functions in the manner described in Section
3405bd8deadSopenharmony_ci    3.9.X of the EXT_shader_image_load_store specification.  Image variables
3415bd8deadSopenharmony_ci    may be used as shader inputs and outputs, uniforms in the default block or
3425bd8deadSopenharmony_ci    in user-defined blocks, or as temporaries.
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci    When used as uniforms in the default block, the value of image variables
3455bd8deadSopenharmony_ci    may be specified with either Uniform1i{v} or UniformHandleui64{v}ARB.  If
3465bd8deadSopenharmony_ci    an image uniform value is specified by Uniform1i{v}, the value passed to
3475bd8deadSopenharmony_ci    Uniform1i{v} indicates an image unit that will be accessed, and the value
3485bd8deadSopenharmony_ci    must be in the range from zero to the implementation-dependent maximum
3495bd8deadSopenharmony_ci    supported number of image units.  The error INVALID_VALUE is generated if
3505bd8deadSopenharmony_ci    a Uniform1i{v} call is used to set an image uniform to a value less than
3515bd8deadSopenharmony_ci    zero or greater than or equal to the value of MAX_IMAGE_UNITS_EXT.  Note
3525bd8deadSopenharmony_ci    that image units used for image variables are independent from the texture
3535bd8deadSopenharmony_ci    image units used for sampler variables; the number of units provided by the
3545bd8deadSopenharmony_ci    implementation may differ.  Textures are bound independently and
3555bd8deadSopenharmony_ci    separately to image and texture image units.  If an image uniform value is
3565bd8deadSopenharmony_ci    specified by UniformHandleui64{v}ARB, the value provided directly specifies
3575bd8deadSopenharmony_ci    a texture object by handle, as defined in Section 3.9.X (Bindless
3585bd8deadSopenharmony_ci    Textures).  When a program is linked, all image uniforms are initialized
3595bd8deadSopenharmony_ci    to zero and considered to be references to image units.  When used as
3605bd8deadSopenharmony_ci    shader inputs, outputs, uniform block members, or temporaries, the value
3615bd8deadSopenharmony_ci    of an image variable is a 64-bit unsigned integer handle and never refers
3625bd8deadSopenharmony_ci    to an image unit.
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    The type of an image variable must match the texture target of the image
3655bd8deadSopenharmony_ci    currently bound to the image unit or referenced by the image handle.
3665bd8deadSopenharmony_ci    Otherwise, the results of load, store, or atomic operations using the
3675bd8deadSopenharmony_ci    image variable are undefined (see Section 4.1.X of the OpenGL Shading
3685bd8deadSopenharmony_ci    Language specification edits in EXT_shader_image_load_store for more
3695bd8deadSopenharmony_ci    detail) but may not include program termination.  Additionally, if the
3705bd8deadSopenharmony_ci    value of an image variable is not a valid image handle or is not resident
3715bd8deadSopenharmony_ci    (section 3.9.X), the results of using that image variable during shader
3725bd8deadSopenharmony_ci    execution are undefined and may lead to program termination.
3735bd8deadSopenharmony_ci
3745bd8deadSopenharmony_ci    Active image variables are those variables actually being used in a
3755bd8deadSopenharmony_ci    program object.  When a program is linked by LinkProgram, the GL
3765bd8deadSopenharmony_ci    determines whether each image variable is active or not.  There is no
3775bd8deadSopenharmony_ci    limit on the number of active image variables that may be used by a
3785bd8deadSopenharmony_ci    program or by any particular shader.  However, the limited number of image
3795bd8deadSopenharmony_ci    units imposes an effective limit on the number of unique non-handle image
3805bd8deadSopenharmony_ci    variables.  Active image variables used as shader inputs, shader outputs,
3815bd8deadSopenharmony_ci    or uniforms in the default uniform block are counted toward
3825bd8deadSopenharmony_ci    implementation-dependent limits on the total number of input, output, or
3835bd8deadSopenharmony_ci    uniform components supported by the program.  Each active image variable
3845bd8deadSopenharmony_ci    may count as two components against such limits.
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    Modify Section 2.14.7, Varying Variables, p. 118
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    (modify first paragraph, p. 119) ... Each component of variables declared
3905bd8deadSopenharmony_ci    as double-precision floating-point scalars, vectors, or matrices, as
3915bd8deadSopenharmony_ci    64-bit integer scalars or vectors, or as samplers or images may be counted
3925bd8deadSopenharmony_ci    as consuming two components.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    (replace second paragraph, p. 121) For the purposes of counting the total
3955bd8deadSopenharmony_ci    number of components to capture, each component of outputs declared as
3965bd8deadSopenharmony_ci    double-precision floating-point scalars, vectors, or matrices, as 64-bit
3975bd8deadSopenharmony_ci    integer scalars or vectors, or as samplers or images may be counted as
3985bd8deadSopenharmony_ci    consuming two components.
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    Modify Section 2.14.8, Shader Execution, p. 122
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    (modify second paragraph, p. 126) ... against the
4045bd8deadSopenharmony_ci    MAX_COMBINED_TEXTURE_IMAGE_UNITS limit.  Samplers accessed using texture
4055bd8deadSopenharmony_ci    handles (section 3.9.X) are not counted against this limit.
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    (modify last paragraph of "Texture Access", p. 127) Using a sampler in a
4085bd8deadSopenharmony_ci    shader will return (R,G,B,A) = (0,0,0,1) if the sampler's associated
4095bd8deadSopenharmony_ci    texture is not complete, as defined in section 3.9.14.  Textures referred
4105bd8deadSopenharmony_ci    to by valid texture handles (section 3.9.X) will always be complete.
4115bd8deadSopenharmony_ci
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.0 Specification (Rasterization)
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    Insert new section after Section 3.9.2, Sampler Objects, p. 257
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    Section 3.9.X, Bindless Textures
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci    The previous sections describe mechanisms to make texture and sampler
4205bd8deadSopenharmony_ci    objects available to shaders or fixed-function fragment processing by
4215bd8deadSopenharmony_ci    binding the objects to texture image units.  Additionally, texture objects
4225bd8deadSopenharmony_ci    may be accessed by shader using texture handles, which are 64-bit unsigned
4235bd8deadSopenharmony_ci    integers identifying the state of a texture and/or sampler object.  The
4245bd8deadSopenharmony_ci    handle zero is reserved and will never be assigned to a valid texture
4255bd8deadSopenharmony_ci    handle.  To obtain a texture handle, use the commands:
4265bd8deadSopenharmony_ci
4275bd8deadSopenharmony_ci      uint64 GetTextureHandleARB(uint texture);
4285bd8deadSopenharmony_ci      uint64 GetTextureSamplerHandleARB(uint texture, uint sampler);
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    GetTextureHandleARB will create a texture handle using the current state of
4315bd8deadSopenharmony_ci    the texture named <texture>, including any embedded sampler state.
4325bd8deadSopenharmony_ci    GetTextureSamplerHandleARB will create a texture handle using the current
4335bd8deadSopenharmony_ci    non-sampler state from the texture named <texture> and the sampler state
4345bd8deadSopenharmony_ci    from the sampler object <sampler>.  In both cases, a 64-bit unsigned
4355bd8deadSopenharmony_ci    integer handle is returned.  The error INVALID_VALUE is generated if
4365bd8deadSopenharmony_ci    <texture> is zero or is not the name of an existing texture object or if
4375bd8deadSopenharmony_ci    <sampler> is zero or is not the name of an existing sampler object.  The
4385bd8deadSopenharmony_ci    error INVALID_OPERATION is generated if the texture object <texture> is
4395bd8deadSopenharmony_ci    not complete (section 3.9.14).  If an error occurs, a handle of zero is
4405bd8deadSopenharmony_ci    returned.
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if the border color (taken from
4435bd8deadSopenharmony_ci    the embedded sampler for GetTextureHandleARB or from the <sampler> for
4445bd8deadSopenharmony_ci    GetTextureSamplerHandleARB) is not one of the following allowed values. If
4455bd8deadSopenharmony_ci    the texture's base internal format is signed or unsigned integer, allowed
4465bd8deadSopenharmony_ci    values are (0,0,0,0), (0,0,0,1), (1,1,1,0), and (1,1,1,1). If the base
4475bd8deadSopenharmony_ci    internal format is not integer, allowed values are (0.0,0.0,0.0,0.0),
4485bd8deadSopenharmony_ci    (0.0,0.0,0.0,1.0), (1.0,1.0,1.0,0.0), and (1.0,1.0,1.0,1.0).
4495bd8deadSopenharmony_ci
4505bd8deadSopenharmony_ci    The handle for each texture or texture/sampler pair is unique; the same
4515bd8deadSopenharmony_ci    handle will be returned if GetTextureHandleARB is called multiple times
4525bd8deadSopenharmony_ci    for the same texture or if GetTextureSamplerHandleARB is called multiple
4535bd8deadSopenharmony_ci    times for the same texture/sampler pair.
4545bd8deadSopenharmony_ci
4555bd8deadSopenharmony_ci    When a texture object is referenced by one or more texture handles, the
4565bd8deadSopenharmony_ci    texture parameters of the object (Section 3.9.8) may not be changed, and
4575bd8deadSopenharmony_ci    the size and format of the images in the texture object (Section 3.9.3)
4585bd8deadSopenharmony_ci    may not be re-specified.  The error INVALID_OPERATION is generated if the
4595bd8deadSopenharmony_ci    functions TexImage*, CopyTexImage*, CompressedTexImage*, TexBuffer*, or
4605bd8deadSopenharmony_ci    TexParameter* are called to modify a texture object referenced by one or
4615bd8deadSopenharmony_ci    more texture handles.  The contents of the images in a texture object may
4625bd8deadSopenharmony_ci    still be updated via commands such as TexSubImage*, CopyTexSubImage*, and
4635bd8deadSopenharmony_ci    CompressedTexSubImage*, and by rendering to a framebuffer object, even if
4645bd8deadSopenharmony_ci    the texture object is referenced by one or more texture handles.
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by BufferData if it is called to
4675bd8deadSopenharmony_ci    modify a buffer object bound to a buffer texture while that texture object
4685bd8deadSopenharmony_ci    is referenced by one or more texture handles.  The contents of the buffer
4695bd8deadSopenharmony_ci    object may still be updated via buffer update commands such as
4705bd8deadSopenharmony_ci    BufferSubData and MapBuffer*, or via the texture update commands, even if
4715bd8deadSopenharmony_ci    the buffer is bound to a texture while that buffer texture object is
4725bd8deadSopenharmony_ci    referenced by one or more texture handles.
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    When a sampler object is referenced by one or more texture handles, the
4755bd8deadSopenharmony_ci    sampler parameters of the object may not be changed.  The error
4765bd8deadSopenharmony_ci    INVALID_OPERATION is generated when calling SamplerParameter* functions to
4775bd8deadSopenharmony_ci    modify a sampler object referenced by one or more texture handles.
4785bd8deadSopenharmony_ci
4795bd8deadSopenharmony_ci    To make a texture handle accessible to shaders for texture mapping
4805bd8deadSopenharmony_ci    operations, a texture handle must first be made resident by calling:
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci        void MakeTextureHandleResidentARB(uint64 handle);
4835bd8deadSopenharmony_ci
4845bd8deadSopenharmony_ci    While the texture handle is resident, it may be used in texture mapping
4855bd8deadSopenharmony_ci    operations.  If a shader attempts to perform a texture mapping operation
4865bd8deadSopenharmony_ci    using a handle that is not resident, the results of that operation are
4875bd8deadSopenharmony_ci    undefined and may lead to application termination.  When a texture handle
4885bd8deadSopenharmony_ci    is resident, the texture it references is also considered resident for the
4895bd8deadSopenharmony_ci    purposes of the AreTexturesResident command.  The error INVALID_OPERATION
4905bd8deadSopenharmony_ci    is generated if <handle> is not a valid texture handle, or if <handle> is
4915bd8deadSopenharmony_ci    already resident in the current GL context.
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci    A texture handle may be made inaccessible to shaders by calling:
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci        void MakeTextureHandleNonResidentARB(uint64 handle);
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if <handle> is not a valid
4985bd8deadSopenharmony_ci    texture handle, or if <handle> is not resident in the current GL context.
4995bd8deadSopenharmony_ci
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci    Modify Section 3.9.10, Cube Map Texture Selection, p. 291
5025bd8deadSopenharmony_ci
5035bd8deadSopenharmony_ci    (insert new paragraph before last paragraph of section, p. 293)
5045bd8deadSopenharmony_ci
5055bd8deadSopenharmony_ci    When accessing cube map textures using texture handles, the seamless cube
5065bd8deadSopenharmony_ci    map enable is ignored and treated as disabled.
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci
5095bd8deadSopenharmony_ci    Modify Section 3.9.11, Texture Minification, p. 293
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    [[Compatibility profile-only]]
5125bd8deadSopenharmony_ci    (modify last paragraph, p. 293) ... <bias_texunit> is zero for textures
5135bd8deadSopenharmony_ci    referred to by handle, and is otherwise the value of TEXTURE_LOD_BIAS for
5145bd8deadSopenharmony_ci    the current texture unit (as described in section 3.9.16). ...
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci    Add to Section 3.9.X (Texture Image Loads and Stores) of
5185bd8deadSopenharmony_ci    EXT_shader_image_load_store:
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci    While texture levels may be made available to shaders by binding them to
5215bd8deadSopenharmony_ci    image units using BindImageTextureEXT, they may also be accessed using
5225bd8deadSopenharmony_ci    image handles.  Image handles are 64-bit integers that identify a level of
5235bd8deadSopenharmony_ci    a texture object, layer information for array and cube map textures, and
5245bd8deadSopenharmony_ci    an associated image format.  The handle zero is reserved and will never be
5255bd8deadSopenharmony_ci    assigned to a valid image handle.  The command
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ci        uint64 GetImageHandleARB(uint texture, int level, boolean layered,
5285bd8deadSopenharmony_ci                                 int layer, enum format);
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci    creates and returns an image handle for level <level> of the texture
5315bd8deadSopenharmony_ci    named <texture>. If <layered> is TRUE, a handle is created for the
5325bd8deadSopenharmony_ci    entire texture level. If <layered> is FALSE, a handle is created for
5335bd8deadSopenharmony_ci    only the layer <layer> of the texture level. <format> specifies a
5345bd8deadSopenharmony_ci    format used to interpret the texels of the image when used for image
5355bd8deadSopenharmony_ci    loads, stores, and atomics, and has the same meaning as the <format>
5365bd8deadSopenharmony_ci    parameter of BindImageTextureEXT(). A 64-bit unsigned integer handle
5375bd8deadSopenharmony_ci    is returned if the command succeeds; otherwise, zero is returned.
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by GetImageHandleARB if:
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci      * <texture> is zero or not the name of an existing texture object;
5425bd8deadSopenharmony_ci
5435bd8deadSopenharmony_ci      * the image for the texture level <level> doesn't exist (i.e., has a
5445bd8deadSopenharmony_ci        size of zero in <texture>); or
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ci      * <layered> is FALSE and <layer> is greater than or equal to
5475bd8deadSopenharmony_ci        the number of layers in the image at level <level>.
5485bd8deadSopenharmony_ci
5495bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by GetImageHandleARB if:
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci      * the texture object <texture> is not complete (section 3.9.14);
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci      * <layered> is TRUE and the texture is not a three-dimensional,
5545bd8deadSopenharmony_ci        one-dimensional array, two dimensional array, cube map, or cube map
5555bd8deadSopenharmony_ci        array texture.
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci    When a texture object is referenced by one or more image handles, the
5585bd8deadSopenharmony_ci    texture parameters of the object (Section 3.9.8) may not be changed, and
5595bd8deadSopenharmony_ci    the size and format of the images in the texture object (Section 3.9.3)
5605bd8deadSopenharmony_ci    may not be re-specified.  The error INVALID_OPERATION is generated when
5615bd8deadSopenharmony_ci    calling TexImage*, CopyTexImage*, CompressedTexImage*, TexBuffer*, or
5625bd8deadSopenharmony_ci    TexParameter* functions while a texture object is referenced by one or
5635bd8deadSopenharmony_ci    more image handles.  The contents of the images in a texture object may
5645bd8deadSopenharmony_ci    still be updated via commands such as TexSubImage*, CopyTexSubImage*, and
5655bd8deadSopenharmony_ci    CompressedTexSubImage*, and by rendering to a framebuffer object, even if
5665bd8deadSopenharmony_ci    the texture object is referenced by one or more image handles.
5675bd8deadSopenharmony_ci
5685bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by BufferData if it is called to
5695bd8deadSopenharmony_ci    modify a buffer object bound to a buffer texture while that texture object
5705bd8deadSopenharmony_ci    is referenced by one or more image handles.  The contents of the buffer
5715bd8deadSopenharmony_ci    object may still be updated via buffer update commands such as
5725bd8deadSopenharmony_ci    BufferSubData and MapBuffer*, or via the texture update commands, even if
5735bd8deadSopenharmony_ci    the buffer is bound to a texture while that buffer texture object is
5745bd8deadSopenharmony_ci    referenced by one or more image handles.
5755bd8deadSopenharmony_ci
5765bd8deadSopenharmony_ci    The handle returned for each combination of <texture>, <level>, <layered>,
5775bd8deadSopenharmony_ci    <layer>, and <format> is unique; the same handle will be returned if
5785bd8deadSopenharmony_ci    GetImageHandleARB is called multiple times with the same parameters.
5795bd8deadSopenharmony_ci
5805bd8deadSopenharmony_ci    To make an image handle accessible to shaders for image loads, stores, and
5815bd8deadSopenharmony_ci    atomic operations, the handle must be made resident by calling:
5825bd8deadSopenharmony_ci
5835bd8deadSopenharmony_ci        void MakeImageHandleResidentARB(uint64 handle, enum access);
5845bd8deadSopenharmony_ci
5855bd8deadSopenharmony_ci    <access> specifies whether the texture bound to the image handle will be
5865bd8deadSopenharmony_ci    treated as READ_ONLY, WRITE_ONLY, or READ_WRITE.  If a shader reads from
5875bd8deadSopenharmony_ci    an image handle made resident as WRITE_ONLY, or writes to an image handle
5885bd8deadSopenharmony_ci    made resident as READ_ONLY, the results of that shader operation are
5895bd8deadSopenharmony_ci    undefined and may lead to application termination.  The error
5905bd8deadSopenharmony_ci    INVALID_OPERATION is generated if <handle> is not a valid image handle, or
5915bd8deadSopenharmony_ci    if <handle> is already resident in the current GL context.
5925bd8deadSopenharmony_ci
5935bd8deadSopenharmony_ci    While the image handle is resident, it may be used in image load, store,
5945bd8deadSopenharmony_ci    and atomic operations.  If a shader attempts to perform an image operation
5955bd8deadSopenharmony_ci    using a handle that is not resident, the results of that operation are
5965bd8deadSopenharmony_ci    undefined and may lead to application termination.  When an image handle
5975bd8deadSopenharmony_ci    is resident, the texture it references is not necessarily considered
5985bd8deadSopenharmony_ci    resident for the purposes of the AreTexturesResident command.
5995bd8deadSopenharmony_ci
6005bd8deadSopenharmony_ci    An image handle may be made inaccessible to shaders by calling:
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci        void MakeImageHandleNonResidentARB(uint64 handle);
6035bd8deadSopenharmony_ci
6045bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if <handle> is not a valid image
6055bd8deadSopenharmony_ci    handle, or if <handle> is not resident in the current GL context.
6065bd8deadSopenharmony_ci
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ci    Modify Section 3.12.2, Shader Execution, p. 323
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci    (replace second-to-last paragraph of "Texture Access", p. 324) Using a
6115bd8deadSopenharmony_ci    sampler in a shader will return (R,G,B,A) = (0,0,0,1) if the sampler's
6125bd8deadSopenharmony_ci    associated texture is not complete, as defined in section 3.9.14.
6135bd8deadSopenharmony_ci    Textures referred to by valid texture handles will always be complete.
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.0 Specification (Special Functions)
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    Modify Section 5.5.1, Commands Not Usable In Display Lists, p. 413
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci    (add a new category to the list on pp. 413-414)
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci    Handle residency management:  MakeTextureHandleResidentARB,
6235bd8deadSopenharmony_ci    MakeTextureHandleNonResidentARB, MakeImageHandleResidentARB,
6245bd8deadSopenharmony_ci    MakeImageHandleNonResidentARB.
6255bd8deadSopenharmony_ci
6265bd8deadSopenharmony_ci    (note:  GetTextureHandleARB, GetTextureSamplerHandleARB, GetImageHandleARB,
6275bd8deadSopenharmony_ci    IsTextureHandleResidentARB, and IsImageHandleResidentARB are also
6285bd8deadSopenharmony_ci    non-listable, but are covered by the blanket rules for Get* and Is*
6295bd8deadSopenharmony_ci    commands in "Other queries")
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.0 Specification (Queries)
6335bd8deadSopenharmony_ci
6345bd8deadSopenharmony_ci    Modify Section 6.1.4, Texture Queries, p. 427
6355bd8deadSopenharmony_ci
6365bd8deadSopenharmony_ci    (add to the end of the section)  The commands:
6375bd8deadSopenharmony_ci
6385bd8deadSopenharmony_ci      boolean IsTextureHandleResidentARB(uint64 handle);
6395bd8deadSopenharmony_ci      boolean IsImageHandleResidentARB(uint64 handle);
6405bd8deadSopenharmony_ci
6415bd8deadSopenharmony_ci    return TRUE if the specified texture or image handle is resident in the
6425bd8deadSopenharmony_ci    current context.  The error INVALID_OPERATION will be generated by
6435bd8deadSopenharmony_ci    IsTextureHandleResidentARB or IsImageHandleResidentARB if <handle> is not
6445bd8deadSopenharmony_ci    a valid texture or image handle, respectively.  In the case of an error,
6455bd8deadSopenharmony_ci    FALSE is returned.
6465bd8deadSopenharmony_ci
6475bd8deadSopenharmony_ci
6485bd8deadSopenharmony_ciAdditions to Appendix D of the OpenGL 4.0 Specification (Shared Objects and
6495bd8deadSopenharmony_ciMultiple Contexts)
6505bd8deadSopenharmony_ci
6515bd8deadSopenharmony_ci    Modify Section D.1.2, Deleted Object and Object Name Lifetimes
6525bd8deadSopenharmony_ci
6535bd8deadSopenharmony_ci    (modify first paragraph, p. 534) ... A buffer, texture, sampler, or
6545bd8deadSopenharmony_ci    renderbuffer object is in use while it is attached to any container object
6555bd8deadSopenharmony_ci    or bound to a context bind point in any context.  A texture or sampler
6565bd8deadSopenharmony_ci    object is also in use if any texture or image handle referencing the
6575bd8deadSopenharmony_ci    object is resident for any context.  Texture and image handles are not
6585bd8deadSopenharmony_ci    deleted until either the underlying texture or sampler object used to
6595bd8deadSopenharmony_ci    create the handle are deleted.  A sync object ...
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    Modify/replace Section D.X of NV_shader_buffer_load
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci    Object Use by GPU Address or Handle
6645bd8deadSopenharmony_ci
6655bd8deadSopenharmony_ci    The GPU address of a buffer object is valid in all contexts in the share
6665bd8deadSopenharmony_ci    group that the buffer belongs to.  Similarly, texture and image handles
6675bd8deadSopenharmony_ci    extracted from texture and/or sampler objects are also valid in all
6685bd8deadSopenharmony_ci    contexts in the share group.  Buffers, texture handles, and image handles
6695bd8deadSopenharmony_ci    must be made resident separately in each context referencing them by GPU
6705bd8deadSopenharmony_ci    address or handle to allow the GL to determine which resources may be used
6715bd8deadSopenharmony_ci    in each command stream.  If a GPU address or handle is used by a given
6725bd8deadSopenharmony_ci    context where the buffer or handle has not been made resident in that
6735bd8deadSopenharmony_ci    context, undefined results including program termination may occur.  Such
6745bd8deadSopenharmony_ci    undefined results may occur even if the buffer or handle in question has
6755bd8deadSopenharmony_ci    been made resident for other contexts belonging to the context's share
6765bd8deadSopenharmony_ci    group.
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci
6795bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 4.00
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
6825bd8deadSopenharmony_ci    language features described in this extension:
6835bd8deadSopenharmony_ci
6845bd8deadSopenharmony_ci      #extension GL_ARB_bindless_texture : <behavior>
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3.
6875bd8deadSopenharmony_ci
6885bd8deadSopenharmony_ci    New preprocessor #defines are added to the OpenGL Shading Language:
6895bd8deadSopenharmony_ci
6905bd8deadSopenharmony_ci      #define GL_ARB_bindless_texture         1
6915bd8deadSopenharmony_ci
6925bd8deadSopenharmony_ci
6935bd8deadSopenharmony_ci    Replace Section 4.1.7 (Samplers), p. 25
6945bd8deadSopenharmony_ci
6955bd8deadSopenharmony_ci    Sampler types (e.g., sampler2D) are effectively opaque handles to texture
6965bd8deadSopenharmony_ci    and sampler objects.  They are used with the built-in texture functions
6975bd8deadSopenharmony_ci    (described in section 8.9 "Texture Lookup Functions") to specify which
6985bd8deadSopenharmony_ci    texture to access and how it is to be filtered.  Samplers are represented
6995bd8deadSopenharmony_ci    using 64-bit integer handles, and may be converted to and from 64-bit
7005bd8deadSopenharmony_ci    integers using constructors.  Samplers may not be implicitly converted to
7015bd8deadSopenharmony_ci    and from 64-bit integers, and may not be used in arithmetic expressions.
7025bd8deadSopenharmony_ci    Samplers may be declared as shader inputs and outputs, as uniform
7035bd8deadSopenharmony_ci    variables, as temporary variables, and as function parameters.  Samplers
7045bd8deadSopenharmony_ci    aggregated into arrays within a shader (using square brackets []) can be
7055bd8deadSopenharmony_ci    indexed with arbitrary integer expressions.  Samplers can be used as
7065bd8deadSopenharmony_ci    l-values, so can be assigned into and used as "out" and "inout" function
7075bd8deadSopenharmony_ci    parameters.  As function parameters, samplers may be only passed to
7085bd8deadSopenharmony_ci    samplers of matching type.  As uniforms in the default uniform block,
7095bd8deadSopenharmony_ci    samplers may be initialized only with the OpenGL API; they cannot be
7105bd8deadSopenharmony_ci    declared with an initializer in a shader.
7115bd8deadSopenharmony_ci
7125bd8deadSopenharmony_ci    The OpenGL API allows default block sampler uniforms to be assigned values
7135bd8deadSopenharmony_ci    referencing either a texture image unit number or a texture handle,
7145bd8deadSopenharmony_ci    depending on the API function used.  All other sampler variables must be
7155bd8deadSopenharmony_ci    assigned a texture handle.  When a sampler uniform is assigned to a
7165bd8deadSopenharmony_ci    texture image unit, texture functions using it will reference the texture
7175bd8deadSopenharmony_ci    bound to the corresponding target of the selected texture image unit.
7185bd8deadSopenharmony_ci    When a texture function uses a sampler variable assigned to a texture
7195bd8deadSopenharmony_ci    handle, the value of the handle must be a valid handle returned by the
7205bd8deadSopenharmony_ci    OpenGL API (Section 3.9.X, Bindless Textures) that has been made resident,
7215bd8deadSopenharmony_ci    and that texture must have a target matching the sampler variable type.
7225bd8deadSopenharmony_ci    Using a sampler whose the texture target does not match that sampler type
7235bd8deadSopenharmony_ci    produces undefined results but not program termination.  Using a sampler
7245bd8deadSopenharmony_ci    that is not a texture image unit reference and is not a valid and resident
7255bd8deadSopenharmony_ci    texture handle produces undefined results including possible program
7265bd8deadSopenharmony_ci    termination.
7275bd8deadSopenharmony_ci
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    Replace Section 4.1.X, (Images)
7305bd8deadSopenharmony_ci
7315bd8deadSopenharmony_ci    Like samplers, images are effectively handles to one-, two-, or three-
7325bd8deadSopenharmony_ci    dimensional images corresponding to all or a portion of a single level of
7335bd8deadSopenharmony_ci    a texture image.  Images are represented using 64-bit integer handles, and
7345bd8deadSopenharmony_ci    may be converted to and from 64-bit integers using constructors.  Samplers
7355bd8deadSopenharmony_ci    may not be implicitly converted to and from 64-bit integers, and may not
7365bd8deadSopenharmony_ci    be used in arithmetic expressions.  There are distinct image variable
7375bd8deadSopenharmony_ci    types for each texture target, and for each of float, integer, and
7385bd8deadSopenharmony_ci    unsigned integer data types.  Image accesses should use an image type that
7395bd8deadSopenharmony_ci    matches the target of the texture whose level is being accessed, or for
7405bd8deadSopenharmony_ci    non-layered bindings of 3D or array images should use the image type that
7415bd8deadSopenharmony_ci    matches the dimensionality of the layer of the image (i.e. a layer of 3D,
7425bd8deadSopenharmony_ci    2DArray, Cube, or CubeArray should use image2D, a layer of 1DArray should
7435bd8deadSopenharmony_ci    use image1D, and a layer of 2DMSArray should use image2DMS). If the image
7445bd8deadSopenharmony_ci    target type does not match the image being accessed in this manner, if the
7455bd8deadSopenharmony_ci    data type does not match the bound image, or if the "size" layout
7465bd8deadSopenharmony_ci    qualifier does not match the image format as described in Section 3.9.X of
7475bd8deadSopenharmony_ci    the OpenGL Specification, the results of image accesses are undefined but
7485bd8deadSopenharmony_ci    may not include program termination.
7495bd8deadSopenharmony_ci
7505bd8deadSopenharmony_ci    Image variables are used in the image load, store, and atomic functions
7515bd8deadSopenharmony_ci    described in Section 8.X, "Image Functions" to specify an image to access.
7525bd8deadSopenharmony_ci    Images may be declared as shader inputs and outputs, as uniform variables,
7535bd8deadSopenharmony_ci    as temporary variables, and as function parameters.  Images may be
7545bd8deadSopenharmony_ci    aggregated into arrays within a shader (using square brackets []) and can
7555bd8deadSopenharmony_ci    be indexed with general integer expressions.  Images can be used as
7565bd8deadSopenharmony_ci    l-values, so can be assigned into and used as "out" and "inout" function
7575bd8deadSopenharmony_ci    parameters.  As uniforms in the default uniform block, images may be
7585bd8deadSopenharmony_ci    initialized only with the OpenGL API; they cannot be declared with an
7595bd8deadSopenharmony_ci    initializer in a shader.  As function parameters, images may be only
7605bd8deadSopenharmony_ci    passed to images of matching type.
7615bd8deadSopenharmony_ci
7625bd8deadSopenharmony_ci    The OpenGL API allows default block image uniforms to be assigned to
7635bd8deadSopenharmony_ci    reference either an image unit number or an image handle, depending on the
7645bd8deadSopenharmony_ci    API function used.  All other image variables must be assigned an image
7655bd8deadSopenharmony_ci    handle.  When an image uniform is assigned to an image unit, image
7665bd8deadSopenharmony_ci    functions using it will reference the texture and image state
7675bd8deadSopenharmony_ci    corresponding to the selected image unit.  When an image function uses a
7685bd8deadSopenharmony_ci    variable assigned to an image handle, the value of the handle must be a
7695bd8deadSopenharmony_ci    valid handle returned by the OpenGL API (Section 3.9.X of
7705bd8deadSopenharmony_ci    EXT_shader_image_load_store, Texture Image Loads and Stores, as modified
7715bd8deadSopenharmony_ci    by this extension) that has been made resident, and that contains image
7725bd8deadSopenharmony_ci    data compatible with the variable type as described above.  Using an image
7735bd8deadSopenharmony_ci    variable that is not an image unit reference and is not a valid and
7745bd8deadSopenharmony_ci    resident image handle produces undefined results including possible
7755bd8deadSopenharmony_ci    program termination.
7765bd8deadSopenharmony_ci
7775bd8deadSopenharmony_ci
7785bd8deadSopenharmony_ci    Modify Section 4.3.4, Inputs, p. 34
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    (modify third paragraph of the section to allow sampler and image types)
7815bd8deadSopenharmony_ci    ...  Vertex shader inputs can only be float, single-precision
7825bd8deadSopenharmony_ci    floating-point scalars, single-precision floating-point vectors, matrices,
7835bd8deadSopenharmony_ci    signed and unsigned integers and integer vectors, sampler and image types.
7845bd8deadSopenharmony_ci
7855bd8deadSopenharmony_ci    (modify last paragraph, p. 35, allowing samplers and images as fragment
7865bd8deadSopenharmony_ci    shader inputs) ... Fragment inputs can only be signed and unsigned
7875bd8deadSopenharmony_ci    integers and integer vectors, floating point scalars, floating-point
7885bd8deadSopenharmony_ci    vectors, matrices, sampler and image types, or arrays or structures of
7895bd8deadSopenharmony_ci    these.  Fragment shader inputs that are signed or unsigned integers,
7905bd8deadSopenharmony_ci    integer vectors, or any double-precision floating- point type, or any
7915bd8deadSopenharmony_ci    sampler or image type must be qualified with the interpolation qualifier
7925bd8deadSopenharmony_ci    "flat".
7935bd8deadSopenharmony_ci
7945bd8deadSopenharmony_ci
7955bd8deadSopenharmony_ci    Modify Section 4.3.6, Outputs, p. 36
7965bd8deadSopenharmony_ci
7975bd8deadSopenharmony_ci    (modify second paragraph, p. 37, to allow sampler and image outputs)
7985bd8deadSopenharmony_ci    ... Output variables can only be floating-point scalars, floating-point
7995bd8deadSopenharmony_ci    vectors, matrices, signed or unsigned integers or integer vectors, sampler
8005bd8deadSopenharmony_ci    or image types, or arrays or structures of any these.
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci    (do not modify the last paragraph, p. 38; samplers and images are not
8035bd8deadSopenharmony_ci    allowed as fragment shader outputs)
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci
8065bd8deadSopenharmony_ci    Modify Section 4.3.7, Interface Blocks, p. 38
8075bd8deadSopenharmony_ci
8085bd8deadSopenharmony_ci    (remove the following bullet from the last list on p. 39, thereby
8095bd8deadSopenharmony_ci    permitting sampler types in interface blocks; image types are also
8105bd8deadSopenharmony_ci    permitted in blocks by this extension)
8115bd8deadSopenharmony_ci
8125bd8deadSopenharmony_ci      * sampler types are not allowed
8135bd8deadSopenharmony_ci
8145bd8deadSopenharmony_ci
8155bd8deadSopenharmony_ci    Modify Section 4.4.6 Opaque-Uniform Layout Qualifiers of the GLSL 4.30 spec
8165bd8deadSopenharmony_ci
8175bd8deadSopenharmony_ci    Image and sampler types accept a uniform layout qualifier identifier
8185bd8deadSopenharmony_ci    controlling whether the uniform may be used with a bindless handle:
8195bd8deadSopenharmony_ci
8205bd8deadSopenharmony_ci    layout-qualifier-id
8215bd8deadSopenharmony_ci        bindless_sampler
8225bd8deadSopenharmony_ci        bindless_image
8235bd8deadSopenharmony_ci        bound_sampler
8245bd8deadSopenharmony_ci        bound_image
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ci    These modifiers control whether default-block uniforms of the
8275bd8deadSopenharmony_ci    corresponding types may have their values set via both UniformHandle* and
8285bd8deadSopenharmony_ci    Uniform1i (bindless_sampler and bindless_image) or only via Uniform1i
8295bd8deadSopenharmony_ci    (bound_sampler and bound_image). These layouts may be specified at global
8305bd8deadSopenharmony_ci    scope to control the default behavior of uniforms of the corresponding
8315bd8deadSopenharmony_ci    types, e.g.
8325bd8deadSopenharmony_ci
8335bd8deadSopenharmony_ci        layout (bindless_sampler) uniform;
8345bd8deadSopenharmony_ci
8355bd8deadSopenharmony_ci    They may also be specified on a uniform variable declaration of a
8365bd8deadSopenharmony_ci    corresponding type, e.g.
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci        layout (bindless_sampler) uniform sampler2D mySampler;
8395bd8deadSopenharmony_ci
8405bd8deadSopenharmony_ci    If both bindless_sampler and bound_sampler, or bindless_image and
8415bd8deadSopenharmony_ci    bound_image, are declared at global scope in any compilation unit, a link-
8425bd8deadSopenharmony_ci    time error will be generated. If these layout qualifiers are applied to
8435bd8deadSopenharmony_ci    other types of default block uniforms, or variables with non-uniform
8445bd8deadSopenharmony_ci    storage, a compile-time error will be generated. In the absence of these
8455bd8deadSopenharmony_ci    qualifiers, sampler and image uniforms are considered "bound".
8465bd8deadSopenharmony_ci    Additionally, if GL_ARB_bindless_texture is not enabled, these uniforms are
8475bd8deadSopenharmony_ci    considered "bound".
8485bd8deadSopenharmony_ci
8495bd8deadSopenharmony_ci    Modify Section 5.4.1, Conversion and Scalar Constructors, p. 60
8505bd8deadSopenharmony_ci
8515bd8deadSopenharmony_ci    (add the following constructors:)
8525bd8deadSopenharmony_ci
8535bd8deadSopenharmony_ci      // In the following four constructors, the low 32 bits of the sampler
8545bd8deadSopenharmony_ci      // type correspond to the .x component of the uvec2 and the high 32 bits
8555bd8deadSopenharmony_ci      // correspond to the .y component.
8565bd8deadSopenharmony_ci      uvec2(any sampler type)     // Converts a sampler type to a
8575bd8deadSopenharmony_ci                                  //   pair of 32-bit unsigned integers
8585bd8deadSopenharmony_ci      any sampler type(uvec2)     // Converts a pair of 32-bit unsigned integers to
8595bd8deadSopenharmony_ci                                  //   a sampler type
8605bd8deadSopenharmony_ci      uvec2(any image type)       // Converts an image type to a
8615bd8deadSopenharmony_ci                                  //   pair of 32-bit unsigned integers
8625bd8deadSopenharmony_ci      any image type(uvec2)       // Converts a pair of 32-bit unsigned integers to
8635bd8deadSopenharmony_ci                                  //   an image type
8645bd8deadSopenharmony_ci
8655bd8deadSopenharmony_ci
8665bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    None
8695bd8deadSopenharmony_ci
8705bd8deadSopenharmony_ciInteractions with OpenGL 4.0 (Core Profile)
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ci    If the core profile of OpenGL 4.0 (or any version since 3.0) is supported,
8735bd8deadSopenharmony_ci    references to fixed-function fragment processing and display lists should
8745bd8deadSopenharmony_ci    be removed.  References to the TEXTURE_LOD_BIAS for the current texture
8755bd8deadSopenharmony_ci    unit should also be removed.
8765bd8deadSopenharmony_ci
8775bd8deadSopenharmony_ciInteractions with OpenGL 3.3 and ARB_sampler_objects
8785bd8deadSopenharmony_ci
8795bd8deadSopenharmony_ci    If neither OpenGL 3.3 nor ARB_sampler_objects is supported, the portion of
8805bd8deadSopenharmony_ci    this extension referring to the sampler object type introduced in OpenGL
8815bd8deadSopenharmony_ci    3.3 should be removed.  In particular, the GetTextureSamplerHandleARB API
8825bd8deadSopenharmony_ci    will not be supported.
8835bd8deadSopenharmony_ci
8845bd8deadSopenharmony_ciInteractions with OpenGL 4.2, ARB_shader_image_load_store, and
8855bd8deadSopenharmony_ciEXT_shader_image_load_store
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci    If OpenGL 4.2, ARB_shader_image_load_store, and
8885bd8deadSopenharmony_ci    EXT_shader_image_load_store are not supported, the portion of this
8895bd8deadSopenharmony_ci    extension supporting image handles and image loads, stores, and atomics
8905bd8deadSopenharmony_ci    should be removed.  In particular, the functions GetImageHandleARB,
8915bd8deadSopenharmony_ci    MakeImageHandleResidentARB, MakeImageHandleNonResidentARB should be removed.
8925bd8deadSopenharmony_ci
8935bd8deadSopenharmony_ci    Portions of this extension have been written against the
8945bd8deadSopenharmony_ci    EXT_shader_image_load_store, since OpenGL 4.2 and the ARB extension did
8955bd8deadSopenharmony_ci    not exist when the specification was first written.  Similar edits would
8965bd8deadSopenharmony_ci    apply to the OpenGL 4.2 and ARB_shader_image_load_store specifications.
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ciInteractions with NV_vertex_attrib_integer_64bit
8995bd8deadSopenharmony_ci
9005bd8deadSopenharmony_ci    If NV_vertex_attrib_integer_64bit is not supported, this extension inherits
9015bd8deadSopenharmony_ci    the {Get}VertexAttribL1ui64{v}ARB entry points and UNSIGNED_INT64_ARB enum, as
9025bd8deadSopenharmony_ci    well as the functional edits describing them. However, references to the
9035bd8deadSopenharmony_ci    uint64_t type in the shader and providing 64-bit unsigned integer data to
9045bd8deadSopenharmony_ci    the shader are removed.
9055bd8deadSopenharmony_ci
9065bd8deadSopenharmony_ciInteractions with NV_gpu_shader5
9075bd8deadSopenharmony_ci
9085bd8deadSopenharmony_ci    If NV_gpu_shader5 is not supported, edits to Section 4.1.7 of the GLSL
9095bd8deadSopenharmony_ci    Specification describing sampler indexing should be changed to read
9105bd8deadSopenharmony_ci    "Sampler values passed into texture built-in functions must be dynamically
9115bd8deadSopenharmony_ci    uniform, otherwise results are undefined." Make a similar edit for images.
9125bd8deadSopenharmony_ci    This is the language found in unextended OpenGL 4.0, modified not to be
9135bd8deadSopenharmony_ci    specific to uniform arrays; NV_gpu_shader5 extends it to allow non-uniform
9145bd8deadSopenharmony_ci    samplers and images.
9155bd8deadSopenharmony_ci
9165bd8deadSopenharmony_ciInteractions with EXT_direct_state_access
9175bd8deadSopenharmony_ci
9185bd8deadSopenharmony_ci    In this extension, INVALID_OPERATION is generated when calling various
9195bd8deadSopenharmony_ci    functions to modify the state of a texture object from which handles have
9205bd8deadSopenharmony_ci    been extracted.  If EXT_direct_state_access is suported, this error
9215bd8deadSopenharmony_ci    behavior is further extended to cover similar functions provided by
9225bd8deadSopenharmony_ci    EXT_direct_state access.  In particular, this error will be generated by:
9235bd8deadSopenharmony_ci    TextureImage*EXT, CopyTextureImage*EXT, CompressedTextureImage*EXT,
9245bd8deadSopenharmony_ci    TextureBufferEXT, TextureParameterEXT, MultiTexImage*EXT,
9255bd8deadSopenharmony_ci    CopyMultiTexImage*EXT, CompressedMultiTexImage*EXT, MultiTexBufferEXT, and
9265bd8deadSopenharmony_ci    MultiTexParameter*EXT.
9275bd8deadSopenharmony_ci
9285bd8deadSopenharmony_ciInteractions with ARB_seamless_cubemap and AMD_seamless_cubemap_per_texture
9295bd8deadSopenharmony_ci
9305bd8deadSopenharmony_ci    If ARB_seamless_cubemap (or OpenGL 4.0, which includes it) is supported,
9315bd8deadSopenharmony_ci    the per-context seamless cubemap enable is ignored and treated as disabled
9325bd8deadSopenharmony_ci    when using texture handles.
9335bd8deadSopenharmony_ci
9345bd8deadSopenharmony_ci    If AMD_seamless_cubemap_per_texture is supported, the seamless cube map
9355bd8deadSopenharmony_ci    texture parameter of the underlying texture does apply when texture
9365bd8deadSopenharmony_ci    handles are used.
9375bd8deadSopenharmony_ci
9385bd8deadSopenharmony_ciInteractions with NV_gpu_program4, NV_gpu_program5, and
9395bd8deadSopenharmony_ciEXT_shader_image_load_store
9405bd8deadSopenharmony_ci
9415bd8deadSopenharmony_ci    If NV_gpu_program5 is supported, the following edits are made to the
9425bd8deadSopenharmony_ci    NV_gpu_program4, NV_gpu_program5, and EXT_shader_image_load_store
9435bd8deadSopenharmony_ci    specifications:
9445bd8deadSopenharmony_ci
9455bd8deadSopenharmony_ci    Modify Section 2.X.2, Program Grammar of NV_gpu_program5
9465bd8deadSopenharmony_ci
9475bd8deadSopenharmony_ci    (add new grammar rules allowing textures to be referred to by handles,
9485bd8deadSopenharmony_ci    e.g., "TEX result, coords, handle(texHandle.x), 2D")
9495bd8deadSopenharmony_ci
9505bd8deadSopenharmony_ci    <textureUseV>           ::= "handle" "(" <addrUseS> ")"
9515bd8deadSopenharmony_ci
9525bd8deadSopenharmony_ci    <imageUnit>             ::= "handle" "(" <addrUseS> ")"
9535bd8deadSopenharmony_ci
9545bd8deadSopenharmony_ci
9555bd8deadSopenharmony_ci    Modify Section 2.X.4.4, Program Texture Access, of NV_gpu_program4
9565bd8deadSopenharmony_ci
9575bd8deadSopenharmony_ci    (modify the paragraph beginning with "The texture used by TextureSample"
9585bd8deadSopenharmony_ci    to permit the use of handles) The texture used by TextureSample() is
9595bd8deadSopenharmony_ci    identified according to the <textureUseV> grammar rule.  If <textureUseV>
9605bd8deadSopenharmony_ci    expands to the grammar rule containing "handle", the texture used is
9615bd8deadSopenharmony_ci    identified by taking the scalar value specified in that rule as a texture
9625bd8deadSopenharmony_ci    handle.  Otherwise, the texture corresponding to the texture image unit
9635bd8deadSopenharmony_ci    specified by <textureUseV> is used.  The texture target...
9645bd8deadSopenharmony_ci
9655bd8deadSopenharmony_ci    If the instruction uses a named texture variable, the <nvTexImageUnit>
9665bd8deadSopenharmony_ci    grammar rule, or the "texture" grammar rule, then the texture used by
9675bd8deadSopenharmony_ci    TextureSample() is one of the textures bound to the texture image unit
9685bd8deadSopenharmony_ci    whose number is specified in the instruction according to the
9695bd8deadSopenharmony_ci    <texImageUnit> grammar rule, and the texture target accessed is specified
9705bd8deadSopenharmony_ci    according to the <texTarget> grammar rule and Table X.17. If the
9715bd8deadSopenharmony_ci    instruction uses the "handle" grammar rule, then the specified texture
9725bd8deadSopenharmony_ci    handle will select which texture is used, and the target of that texture
9735bd8deadSopenharmony_ci    must match the target specified by the <texTarget> grammar rule or else
9745bd8deadSopenharmony_ci    the result is undefined. Fixed-function texture enables are always ignored
9755bd8deadSopenharmony_ci    when determining which texture to access in a program.
9765bd8deadSopenharmony_ci
9775bd8deadSopenharmony_ci
9785bd8deadSopenharmony_ci    Section 2.X.5.Y, Program Options
9795bd8deadSopenharmony_ci
9805bd8deadSopenharmony_ci    If a program (in any shader stage) specifies the option
9815bd8deadSopenharmony_ci    "ARB_bindless_texture", the grammar edits described in section 2.X.2
9825bd8deadSopenharmony_ci    will apply.
9835bd8deadSopenharmony_ci
9845bd8deadSopenharmony_ci
9855bd8deadSopenharmony_ci    Modify Section 2.X.8.Z, LOADIM: Image Load, of EXT_shader_image_load_store
9865bd8deadSopenharmony_ci
9875bd8deadSopenharmony_ci    (modify the first paragraph) The LOADIM instruction ... from the texture
9885bd8deadSopenharmony_ci    specified by <imageUnit>.  If <imageUnit> expands to the grammar rule
9895bd8deadSopenharmony_ci    containing "handle", the texture used is identified by taking the scalar
9905bd8deadSopenharmony_ci    value specified in that rule as an image handle.  Otherwise, the texture
9915bd8deadSopenharmony_ci    corresponding to the image unit specified by <imageUnit> is used.
9925bd8deadSopenharmony_ci    Unformatted loads read...
9935bd8deadSopenharmony_ci
9945bd8deadSopenharmony_ci    Modify Section 2.X.8.Z, STOREIM: Image Store, of
9955bd8deadSopenharmony_ci    EXT_shader_image_load_store
9965bd8deadSopenharmony_ci
9975bd8deadSopenharmony_ci    (modify the first paragraph) The STOREIM instruction ... to the texture
9985bd8deadSopenharmony_ci    specified by <imageUnit> using the data specified in the first vector
9995bd8deadSopenharmony_ci    operand.  If <imageUnit> expands to the grammar rule containing "handle",
10005bd8deadSopenharmony_ci    the texture used is identified by taking the scalar value specified in
10015bd8deadSopenharmony_ci    that rule as an image handle.  Otherwise, the texture corresponding to the
10025bd8deadSopenharmony_ci    image unit specified by <imageUnit> is used.  The store is performed in
10035bd8deadSopenharmony_ci    the manner described in Section 3.9.X.
10045bd8deadSopenharmony_ci
10055bd8deadSopenharmony_ci
10065bd8deadSopenharmony_ci    Modify Section 2.X.8.Z, ATOMIM:  Image Atomic Memory Operation, of
10075bd8deadSopenharmony_ci    EXT_shader_image_load_store
10085bd8deadSopenharmony_ci
10095bd8deadSopenharmony_ci    (modify the first paragraph) The ATOMIM instruction takes ...image load
10105bd8deadSopenharmony_ci    from the texture specified by <imageUnit>, performs ... returns the loaded
10115bd8deadSopenharmony_ci    value in the vector result.  If <imageUnit> expands to the grammar rule
10125bd8deadSopenharmony_ci    containing "handle", the texture used is identified by taking the scalar
10135bd8deadSopenharmony_ci    value specified in that rule as an image handle.  Otherwise, the texture
10145bd8deadSopenharmony_ci    corresponding to the image unit specified by <imageUnit> is used.  The
10155bd8deadSopenharmony_ci    atomic operation is performed in the manner described in Section 3.9.X.
10165bd8deadSopenharmony_ci
10175bd8deadSopenharmony_ciInteractions with GLSL 4.20
10185bd8deadSopenharmony_ci
10195bd8deadSopenharmony_ci    Without GLSL 4.20 support, sampler and image uniforms may only be
10205bd8deadSopenharmony_ci    initialized through the OpenGL API. With GLSL 4.20, sampler and image
10215bd8deadSopenharmony_ci    uniforms may be initialized in the shader using
10225bd8deadSopenharmony_ci
10235bd8deadSopenharmony_ci        layout(binding = integer-constant)
10245bd8deadSopenharmony_ci
10255bd8deadSopenharmony_ci    as described in section 4.4.4 "Opaque-Uniform Layout Qualifiers". When
10265bd8deadSopenharmony_ci    ARB_bindless_texture is supported, these initial binding values are always
10275bd8deadSopenharmony_ci    taken to mean a texture image or image unit number, not a bindless handle.
10285bd8deadSopenharmony_ci
10295bd8deadSopenharmony_ciInteractions with NV_bindless_texture
10305bd8deadSopenharmony_ci
10315bd8deadSopenharmony_ci    If both extensions are supported, handles generated by *ARB functions may
10325bd8deadSopenharmony_ci    be used with *NV entry points and vice versa.  GetTexture*HandleARB can not
10335bd8deadSopenharmony_ci    be used to create handles for textures/samplers with arbitrary border
10345bd8deadSopenharmony_ci    colors.  However, if NV_bindless_texture is supported, handles created by
10355bd8deadSopenharmony_ci    GetTexture*HandleNV can be used with this extension as though no border
10365bd8deadSopenharmony_ci    color restriction existed.
10375bd8deadSopenharmony_ci
10385bd8deadSopenharmony_ciErrors
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by GetTextureHandleARB or
10415bd8deadSopenharmony_ci    GetTextureSamplerHandleARB if <texture> is zero or not the name of an
10425bd8deadSopenharmony_ci    existing texture object.
10435bd8deadSopenharmony_ci
10445bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by GetTextureSamplerHandleARB if
10455bd8deadSopenharmony_ci    <sampler> is zero or is not the name of an existing sampler object.
10465bd8deadSopenharmony_ci
10475bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by GetTextureHandleARB or
10485bd8deadSopenharmony_ci    GetTextureSamplerHandleARB if thetexture object specified by <texture> is
10495bd8deadSopenharmony_ci    not complete.
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
10525bd8deadSopenharmony_ci    CompressedTexImage*, TexBuffer*, TexParameter*, as well as other functions
10535bd8deadSopenharmony_ci    defined in terms of these, if the texture object to be modified is
10545bd8deadSopenharmony_ci    referenced by one or more texture or image handles.
10555bd8deadSopenharmony_ci
10565bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by BufferData, or any function
10575bd8deadSopenharmony_ci    defined in terms of this, if the buffer object to be modified is bound
10585bd8deadSopenharmony_ci    to a buffer texture that is referenced by one or more texture or image
10595bd8deadSopenharmony_ci    handles.
10605bd8deadSopenharmony_ci
10615bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by SamplerParameter* if <sampler>
10625bd8deadSopenharmony_ci    identifies a sampler object referenced by one or more texture handles.
10635bd8deadSopenharmony_ci
10645bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by MakeTextureHandleResidentARB if
10655bd8deadSopenharmony_ci    <handle> is not a valid texture handle, or if <handle> is already resident
10665bd8deadSopenharmony_ci    in the current GL context.
10675bd8deadSopenharmony_ci
10685bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by MakeTextureHandleNonResidentARB
10695bd8deadSopenharmony_ci    if <handle> is not a valid texture handle, or if <handle> is not resident
10705bd8deadSopenharmony_ci    in the current GL context.
10715bd8deadSopenharmony_ci
10725bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by GetImageHandleARB if <texture> is
10735bd8deadSopenharmony_ci    zero or not the name of an existing texture object, if the image for
10745bd8deadSopenharmony_ci    <level> does not existing in <texture>, or if <layered> is FALSE and
10755bd8deadSopenharmony_ci    <layer> is greater than or equal to the number of layers in the image at
10765bd8deadSopenharmony_ci    <level>.
10775bd8deadSopenharmony_ci
10785bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by GetImageHandleARB if the
10795bd8deadSopenharmony_ci    texture object <texture> is not complete or if <layered> is TRUE and
10805bd8deadSopenharmony_ci    <texture> is not a three-dimensional, one-dimensional array, two
10815bd8deadSopenharmony_ci    dimensional array, cube map, or cube map array texture.
10825bd8deadSopenharmony_ci
10835bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by MakeImageHandleResidentARB if
10845bd8deadSopenharmony_ci    <handle> is not a valid image handle, or if <handle> is already resident
10855bd8deadSopenharmony_ci    in the current GL context.
10865bd8deadSopenharmony_ci
10875bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by MakeImageHandleNonResidentARB
10885bd8deadSopenharmony_ci    if <handle> is not a valid image handle, or if <handle> is not resident in
10895bd8deadSopenharmony_ci    the current GL context.
10905bd8deadSopenharmony_ci
10915bd8deadSopenharmony_ci    The error INVALID_OPERATION will be generated by IsTextureHandleResidentARB
10925bd8deadSopenharmony_ci    and IsImageHandleResidentARB if <handle> is not a valid texture or image
10935bd8deadSopenharmony_ci    handle, respectively.
10945bd8deadSopenharmony_ci
10955bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated by UniformHandleui64{v}ARB if the
10965bd8deadSopenharmony_ci    sampler or image uniform being updated has the "bound_sampler" or
10975bd8deadSopenharmony_ci    "bound_image" layout qualifier.
10985bd8deadSopenharmony_ci
10995bd8deadSopenharmony_ci
11005bd8deadSopenharmony_ciExamples
11015bd8deadSopenharmony_ci
11025bd8deadSopenharmony_ci    To loop through a collection of 256 textures in the OpenGL API using a
11035bd8deadSopenharmony_ci    conventional GLSL shader and without calling glBindTexture, one might do:
11045bd8deadSopenharmony_ci
11055bd8deadSopenharmony_ci      #define NUM_TEXTURES      256
11065bd8deadSopenharmony_ci      GLuint   textures[NUM_TEXTURES];
11075bd8deadSopenharmony_ci      GLuint64 texHandles[NUM_TEXTURES];
11085bd8deadSopenharmony_ci
11095bd8deadSopenharmony_ci      // Initialize the texture objects and handles.
11105bd8deadSopenharmony_ci      glGenTextures(NUM_TEXTURES, textures);
11115bd8deadSopenharmony_ci      for (int i = 0; i < NUM_TEXTURES; i++) {
11125bd8deadSopenharmony_ci
11135bd8deadSopenharmony_ci        // Initialize the texture images with glTexImage/glTexStorage.
11145bd8deadSopenharmony_ci        // Initialize the texture parameters as required.
11155bd8deadSopenharmony_ci
11165bd8deadSopenharmony_ci        // Get a handle for the texture.
11175bd8deadSopenharmony_ci        texHandles[i] = glGetTextureHandleARB(textures[i]);
11185bd8deadSopenharmony_ci
11195bd8deadSopenharmony_ci        // At this point, it's no longer possible to resize/reallocate
11205bd8deadSopenharmony_ci        // texture images or modify texture parameters for "textures[i]".
11215bd8deadSopenharmony_ci        // However, it's still possible to update texture data via
11225bd8deadSopenharmony_ci        // glTexSubImage.
11235bd8deadSopenharmony_ci
11245bd8deadSopenharmony_ci        // Make the handle resident before using it.
11255bd8deadSopenharmony_ci        glMakeTextureHandleResidentARB(texHandles[i]);
11265bd8deadSopenharmony_ci      }
11275bd8deadSopenharmony_ci
11285bd8deadSopenharmony_ci      // Compile GLSL shader using sampler uniform <u>.  The shader itself
11295bd8deadSopenharmony_ci      // needs no special #extension directive as long as <u> is a uniform in
11305bd8deadSopenharmony_ci      // the default partition.  Link the program, and query the location of
11315bd8deadSopenharmony_ci      // <u>, which we will store in <location>.
11325bd8deadSopenharmony_ci
11335bd8deadSopenharmony_ci      // Render a little bit using each of the texture handles in turn.
11345bd8deadSopenharmony_ci      for (int i = 0; i < NUM_TEXTURES; i++) {
11355bd8deadSopenharmony_ci
11365bd8deadSopenharmony_ci        // Update the single sampler uniform <u> to point at "texHandles[i]".
11375bd8deadSopenharmony_ci        glUniformHandleui64ARB(location, texHandles[i]);
11385bd8deadSopenharmony_ci
11395bd8deadSopenharmony_ci        drawStuff();
11405bd8deadSopenharmony_ci      }
11415bd8deadSopenharmony_ci
11425bd8deadSopenharmony_ci      ...
11435bd8deadSopenharmony_ci
11445bd8deadSopenharmony_ci      // If the application doesn't need to use texHandles[10] for a while, it
11455bd8deadSopenharmony_ci      // can make it non-resident to reduce the overall memory footprint.
11465bd8deadSopenharmony_ci      glMakeTextureHandleNonResidentARB(texHandles[10]);
11475bd8deadSopenharmony_ci
11485bd8deadSopenharmony_ci      // After this point, the texture data associated with texHandles[10] is
11495bd8deadSopenharmony_ci      // not guaranteed to be resident, and using it in a draw call could
11505bd8deadSopenharmony_ci      // result in exceptions.  Use glMakeTextureHandleResidentARB() to make it
11515bd8deadSopenharmony_ci      // resident again before it's needed for rendering.
11525bd8deadSopenharmony_ci
11535bd8deadSopenharmony_ci    The GLSL portion of this extension removes the restriction that sampler
11545bd8deadSopenharmony_ci    variables must be uniforms in the default block.  You can store a large
11555bd8deadSopenharmony_ci    collection of samplers in a uniform block, pass them through the pipeline
11565bd8deadSopenharmony_ci    as 64-bit integers.
11575bd8deadSopenharmony_ci
11585bd8deadSopenharmony_ci    To use a "dictionary" of samplers in a uniform block, you could use a
11595bd8deadSopenharmony_ci    shader like:
11605bd8deadSopenharmony_ci
11615bd8deadSopenharmony_ci      #version 400
11625bd8deadSopenharmony_ci      #extension GL_ARB_bindless_texture : require
11635bd8deadSopenharmony_ci      #define NUM_TEXTURES 256
11645bd8deadSopenharmony_ci
11655bd8deadSopenharmony_ci      flat in int whichSampler;
11665bd8deadSopenharmony_ci      in vec2 texCoord;
11675bd8deadSopenharmony_ci      out vec4 finalColor;
11685bd8deadSopenharmony_ci
11695bd8deadSopenharmony_ci      uniform Samplers {
11705bd8deadSopenharmony_ci        sampler2D allTheSamplers[NUM_TEXTURES];
11715bd8deadSopenharmony_ci      };
11725bd8deadSopenharmony_ci
11735bd8deadSopenharmony_ci      void main()
11745bd8deadSopenharmony_ci      {
11755bd8deadSopenharmony_ci        finalColor = texture(allTheSamplers[whichSampler], texCoord);
11765bd8deadSopenharmony_ci      }
11775bd8deadSopenharmony_ci
11785bd8deadSopenharmony_ci    In the following example, the sampler to use is selected in a vertex
11795bd8deadSopenharmony_ci    shader, passed to the fragment shader as a (flat) input, and then used for
11805bd8deadSopenharmony_ci    a texture lookup.
11815bd8deadSopenharmony_ci
11825bd8deadSopenharmony_ci      #version 400
11835bd8deadSopenharmony_ci      #extension GL_ARB_bindless_texture : require
11845bd8deadSopenharmony_ci
11855bd8deadSopenharmony_ci      flat in sampler2D theSampler;
11865bd8deadSopenharmony_ci      in vec2 texCoord;
11875bd8deadSopenharmony_ci      out vec4 finalColor;
11885bd8deadSopenharmony_ci
11895bd8deadSopenharmony_ci      void main()
11905bd8deadSopenharmony_ci      {
11915bd8deadSopenharmony_ci        finalColor = texture(theSampler, texCoord);
11925bd8deadSopenharmony_ci      }
11935bd8deadSopenharmony_ci
11945bd8deadSopenharmony_ci
11955bd8deadSopenharmony_ciNew State
11965bd8deadSopenharmony_ci
11975bd8deadSopenharmony_ci    Add new table, Bindless Texture Handles
11985bd8deadSopenharmony_ci
11995bd8deadSopenharmony_ci                                               Initial
12005bd8deadSopenharmony_ci    Get Value    Type   Get Command             Value     Description                  Sec.  Attribute
12015bd8deadSopenharmony_ci    ------------ ----  --------------------    -------    -------------------------   ------  -------
12025bd8deadSopenharmony_ci    -            Z64   GetTextureHandleARB       n/a      texture handle              3.9.X      -
12035bd8deadSopenharmony_ci                        or GetTextureSampler-
12045bd8deadSopenharmony_ci                        HandleARB
12055bd8deadSopenharmony_ci    -            Z+           -                  n/a      texture object used         3.9.X      -
12065bd8deadSopenharmony_ci    -            Z+           -                  n/a      sampler object used         3.9.X      -
12075bd8deadSopenharmony_ci    -            nxB    IsTextureHandle-        FALSE     is bindless texture handle  3.9.X      -
12085bd8deadSopenharmony_ci                         ResidentARB                      resident for the current
12095bd8deadSopenharmony_ci                                                          context (separate state per
12105bd8deadSopenharmony_ci                                                          context/handle pair)
12115bd8deadSopenharmony_ci
12125bd8deadSopenharmony_ci    Add new table, Bindless Image Handles
12135bd8deadSopenharmony_ci
12145bd8deadSopenharmony_ci                                               Initial
12155bd8deadSopenharmony_ci    Get Value    Type   Get Command             Value     Description                  Sec.  Attribute
12165bd8deadSopenharmony_ci    ------------ ----  --------------------    -------    -------------------------   ------  -------
12175bd8deadSopenharmony_ci    -            Z64   GetImageHandleARB         n/a      image handle                3.9.X      -
12185bd8deadSopenharmony_ci    -            Z+           -                  n/a      texture object used         3.9.X      -
12195bd8deadSopenharmony_ci    -            Z+           -                  n/a      texture object level        3.9.X      -
12205bd8deadSopenharmony_ci    -            B            -                  n/a      is image handle layered?    3.9.X      -
12215bd8deadSopenharmony_ci    -            Z+           -                  n/a      selected layer for non-     3.9.X      -
12225bd8deadSopenharmony_ci                                                           layered images
12235bd8deadSopenharmony_ci    -            Z_<n>        -                  n/a      image internal format enum  3.9.X      -
12245bd8deadSopenharmony_ci    -            nxB   IsImageHandle-           FALSE     is bindless image handle    3.9.X      -
12255bd8deadSopenharmony_ci                         ResidentARB                       resident for the current
12265bd8deadSopenharmony_ci                                                           context (separate state
12275bd8deadSopenharmony_ci                                                           per context/handle pair)
12285bd8deadSopenharmony_ci
12295bd8deadSopenharmony_ciIssues
12305bd8deadSopenharmony_ci
12315bd8deadSopenharmony_ci    (1) Could this have been specified as simply making the maximum number of
12325bd8deadSopenharmony_ci        texture image units and image units arbitrarily large and then
12335bd8deadSopenharmony_ci        indexing into an array of samplers or images?
12345bd8deadSopenharmony_ci
12355bd8deadSopenharmony_ci      RESOLVED: Perhaps, but this approach doesn't involve any arbitrarily
12365bd8deadSopenharmony_ci      limits. Allowing the implementation to choose the GPU handle can avoid
12375bd8deadSopenharmony_ci      the need for some kind of unit->address translation. It's also
12385bd8deadSopenharmony_ci      beneficial for the GPU handles to be static.
12395bd8deadSopenharmony_ci
12405bd8deadSopenharmony_ci    (2) Should we add commands to allow prioritizing which allocations belong
12415bd8deadSopenharmony_ci        in dedicated video memory?
12425bd8deadSopenharmony_ci
12435bd8deadSopenharmony_ci      RESOLVED: Defer to a future extension.
12445bd8deadSopenharmony_ci
12455bd8deadSopenharmony_ci    (3) How should we handle separate samplers?
12465bd8deadSopenharmony_ci
12475bd8deadSopenharmony_ci      RESOLVED:  OpenGL 3.3 created separate sampler objects, and provided
12485bd8deadSopenharmony_ci      separate binding points in a texture image unit.  When referencing a
12495bd8deadSopenharmony_ci      texture image unit with a sampler object bound, the state of that object
12505bd8deadSopenharmony_ci      is used; otherwise, sampler state embedded in the texture is used.  In
12515bd8deadSopenharmony_ci      either case, each texture image unit consists of a texture/sampler pair,
12525bd8deadSopenharmony_ci      and no capability is provided to mix the texture from one unit with
12535bd8deadSopenharmony_ci      samplers from another.
12545bd8deadSopenharmony_ci
12555bd8deadSopenharmony_ci      This extension provides support for use of OpenGL 3.3-style sampler
12565bd8deadSopenharmony_ci      objects via the GetTextureSamplerHandleARB entry point, which can be used
12575bd8deadSopenharmony_ci      to create a handle for each pair of texture/sampler objects the
12585bd8deadSopenharmony_ci      application wishes to use.  GLSL samplers can be used with texture
12595bd8deadSopenharmony_ci      handles in the same way that they can be used with the texture/sampler
12605bd8deadSopenharmony_ci      object pair associated with a texture image unit.
12615bd8deadSopenharmony_ci
12625bd8deadSopenharmony_ci      It's possible that some future extension to OpenGL might allow shaders
12635bd8deadSopenharmony_ci      to mix and match texture and sampler objects within a shader instead of
12645bd8deadSopenharmony_ci      using pre-defined pairs.  Such shaders would use two different shader
12655bd8deadSopenharmony_ci      variable types -- one encapsulating texture object state and the other
12665bd8deadSopenharmony_ci      encapsulating sampler state.  To allow bindless texture support in this
12675bd8deadSopenharmony_ci      mode, we would expect to add a new handle type (sampler handles) and to
12685bd8deadSopenharmony_ci      provide new APIs to extract sampler handles from sampler objects and to
12695bd8deadSopenharmony_ci      manage sampler handle residency.  (It's not immediately clear whether it
12705bd8deadSopenharmony_ci      would even be necessary to manage sampler handle residency, since
12715bd8deadSopenharmony_ci      sampler objects only have a small number of state variables.)
12725bd8deadSopenharmony_ci
12735bd8deadSopenharmony_ci    (4) Can texture or sampler objects be modified while they are used by a
12745bd8deadSopenharmony_ci        texture or image handle?
12755bd8deadSopenharmony_ci
12765bd8deadSopenharmony_ci      RESOLVED:  No.  If such changes were permitted, each modification to the
12775bd8deadSopenharmony_ci      texture object would require potential synchronization with one or more
12785bd8deadSopenharmony_ci      texture/image handles extracted from the texture.  This seems like a lot
12795bd8deadSopenharmony_ci      of bookkeeping with little benefit.  One exception to this rule is that
12805bd8deadSopenharmony_ci      individual texels of such texture objects may still be updated with APIs
12815bd8deadSopenharmony_ci      such as TexSubImage* and by rendering to a framebuffer object to which
12825bd8deadSopenharmony_ci      the texture is attached.
12835bd8deadSopenharmony_ci
12845bd8deadSopenharmony_ci    (5) Is there a way to release a texture or image handle after it is
12855bd8deadSopenharmony_ci    created?
12865bd8deadSopenharmony_ci
12875bd8deadSopenharmony_ci      RESOLVED:  No API is provided to release or delete handles once they are
12885bd8deadSopenharmony_ci      created.  Texture and image handles are automatically reclaimed when the
12895bd8deadSopenharmony_ci      underlying texture or sampler objects are finally deleted.  This
12905bd8deadSopenharmony_ci      deletion will happen only when no handle using the texture or sampler
12915bd8deadSopenharmony_ci      object is resident on any context.  This decision is similar to that of
12925bd8deadSopenharmony_ci      NV_shader_buffer_load, which didn't provide any mechanism to release the
12935bd8deadSopenharmony_ci      address of a buffer object.
12945bd8deadSopenharmony_ci
12955bd8deadSopenharmony_ci      One consequence of this decision is that structural changes (e.g., image
12965bd8deadSopenharmony_ci      size and format and parameter changes) to textures from which handles
12975bd8deadSopenharmony_ci      are extracted are not possible for the lifetime of the texture.
12985bd8deadSopenharmony_ci
12995bd8deadSopenharmony_ci    (6) How do texture and image handles work with multiple contexts sharing a
13005bd8deadSopenharmony_ci        set of texture and sampler objects?
13015bd8deadSopenharmony_ci
13025bd8deadSopenharmony_ci      RESOLVED:  Texture and image handles are shared by all contexts in a
13035bd8deadSopenharmony_ci      share group, in the same way that GPU addresses are shared in
13045bd8deadSopenharmony_ci      NV_shader_buffer_load.  Once a handle has been extracted from a texture
13055bd8deadSopenharmony_ci      or texture/sampler pair in any context, that handle may be used by all
13065bd8deadSopenharmony_ci      other contexts in the share group.
13075bd8deadSopenharmony_ci
13085bd8deadSopenharmony_ci      However, texture and image handle residency is managed per-context.  If
13095bd8deadSopenharmony_ci      a texture or image handle is used in multiple contexts in a share group,
13105bd8deadSopenharmony_ci      the handle must be made resident in all such contexts.
13115bd8deadSopenharmony_ci
13125bd8deadSopenharmony_ci    (7) What happens if you try to delete a texture or sampler object with a
13135bd8deadSopenharmony_ci        handle that is resident in another context?
13145bd8deadSopenharmony_ci
13155bd8deadSopenharmony_ci      RESOLVED:  Deleting the texture will remove the texture from the name
13165bd8deadSopenharmony_ci      space and make all handles using the texture non-resident in the current
13175bd8deadSopenharmony_ci      context.  However, texture or image handles for a deleted texture are
13185bd8deadSopenharmony_ci      not deleted until the underlying texture or sampler object itself is
13195bd8deadSopenharmony_ci      deleted.  That deletion won't happen until the object is not bound
13205bd8deadSopenharmony_ci      anywhere and there are no handles using the object that are resident in
13215bd8deadSopenharmony_ci      any context.
13225bd8deadSopenharmony_ci
13235bd8deadSopenharmony_ci    (8) Can you get a handle from a default texture object (numbered zero)?
13245bd8deadSopenharmony_ci
13255bd8deadSopenharmony_ci      RESOLVED:  No, for several reasons.  First, the APIs to extract a
13265bd8deadSopenharmony_ci      texture handle only take a texture object number, with no target.  Since
13275bd8deadSopenharmony_ci      there is a separate default texture object for each texture target, the
13285bd8deadSopenharmony_ci      texture object number zero does not identify a unique texture.
13295bd8deadSopenharmony_ci      Additionally, since the spec forbids modification of textures used with
13305bd8deadSopenharmony_ci      handles, extracting a handle from a default texture would leave the
13315bd8deadSopenharmony_ci      texture in a state where it could be neither modified nor deleted.
13325bd8deadSopenharmony_ci
13335bd8deadSopenharmony_ci    (9) Can you have multiple handles for the same texture or texture/sampler
13345bd8deadSopenharmony_ci        pair?
13355bd8deadSopenharmony_ci
13365bd8deadSopenharmony_ci      RESOLVED:  Any texture object can have at most one handle extracted from
13375bd8deadSopenharmony_ci      the texture object via GetTextureHandleARB; calling that function
13385bd8deadSopenharmony_ci      multiple times on a single texture will always return the same handle.
13395bd8deadSopenharmony_ci
13405bd8deadSopenharmony_ci      A texture or sampler object may have multiple texture handles extracted
13415bd8deadSopenharmony_ci      from it via GetTextureSamplerHandleARB, since such handles correspond to
13425bd8deadSopenharmony_ci      a texture/sampler pair and a single texture or sampler object may be
13435bd8deadSopenharmony_ci      paired with multiple objects of the other type.  However, calling that
13445bd8deadSopenharmony_ci      function multiple times on a single texture/sampler pair will always
13455bd8deadSopenharmony_ci      return the same handle.
13465bd8deadSopenharmony_ci
13475bd8deadSopenharmony_ci      A texture object may have multiple image handles extracted from it via
13485bd8deadSopenharmony_ci      GetImageHandleARB; however, each such handle must represent a different
13495bd8deadSopenharmony_ci      "view" of the texture.  If that function is called multiple times with
13505bd8deadSopenharmony_ci      the same <texture>, <level>, <layered>, <layer>, and <format>
13515bd8deadSopenharmony_ci      parameters, the same handle will always be returned.
13525bd8deadSopenharmony_ci
13535bd8deadSopenharmony_ci    (10) Should we provide <access> parameters for MakeTextureHandleResidentARB
13545bd8deadSopenharmony_ci         and MakeImageHandleResidentARB?
13555bd8deadSopenharmony_ci
13565bd8deadSopenharmony_ci      RESOLVED:  For MakeImageHandleResidentARB, yes.  It may be useful to be
13575bd8deadSopenharmony_ci      able to make a given texture resident only for reading or writing.  For
13585bd8deadSopenharmony_ci      MakeTextureHandleResidentARB, no.  Texture mapping is a read-only
13595bd8deadSopenharmony_ci      operation; texture handles can really only be used for reading.  So all
13605bd8deadSopenharmony_ci      calls to MakeTextureHandleResidentARB are considered to use an access
13615bd8deadSopenharmony_ci      mode of READ_ONLY.
13625bd8deadSopenharmony_ci
13635bd8deadSopenharmony_ci    (11) Should implicit conversions be supported for converting uint64-typed
13645bd8deadSopenharmony_ci         handles to sampler and image types?
13655bd8deadSopenharmony_ci
13665bd8deadSopenharmony_ci      RESOLVED:  No.  An explicit constructor is provided to build a handle
13675bd8deadSopenharmony_ci      from uvec2 or vice versa.
13685bd8deadSopenharmony_ci
13695bd8deadSopenharmony_ci    (12) How do we handle backwards compatibility for sampler uniforms in the
13705bd8deadSopenharmony_ci         default uniform block, which have historically been set to point at a
13715bd8deadSopenharmony_ci         texture image unit?
13725bd8deadSopenharmony_ci
13735bd8deadSopenharmony_ci      RESOLVED:  We allow sampler uniforms to be set either using handles (via
13745bd8deadSopenharmony_ci      the UniformHandle* APIs) or texture image units (via the previously used
13755bd8deadSopenharmony_ci      Uniform1i* APIs).  If the uniform was last set with a handle, the
13765bd8deadSopenharmony_ci      specified handle will be used for texture access.  Otherwise, the value
13775bd8deadSopenharmony_ci      of the uniform is treated as a texture image unit when the texture is
13785bd8deadSopenharmony_ci      accessed, and is resolved to refer to the appropriate texture bound to
13795bd8deadSopenharmony_ci      that unit.
13805bd8deadSopenharmony_ci
13815bd8deadSopenharmony_ci      We expect that implementations will distinguish between the two types of
13825bd8deadSopenharmony_ci      uniform values either by a per-uniform flag or by reserving a subset of
13835bd8deadSopenharmony_ci      the 2^64 possible handle values to be used to refer to texture image
13845bd8deadSopenharmony_ci      units.
13855bd8deadSopenharmony_ci
13865bd8deadSopenharmony_ci      We impose no limit on the mixing and matching of texture image unit and
13875bd8deadSopenharmony_ci      handle-based uniform values; an application is permitted to set some
13885bd8deadSopenharmony_ci      uniforms via UniformHandle*ARB and others via Uniform1i.  We don't expect
13895bd8deadSopenharmony_ci      such mixing and matching to be common.
13905bd8deadSopenharmony_ci
13915bd8deadSopenharmony_ci      When a sampler or image uniform's value is queried via any of the
13925bd8deadSopenharmony_ci      GetUniform* commands, the returned value will reflect the most recently
13935bd8deadSopenharmony_ci      set value through either UniformHandle* or Uniform1i*, converted to the
13945bd8deadSopenharmony_ci      requested type.
13955bd8deadSopenharmony_ci
13965bd8deadSopenharmony_ci    (13) Should UniformHandleui64{v}ARB check the provided uniform value(s) to
13975bd8deadSopenharmony_ci         determine if they are valid handles?
13985bd8deadSopenharmony_ci
13995bd8deadSopenharmony_ci      RESOLVED:  No; passing in proper texture or image handles is the
14005bd8deadSopenharmony_ci      responsibility of the application.  Note that even if we did verify that
14015bd8deadSopenharmony_ci      handles were valid at the time sampler or image uniforms were specified,
14025bd8deadSopenharmony_ci      there is no guarantee that they would still be valid for texture or
14035bd8deadSopenharmony_ci      image accesses when they are used.  In particular, the texture referred
14045bd8deadSopenharmony_ci      to by the handle may have be deleted, or may exist without being made
14055bd8deadSopenharmony_ci      resident for the context in question.
14065bd8deadSopenharmony_ci
14075bd8deadSopenharmony_ci    (14) With this extension, GLSL sampler and image variables may be
14085bd8deadSopenharmony_ci         specified using 64-bit handles and are permitted to count as two
14095bd8deadSopenharmony_ci         components toward implementation-dependent limits on uniforms, shader
14105bd8deadSopenharmony_ci         inputs, and shader outputs.  Is there a backward compatibility
14115bd8deadSopenharmony_ci         problem here?
14125bd8deadSopenharmony_ci
14135bd8deadSopenharmony_ci      RESOLVED:  If there is one, we don't expect it to be very serious.
14145bd8deadSopenharmony_ci
14155bd8deadSopenharmony_ci      Prior to this extension, samplers or images could not be used as shader
14165bd8deadSopenharmony_ci      inputs or outputs, so there is no compatibility problem there.  Samplers
14175bd8deadSopenharmony_ci      and images could be used as uniforms, however.  While there is no
14185bd8deadSopenharmony_ci      explicit spec language describing the amount of storage required for
14195bd8deadSopenharmony_ci      samplers and images, one might construe this lack of language to mean
14205bd8deadSopenharmony_ci      that only a single component was previously required.  Allowing for
14215bd8deadSopenharmony_ci      64-bit handles in this extension could double the requirement and cause
14225bd8deadSopenharmony_ci      shaders that previously just barely fit to exceed implementation
14235bd8deadSopenharmony_ci      limits.
14245bd8deadSopenharmony_ci
14255bd8deadSopenharmony_ci      Implementations that consider this issue serious could increase their
14265bd8deadSopenharmony_ci      uniform limit slightly to compensate.  Note that the number of sampler
14275bd8deadSopenharmony_ci      variables used prior to this extension was quite limited, so the amount
14285bd8deadSopenharmony_ci      of extra storage required for 64-bit handles should be small.
14295bd8deadSopenharmony_ci
14305bd8deadSopenharmony_ci    (15) What happens if you try to access a texture or image handle that is
14315bd8deadSopenharmony_ci         (a) invalid, (b) non-resident, or (c) corresponds to a texture of a
14325bd8deadSopenharmony_ci         target different from the target used for the access (e.g., doing a
14335bd8deadSopenharmony_ci         3D lookup with a handle referring to a 2D texture)?
14345bd8deadSopenharmony_ci
14355bd8deadSopenharmony_ci      RESOLVED:  For (a), we specify undefined behavior including possible
14365bd8deadSopenharmony_ci      program termination.  Such accesses are effectively equivalent to
14375bd8deadSopenharmony_ci      chasing an invalid pointer.
14385bd8deadSopenharmony_ci
14395bd8deadSopenharmony_ci      For (b), we treat non-resident handles as invalid.  Note that this
14405bd8deadSopenharmony_ci      extension doesn't require that accesses to non-resident handles fail.
14415bd8deadSopenharmony_ci
14425bd8deadSopenharmony_ci      For (c), we specify that loads/stores to textures of the "wrong" type
14435bd8deadSopenharmony_ci      may have undefined results but should not result in program termination.
14445bd8deadSopenharmony_ci      This same situation could arise in EXT_shader_image_load_store, where
14455bd8deadSopenharmony_ci      each image unit has a single attachment point shared by all targets, and
14465bd8deadSopenharmony_ci      the same behavior was specified there.  Similar situations could also
14475bd8deadSopenharmony_ci      arise for indexed texture accesses in OpenGL 4.0, where out-of-bounds
14485bd8deadSopenharmony_ci      array indices could cause a shader to use a texture unit whose "active"
14495bd8deadSopenharmony_ci      target was the wrong kind.
14505bd8deadSopenharmony_ci
14515bd8deadSopenharmony_ci    (16) Prior to this extension, there were limits on the number of different
14525bd8deadSopenharmony_ci         textures that could be accessed at once -- the number of texture
14535bd8deadSopenharmony_ci         image units and image units were limited by implementation-dependent
14545bd8deadSopenharmony_ci         constants.  What limits apply with this extension?
14555bd8deadSopenharmony_ci
14565bd8deadSopenharmony_ci      RESOLVED:  Since texture image units and image units need not be used
14575bd8deadSopenharmony_ci      with this extension, those limits no longer apply to shaders that use
14585bd8deadSopenharmony_ci      bindless textures.  With this extension, there is no longer any direct
14595bd8deadSopenharmony_ci      limit on the number of textures/images that may be used in any shader
14605bd8deadSopenharmony_ci      stage.
14615bd8deadSopenharmony_ci
14625bd8deadSopenharmony_ci      There may still be indirect limits based on the total amount of storage
14635bd8deadSopenharmony_ci      available:
14645bd8deadSopenharmony_ci
14655bd8deadSopenharmony_ci        * Limits on the total amount of uniform memory imply a limit on the
14665bd8deadSopenharmony_ci          total number of texture handles stored as uniforms.
14675bd8deadSopenharmony_ci
14685bd8deadSopenharmony_ci        * Limits on the number of shader input/output components imply a limit
14695bd8deadSopenharmony_ci          on the number of texture handles passed as shader inputs and
14705bd8deadSopenharmony_ci          outputs.
14715bd8deadSopenharmony_ci
14725bd8deadSopenharmony_ci        * Limits on the total amount of addressable texture memory imply a
14735bd8deadSopenharmony_ci          limit on the total number of resident texture handles.
14745bd8deadSopenharmony_ci
14755bd8deadSopenharmony_ci        * Implementations may have (high) limits on the total number of
14765bd8deadSopenharmony_ci          texture handles available in the system.
14775bd8deadSopenharmony_ci
14785bd8deadSopenharmony_ci    (17) Should we provide any queries to extract information from texture or
14795bd8deadSopenharmony_ci         image handles?
14805bd8deadSopenharmony_ci
14815bd8deadSopenharmony_ci      RESOLVED:  No.
14825bd8deadSopenharmony_ci
14835bd8deadSopenharmony_ci    (18) Texture and image handles may be made resident or non-resident.  How
14845bd8deadSopenharmony_ci         does handle residency interact with texture residency queries from
14855bd8deadSopenharmony_ci         OpenGL 1.1 (AreTexturesResident or TEXTURE_RESIDENT)?
14865bd8deadSopenharmony_ci
14875bd8deadSopenharmony_ci      RESOLVED:  The residency state for texture and image handles in this
14885bd8deadSopenharmony_ci      extension is completely independent from OpenGL 1.1's TEXTURE_RESIDENT
14895bd8deadSopenharmony_ci      query.  Residency for texture handles is a function of whether the
14905bd8deadSopenharmony_ci      MakeTextureHandleResidentARB has been called for the handle.  OpenGL 1.1
14915bd8deadSopenharmony_ci      residency is typically a function of whether the texture data are
14925bd8deadSopenharmony_ci      resident in GPU-accessible memory.
14935bd8deadSopenharmony_ci
14945bd8deadSopenharmony_ci      When a texture handle is not made resident, the texture that it refers
14955bd8deadSopenharmony_ci      to may or may not be stored in GPU-accessible memory.  The
14965bd8deadSopenharmony_ci      TEXTURE_RESIDENT query may return TRUE in this case.  However, it does
14975bd8deadSopenharmony_ci      not guarantee that the texture handle may be used safely.
14985bd8deadSopenharmony_ci
14995bd8deadSopenharmony_ci      When a texture handle is made resident, the texture that it refers to is
15005bd8deadSopenharmony_ci      also considered resident for the purposes of the old TEXTURE_RESIDENT
15015bd8deadSopenharmony_ci      query.  When an image handle is resident, the texture that it refers to
15025bd8deadSopenharmony_ci      may or may not be considered resident for the query -- the resident
15035bd8deadSopenharmony_ci      image handle may refer only to a single layer of a single mipmap level
15045bd8deadSopenharmony_ci      of the full texture.
15055bd8deadSopenharmony_ci
15065bd8deadSopenharmony_ci    (19) How does ARB_bindless_texture differ from NV_bindless_texture?
15075bd8deadSopenharmony_ci
15085bd8deadSopenharmony_ci      RESOLVED:
15095bd8deadSopenharmony_ci
15105bd8deadSopenharmony_ci      - The constructors to convert between sampler and integer types use uvec2
15115bd8deadSopenharmony_ci        rather than uint64_t to avoid a dependency on the 64-bit integer types
15125bd8deadSopenharmony_ci        in the shader from NV_gpu_shader5.
15135bd8deadSopenharmony_ci
15145bd8deadSopenharmony_ci      - The interaction with NV_vertex_attrib_integer_64bit is modified to
15155bd8deadSopenharmony_ci        incorporate the minimal amount of the extension required specify vertex
15165bd8deadSopenharmony_ci        inputs of sampler/image types.
15175bd8deadSopenharmony_ci
15185bd8deadSopenharmony_ci      - Sampler and image handles passed to texture built-in functions must be
15195bd8deadSopenharmony_ci        dynamically uniform (NV_bindless_texture assumed NV_gpu_shader5 which
15205bd8deadSopenharmony_ci        removed this restriction). In order to increase the utility of this
15215bd8deadSopenharmony_ci        extension, the DrawIDARB shader input in a multi-draw
15225bd8deadSopenharmony_ci        (ARB_shader_draw_parameters) should be defined to be dynamically
15235bd8deadSopenharmony_ci        uniform.
15245bd8deadSopenharmony_ci
15255bd8deadSopenharmony_ci      - New layout qualifiers are added to inform the compiler of whether
15265bd8deadSopenharmony_ci        default-block sampler and image uniforms may be used with bindless
15275bd8deadSopenharmony_ci        handles. In NV_bindless_texture any uniforms may be used with bindless
15285bd8deadSopenharmony_ci        handles. So a shader can be ported from NV_bindless_texture to
15295bd8deadSopenharmony_ci        ARB_bindless_texture by declaring:
15305bd8deadSopenharmony_ci
15315bd8deadSopenharmony_ci            layout (bindless_sampler) uniform;
15325bd8deadSopenharmony_ci            layout (bindless_image) uniform;
15335bd8deadSopenharmony_ci
15345bd8deadSopenharmony_ci        NV_bindless_texture didn't require any shader changes to make uniforms
15355bd8deadSopenharmony_ci        usable with UniformHandleui64{v}, but ARB_bindless_texture requires
15365bd8deadSopenharmony_ci        these declarations.
15375bd8deadSopenharmony_ci
15385bd8deadSopenharmony_ci      - Not all implementations support an unlimited number of border colors,
15395bd8deadSopenharmony_ci        so ARB_bindless_texture only allows a limited set of border colors.
15405bd8deadSopenharmony_ci        GetTextureHandleARB and GetTextureSamplerHandleARB generate an error
15415bd8deadSopenharmony_ci        if the border color is not R=G=B=(0 or 1), A=(0 or 1), but the
15425bd8deadSopenharmony_ci        corresponding *NV entry points will allow an arbitrary border color.
15435bd8deadSopenharmony_ci
15445bd8deadSopenharmony_ciRevision History
15455bd8deadSopenharmony_ci
15465bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
15475bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------
15485bd8deadSopenharmony_ci     1              jbolz     Internal revisions.
15495bd8deadSopenharmony_ci                    pbrown
15505bd8deadSopenharmony_ci     2    05/01/13  jbolz     Add border color limitation.
15515bd8deadSopenharmony_ci     3    07/24/13  Jon Leech Fix typos & 'program' -> 'texture' in
15525bd8deadSopenharmony_ci                              description of GetImageHandleARB (public
15535bd8deadSopenharmony_ci                              bugs 914,915).
15545bd8deadSopenharmony_ci     4    06/13/14  dkoch     Fix a variety of typos and missing words.
15555bd8deadSopenharmony_ci                              Add missing error condition for BufferData and
15565bd8deadSopenharmony_ci                              buffer textures.
15575bd8deadSopenharmony_ci     5    02/13/17  pbrown    Update issue (19) to correct discussion of the
15585bd8deadSopenharmony_ci                              DrawIDARB built-in and the name of the
15595bd8deadSopenharmony_ci                              extension that added it.
1560