gfx/angle/extensions/ANGLE_texture_usage.txt

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 Name
     3     ANGLE_texture_usage
     5 Name Strings
     7     GL_ANGLE_texture_usage
     9 Contributors
    11     Nicolas Capens, TransGaming
    12     Daniel Koch, TransGaming
    14 Contact
    16     Daniel Koch, TransGaming (daniel 'at' transgaming.com)
    18 Status
    20     Complete
    22 Version
    24     Last Modified Date:  November 10, 2011
    25     Version:             2
    27 Number
    29     OpenGL ES Extension #112 
    31 Dependencies
    33     This extension is written against the OpenGL ES 2.0 Specification.
    35 Overview
    37     In some implementations it is advantageous to know the expected
    38     usage of a texture before the backing storage for it is allocated.  
    39     This can help to inform the implementation's choice of format
    40     and type of memory used for the allocation. If the usage is not
    41     known in advance, the implementation essentially has to make a 
    42     guess as to how it will be used.  If it is later proven wrong,
    43     it may need to perform costly re-allocations and/or reformatting 
    44     of the texture data, resulting in reduced performance.
    46     This extension adds a texture usage flag that is specified via
    47     the TEXTURE_USAGE_ANGLE TexParameter.  This can be used to 
    48     indicate that the application knows that this texture will be 
    49     used for rendering.
    51 IP Status
    53     No known IP claims.
    55 New Procedures and Functions
    57     None
    59 New Tokens
    61     Accepted as a value for <pname> for the TexParameter{if} and 
    62     TexParameter{if}v commands and for the <value> parameter of
    63     GetTexParameter{if}v: 
    65         TEXTURE_USAGE_ANGLE                     0x93A2
    67     Accepted as a value to <param> for the TexParameter{if} and 
    68     to <params> for the TexParameter{if}v commands with a <pname> of 
    69     TEXTURE_USAGE_ANGLE; returned as possible values for <data> when 
    70     GetTexParameter{if}v is queried with a <value> of TEXTURE_USAGE_ANGLE:
    72         NONE                                    0x0000
    73         FRAMEBUFFER_ATTACHMENT_ANGLE            0x93A3
    75 Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
    77     None
    79 Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
    81     Add a new row to Table 3.10 (Texture parameters and their values):
    83     Name                | Type | Legal Values 
    84     ------------------------------------------------------------
    85     TEXTURE_USAGE_ANGLE | enum | NONE, FRAMEBUFFER_ATTACHMENT_ANGLE
    87     Add a new section 3.7.x (Texture Usage) before section 3.7.12 and 
    88     renumber the subsequent sections: 
    90     "3.7.x Texture Usage
    92     Texture usage can be specified via the TEXTURE_USAGE_ANGLE value
    93     for the <pname> argument to TexParameter{if}[v]. In order to take effect,
    94     the texture usage must be specified before the texture contents are
    95     defined either via TexImage2D or TexStorage2DEXT.
    97     The usage values can impact the layout and type of memory used for the 
    98     texture data. Specifying incorrect usage values may result in reduced
    99     functionality and/or significantly degraded performance.
   101     Possible values for <params> when <pname> is TEXTURE_USAGE_ANGLE are:
   103     NONE - the default. No particular usage has been specified and it is
   104         up to the implementation to determine the usage of the texture.
   105         Leaving the usage unspecified means that the implementation may 
   106         have to reallocate the texture data as the texture is used in 
   107         various ways.
   109     FRAMEBUFFER_ATTACHMENT_ANGLE - this texture will be attached to a 
   110         framebuffer object and used as a desination for rendering or blits."
   112     Modify section 3.7.12 (Texture State) and place the last 3 sentences
   113     with the following:
   115     "Next, there are the three sets of texture properties; each consists of
   116     the selected minification and magnification filters, the wrap modes for
   117     <s> and <t>, and the usage flags. In the initial state, the value assigned
   118     to TEXTURE_MIN_FILTER is NEAREST_MIPMAP_LINEAR, and the value for 
   119     TEXTURE_MAG_FILTER is LINEAR. <s> and <t> wrap modes are both set to
   120     REPEAT. The initial value for TEXTURE_USAGE_ANGLE is NONE."
   123 Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
   124 Operations and the Framebuffer)
   126     None
   128 Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
   129 Functions):
   131     None
   133 Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and
   134 State Requests)
   136     None
   138 Dependencies on EXT_texture_storage
   140     If EXT_texture_storage is not supported, omit any references to 
   141     TexStorage2DEXT.
   143 Errors
   145     If TexParameter{if} or TexParamter{if}v is called with a <pname>
   146     of TEXTURE_USAGE_ANGLE and the value of <param> or <params> is not
   147     NONE or FRAMEBUFFER_ATTACHMENT_ANGLE the error INVALID_VALUE is
   148     generated.
   150 Usage Example
   152     /* create and bind texture */
   153     glGenTextures(1, &texture);
   154     glActiveTexture(GL_TEXTURE0);
   155     glBindTexture(GL_TEXTURE_2D, texture);
   157     /* specify texture parameters */
   158     glTexParameteri(GL_TEXTURE_2D, GL_*, ...);  /* as before */
   160     /* specify that we'll be rendering to the texture */
   161     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
   163     glTexStorage2DEXT(GL_TEXTURE_2D, levels, ...); // Allocation
   164     for(int level = 0; level < levels; ++level)
   165         glTexSubImage2D(GL_TEXTURE_2D, level, ...); // Initialisation
   167 Issues
   169     1. Should there be a dynamic usage value?
   171        DISCUSSION: We could accept a dynamic flag to indicate that a texture will
   172        be updated frequently. We could map this to D3D9 dynamic textures. This would
   173        allow us to avoid creating temporary surfaces when updating the texture.
   174        However renderable textures cannot be dynamic in D3D9, which eliminates the 
   175        primary use case for this.  Furthermore, the memory usage of dynamic textures
   176        typically increases threefold when you lock it.
   178     2. Should the texture usage be an enum or a bitfield?
   180        UNRESOLVED.  Using a bitfield would allow combination of values to be specified.
   181        On the other hand, if combinations are really required, additional <pnames>
   182        could be added as necessary.  Querying a bitfield via the GetTexParameter command
   183        feels a bit odd.
   185     3. What should happen if TEXTURE_USAGE_ANGLE is set/changed after the texture
   186        contents have been specified?
   188        RESOLVED: It will have no effect. However, if the texture is redefined (for 
   189        example by TexImage2D) the new allocation will use the updated usage.
   190        GetTexParameter is used to query the value of the TEXTURE_USAGE_ANGLE
   191        state that was last set by TexParameter for the currently bound texture, or
   192        the default value if it has never been set. There is no way to determine the 
   193        usage that was in effect at the time the texture was defined.
   195 Revision History
   197     Rev.    Date      Author     Changes
   198     ----  ----------- ---------  ----------------------------------------
   199       1   10 Nov 2011 dgkoch     Initial revision
   200       2   10 Nov 2011 dgkoch     Add overview

mercurial