Edit

kc3-lang/angle/extensions/ANGLE_get_tex_level_parameter.txt

Branch :

  • Show log

    Commit

  • Author : Geoff Lang
    Date : 2020-10-14 11:31:56
    Hash : 089ef0fa
    Message : Expose glGetTexLevelParameter{if}v before ES 3.1. Add a new extension, ANGLE_get_tex_level_parameter which allows users to query texture size and format information before ES 3.1. This is very useful for re-using existing textures instead of re-allocating. Bug: chromium:1132514 Change-Id: I71f6bad8bdacb91875cc81b4884d4c3099235f3f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2469959 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • extensions/ANGLE_get_tex_level_parameter.txt
  • Name
    
        ANGLE_get_tex_level_parameter
    
    Name Strings
    
        GL_ANGLE_get_tex_level_parameter
    
    Contributors
    
        Geoff Lang, Google
    
    Contact
    
        Geoff Lang (geofflang 'at' google.com)
    
    Status
    
        Incomplete
    
    Version
    
        Last Modified Date: Oct 12, 2020
        Author Revision: 1
    
    Number
    
        OpenGL ES Extension XX
    
    Dependencies
    
        OpenGL ES 2.0 is required.
    
        This extension is written against the OpenGL ES 3.0.5 specification.
    
    Overview
    
        This extension allows the user to query information about specific texture
        levels exposed later in OpenGL ES 3.1.
    
    IP Status
    
        No known IP claims.
    
    New Procedures and Functions
    
        void GetTexLevelParameter{if}vANGLE(enum target, int level,
                                            enum pname, T *params );
    
    New Tokens
    
        Accepted by the <pname> parameter of GetTexLevelParameter{if}vANGLE:
    
            TEXTURE_WIDTH                                     0x1000
            TEXTURE_HEIGHT                                    0x1001
            TEXTURE_DEPTH                                     0x8071
            TEXTURE_INTERNAL_FORMAT                           0x1003
            TEXTURE_RED_SIZE                                  0x805C
            TEXTURE_GREEN_SIZE                                0x805D
            TEXTURE_BLUE_SIZE                                 0x805E
            TEXTURE_ALPHA_SIZE                                0x805F
            TEXTURE_DEPTH_SIZE                                0x884A
            TEXTURE_STENCIL_SIZE                              0x88F1
            TEXTURE_SHARED_SIZE                               0x8C3F
            TEXTURE_RED_TYPE                                  0x8C10
            TEXTURE_GREEN_TYPE                                0x8C11
            TEXTURE_BLUE_TYPE                                 0x8C12
            TEXTURE_ALPHA_TYPE                                0x8C13
            TEXTURE_DEPTH_TYPE                                0x8C16
            TEXTURE_COMPRESSED                                0x86A1
    
    Additions to Chapter 6 of the OpenGL ES 3.0.5 Specification (State and State
    Requests)
    
        Modify Section 6.1.4 "Texture Queries":
    
        (Add the following text to the end of the section)
    
        The commands
    
            void GetTexLevelParameter{if}vANGLE(enum target, int level,
                                                enum pname, T *params );
    
        place information about texture image parameter <pname> for level-of-detail
        <level> of the specified target into <params>. <pname> must be one of the
        symbolic values in table 6.11.
    
        <target> may be one of TEXTURE_2D or one of the cube map face targets from
        table 3.18, indicating the two-dimensional texture or one of the six distinct
        2D images making up the cube map texture object. Otherwise an INVALID_ENUM is
        generated.
    
        <level> determines which level-of-detail's state is returned. If <level>
        is negative or larger than the maximum allowable level-of-detail, then an
        INVALID_VALUE error is generated.
    
        Note that TEXTURE_CUBE_MAP is not a valid <target> parameter for
        GetTexLevelParameter{if}vANGLE, because it does not specify a particular
        cube map face.
    
        For texture images with uncompressed internal formats, queries of
        <pname> TEXTURE_RED_TYPE, TEXTURE_GREEN_TYPE, TEXTURE_BLUE_TYPE,
        TEXTURE_ALPHA_TYPE, and TEXTURE_DEPTH_TYPE return the data type used
        to store the component. Types NONE, SIGNED_NORMALIZED, UNSIGNED_-
        NORMALIZED, FLOAT, INT, and UNSIGNED_INT respectively indicate missing,
        signed normalized fixed-point, unsigned normalized fixed-point,
        floating-point, signed unnormalized integer, and unsigned unnormalized
        integer components. Queries of <pname> TEXTURE_RED_SIZE, TEXTURE_GREEN_SIZE,
        TEXTURE_BLUE_SIZE, TEXTURE_ALPHA_SIZE, TEXTURE_DEPTH_SIZE,
        TEXTURE_STENCIL_SIZE, and TEXTURE_SHARED_SIZE return the actual resolutions
        of the stored image components, not the resolutions specified when the image
        was defined. Invalid <pname> generate an INVALID_ENUM error.
    
        For texture images with compressed internal formats, the types returned
        specify how components are interpreted after decompression, while the
        resolutions returned specify the component resolution of an uncompressed
        internal format that produces an image of roughly the same quality as the
        compressed image in question. Since the quality of the implementation's
        compression algorithm is likely data-dependent, the returned component sizes
        should be treated only as rough approximations.
    
        Queries of <pname> TEXTURE_INTERNAL_FORMAT, TEXTURE_WIDTH, TEXTURE_HEIGHT,
        and TEXTURE_DEPTH return the internal format, width, height, and depth,
        respectively, as specified when the image array was created.
    
    Errors
    
        The error INVALID_ENUM is generated by GetTexLevelParameter{if}vANGLE
        if <target> is not one of TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, one of
        the cube map face targets from table 3.18, or TEXTURE_2D_MULTISAMPLE_ANGLE.
    
        The error INVALID_VALUE is generated by GetTexLevelParameter{if}vANGLE
        if <level> is negative or larger than the maximum allowable level-of-detail.
    
        The error INVALID_ENUM is generated by GetTexLevelParameter{if}vANGLE
        if <value> is not one of TEXTURE_RED_TYPE, TEXTURE_GREEN_TYPE,
        TEXTURE_BLUE_TYPE, TEXTURE_ALPHA_TYPE, TEXTURE_DEPTH_TYPE,
        TEXTURE_DEPTH_SIZE, TEXTURE_STENCIL_SIZE, TEXTURE_SHARED_SIZE,
        TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_DEPTH, TEXTURE_INTERNAL_FORMAT,
        TEXTURE_RED_SIZE, TEXTURE_GREEN_SIZE, TEXTURE_BLUE_SIZE, TEXTURE_ALPHA_SIZE,
        or TEXTURE_COMPRESSED.
    
    New State
    
        (add new table 6.10, Textures (state per texture image), renumber subsequent tables)
    
                                                                  Initial
        Get Value                Type   Get Command                Value   Description                  Sec.
        ----------------------   ----   -------------------        ------  ---------------------------  ------
        TEXTURE_WIDTH             Z+    GetTexLevelParameterANGLE  0       Specified width              3.8
        TEXTURE_HEIGHT            Z+    GetTexLevelParameterANGLE  0       Specified height (2D/3D)     3.8
        TEXTURE_DEPTH             Z+    GetTexLevelParameterANGLE  0       Specified depth (3D)         3.8
        TEXTURE_INTERNAL_FORMAT   E     GetTexLevelParameterANGLE  RGBA    Internal format              3.8
                                                                   or R8   (see section 3.8.14)
        TEXTURE_x_SIZE            6xZ+  GetTexLevelParameterANGLE  0       Component resolution (x is   3.8
                                                                           RED, GREEN, BLUE, ALPHA,
                                                                           DEPTH, or STENCIL)
        TEXTURE_SHARED_SIZE       Z+    GetTexLevelParameterANGLE  0       Shared exponent field        3.8
                                                                           resolution
        TEXTURE_x_TYPE            E     GetTexLevelParameterANGLE  NONE    Component type (x is RED,    6.1.4
                                                                           GREEN, BLUE, ALPHA, or
                                                                           DEPTH)
        TEXTURE_COMPRESSED        B     GetTexLevelParameterANGLE  FALSE   True if image has a          3.8.6
                                                                           compressed internal format
    
    Issues
        None
    
    Revision History
    
        Rev.    Date    Author       Changes
        ----  --------  ----------   --------------------------------------------
        1     14/10/20   Geoff Lang  First revision. Adapted from OpenGL ES
                                     specification 3.1.