15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_sRGB
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_sRGB
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Maurice Ribble
125bd8deadSopenharmony_ci    Tero Aurto
135bd8deadSopenharmony_ci    Jon Leech
145bd8deadSopenharmony_ci    Mark Callow
155bd8deadSopenharmony_ci    Daniel Koch
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    Parts of this extension are copied from ARB_framebuffer_sRGB.
185bd8deadSopenharmony_ci    Parts of this extension are copied from EXT_texture_sRGB.
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciContact
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Maurice Ribble, Qualcomm (mribble 'at' qualcomm.com)
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciStatus
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    Not complete.
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciVersion
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Date: Sept 14, 2011
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciNumber
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    OpenGL ES Extension #105
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciDependencies
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    This requires OpenGL ES 1.0 or greater.  This extension is written based on
395bd8deadSopenharmony_ci    the wording of the OpenGL ES 2.0 specification.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    This extension requires support for OES_rgb8_rgba8 or equivalent 
425bd8deadSopenharmony_ci    functionality.
435bd8deadSopenharmony_ci    
445bd8deadSopenharmony_ci    If OES_texture_3D is not supported then the parts of this extension for 3d
455bd8deadSopenharmony_ci    textures should be ignored.
465bd8deadSopenharmony_ci    
475bd8deadSopenharmony_ci    If this is being used with ES 1.x then you need to support 
485bd8deadSopenharmony_ci    OES_framebuffer_object for the framebuffer object related features in this
495bd8deadSopenharmony_ci    extension.
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ciOverview
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    The sRGB color space is based on typical (non-linear) response of the human
545bd8deadSopenharmony_ci    eye.  It has been standardized by the International Electrotechnical 
555bd8deadSopenharmony_ci    Commission (IEC) as IEC 61966-2-1.  The transfer function of sRGB roughly
565bd8deadSopenharmony_ci    corresponds to a power function with a gamma of 2.2.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    FRAMEBUFFERS
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    OpenGL assumes framebuffer color components are stored in a linear color
615bd8deadSopenharmony_ci    space.  In particular, framebuffer blending is a linear operation.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension adds a framebuffer capability for sRGB framebuffer update
645bd8deadSopenharmony_ci    and blending.  When blending is disabled but the new sRGB updated mode is
655bd8deadSopenharmony_ci    enabled (assume the framebuffer supports the capability), high-precision 
665bd8deadSopenharmony_ci    linear color component values for red, green, and blue generated by
675bd8deadSopenharmony_ci    fragment coloring are encoded for sRGB prior to being written into the
685bd8deadSopenharmony_ci    framebuffer.  When blending is enabled along with the new sRGB update mode,
695bd8deadSopenharmony_ci    red, green, and blue framebuffer color components are treated as sRGB
705bd8deadSopenharmony_ci    values that are converted to linear color values, blended with the high-
715bd8deadSopenharmony_ci    precision color values generated by fragment coloring, and then the blend
725bd8deadSopenharmony_ci    result is encoded for sRGB just prior to being written into the 
735bd8deadSopenharmony_ci    framebuffer.
745bd8deadSopenharmony_ci    
755bd8deadSopenharmony_ci    TEXTURES
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    Conventional texture formats assume a linear color space.  So for a 
785bd8deadSopenharmony_ci    conventional internal texture format such as GL_RGB8, the 256 discrete
795bd8deadSopenharmony_ci    values for each 8-bit color component map linearly and uniformly to the
805bd8deadSopenharmony_ci    [0,1] range.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ciNew Procedures and Functions
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    None
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ciNew Tokens
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    Accepted by the <format> and <internalformat> parameter of TexImage2D, and 
895bd8deadSopenharmony_ci    TexImage3DOES.  These are also accepted by <format> parameter of 
905bd8deadSopenharmony_ci    TexSubImage2D and TexSubImage3DOES:
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci        SRGB_EXT                                       0x8C40
935bd8deadSopenharmony_ci        SRGB_ALPHA_EXT                                 0x8C42
945bd8deadSopenharmony_ci    
955bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of RenderbufferStorage:
965bd8deadSopenharmony_ci        SRGB8_ALPHA8_EXT                               0x8C43
975bd8deadSopenharmony_ci        
985bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv:
995bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT      0x8210
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ciAdditions to Chapter 3 of the 2.0 Specification (Rasterization)
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ciModify Section 3.7.1, Texture Image Specification:
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci    Add 2 new rows to Table 3.3
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci        SRGB_EXT             R, G, B        Color
1085bd8deadSopenharmony_ci        SRGB_ALPHA_EXT       R, G, B, A     Color
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    Add 2 new rows to Table 3.4
1115bd8deadSopenharmony_ci    
1125bd8deadSopenharmony_ci        SRGB_EXT           UNSIGNED_BYTE     3
1135bd8deadSopenharmony_ci        SRGB_ALPHA_EXT     UNSIGNED_BYTE     4
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ciModify Section 3.7.11: Mipmap Generation
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    Add the following sentence to the end of this section:
1185bd8deadSopenharmony_ci    
1195bd8deadSopenharmony_ci    If the format of a texture is sRGB, he error INVALID_OPERATION is 
1205bd8deadSopenharmony_ci    generated.
1215bd8deadSopenharmony_ci        
1225bd8deadSopenharmony_ciAdd Section 3.7.14, sRGB Texture Color Conversion
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    If the currently bound texture's internal format is one of SRGB_EXT or 
1255bd8deadSopenharmony_ci    SRGB_ALPHA_EXT the red, green, and blue components are converted from an
1265bd8deadSopenharmony_ci    sRGB color space to a  linear color space as part of filtering described in
1275bd8deadSopenharmony_ci    sections 3.7.7 and 3.7.8. Any alpha component is left unchanged.  Ideally,
1285bd8deadSopenharmony_ci    implementations should perform this color conversion on each sample prior
1295bd8deadSopenharmony_ci    to filtering but implementations are allowed to perform this conversion
1305bd8deadSopenharmony_ci    after filtering (though this post-filtering approach is inferior to 
1315bd8deadSopenharmony_ci    converting from sRGB prior to filtering).
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    The conversion from an sRGB encoded component, cs, to a linear component,
1345bd8deadSopenharmony_ci    cl, is as follows.
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci            {  cs / 12.92,                 cs <= 0.04045
1375bd8deadSopenharmony_ci       cl = {
1385bd8deadSopenharmony_ci            {  ((cs + 0.055)/1.055)^2.4,   cs >  0.04045
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    Assume cs is the sRGB component in the range [0,1]."
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ciAdditions to Chapter 4 of the Specification
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    DELETE the following sentence from section 4.1.6 (Blending) because it is 
1455bd8deadSopenharmony_ci    moved to the new "sRGB Conversion" section:
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    Each of these floating-point values is clamped to [0,1] and converted back
1485bd8deadSopenharmony_ci    to a fixed-point value in the manner described in section 2.1.2.
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    Replace the following sentence:
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    Destination (framebuffer) components are taken to be fixed-point values 
1535bd8deadSopenharmony_ci    represented according to the scheme in section 2.1.2 (Final Color 
1545bd8deadSopenharmony_ci    Processing), as are source (fragment) components.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    with the following sentences:
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    Destination (framebuffer) components are taken to be fixed-point values
1595bd8deadSopenharmony_ci    represented according to the scheme in section 2.1.2 (Final Color
1605bd8deadSopenharmony_ci    Processing).  The R G, and B destination color values (after conversion
1615bd8deadSopenharmony_ci    from fixed-point to floating-point) are considered to be encoded for the
1625bd8deadSopenharmony_ci    sRGB color space and hence need to be linearized prior to their use in
1635bd8deadSopenharmony_ci    blending.  Each R, G, and B component is linearized by some approximation
1645bd8deadSopenharmony_ci    of the following:
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci            {  cs / 12.92,                 cs <= 0.04045
1675bd8deadSopenharmony_ci       cl = {
1685bd8deadSopenharmony_ci            {  ((cs + 0.055)/1.055)^2.4,   cs >  0.04045
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    where cs is the component value prior to linearization and cl is the 
1715bd8deadSopenharmony_ci    result.
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    If the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT for the 
1745bd8deadSopenharmony_ci    framebuffer attachment corresponding to the destination buffer is SRGB, the
1755bd8deadSopenharmony_ci    R, G, and B destination color values (after conversion from fixedpoint to 
1765bd8deadSopenharmony_ci    floating-point) are considered to be encoded for the sRGB color space and 
1775bd8deadSopenharmony_ci    hence must be linearized prior to their use in blending. Each R, G, and B 
1785bd8deadSopenharmony_ci    component is converted in the same fashion described for sRGB texture 
1795bd8deadSopenharmony_ci    components as described below.
1805bd8deadSopenharmony_ci    
1815bd8deadSopenharmony_ci    If the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT is not SRGB, no 
1825bd8deadSopenharmony_ci    linearization is performed.
1835bd8deadSopenharmony_ci    
1845bd8deadSopenharmony_ci    The resulting linearized R, G, and B and unmodified A values are
1855bd8deadSopenharmony_ci    recombined as the destination color used in blending computations.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    ADD new section 4.1.X "sRGB Conversion".  With this new section added,
1885bd8deadSopenharmony_ci    understand the "next operation" referred to in the section 4.1.6
1895bd8deadSopenharmony_ci    (Blending) to now be "sRGB Conversion" (instead of "Dithering").
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    "If the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT for the 
1925bd8deadSopenharmony_ci    framebuffer attachment corresponding to the destination buffer is SRGB, the
1935bd8deadSopenharmony_ci    R, G, and B values after blending are converted into the non-linear sRGB 
1945bd8deadSopenharmony_ci    color space by computing:
1955bd8deadSopenharmony_ci    
1965bd8deadSopenharmony_ci             {  0.0,                          cl        <= 0
1975bd8deadSopenharmony_ci             {  12.92 * c,                    0         <  cl < 0.0031308
1985bd8deadSopenharmony_ci        cs = {  1.055 * cl^0.41666 - 0.055,   0.0031308 <= cl < 1
1995bd8deadSopenharmony_ci             {  1.0,                                       cl >= 1
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    where cl is the R, G, or B element and cs is the result (effectively
2025bd8deadSopenharmony_ci    converted into an sRGB color space).
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    The resulting cs values for R, G, and B and the unmodified A form a new 
2055bd8deadSopenharmony_ci    RGBA color value. If the color buffer is fixed-point, the components of
2065bd8deadSopenharmony_ci    this RGBA color value are clamped to [0,1] and then converted to a fixed-
2075bd8deadSopenharmony_ci    point value.  The resulting four values are sent to the subsequent 
2085bd8deadSopenharmony_ci    dithering operation."
2095bd8deadSopenharmony_ci    
2105bd8deadSopenharmony_ci    The following should be added to table 4.5 Renderbuffer Image formats:
2115bd8deadSopenharmony_ci    SRGB8_ALPHA8_EXT     color_renderable 8  8  8  8  -  -
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ciAdditions to Chapter 5 of the 2.0 Specification (Special Functions)
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    None
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ciAdditions to Chapter 6 of the 2.0 Specification (State and State Requests)
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci    Add the following to 6.1.13's description of 
2205bd8deadSopenharmony_ci    GetFramebufferAttachmentParameteriv:
2215bd8deadSopenharmony_ci    
2225bd8deadSopenharmony_ci    If pname is FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT, param will contain 
2235bd8deadSopenharmony_ci    the encoding of components of the specified attachment, one of LINEAR or 
2245bd8deadSopenharmony_ci    SRGB for linear or sRGB-encoded components, respectively. Only color buffer
2255bd8deadSopenharmony_ci    components may be sRGB-encoded. For the default framebuffer, color encoding
2265bd8deadSopenharmony_ci    is determined by the implementation. For framebuffer objects, components
2275bd8deadSopenharmony_ci    are sRGB-encoded if the internal format of a color attachment is SRGB_EXT, SRGB_ALPHA_EXT, or SRGB8_ALPHA8_EXT.
2285bd8deadSopenharmony_ci    
2295bd8deadSopenharmony_ci    Add the following to 6.2 State Tables
2305bd8deadSopenharmony_ci    
2315bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING z2 GetFramebufferAttachementParameteriv
2325bd8deadSopenharmony_ci     - Encoding of components in the attached image  6.1.13
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language specification
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    None
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ciAdditions to the GLX Specification
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    None
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ciErrors
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    Relaxation of INVALID_ENUM errors
2455bd8deadSopenharmony_ci    ---------------------------------
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    TexImage2D, TexImage3DOES, and RenderBufferStorage now accept the new 
2485bd8deadSopenharmony_ci    tokens as listed in the "New Tokens" section.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ciNew Implementation Dependent State
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    None
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ciIssues
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ci    1) Do we require SRGB8_EXT be supported for RenderbufferStorage?
2575bd8deadSopenharmony_ci    
2585bd8deadSopenharmony_ci    No.  Some hardware would need to pad this out to RGBA and instead of adding
2595bd8deadSopenharmony_ci    that unknown for application  developers we will simply not support that
2605bd8deadSopenharmony_ci    format in this extension.
2615bd8deadSopenharmony_ci    
2625bd8deadSopenharmony_ci    2) Should the SLUMINANCE* family be supported?
2635bd8deadSopenharmony_ci     
2645bd8deadSopenharmony_ci    No.  Luminance is a rarely used format so we won't support it here.
2655bd8deadSopenharmony_ci    
2665bd8deadSopenharmony_ci    3) Should we allow the SRGB_*_S3TC_DXT* or any of the other COMPRESSED
2675bd8deadSopenharmony_ci    formats if the implementation supports any of those formats?
2685bd8deadSopenharmony_ci    
2695bd8deadSopenharmony_ci    No since all hardware doesn't support this.  It can be added as a separate
2705bd8deadSopenharmony_ci    extension if needed.
2715bd8deadSopenharmony_ci    
2725bd8deadSopenharmony_ci    4) What is the expectation for mipmap generation on SRGB textures?  Issue
2735bd8deadSopenharmony_ci    24 from EXT_texture_sRGB gives two possible ways, will we leave it 
2745bd8deadSopenharmony_ci    similarly undefined, or is this not intended to be supported at all?
2755bd8deadSopenharmony_ci    
2765bd8deadSopenharmony_ci    No.  This in not likely to be used much so for simplicity let's not require
2775bd8deadSopenharmony_ci    it.  This will generate an INVALID_OPERATION error.
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ciRevision History
2805bd8deadSopenharmony_ci  #06    9/14/2011    Maurice Ribble     Removed compressed formats and
2815bd8deadSopenharmony_ci                                          disallowed generateMipmaps
2825bd8deadSopenharmony_ci  #05    9/12/2011    Maurice Ribble     Updated issues and added 
2835bd8deadSopenharmony_ci                                          FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
2845bd8deadSopenharmony_ci  #04    8/18/2011    Maurice Ribble     Fixes and issues from Daniel Koch.
2855bd8deadSopenharmony_ci  #03    7/21/2011    Maurice Ribble     Language cleanup suggested by Jon 
2865bd8deadSopenharmony_ci                                         Leech and Mark Callow.
2875bd8deadSopenharmony_ci  #02    7/20/2011    Maurice Ribble     Minor updates.
2885bd8deadSopenharmony_ci  #01    3/17/2011    Maurice Ribble     First draft.
289