15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_sampler_objects
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_sampler_objects
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Graham Sellers, AMD (graham.sellers 'at' amd.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Graham Sellers, AMD
165bd8deadSopenharmony_ci    Jaakko Konttinen, AMD
175bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA
185bd8deadSopenharmony_ci    Daniel Koch, TransGaming
195bd8deadSopenharmony_ci    Bruce Merry, ARM
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciNotice
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Copyright (c) 2010-2013 The Khronos Group Inc. Copyright terms at
245bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciSpecification Update Policy
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
295bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
305bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
315bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
325bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
335bd8deadSopenharmony_ci    described in more detail at
345bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciStatus
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Complete. Approved by the ARB at the 2010/01/22 F2F meeting.
395bd8deadSopenharmony_ci    Approved by the Khronos Board of Promoters on March 10, 2010.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciVersion
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    Version 13, November 12, 2014
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciNumber
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    ARB Extension #81
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciDependencies
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension is written against the OpenGL 3.2 (Compatibility
525bd8deadSopenharmony_ci    Profile) specification.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    This extension interacts with EXT_texture_filter_anisotropic.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    OpenGL 1.0 is required.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ciOverview
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    In unextended OpenGL textures are considered to be sets of image
615bd8deadSopenharmony_ci    data (mip-chains, arrays, cube-map face sets, etc.) and sampling
625bd8deadSopenharmony_ci    state (sampling mode, mip-mapping state, coordinate wrapping and
635bd8deadSopenharmony_ci    clamping rules, etc.) combined into a single object. It is typical
645bd8deadSopenharmony_ci    for an application to use many textures with a limited set of
655bd8deadSopenharmony_ci    sampling states that are the same between them. In order to use
665bd8deadSopenharmony_ci    textures in this way, an application must generate and configure
675bd8deadSopenharmony_ci    many texture names, adding overhead both to applications and to
685bd8deadSopenharmony_ci    implementations. Furthermore, should an application wish to sample
695bd8deadSopenharmony_ci    from a texture in more than one way (with and without mip-mapping,
705bd8deadSopenharmony_ci    for example) it must either modify the state of the texture or
715bd8deadSopenharmony_ci    create two textures, each with a copy of the same image data. This
725bd8deadSopenharmony_ci    can introduce runtime and memory costs to the application.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    This extension separates sampler state from texture image data. A
755bd8deadSopenharmony_ci    new object type is introduced, the sampler (representing generic
765bd8deadSopenharmony_ci    sampling parameters). The new sampler objects are represented by a
775bd8deadSopenharmony_ci    new named type encapsulating the sampling parameters of a
785bd8deadSopenharmony_ci    traditional texture object. Sampler objects may be bound to texture
795bd8deadSopenharmony_ci    units to supplant the bound texture's sampling state. A single
805bd8deadSopenharmony_ci    sampler may be bound to more than one texture unit simultaneously,
815bd8deadSopenharmony_ci    allowing different textures to be accessed with a single set of
825bd8deadSopenharmony_ci    shared sampling parameters. Also, by binding different sampler
835bd8deadSopenharmony_ci    objects to texture units to which the same texture has been bound,
845bd8deadSopenharmony_ci    the same texture image data may be sampled with different sampling
855bd8deadSopenharmony_ci    parameters.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ciIP Status
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    No known IP claims.
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ciNew Procedures and Functions
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    void GenSamplers(sizei count, uint *samplers);
945bd8deadSopenharmony_ci    void DeleteSamplers(sizei count, const uint * samplers);
955bd8deadSopenharmony_ci    boolean IsSampler(uint sampler);
965bd8deadSopenharmony_ci    void BindSampler(uint unit, uint sampler);
975bd8deadSopenharmony_ci    void SamplerParameteri(uint sampler, enum pname, int param);
985bd8deadSopenharmony_ci    void SamplerParameterf(uint sampler, enum pname, float param);
995bd8deadSopenharmony_ci    void SamplerParameteriv(uint sampler, enum pname, const int *params);
1005bd8deadSopenharmony_ci    void SamplerParameterfv(uint sampler, enum pname, const float *params);
1015bd8deadSopenharmony_ci    void SamplerParameterIiv(uint sampler, enum pname, const int *params);
1025bd8deadSopenharmony_ci    void SamplerParameterIuiv(uint sampler, enum pname, const uint *params);
1035bd8deadSopenharmony_ci    void GetSamplerParameteriv(uint sampler, enum pname, int *params);
1045bd8deadSopenharmony_ci    void GetSamplerParameterfv(uint sampler, enum pname, float *params);
1055bd8deadSopenharmony_ci    void GetSamplerParameterIiv(uint sampler, enum pname, int *params);
1065bd8deadSopenharmony_ci    void GetSamplerParameterIuiv(uint sampler, enum pname, uint *params);
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ciNew Tokens
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    Accepted by the <value> parameter of the GetBooleanv, GetIntegerv,
1115bd8deadSopenharmony_ci    GetInteger64v, GetFloatv and GetDoublev functions:
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci        SAMPLER_BINDING                                 0x8919
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.2 Specification (Compatibility Profile) (OpenGL Operation)
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    None.
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.2 Specification (Compatibility Profile) (Rasterization)
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    Additions to Section 3.8.12 Texture Completeness
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    Add subheading "Effects of Sampler Objects on Texture Completeness"
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    If a sampler object and a texture object are simultaneously bound to
1265bd8deadSopenharmony_ci    the same texture unit, then the sampling state for that unit is
1275bd8deadSopenharmony_ci    taken from the sampler object (see section 3.9.2, "Sampler
1285bd8deadSopenharmony_ci    Objects"). This can have an effect on the effective completeness of
1295bd8deadSopenharmony_ci    the texture. In particular, if the texture is not mipmap complete
1305bd8deadSopenharmony_ci    and the sampler object specifies a MIN_FILTER requiring mipmaps, the
1315bd8deadSopenharmony_ci    texture will be considered incomplete for the purposes of that
1325bd8deadSopenharmony_ci    texture unit. However, if the sampler object does not require
1335bd8deadSopenharmony_ci    mipmaps, the texture object will be considered complete. This means
1345bd8deadSopenharmony_ci    that a texture can be considered both complete and incomplete
1355bd8deadSopenharmony_ci    simultaneously if it is bound to two or more texture units along
1365bd8deadSopenharmony_ci    with sampler objects with different states.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    Additions to Section 3.9 Texturing
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    Modify the prologue to Section 3.9 as follows:
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Renumber Section 3.9.14 "Texture Objects" to Section 3.9.1. renumber
1435bd8deadSopenharmony_ci    subsequent sections
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    Replace Section 3.9.1 "Texture Objects"
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    3.9.1 Texture Objects
1485bd8deadSopenharmony_ci    ---------------------
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    Textures in GL are represented by named objects. The name space for
1515bd8deadSopenharmony_ci    texture objects is the unsigned integers, with zero reserved by the
1525bd8deadSopenharmony_ci    GL to represent the default texture object. The default texture
1535bd8deadSopenharmony_ci    object is bound to each of the TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
1545bd8deadSopenharmony_ci    TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE,
1555bd8deadSopenharmony_ci    TEXTURE_BUFFER, TEXTURE_CUBE_MAP, TEXTURE_2D_MULTISAMPLE, and
1565bd8deadSopenharmony_ci    TEXTURE_2D_MULTISAMPLE_ARRAY targets during context initialization.
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    A new texture object is created by binding an unused name to one of
1595bd8deadSopenharmony_ci    these texture targets. The command
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci        void GenTextures( sizei n, uint *textures );
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    returns <n> previously unused texture names in <textures>. These
1645bd8deadSopenharmony_ci    names are marked as used, for the purposes of GenTextures only, but
1655bd8deadSopenharmony_ci    they acquire texture state and a dimensionality only when they are
1665bd8deadSopenharmony_ci    first bound, just as if they were unused. The binding is effected by
1675bd8deadSopenharmony_ci    calling
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci        void BindTexture( enum target, uint texture );
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    with <target> set to the desired texture target and <texture> set to
1725bd8deadSopenharmony_ci    the unused name. The resulting texture object is a new state vector,
1735bd8deadSopenharmony_ci    comprising all the state and with the same initial values listed in
1745bd8deadSopenharmony_ci    section 3.9.13. The new texture object bound to <target> is, and
1755bd8deadSopenharmony_ci    remains a texture of the dimensionality and type specified by
1765bd8deadSopenharmony_ci    <target> until it is deleted.
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    BindTexture may also be used to bind an existing texture object to
1795bd8deadSopenharmony_ci    any of these targets. The error INVALID_OPERATION is generated if an
1805bd8deadSopenharmony_ci    attempt is made to bind a texture object of different dimensionality
1815bd8deadSopenharmony_ci    than the specified <target>. If the bind is successful no change is
1825bd8deadSopenharmony_ci    made to the state of the bound texture object, and any previous
1835bd8deadSopenharmony_ci    binding to <target> is broken.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci** This error applies only to 3.2 core profile / 3.1 w/o ARB_compatibility /
1865bd8deadSopenharmony_ci** 3.0 deprecated contexts.
1875bd8deadSopenharmony_ci    BindTexture fails and an INVALID_OPERATION error is generated if
1885bd8deadSopenharmony_ci    <texture> is not zero or a name returned from a previous call to
1895bd8deadSopenharmony_ci    GenTextures, or if such a name has since been deleted. While a
1905bd8deadSopenharmony_ci    texture object is bound, GL operations on the target to which it is
1915bd8deadSopenharmony_ci    bound affect the bound object, and queries of the target to which it
1925bd8deadSopenharmony_ci    is bound return state from the bound object. If texture mapping of
1935bd8deadSopenharmony_ci    the dimensionality of the target to which a texture object is bound
1945bd8deadSopenharmony_ci    is enabled, the state of the bound texture object directs the
1955bd8deadSopenharmony_ci    texturing operation.
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    Texture objects are deleted by calling
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci        void DeleteTextures( sizei n, uint *textures );
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    <textures> contains <n> names of texture objects to be deleted.
2025bd8deadSopenharmony_ci    After a texture object is deleted, it has no contents or
2035bd8deadSopenharmony_ci    dimensionality, and its name is again unused. If a texture that is
2045bd8deadSopenharmony_ci    currently bound to any of the target bindings of BindTexture is
2055bd8deadSopenharmony_ci    deleted, it is as though BindTexture had been executed with the same
2065bd8deadSopenharmony_ci    target and texture zero. Additionally, special care must be taken
2075bd8deadSopenharmony_ci    when deleting a texture if any of the images of the texture are
2085bd8deadSopenharmony_ci    attached to a framebuffer object. See section 4.4.2 for details.
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Unused names in <textures> are silently ignored, as is the name zero.
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    The texture object name space, including the initial one-, two-, and
2135bd8deadSopenharmony_ci    three- dimensional, one- and two-dimensional array, rectangular,
2145bd8deadSopenharmony_ci    buffer, cube map, two-dimensional multisample, and two-dimensional
2155bd8deadSopenharmony_ci    multisample array texture objects, is shared among all texture
2165bd8deadSopenharmony_ci    units. A texture object may be bound to more than one texture unit
2175bd8deadSopenharmony_ci    simultaneously. After a texture object is bound, any GL operations
2185bd8deadSopenharmony_ci    on that target object affect any other texture units to which the
2195bd8deadSopenharmony_ci    same texture object is bound.
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci    Texture binding is affected by the setting of the state
2225bd8deadSopenharmony_ci    ACTIVE_TEXTURE. If a texture object is deleted, it as if all texture
2235bd8deadSopenharmony_ci    units which are bound to that texture object are rebound to texture
2245bd8deadSopenharmony_ci    object zero.
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    Insert new Section 3.9.2 "Sampler Objects", renumber subsequent
2275bd8deadSopenharmony_ci    sections.
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    3.9.2 Sampler Objects
2305bd8deadSopenharmony_ci    ---------------------
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci    The state necessary for texturing can be divided into two categories
2335bd8deadSopenharmony_ci    as described in Section 3.9.13. An OpenGL texture object represents
2345bd8deadSopenharmony_ci    both sets. The first set represents dimensionality and other image
2355bd8deadSopenharmony_ci    parameters, and the second set represents sampling state.
2365bd8deadSopenharmony_ci    Additionally, a sampler object may be created to encapsulate only
2375bd8deadSopenharmony_ci    the second set, or the sampling state, of a texture object.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    A new sampler object is created by binding an unused name to a
2405bd8deadSopenharmony_ci    texture unit. The command
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci        void GenSamplers( sizei count, uint *samplers );
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    returns <count> previously unused sampler object names in
2455bd8deadSopenharmony_ci    <samplers>. The name zero is reserved by the GL to represent no
2465bd8deadSopenharmony_ci    sampler being bound to a sampler unit. The names are marked as used,
2475bd8deadSopenharmony_ci    for the purposes of GenSamplers only, but they acquire state only
2485bd8deadSopenharmony_ci    when they are first used as a parameter to BindSampler,
2495bd8deadSopenharmony_ci    SamplerParameter*, GetSamplerParameter*, or IsSampler. When a
2505bd8deadSopenharmony_ci    sampler object is first used in one of these functions, the
2515bd8deadSopenharmony_ci    resulting sampler object is initialized with a new state vector,
2525bd8deadSopenharmony_ci    comprising all the state and with the same initial values listed in
2535bd8deadSopenharmony_ci    table 6.23.
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci    When a sampler object is bound to a texture unit, its state
2565bd8deadSopenharmony_ci    supersedes that of the texture object bound to that texture unit. If
2575bd8deadSopenharmony_ci    the sampler name zero is bound to a texture unit, the currently
2585bd8deadSopenharmony_ci    bound texture's sampler state becomes active. A single sampler
2595bd8deadSopenharmony_ci    object may be bound to multiple texture units simultaneously.
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    A sampler binding is effected by calling
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci        void BindSampler( uint unit, uint sampler );
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci    with <unit> set to the texture unit to which to bind the sampler and
2665bd8deadSopenharmony_ci    <sampler> set to the name of a sampler object returned from a
2675bd8deadSopenharmony_ci    previous call to GenSampler.
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    <unit> must be between zero and the value of
2705bd8deadSopenharmony_ci    MAX_TEXTURE_IMAGE_UNITS-1. <sampler> is the name of a sampler object
2715bd8deadSopenharmony_ci    that has previously been reserved by a call to GenSamplers.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    If the bind is successful no change is made to the state of the
2745bd8deadSopenharmony_ci    bound sampler object, and any previous binding to <unit> is broken.
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    BindSampler fails and an INVALID_OPERATION error is generated if
2775bd8deadSopenharmony_ci    <sampler> is not zero or a name returned from a previous call to
2785bd8deadSopenharmony_ci    GenSamplers, or if such a name has since been deleted with
2795bd8deadSopenharmony_ci    DeleteSamplers. An INVALID_VALUE error is generated if <unit> is
2805bd8deadSopenharmony_ci    greater than or equal to the value of
2815bd8deadSopenharmony_ci    MAX_COMBINED_TEXTURE_IMAGE_UNITS.
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci    If state is present in a sampler object bound to a texture unit that
2845bd8deadSopenharmony_ci    would have been rejected by a call to TexParameter for the texture
2855bd8deadSopenharmony_ci    bound to that unit, the behavior of the implementation is as if the
2865bd8deadSopenharmony_ci    texture were incomplete. For example, if TEXTURE_WRAP_S,
2875bd8deadSopenharmony_ci    TEXTURE_WRAP_T or TEXTURE_WRAP_R is set to REPEAT or MIRRORED_REPEAT
2885bd8deadSopenharmony_ci    on the sampler object bound to a texture unit and the texture bound
2895bd8deadSopenharmony_ci    to that unit is a TEXTURE_RECTANGLE, the texture will be considered
2905bd8deadSopenharmony_ci    incomplete.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    The currently bound sampler may be queried by calling GetIntegerv
2935bd8deadSopenharmony_ci    with <pname> set to SAMPLER_BINDING. When a sampler object is
2945bd8deadSopenharmony_ci    unbound from the texture unit (by binding another sampler object, or
2955bd8deadSopenharmony_ci    the sampler object named zero, to that texture unit) the modified
2965bd8deadSopenharmony_ci    state is again replaced with the sampler state associated with the
2975bd8deadSopenharmony_ci    texture object bound to that texture unit.
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    The parameters represented by a sampler object are a subset of those
3005bd8deadSopenharmony_ci    described in Section 3.9.6 "Texture Parameters". Each parameter of a
3015bd8deadSopenharmony_ci    sampler object is set by calling
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci        void SamplerParameter{if}{v}( uint sampler, enum pname, T param );
3045bd8deadSopenharmony_ci        void SamplerParameterI{u ui}v( uint sampler, enum pname, T *params );
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci    <sampler> is the name of a sampler object previously reserved by a
3075bd8deadSopenharmony_ci    call to GenSamplers. <pname> is the name of a parameter to modify
3085bd8deadSopenharmony_ci    and <param> is the new value of that parameter. An INVALID_OPERATION
3095bd8deadSopenharmony_ci    error is generated if <sampler> is not the name of a sampler object
3105bd8deadSopenharmony_ci    previously returned from a call to GenSamplers. The values accepted
3115bd8deadSopenharmony_ci    in the <pname> parameter are TEXTURE_WRAP_S, TEXTURE_WRAP_T,
3125bd8deadSopenharmony_ci    TEXTURE_WRAP_R, TEXTURE_MIN_FILTER, TEXTURE_MAG_FILTER,
3135bd8deadSopenharmony_ci    TEXTURE_BORDER_COLOR, TEXTURE_MIN_LOD, TEXTURE_MAX_LOD,
3145bd8deadSopenharmony_ci    TEXTURE_LOD_BIAS, TEXTURE_COMPARE_MODE, TEXTURE_COMPARE_FUNC and
3155bd8deadSopenharmony_ci    TEXTURE_MAX_ANISOTROPY_EXT. Texture state listed in table 6.22 but
3165bd8deadSopenharmony_ci    not listed here and in the sampler state in table 6.23 is not part
3175bd8deadSopenharmony_ci    of the sampler state, and remains in the texture object.
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    If the values for TEXTURE_BORDER_COLOR are specified with a call to
3205bd8deadSopenharmony_ci    SamplerParameterIiv or SamplerParameterIuiv, the values are
3215bd8deadSopenharmony_ci    unmodified and stored with an internal data type of integer. If
3225bd8deadSopenharmony_ci    specified with SamplerParameteriv, they are converted to
3235bd8deadSopenharmony_ci    floating-point using equation 2.2. Otherwise, the values are
3245bd8deadSopenharmony_ci    unmodified and stored as floating-point.
3255bd8deadSopenharmony_ci
3265bd8deadSopenharmony_ci    An INVALID_ENUM error is generated if <pname> is not the name of a
3275bd8deadSopenharmony_ci    parameter accepted by SamplerParameter*. If the value of <param> is
3285bd8deadSopenharmony_ci    not an acceptable value for the parameter specified in <pname>, an
3295bd8deadSopenharmony_ci    error is generated as specified in the description of TexParameter*.
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    Modifying a parameter of a sampler object affects all texture units
3325bd8deadSopenharmony_ci    to which that sampler object is bound. Calling TexParameter has no
3335bd8deadSopenharmony_ci    effect on the sampler object bound to the active texture unit. It
3345bd8deadSopenharmony_ci    will modify the parameters of the texture object bound to that unit.
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    Sampler objects are deleted by calling
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci        void DeleteSamplers( sizei count, const uint *samplers );
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    <samplers> contains <count> names of sampler objects to be deleted.
3415bd8deadSopenharmony_ci    After a sampler object is deleted, its name is again unused. If a
3425bd8deadSopenharmony_ci    sampler object that is currently bound to a sampler unit is deleted,
3435bd8deadSopenharmony_ci    it is as though BindSampler is called with <unit> set to the unit
3445bd8deadSopenharmony_ci    the sampler is bound to and <sampler> zero. Unused names in
3455bd8deadSopenharmony_ci    <samplers> are silently ignored, as is the reserved name zero.
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.2 Specification (Compatibility Profile) (Per-Fragment Operations and the Framebuffer)
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ci    None.
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.2 Specification (Compatibility Profile) (Special Functions)
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    Add a new category of commands not usable in display lists
3545bd8deadSopenharmony_ci    to section 5.4.1:
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ci   "Sampler objects: GenSamplers and DeleteSamplers."
3575bd8deadSopenharmony_ci
3585bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.2 Specification (Compatibility Profile) (State and State Requests)
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    Insert new section 6.1.5 "Sampler Queries" following existing
3615bd8deadSopenharmony_ci    section 6.1.4 and renumber following sections:
3625bd8deadSopenharmony_ci
3635bd8deadSopenharmony_ci    6.1.5 Sampler Queries
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    The command
3665bd8deadSopenharmony_ci
3675bd8deadSopenharmony_ci        boolean IsSampler( uint sampler );
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    may be called to determine whether <sampler> is the name of a
3705bd8deadSopenharmony_ci    sampler object IsSampler will return TRUE if <sampler> is the name
3715bd8deadSopenharmony_ci    of a sampler object previously returned from a call to GenSamplers
3725bd8deadSopenharmony_ci    and FALSE otherwise. Zero is not the name of a sampler object. The
3735bd8deadSopenharmony_ci    current values of the parameters of a sampler object may be queried
3745bd8deadSopenharmony_ci    by calling
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci        void GetSamplerParameter{if}v( uint sampler, enum pname, T *params );
3775bd8deadSopenharmony_ci        void GetSamplerParameterI{i ui}v( uint sampler, enum pname, T *params );
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci    <sampler> is the name of the sampler object from which to retrieve
3805bd8deadSopenharmony_ci    parameters. <pname> is the name of the parameter whose value to
3815bd8deadSopenharmony_ci    retrieve and <params> is the address of an array into which the
3825bd8deadSopenharmony_ci    current value of the desired parameter will be placed.
3835bd8deadSopenharmony_ci    GetSamplerParameter* accepts the same values for <pname> as
3845bd8deadSopenharmony_ci    SamplerParameter*. An INVALID_OPERATION error is generated if
3855bd8deadSopenharmony_ci    <sampler> is not the name of a sampler object previously returned
3865bd8deadSopenharmony_ci    from a call to GenSamplers. An INVALID_ENUM error is generated if
3875bd8deadSopenharmony_ci    <pname> is not the name of a parameter accepted by
3885bd8deadSopenharmony_ci    GetSamplerParameter*.
3895bd8deadSopenharmony_ci
3905bd8deadSopenharmony_ci    Querying value TEXTURE_BORDER_COLOR with GetSamplerParameterIiv or
3915bd8deadSopenharmony_ci    GetSamplerParameterIuiv returns the border color values as signed
3925bd8deadSopenharmony_ci    integers or unsigned integers, respectively; otherwise the values
3935bd8deadSopenharmony_ci    are returned as described in section 6.1.2. If the border color is
3945bd8deadSopenharmony_ci    queried with a type that does not match the original type with which
3955bd8deadSopenharmony_ci    it was specified, the result is undefined.
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ci    In section 6.1.19, append to the paragraph starting "When PushAttrib
3995bd8deadSopenharmony_ci    is called with TEXTURE_BIT set...":
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci   "... are restored to their pushed values. The bindings and state for
4025bd8deadSopenharmony_ci    sampler objects are not pushed or popped."
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 3.2 Specification (Compatibility Profile) (Invariance)
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    None.
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ciInteractions with EXT_texture_filter_anisotropic
4095bd8deadSopenharmony_ci
4105bd8deadSopenharmony_ci    If EXT_texture_filter_anisotropic is not supported, remove all
4115bd8deadSopenharmony_ci    references to TEXTURE_MAX_ANISOTROPY_EXT.
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    None.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ciGLX Protocol
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci    None.
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ciErrors
4225bd8deadSopenharmony_ci
4235bd8deadSopenharmony_ci    INVALID_OPERATION is generated by BindSampler if <sampler> is not
4245bd8deadSopenharmony_ci    zero or a name returned from a previous call to GenSamplers.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    INVALID_VALUE is generated by BindSampler if <unit> is greater than
4275bd8deadSopenharmony_ci    MAX_TEXTURE_IMAGE_UNITS-1.
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    INVALID_OPERATION is generated by SamplerParameter* and
4305bd8deadSopenharmony_ci    GetSamplerParameter* if <sampler> is not a name returned from a
4315bd8deadSopenharmony_ci    previous call to GenSamplers.
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ciNew State
4345bd8deadSopenharmony_ci
4355bd8deadSopenharmony_ci    Append to Table 6.20, "Textures (state per texture unit and binding point)"
4365bd8deadSopenharmony_ci
4375bd8deadSopenharmony_ci    +-----------------------+-----------+-------------------+-----------------+-------------------------+--------+------------+
4385bd8deadSopenharmony_ci    | Get Value             | Type      | Get Command       | Initial Value   | Description             | Sec    | Attribute  |
4395bd8deadSopenharmony_ci    +-----------------------+-----------+-------------------+-----------------+-------------------------+--------+------------+
4405bd8deadSopenharmony_ci    | SAMPLER_BINDING       | 48* x Z+  | GetIntegerv       | 0               | Sampler object bound    | 3.9.2  | -          |
4415bd8deadSopenharmony_ci    |                       |           |                   |                 | to active texture unit  |        |            |
4425bd8deadSopenharmony_ci    +-----------------------+-----------+-------------------+-----------------+-------------------------+--------+------------+
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    Add new Table 6.23, "Textures (state per sampler object)", renumber subsequent tables.
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ci    +---------------------------+-----------+----------------------+------------------------+------------------------------+--------+------------+
4475bd8deadSopenharmony_ci    | Get Value                 | Type      | Get Command          | Initial Value          | Description                  | Sec    | Attribute  |
4485bd8deadSopenharmony_ci    +---------------------------+-----------+----------------------+------------------------+------------------------------+--------+------------+
4495bd8deadSopenharmony_ci    | TEXTURE_BORDER_COLOR      | n x C     | GetSamplerParameter  | 0,0,0,0                | Border color                 | 3.9    | -          |
4505bd8deadSopenharmony_ci    | TEXTURE_MIN_FILTER        | n x Z6    | GetSamplerParameter  | NEAREST_MIPMAP_LINEAR  | Minification function        | 3.9.9  | -          |
4515bd8deadSopenharmony_ci    | TEXTURE_MAG_FILTER        | n x Z2    | GetSamplerParameter  | LINEAR                 | Magnification function       | 3.9.10 | -          |
4525bd8deadSopenharmony_ci    | TEXTURE_WRAP_S            | n x Z5    | GetSamplerParameter  | REPEAT                 | Texcoord s wrap mode         | 3.9.9  | -          |
4535bd8deadSopenharmony_ci    | TEXTURE_WRAP_T            | n x Z5    | GetSamplerParameter  | REPEAT                 | Texcoord t wrap mode         | 3.9.9  | -          |
4545bd8deadSopenharmony_ci    | TEXTURE_WRAP_R            | n x Z5    | GetSamplerParameter  | REPEAT                 | Texcoord r wrap mode         | 3.9.9  | -          |
4555bd8deadSopenharmony_ci    | TEXTURE_MIN_LOD           | n x R     | GetSamplerParameter  | -1000                  | Minimum level of detail      | 3.9    | -          |
4565bd8deadSopenharmony_ci    | TEXTURE_MAX_LOD           | n x R     | GetSamplerParameter  | 1000                   | Maximum level of detail      | 3.9    | -          |
4575bd8deadSopenharmony_ci    | TEXTURE_LOD_BIAS          | n x R     | GetSamplerParameter  | 0.0                    | Texture level of detail      | 3.9.9  | -          |
4585bd8deadSopenharmony_ci    |                           |           |                      |                        | bias (biastexobj)            |        |            |
4595bd8deadSopenharmony_ci    | TEXTURE_COMPARE_MODE      | n x Z2    | GetSamplerParameter  | NONE                   | Comparison mode              | 3.9.16 | -          |
4605bd8deadSopenharmony_ci    | TEXTURE_COMPARE_FUNC      | n x Z8    | GetSamplerParameter  | LEQUAL                 | Comparison function          | 3.9.16 | -          |
4615bd8deadSopenharmony_ci    | TEXTURE_MAX_ANISOTROPY_EXT| n x R     | GetSamplerParameter  | 1.0                    | Maximum degree of anisotropy | 3.9    | -          |
4625bd8deadSopenharmony_ci    +---------------------------+-----------+----------------------+------------------------+------------------------------+--------+------------+
4635bd8deadSopenharmony_ci
4645bd8deadSopenharmony_ciNew Implementation Dependent State
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci    None.
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ciIssues
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci    1) Should BindSampler take a <target> parameter?
4715bd8deadSopenharmony_ci
4725bd8deadSopenharmony_ci    DISCUSSION: Currently it does not. Binding a sampler to a texture
4735bd8deadSopenharmony_ci    unit binds it to all targets. Binding a texture to a target of a
4745bd8deadSopenharmony_ci    texture unit continues to determine the target precedence.
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    2) What is the set of state associated with a sampler object?
4775bd8deadSopenharmony_ci       Specifically, should TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL be
4785bd8deadSopenharmony_ci       part of the sampler or the texture?
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    DISCUSSION: TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL are presently
4815bd8deadSopenharmony_ci    part of the image state (texture) and are thus not included in the
4825bd8deadSopenharmony_ci    sampler object. TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_WRAP_R,
4835bd8deadSopenharmony_ci    TEXTURE_MIN_FILTER, TEXTURE_MAG_FILTER, TEXTURE_BORDER_COLOR,
4845bd8deadSopenharmony_ci    TEXTURE_MIN_LOD, TEXTURE_MAX_LOD, TEXTURE_LOD_BIAS,
4855bd8deadSopenharmony_ci    TEXTURE_COMPARE_MODE, TEXTURE_COMPARE_FUNC are the states included
4865bd8deadSopenharmony_ci    in the sampler object.
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci    3) How would one use the same sampler state to access multiple
4895bd8deadSopenharmony_ci       textures?
4905bd8deadSopenharmony_ci
4915bd8deadSopenharmony_ci    DISCUSSION: Generate a sampler object, set its state. Then, bind the
4925bd8deadSopenharmony_ci    same sampler object to multiple texture units (perhaps with
4935bd8deadSopenharmony_ci    different textures bound to them) and use those units as usual.
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    4) How would one access the same texture with different samplers?
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci    DISCUSSION: Generate a sampler object for each intended set of
4985bd8deadSopenharmony_ci    sampling parameters and bind them to different texture units. Bind
4995bd8deadSopenharmony_ci    the same texture to each of those units. That same texture will be
5005bd8deadSopenharmony_ci    sampled according to the parameters contained in the sampler object
5015bd8deadSopenharmony_ci    bound to the respective unit.
5025bd8deadSopenharmony_ci
5035bd8deadSopenharmony_ci    5) Does it matter what order samplers and textures are bound to
5045bd8deadSopenharmony_ci       texture units?
5055bd8deadSopenharmony_ci
5065bd8deadSopenharmony_ci    No. As long as a sampler is bound to a texture unit, it acts as the
5075bd8deadSopenharmony_ci    source of the sampler state for that unit. Textures may be switched
5085bd8deadSopenharmony_ci    in and out without affecting the sampler state. This includes the
5095bd8deadSopenharmony_ci    default texture object.
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    6) If a sampler object is bound to multiple texture units and its
5125bd8deadSopenharmony_ci    state is modified, is that state visible to all of those units?
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ci    Yes.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci    7) Should sampler objects be made visible to the shading language.
5175bd8deadSopenharmony_ci
5185bd8deadSopenharmony_ci    This is left for a future extension. Separating samplers and texture
5195bd8deadSopenharmony_ci    images in the shader allows for a run-time combinatorial explosion
5205bd8deadSopenharmony_ci    of sampler- texture pairs that would be difficult to count. It is
5215bd8deadSopenharmony_ci    also very clumsy to specify in a way that interacts cleanly with
5225bd8deadSopenharmony_ci    prior versions of OpenGL. This may become more feasible to apply
5235bd8deadSopenharmony_ci    against a future version of OpenGL, but this extension is applicable
5245bd8deadSopenharmony_ci    to any version of OpenGL.
5255bd8deadSopenharmony_ci
5265bd8deadSopenharmony_ci    8) Can sampler objects be shared between contexts?
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci    Yes. The semantics of sharing a sampler object between contexts is
5295bd8deadSopenharmony_ci    the same as that of sharing texture objects.
5305bd8deadSopenharmony_ci
5315bd8deadSopenharmony_ci    9) What happens when a sampler object bound to a texture unit has a
5325bd8deadSopenharmony_ci       parameter that is incompatible with the texture that is bound to
5335bd8deadSopenharmony_ci       that unit?
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    The behavior is as if the texture is incomplete.
5365bd8deadSopenharmony_ci
5375bd8deadSopenharmony_ci    10) When are sampler objects created? When do they start to exist?
5385bd8deadSopenharmony_ci
5395bd8deadSopenharmony_ci    Sampler objects are created when they are first used by any function
5405bd8deadSopenharmony_ci    taking the name of a sampler object as a parameter. Their names must
5415bd8deadSopenharmony_ci    be reserved by a call to GenSamplers. For all intents and purposes,
5425bd8deadSopenharmony_ci    it is as if they start existing when GenSamplers creates their
5435bd8deadSopenharmony_ci    names.
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ciRevision History
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ci    Rev.    Date      Author    Changes
5485bd8deadSopenharmony_ci    ----  ----------  --------- -----------------------------------------
5495bd8deadSopenharmony_ci    13    11/12/2014  Jon Leech Fix spelling of TEXTURE_MAX_ANISOTROPY
5505bd8deadSopenharmony_ci                                (public Bug 1263).
5515bd8deadSopenharmony_ci    12    07/22/2011  Jon Leech Fix valid <unit> values to be based
5525bd8deadSopenharmony_ci                                on MAX_COMBINED_TEXTURE_IMAGE_UNITS
5535bd8deadSopenharmony_ci                                instead of MAX_TEXTURE_IMAGE_UNITS (bug
5545bd8deadSopenharmony_ci                                6406).
5555bd8deadSopenharmony_ci    11    07/07/2010  Jon Leech Do not allow sampler bindings and sampler
5565bd8deadSopenharmony_ci                                object state to be pushed and popped, by
5575bd8deadSopenharmony_ci                                modifying all new state table entries to
5585bd8deadSopenharmony_ci                                have no attribute group and adding a
5595bd8deadSopenharmony_ci                                clarifying statement in section 6.1.20.
5605bd8deadSopenharmony_ci                                Do not allow GenSamplers and
5615bd8deadSopenharmony_ci                                DeleteSamplers in display lists (bug
5625bd8deadSopenharmony_ci                                6056).
5635bd8deadSopenharmony_ci    10    03/29/2010  pbrown    Further fixes in the listed prototypes;
5645bd8deadSopenharmony_ci                                use separate lines for external parsing.
5655bd8deadSopenharmony_ci     9    03/27/2010  pbrown    Fix an incorrect prototype for BindSampler
5665bd8deadSopenharmony_ci                                in the new functions section (bug 6146).
5675bd8deadSopenharmony_ci     8    03/22/2010  Jon Leech Change error for invalid <sampler> names
5685bd8deadSopenharmony_ci                                passed to *SamplerParameter* from
5695bd8deadSopenharmony_ci                                INVALID_VALUE to INVALID_OPERATION for
5705bd8deadSopenharmony_ci                                consistency (bug 6026). Expand Errors
5715bd8deadSopenharmony_ci                                section. Reformat to 80 columns.
5725bd8deadSopenharmony_ci     7    02/10/2010  Jon Leech Add const to SamplerParameter*v 'params'.
5735bd8deadSopenharmony_ci     6    01/26/2010  pbrown    Assign enum for SAMPLER_BINDING.
5745bd8deadSopenharmony_ci     5    01/05/2010  gsellers  Add SamplerParameterI*, GetSamplerParameterI*
5755bd8deadSopenharmony_ci                                (bug 5806).
5765bd8deadSopenharmony_ci                                Fix ambiguity about when sampler objects
5775bd8deadSopenharmony_ci                                are created. Samplers names are reserved
5785bd8deadSopenharmony_ci                                by GenSamplers but actually created
5795bd8deadSopenharmony_ci                                (default state initialized) on first
5805bd8deadSopenharmony_ci                                use. There is no bind-to-create for
5815bd8deadSopenharmony_ci                                sampler objects. (bug 5813).
5825bd8deadSopenharmony_ci                                Add language about effect of sampler
5835bd8deadSopenharmony_ci                                objects on effective texture
5845bd8deadSopenharmony_ci                                completeness (bug 5838). Specify that
5855bd8deadSopenharmony_ci                                illegal sampler states for particular
5865bd8deadSopenharmony_ci                                texture types result in incomplete
5875bd8deadSopenharmony_ci                                textures, rather than undefined
5885bd8deadSopenharmony_ci                                behavior.
5895bd8deadSopenharmony_ci     4    12/11/2009  Jon Leech Reorganization and consistency edits
5905bd8deadSopenharmony_ci                                resulting from 3.3 spec integration.
5915bd8deadSopenharmony_ci                                Remove ARB suffixes.
5925bd8deadSopenharmony_ci     3    11/19/2009  gsellers  Feedback from bmerry.
5935bd8deadSopenharmony_ci     2    11/11/2009  gsellers  Incorporate feedback.
5945bd8deadSopenharmony_ci     1    11/09/2009  gsellers  Initial version based on draft
5955bd8deadSopenharmony_ci                                EXT_separate_sampler_objects.
596