Name

    ARB_texture_mirror_clamp_to_edge

Name Strings

    GL_ARB_texture_mirror_clamp_to_edge

Contact

    Daniel Koch, NVIDIA Corporation (dkoch 'at' nvidia.com)

Contributors

    Contributors to ATI_texture_mirror_once
    Contributors to EXT_texture_mirror_clamp
    Ian Romanick, Intel
    Members of the ARB working group

Notice

    Copyright (c) 2013 The Khronos Group Inc. Copyright terms at
        http://www.khronos.org/registry/speccopyright.html

Specification Update Policy

    Khronos-approved extension specifications are updated in response to
    issues and bugs prioritized by the Khronos OpenGL Working Group. For
    extensions which have been promoted to a core Specification, fixes will
    first appear in the latest version of that core Specification, and will
    eventually be backported to the extension document. This policy is
    described in more detail at
        https://www.khronos.org/registry/OpenGL/docs/update_policy.php

Status

    Complete. Approved by the ARB on June 3, 2013.
    Ratified by the Khronos Board of Promoters on July 19, 2013.

Version

    Last Modified Date: April 22, 2013
    Revision 4

Number

    ARB Extension #149

Dependencies

    OpenGL 1.4 is required.

    This extension is written against the OpenGL 4.3 (Core Profile)
    Specification (October 18, 2012).

    This extension interacts with EXT_texture3D.

    This extension interacts with ARB_texture_rectangle.

    This extension interacts with ARB_sampler_objects.

Overview

    ARB_texture_mirror_clamp_to_edge extends the set of texture wrap modes to
    include an additional mode (GL_MIRROR_CLAMP_TO_EDGE) that effectively uses
    a texture map twice as large as the original image in which the additional
    half of the new image is a mirror image of the original image.

    This new mode relaxes the need to generate images whose opposite edges
    match by using the original image to generate a matching "mirror image".
    This mode allows the texture to be mirrored only once in the negative
    s, t, and r directions.

New Procedure and Functions

    None

New Tokens

    Accepted by the <param> parameter of TexParameter{if}, SamplerParameter{if}
    and SamplerParameter{if}v, and by the <params> parameter of
    TexParameter{if}v, TexParameterI{i ui}v and SamplerParameterI{i ui}v when
    their <pname> parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or
    TEXTURE_WRAP_R:

        MIRROR_CLAMP_TO_EDGE      0x8743 (same value as MIRROR_CLAMP_TO_EDGE_ATI/EXT)

Additions to Chapter 8 if the OpenGL 4.3 (Core Profile) Specification
(Textures and Samplers)

  In section 8.2 (Sampler Objects) modify the second sentence of the
  sixth paragraph (reading "For example, if..") to read as follows:

    "For example, if TEXTURE_WRAP_S or TEXTURE_WRAP_T is set to REPEAT,
    MIRRORED_REPEAT, or MIRROR_CLAMP_TO_EDGE on the sampler object bound
    to a texture unit and the texture bond to that unit is a rectangle
    texture, the texture will be considered incomplete."

  In section 8.10 (Texture Parameters) modify the table entries for Table 8.16
  (Texture parameters and their values) for TEXTURE_WRAP_S, TEXTURE_WRAP_T,
  and TEXTURE_WRAP_R and add the following to the "Legal Values" column:

    Name             Type   Legal Values
    ---------------  ----   ------------
    TEXTURE_WRAP_S   enum   (.. as before)
                            MIRROR_CLAMP_TO_EDGE
    TEXTURE_WRAP_T   enum   (.. as before)
                            MIRROR_CLAMP_TO_EDGE
    TEXTURE_WRAP_R   enum   (.. as before)
                            MIRROR_CLAMP_TO_EDGE

  In section 8.14.2 (Coordinate Wrapping and Texel Selection) add the
  following row to Table 8.19 (Texel location wrap mode application):

    Wrap mode                Result of wrap(coord)
    ---------                ---------------------
    (previous entries..)
    MIRROR_CLAMP_TO_EDGE     min(1-1/(2*size), max(1/(2*size), abs(coord)))

Additions to the GLX Specification

    None

GLX Protocol

    None

Errors

    The error INVALID_ENUM is generated when TexParameter* is called
    with a target of TEXTURE_RECTANGLE and the TEXTURE_WRAP_S,
    TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set to REPEAT,
    MIRRORED_REPEAT, or MIRROR_CLAMP_TO_EDGE.

Dependencies on EXT_texture3D or equivalent

    If EXT_texture3D or equivalent functionality is not implemented,
    then the references to clamping of 3D textures in this file are
    invalid, and references to TEXTURE_WRAP_R should be ignored.

Dependencies on ARB_texture_rectangle or equivalent

    If ARB_texture_rectangle or equivalent functionality is not
    implemented, then ignore all references to rectangle textures.

Dependencies on ARB_sampler_objects or equivalent

    If ARB_sampler_objects or equivalent functionality is not supported,
    then ignore all references to sampler objects and SamplerParameter*
    functions.

New State

    Only the type information changes for these parameters:

    Update Table 23.14 (Textures - state per texture object)
    Get Value           Get Command       Type    Initial Value  (...)
    ---------           -----------       ----    -------------
    TEXTURE_WRAP_S      GetTexParameter   n x Z5  see sec 8.21   (...)
    TEXTURE_WRAP_T      GetTexParameter   n x Z5  see sec 8.21   (...)
    TEXTURE_WRAP_R      GetTexParameter   n x Z5  see sec 8.21   (...)

    Update Table 23.18 (Textures - state per sampler object)
    Get Value           Get Command             Type    Initial Value  (...)
    ---------           -----------             ----    -------------
    TEXTURE_WRAP_S      GetSamplerParameteriv   n x Z5  see sec 8.21   (...)
    TEXTURE_WRAP_T      GetSamplerParameteriv   n x Z5  see sec 8.21   (...)
    TEXTURE_WRAP_R      GetSamplerParameteriv   n x Z5  see sec 8.21   (...)

New Implementation Dependent State

    None

Issues

    1. Should we include MIRROR_CLAMP for compatibility profiles?
    What about MIRROR_CLAMP_TO_BORDER? (And more importantly can all
    vendors support it?)

    RESOLVED. No. Some vendors stated that they can't support
    MIRROR_CLAMP_TO_BORDER and MIRROR_CLAMP (although it's not clear if
    they'd ever ship a compatibility profile with this extension), but
    regardless we'll leave them out of this extension.

Revision History

    Revision 4, April 22, 2013 (Daniel Koch)
    - fix interactions and remove ARB suffixes
    Revision 3, April 21, 2013 (Daniel Koch)
    - formatting, updates to Table 23.14
    Revision 2, March 19, 2013 (Daniel Koch)
    - remove MIRROR_CLAMP functionality and rename extension
    Revision 1, January 20, 2013 (Daniel Koch)
    - Initial ARB version based on ATI_texture_mirror_once and
      EXT_texture_mirror_clamp.
    Revision 0.9, January 3, 2013 (Ian Romanick)
    - Add interactions with OpenGL contexts that have removed GL_CLAMP
      and friends.
