15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_texture_sRGB 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_texture_sRGB 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Alain Bouchard, Matrox 125bd8deadSopenharmony_ci Brian Paul, Tungsten Graphics 135bd8deadSopenharmony_ci Daniel Vogel, Epic Games 145bd8deadSopenharmony_ci Eric Werness, NVIDIA 155bd8deadSopenharmony_ci Kiril Vidimce, Pixar 165bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA 175bd8deadSopenharmony_ci Pat Brown, NVIDIA 185bd8deadSopenharmony_ci Yanjun Zhang, S3 Graphics 195bd8deadSopenharmony_ci Jeremy Sandmel, Apple 205bd8deadSopenharmony_ci Herb Kuta, Quantum3D 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciContact 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciStatus 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Implemented by NVIDIA's Release 80 driver series for GeForce FX 295bd8deadSopenharmony_ci (NV3x), GeForce 6 and 7 Series (NV4x and G7x), and Quadro FX (NV3xGL, 305bd8deadSopenharmony_ci NV4xGL, G7xGL). 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Date: January 24, 2007 355bd8deadSopenharmony_ci Revision: 0.8 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciNumber 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci 315 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciDependencies 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci OpenGL 1.1 required 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci EXT_texture_compression_s3tc interacts with this extension. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci NV_texture_compression_vtc interacts with this extension. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This extension is written against the OpenGL 2.0 (September 7, 505bd8deadSopenharmony_ci 2004) specification. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ciOverview 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci Conventional texture formats assume a linear color space. So for 555bd8deadSopenharmony_ci a conventional internal texture format such as GL_RGB8, the 256 565bd8deadSopenharmony_ci discrete values for each 8-bit color component map linearly and 575bd8deadSopenharmony_ci uniformly to the [0,1] range. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci The sRGB color space is based on typical (non-linear) monitor 605bd8deadSopenharmony_ci characteristics expected in a dimly lit office. It has been 615bd8deadSopenharmony_ci standardized by the International Electrotechnical Commission (IEC) 625bd8deadSopenharmony_ci as IEC 61966-2-1. The sRGB color space roughly corresponds to 2.2 635bd8deadSopenharmony_ci gamma correction. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci This extension adds a few new uncompressed and compressed color 665bd8deadSopenharmony_ci texture formats with sRGB color components. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ciIssues 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci 1) What should this extension be called? 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci RESOLVED: EXT_texture_sRGB. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci The "EXT_texture" part indicates the extension is in the texture 755bd8deadSopenharmony_ci domain and "sRGB" indicates the extension is adding a set of 765bd8deadSopenharmony_ci sRGB formats. ARB_texture_float is similarly named where "_float" 775bd8deadSopenharmony_ci indicates float texture formats are added by the extension. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci The mixed-case spelling of sRGB is the established usage so 805bd8deadSopenharmony_ci "_sRGB" is preferred to "_srgb". The "s" stands for standard 815bd8deadSopenharmony_ci (color space). 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci For token names, we use "SRGB" since token names are uniformly 845bd8deadSopenharmony_ci capitalized. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci 2) Should this extension mandate that sRGB conversion be performed 875bd8deadSopenharmony_ci pre-filtering? 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci RESOLVED: Post-filtering sRGB color conversion is allowed though 905bd8deadSopenharmony_ci pre-filtering conversion is the preferred approach. 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci Ideally, sRGB conversion moves from the non-linear sRGB to the 935bd8deadSopenharmony_ci linear RGB color space. However, implementations should be 945bd8deadSopenharmony_ci provided leeway as to whether sRGB conversion occurs before or 955bd8deadSopenharmony_ci after texture filtering of RGB components. 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci 3) Should the alpha component of sRGB texture formats be 985bd8deadSopenharmony_ci gamma-corrected? 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci RESOLVED: No. Alpha is correctly understood to be a weighting 1015bd8deadSopenharmony_ci factor that is best stored in a linear representation. The alpha 1025bd8deadSopenharmony_ci component should always be stored as a linear value. 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci "SRGB_ALPHA" is used to indicate sRGB formats with an alpha 1055bd8deadSopenharmony_ci component. This naming (as opposed to something like "SRGBA") 1065bd8deadSopenharmony_ci helps highlight the fact that the alpha component is separate 1075bd8deadSopenharmony_ci and stored with a linear distribution of precision. 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci 4) Should formats for sRGB luminance values be supported? 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci RESOLVED: Yes. Implementations can always support luminance 1125bd8deadSopenharmony_ci and luminance-alpha sRGB formats as an RGB8 or RGBA8 format with 1135bd8deadSopenharmony_ci replicated R, G, and B values. 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci For lack of a better term, "SLUMINANCE" will be used within 1165bd8deadSopenharmony_ci token names to indicate sRGB values with identical red, green, 1175bd8deadSopenharmony_ci and blue components. 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci 5) Should formats for sRGB intensity values be supported? 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci RESOLVED: No. Intensity uses the same value for both luminance 1225bd8deadSopenharmony_ci and alpha. Treating a single value as an sRGB luminance value 1235bd8deadSopenharmony_ci and a linear alpha value is undesirable. 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci Hardware design is simplified if alpha never involves sRGB 1265bd8deadSopenharmony_ci conversions. 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci 6) Should all component sizes be supported for sRGB components or 1295bd8deadSopenharmony_ci just 8-bit? 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci RESOLVED: Just 8-bit. For sRGB values with more than 8 bit of 1325bd8deadSopenharmony_ci precision, a linear representation may be easier to work with 1335bd8deadSopenharmony_ci and adequately represent dim values. Storing 5-bit and 6-bit 1345bd8deadSopenharmony_ci values in sRGB form is unnecessary because applications 1355bd8deadSopenharmony_ci sophisticated enough to sRGB to maintain color precision will 1365bd8deadSopenharmony_ci demand at least 8-bit precision for sRGB values. 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci Because hardware tables are required sRGB conversions, it doesn't 1395bd8deadSopenharmony_ci make sense to burden hardware with conversions that are unlikely 1405bd8deadSopenharmony_ci when 8-bit is the norm for sRGB values. 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci 7) Should color tables, convolution kernels, histogram table, 1435bd8deadSopenharmony_ci and minmax table entries support sRGB formats? 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci RESOLVED: No. 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci The internalformat for histogram table entries determines the bit 1485bd8deadSopenharmony_ci precision of the histogram bin counters so indicating the sRGB 1495bd8deadSopenharmony_ci color space is meaningless in this context. The internalformat 1505bd8deadSopenharmony_ci for minmax table entries simply indicates the components 1515bd8deadSopenharmony_ci for minmax bounding so indicating the sRGB color space is 1525bd8deadSopenharmony_ci meaningless. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci Convolution filter values are weighting factors rather than 1555bd8deadSopenharmony_ci color values needing a color space. 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci Color table entries may be colors but the component values are 1585bd8deadSopenharmony_ci typically stored with more than 8 bits already. For example, 1595bd8deadSopenharmony_ci software implementations of the OpenGL color table functionality 1605bd8deadSopenharmony_ci typically store colors in floating-point. 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci 8) Should generic compressed sRGB formats be supported? 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci RESOLVED: Yes. Implementations are free simply to use 1655bd8deadSopenharmony_ci uncompressed sRGB formats to implement the GL_COMPRESSED_SRGB_* 1665bd8deadSopenharmony_ci formats. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci 9) Should S3TC compressed sRGB formats be supported? 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci RESOLVED: Yes, but only if EXT_texture_compression_s3tc is also 1715bd8deadSopenharmony_ci advertised. For competitive reasons, we expect OpenGL will need 1725bd8deadSopenharmony_ci an S3TC-based block compression format for sRGB data. 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci Rather than expose a separate "sRGB_compression" extension, 1755bd8deadSopenharmony_ci it makes more sense to specify a dependency between 1765bd8deadSopenharmony_ci EXT_texture_compression_s3tc and this extension such that when 1775bd8deadSopenharmony_ci BOTH extensions are exposed, the GL_COMPRESSED_SRGB*_S3TC_DXT*_EXT 1785bd8deadSopenharmony_ci tokens are accepted. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci We avoid explicitly requiring S3TC formats when EXT_texture_sRGB 1815bd8deadSopenharmony_ci is advertised to avoid IP encumbrances. 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci 10) Should the S3TC decompression algorithm be affected by support 1845bd8deadSopenharmony_ci for sRGB component values? 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci RESOLVED: No. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci S3TC involves the linear weighting of two per-block R5G6B5 colors. 1895bd8deadSopenharmony_ci The sRGB to linear RGB color conversion should occur AFTER the 1905bd8deadSopenharmony_ci linear weighting of the two per-block colors performed during 1915bd8deadSopenharmony_ci texel decompression. 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci Also be aware that an sRGB value with 8-bit red, green, and blue 1945bd8deadSopenharmony_ci components must be quantized to a 5, 6, and 5 bits respectively 1955bd8deadSopenharmony_ci to form the two per-block R5G6B5 colors. 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci S3TC compressors may wish to account for the sRGB color space 1985bd8deadSopenharmony_ci as part of the compression algorithm. 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci 11) Should VTC compressed sRGB formats be supported? 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci RESOLVED. Yes, for the same reasons as S3TC. 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci 12) Should pixel data entering or exiting the OpenGL pixel path be 2055bd8deadSopenharmony_ci labeled as sRGB or conventional linear RGB? This would allow 2065bd8deadSopenharmony_ci pixels labeled as sRGB to be converted to a linear RGB color space 2075bd8deadSopenharmony_ci prior to processing by the pixel path which includes operations 2085bd8deadSopenharmony_ci such as convolution, scale, and bias that presume a linear 2095bd8deadSopenharmony_ci color space. If the destination (say a texture with an sRGB 2105bd8deadSopenharmony_ci internal format) was sRGB, then linear RGB components would be 2115bd8deadSopenharmony_ci converted to sRGB prior to being packed into the texture image. 2125bd8deadSopenharmony_ci This would assume new format parameters to glDrawPixels and 2135bd8deadSopenharmony_ci glReadPixels indicating the source or destination format was 2145bd8deadSopenharmony_ci sRGB if a GL_SRGB_EXT or GL_SRGB_ALPHA_EXT format is specified. 2155bd8deadSopenharmony_ci Likewise, a format parameter to glTexImage2D such as GL_SRGB_EXT 2165bd8deadSopenharmony_ci would indicate the pixel data was already in an sRGB color space 2175bd8deadSopenharmony_ci where GL_RGB would indicate a linear color space. New state 2185bd8deadSopenharmony_ci would indicate if the framebuffer held sRGB or linear RGB pixels. 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci RESOLVED: No. 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci The pixel path should be left blind to color spaces and provide 2235bd8deadSopenharmony_ci no implicit conversions. 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci Core pixel maps and ARB_imaging provides sufficient color 2265bd8deadSopenharmony_ci tables so that applications interested in managing color space 2275bd8deadSopenharmony_ci conversions within the pixel path can do so themselves. 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci A 256 entry table outputting floating-point values is sufficient 2305bd8deadSopenharmony_ci to convert sRGB to linear RGB. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci However when converting from linear RGB to sRGB, one must 2335bd8deadSopenharmony_ci be careful to make sure the source linear RGB values are 2345bd8deadSopenharmony_ci specified with more than 8 bits of precision and the color 2355bd8deadSopenharmony_ci table to implement the conversion must likewise have more than 2365bd8deadSopenharmony_ci 256 entries. A power-of-two table sufficient to map values 2375bd8deadSopenharmony_ci to each of the 256 sRGB encodings for an 8-bit sRGB component 2385bd8deadSopenharmony_ci requires at least 4096 entries (a fairly large color table). 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci Because vertex and fragment programs and shaders operate in 2415bd8deadSopenharmony_ci floating-point and have sufficient programmability to implement 2425bd8deadSopenharmony_ci the sRGB to linear RGB and vice versa without resorting to large 2435bd8deadSopenharmony_ci tables. 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci 13) Does this extension imply filtered results from sRGB texture 2465bd8deadSopenharmony_ci have more than 8 bits of precision? 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci RESOLVED: Effectively, yes. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci 8-bit components of sRGB texels are converted to linear RGB values 2515bd8deadSopenharmony_ci which requires more than 8 bits to avoid lose of precision. 2525bd8deadSopenharmony_ci This implies the filtering involve more than 8 bits of color 2535bd8deadSopenharmony_ci precision per component. Moreover, fragment color (whether by 2545bd8deadSopenharmony_ci a fragment program, vertex program, or glTexEnv modes) should 2555bd8deadSopenharmony_ci operate at precision beyond 8 bits per color component. 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci The exact precision maintained (and its distribution) is left to 2585bd8deadSopenharmony_ci implementations to define but returning at least 12 but more 2595bd8deadSopenharmony_ci likely 16 linear bits per component, post-filtering, is a 2605bd8deadSopenharmony_ci reasonable expectation for developers. 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci This extension assumes fragment coloring is performed 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci 14) What must be specified as far as how do you convert to and from 2655bd8deadSopenharmony_ci sRGB and linear RGB color spaces? 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci RESOLVED: The specification language needs to only supply the 2685bd8deadSopenharmony_ci sRGB to linear RGB conversion (see section 3.8.x below). 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci For completeness, the accepted linear RGB to sRGB conversion 2715bd8deadSopenharmony_ci (the inverse of the function specified in section 3.8.x) is as 2725bd8deadSopenharmony_ci follows: 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci Given a linear RGB component, cl, convert it to an sRGB component, 2755bd8deadSopenharmony_ci cs, in the range [0,1], with this pseudo-code: 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci if (isnan(cl)) { 2785bd8deadSopenharmony_ci /* Map IEEE-754 Not-a-number to zero. */ 2795bd8deadSopenharmony_ci cs = 0.0; 2805bd8deadSopenharmony_ci } else if (cl > 1.0) { 2815bd8deadSopenharmony_ci cs = 1.0; 2825bd8deadSopenharmony_ci } else if (cl < 0.0) { 2835bd8deadSopenharmony_ci cs = 0.0; 2845bd8deadSopenharmony_ci } else if (cl < 0.0031308) { 2855bd8deadSopenharmony_ci cs = 12.92 * cl; 2865bd8deadSopenharmony_ci } else { 2875bd8deadSopenharmony_ci cs = 1.055 * pow(cl, 0.41666) - 0.055; 2885bd8deadSopenharmony_ci } 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ci sRGB components are typically stored as unsigned 8-bit 2915bd8deadSopenharmony_ci fixed-point values. If cs is computed with the above 2925bd8deadSopenharmony_ci pseudo-code, cs can be converted to a [0,255] integer with this 2935bd8deadSopenharmony_ci formula: 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci csi = floor(255.0 * cs + 0.5) 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci 15) Does this extension provide any sort of sRGB framebuffer formats 2985bd8deadSopenharmony_ci or guarantee images rendered with sRGB textures will "look good" 2995bd8deadSopenharmony_ci when output to a device supporting an sRGB color space? 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci RESOLVED: No. 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci Whether the displayed framebuffer is displayed to a monitor that 3045bd8deadSopenharmony_ci faithfully reproduces the sRGB color space is beyond the scope 3055bd8deadSopenharmony_ci of this extension. This involves the gamma correction and color 3065bd8deadSopenharmony_ci calibration of the physical display device. 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci With this extension, artists can author content in an sRGB color 3095bd8deadSopenharmony_ci space and provide that sRGB content for use as texture imagery 3105bd8deadSopenharmony_ci that can be properly converted to linear RGB and filtered as part 3115bd8deadSopenharmony_ci of texturing in a way that preserves the sRGB distribution of 3125bd8deadSopenharmony_ci precision, but that does NOT mean sRGB pixels are output 3135bd8deadSopenharmony_ci to the framebuffer. Indeed, this extension provides texture 3145bd8deadSopenharmony_ci formats that convert sRGB to linear RGB as part of filtering. 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci With programmable shading, an application could perform a 3175bd8deadSopenharmony_ci linear RGB to sRGB conversion just prior to emitting color 3185bd8deadSopenharmony_ci values from the shader. Even so, OpenGL blending (other than 3195bd8deadSopenharmony_ci simple modulation) will perform linear math operations on values 3205bd8deadSopenharmony_ci stored in a non-linear space which is technically incorrect for 3215bd8deadSopenharmony_ci sRGB-encoded colors. 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci One way to think about these sRGB texture formats is that they 3245bd8deadSopenharmony_ci simply provide color components with a distribution of values 3255bd8deadSopenharmony_ci distributed to favor precision towards 0 rather than evenly 3265bd8deadSopenharmony_ci distributing the precision with conventional non-sRGB formats 3275bd8deadSopenharmony_ci such as GL_RGB8. 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci 16) How does this extension interact with EXT_framebuffer_object? 3305bd8deadSopenharmony_ci 3315bd8deadSopenharmony_ci RESOLVED: No specific interaction language is necessary but 3325bd8deadSopenharmony_ci there is no provision that pixels written into a framebuffer 3335bd8deadSopenharmony_ci object with a texture with an sRGB internal format for its color 3345bd8deadSopenharmony_ci buffer will in anyway convert the output color values into an sRGB 3355bd8deadSopenharmony_ci color space. A fragment program or shader could be written to 3365bd8deadSopenharmony_ci convert linear RGB values to sRGB values prior to shader output, 3375bd8deadSopenharmony_ci but NO automatic conversion is performed. 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci So you can create a texture with an sRGB internal format (such 3405bd8deadSopenharmony_ci as GL_SRGB8_ALPHA8_EXT), bind that texture to a framebuffer 3415bd8deadSopenharmony_ci object with glFramebufferTexture2DEXT, and then render into 3425bd8deadSopenharmony_ci that framebuffer. If you then texture with the sRGB texture, 3435bd8deadSopenharmony_ci the texels within the texture are treated as sRGB values for 3445bd8deadSopenharmony_ci filtering. 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci 17) Should sRGB be supported with a texture parameter rather than 3475bd8deadSopenharmony_ci new texture formats? 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci RESOLVED: Adding new texture formats is the right approach. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci Hardware is expected to implements sRGB conversions via hardwired 3525bd8deadSopenharmony_ci look-up tables. Such tables are expensive (when sRGB isn't 3535bd8deadSopenharmony_ci being used, they are basically "wasted gates") and so we want to 3545bd8deadSopenharmony_ci minimize the number of unique tables that hardware must support. 3555bd8deadSopenharmony_ci However OpenGL supports various component sizes for RGB and RGBA 3565bd8deadSopenharmony_ci textures. 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci Various RGB texture formats have different bit sizes for R, G, 3595bd8deadSopenharmony_ci and B that map to [0,1]. Think about RGB5. It encodes values 3605bd8deadSopenharmony_ci 0/15, 1/15, 2/15, ... 14/15, and 15/15. Excepting 0/15==0.0 3615bd8deadSopenharmony_ci and 15/15==1.0, those values are different than the values 3625bd8deadSopenharmony_ci for RGB8 which would be 0/255, 1/255, ... 254/255, 255/255. 3635bd8deadSopenharmony_ci Technically, you'd need a different sRGB table to toggle between 3645bd8deadSopenharmony_ci RGB4 and sRGB4 than you'd need to toggle between RGB8 and sRGB8. 3655bd8deadSopenharmony_ci There are also RGB12 and RGB16 textures where it is simply not 3665bd8deadSopenharmony_ci tractable to implement 4096 and 65,536 entry tables, nor is the 3675bd8deadSopenharmony_ci "real" sRGB conversion math cheap enough to evaluate directly 3685bd8deadSopenharmony_ci at those precisions. 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci What this extension shouldn't require is sRGB conversion for 3715bd8deadSopenharmony_ci any component sizes beyond 8-bit. Indeed, it appears the only 3725bd8deadSopenharmony_ci component sizes sRGB users really care about are 8-bit components. 3735bd8deadSopenharmony_ci This is because if you have more than 8 bits per component, 3745bd8deadSopenharmony_ci you typically have enough precision to avoid the complexity 3755bd8deadSopenharmony_ci created by a non-linear RGB component encoding. Additionally, 3765bd8deadSopenharmony_ci sRGB users are picky about color reproduction so fewer than 8 3775bd8deadSopenharmony_ci bits is generally not acceptable to them. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci The problem with making a "toggle" (say controlled by 3805bd8deadSopenharmony_ci glTexParameter) is that hardware would very likely (indeed 3815bd8deadSopenharmony_ci it's pretty much certain) not implement toggling between RGB12 3825bd8deadSopenharmony_ci and sRGB12 formats. Recall that OpenGL doesn't mandate internal 3835bd8deadSopenharmony_ci formats so you can request GL_RGB8 and have the implementation 3845bd8deadSopenharmony_ci actually given you RGB12 or RGB10 or R5G6B5. 3855bd8deadSopenharmony_ci 3865bd8deadSopenharmony_ci It is inappropriate to put in a texture parameter mode where 3875bd8deadSopenharmony_ci we say "this mode works just with GL_RGB8 and GL_RGBA8 and yet 3885bd8deadSopenharmony_ci only when the underlying internal format is actually RGB8 or 3895bd8deadSopenharmony_ci RGBA8". We'd also surely preclude floating-point RGB formats, 3905bd8deadSopenharmony_ci signed RGB formats, new HDR formats, and certain compressed RGB 3915bd8deadSopenharmony_ci formats from being included because such formats don't really 3925bd8deadSopenharmony_ci even make sense for sRGB. 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci By adding new formats specifically for the sRGB color space, 3955bd8deadSopenharmony_ci we avoid all these problems. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci We also avoid an awkward precedent where other more varied 3985bd8deadSopenharmony_ci color spaces (CYMK, XYZ, and YUV being obvious examples) have 3995bd8deadSopenharmony_ci to "toggle" between RGB and RGBA formats. Indeed, already 4005bd8deadSopenharmony_ci extensions for such other color spaces (YUV and CMYK at least) 4015bd8deadSopenharmony_ci set the precedent of introducing new texture formats. 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci 18) How is the texture border color handled for sRGB formats? 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci RESOLVED: The texture border color is specified as four 4065bd8deadSopenharmony_ci floating-point values. Given that the texture border color can 4075bd8deadSopenharmony_ci be specified at such high precision, it is always treated as a 4085bd8deadSopenharmony_ci linear RGBA value. 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci Only texel components are converted from the sRGB encoding to a 4115bd8deadSopenharmony_ci linear RGB value ahead of texture filtering. The border color 4125bd8deadSopenharmony_ci can be used "as is" without any conversion. 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci The implication of this is, for example, that two textures with 4155bd8deadSopenharmony_ci GL_RGBA8 and GL_SRGB8_ALPHA8_EXT internal formats respectively and 4165bd8deadSopenharmony_ci a border color of (0.4, 0.2, 0.9, 0.1) and the GL_CLAMP_TO_BORDER 4175bd8deadSopenharmony_ci wrap mode will both return (0.4, 0.2, 0.9, 0.1) if 100% of the 4185bd8deadSopenharmony_ci border color is sampled. 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci By keeping the texture border color specified as a linear 4215bd8deadSopenharmony_ci RGB value at the API level allows developers to specify the 4225bd8deadSopenharmony_ci high-precision texture border color in a single consistent color 4235bd8deadSopenharmony_ci space without concern for how the sRGB conversion is implemented 4245bd8deadSopenharmony_ci in relation to filtering. 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci An implementation that does post-filtering sRGB conversion is 4275bd8deadSopenharmony_ci likely to store convert the texture border color to sRGB within 4285bd8deadSopenharmony_ci the driver so it can be filtered with the sRGB values coming 4295bd8deadSopenharmony_ci from texels and then the filtered sRGB value is converted to 4305bd8deadSopenharmony_ci linear RGB. 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci By maintaining the texture border color always in linear RGB, 4335bd8deadSopenharmony_ci we avoid developers having to know if an implementation is 4345bd8deadSopenharmony_ci performing the sRGB conversion (ideally) pre-filtering or (less 4355bd8deadSopenharmony_ci ideally) post-filtering. 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci 19) How does this extension interact with NV_texture_expand_normal? 4385bd8deadSopenharmony_ci 4395bd8deadSopenharmony_ci RESOLVED: sRGB components are not affected by the "expand normal" 4405bd8deadSopenharmony_ci mode even though they are unsigned components because they have 4415bd8deadSopenharmony_ci non-linear precision (similar to floating-point). 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci The alpha component of GL_SRGB8_ALPHA8_EXT and other sRGB formats 4445bd8deadSopenharmony_ci with an alpha component is affected by the "expand normal" mode. 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci The sRGB formats have unsigned components with [0,1] range which 4475bd8deadSopenharmony_ci is the requirement for the NV_texture_expand_normal extension's 4485bd8deadSopenharmony_ci operation. 4495bd8deadSopenharmony_ci 4505bd8deadSopenharmony_ci Be warned because sRGB formats distribute their precision more 4515bd8deadSopenharmony_ci towards zero, enabling the GL_EXPAND_NORMAL_NV mode with sRGB 4525bd8deadSopenharmony_ci textures will mean there are more representable negative values 4535bd8deadSopenharmony_ci than positive values. For example, the 8-bit value 128 maps 4545bd8deadSopenharmony_ci roughly to zero when encoded with a GL_RGB8 internal format and 4555bd8deadSopenharmony_ci then remapped with the GL_EXPAND_NORMAL_NV mode. In contrast, 4565bd8deadSopenharmony_ci the sRGB encoded 8-bit value 188 maps roughly to zero when encoded 4575bd8deadSopenharmony_ci with a GL_SRGB8_ALPHA8 internal format and then remapped with 4585bd8deadSopenharmony_ci GL_EXPAND_NORMAL_NV. Still 0 will map to -1 and 255 will map 4595bd8deadSopenharmony_ci to +1 in either case. 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci 20) What values should glGetTexImage return? Are the sRGB values 4625bd8deadSopenharmony_ci returned "as-is" or are they converted to linear RGB first? 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci RESOLVED: sRGB values are returned "as-is" without an 4655bd8deadSopenharmony_ci sRGB-to-linear conversion. Unlike other commands that transfer 4665bd8deadSopenharmony_ci pixel data, "No pixel transform operations are performed" on 4675bd8deadSopenharmony_ci the queried texture image. 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci 21) How does glCopyTex[Sub]Image work with sRGB? Suppose we're 4705bd8deadSopenharmony_ci rendering to a floating point pbuffer or framebuffer object and 4715bd8deadSopenharmony_ci do CopyTexImage. Are the linear framebuffer values converted 4725bd8deadSopenharmony_ci to sRGB during the copy? 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci RESOLVED: No, linear framebuffer values will NOT be automatically 4755bd8deadSopenharmony_ci converted to the sRGB encoding during the copy. If such a 4765bd8deadSopenharmony_ci conversion is desired, as explained in issue 12, the red, green, 4775bd8deadSopenharmony_ci and blue pixel map functionality can be used to implement a 4785bd8deadSopenharmony_ci linear-to-sRGB encoding translation. 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci 22) Should the new COMPRESSED_SRGB_* formats be listed in an 4815bd8deadSopenharmony_ci implementation's GL_COMPRESSED_TEXTURE_FORMATS list? 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci RESOLVED: No. Section 3.8.1 says formats listed by 4845bd8deadSopenharmony_ci GL_COMPRESSED_TEXTURE_FORMATS are "suitable for general-purpose 4855bd8deadSopenharmony_ci usage." The non-linear distribution of red, green, and 4865bd8deadSopenharmony_ci blue for these sRGB compressed formats makes them not really 4875bd8deadSopenharmony_ci general-purpose. 4885bd8deadSopenharmony_ci 4895bd8deadSopenharmony_ci 23) Could this extension be implemented by hardware with no special 4905bd8deadSopenharmony_ci hardware support for sRGB but does support native GL_RGB12 or 4915bd8deadSopenharmony_ci GL_RGB16 textures? If so, how? 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci RESOLVED. Yes. 4945bd8deadSopenharmony_ci 4955bd8deadSopenharmony_ci The conversion from the sRGB encoding to linear encoding described 4965bd8deadSopenharmony_ci in section 3.8.x could be performed at texture specification 4975bd8deadSopenharmony_ci time (after the image has been transformed by the pixel path) 4985bd8deadSopenharmony_ci rather than texture fetch time. 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci When glTexImage2D, glTexSubImage2D, glCopyTexImage2D, etc. occur, 5015bd8deadSopenharmony_ci the pixels would be transformed by the pixel path as normal and 5025bd8deadSopenharmony_ci then when pixels are converted to the internal texture format, 5035bd8deadSopenharmony_ci the section 3.8.x conversion is applied to the red, green, and 5045bd8deadSopenharmony_ci blue components (not alpha). The result of this conversion 5055bd8deadSopenharmony_ci can be quantized and stored into the respective red, green, 5065bd8deadSopenharmony_ci or blue 12-bit or 16-bit component of the stored texel. 5075bd8deadSopenharmony_ci 5085bd8deadSopenharmony_ci This means when a texture fetch occurs, no fetch-time conversion 5095bd8deadSopenharmony_ci is required. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci The advantages of this approach is that sRGB conversion is 5125bd8deadSopenharmony_ci pre-filtering (the ideal) and the hardware is not required to have 5135bd8deadSopenharmony_ci texture fetch hardware to perform the special sRGB conversion. 5145bd8deadSopenharmony_ci 5155bd8deadSopenharmony_ci The disadvantage of this technique is that sRGB textures may 5165bd8deadSopenharmony_ci require more space than required if 8-bit component sRGB components 5175bd8deadSopenharmony_ci are stored in texture memory. 5185bd8deadSopenharmony_ci 5195bd8deadSopenharmony_ci The ability to implement this extension in this manner provides 5205bd8deadSopenharmony_ci one more justification to avoid a "toggle" texture parameter 5215bd8deadSopenharmony_ci for sRGB conversion or not. 5225bd8deadSopenharmony_ci 5235bd8deadSopenharmony_ci One caveat to this approach is that glGetTexImage should 5245bd8deadSopenharmony_ci return the texel values with the sRGB conversion from section 5255bd8deadSopenharmony_ci 3.8.x "reverse converted". (The section 3.8.x function is 5265bd8deadSopenharmony_ci reversible.) As specified, the conversion is performed at fetch 5275bd8deadSopenharmony_ci time so the understanding is that data returned by glGetTexImage 5285bd8deadSopenharmony_ci should be the texels prior to the conversion. If the components 5295bd8deadSopenharmony_ci are stored converted, that means they must be reverse-converted 5305bd8deadSopenharmony_ci when returned by glGetTexImage. 5315bd8deadSopenharmony_ci 5325bd8deadSopenharmony_ci 24) How should mipmap generation work for sRGB textures? 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ci RESOLVED: The best way to perform mipmap generation for sRGB 5355bd8deadSopenharmony_ci textures is by downsampling the sRGB image in a linear color 5365bd8deadSopenharmony_ci space. 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci This involves converting the RGB components of sRGB texels 5395bd8deadSopenharmony_ci in a given texture image level to linear RGB space, filtering 5405bd8deadSopenharmony_ci appropriately in that linear RGB space, and then converting the 5415bd8deadSopenharmony_ci linear RGB values to sRGB for storage in the downsampled texture 5425bd8deadSopenharmony_ci level image. 5435bd8deadSopenharmony_ci 5445bd8deadSopenharmony_ci (Remember alpha, when present, is linear even in sRGB texture 5455bd8deadSopenharmony_ci formats.) 5465bd8deadSopenharmony_ci 5475bd8deadSopenharmony_ci The OpenGL specification says "No particular filter algorithm 5485bd8deadSopenharmony_ci is required, though a box filter is recommended as the default 5495bd8deadSopenharmony_ci filter" meaning there is no requirement for how even non-sRGB 5505bd8deadSopenharmony_ci mipmaps should be generated. So while the resolution to this 5515bd8deadSopenharmony_ci issue is technically a recommendation, it is however a strongly 5525bd8deadSopenharmony_ci advised recommendation. 5535bd8deadSopenharmony_ci 5545bd8deadSopenharmony_ci The rationale for why sRGB textures should be converted to 5555bd8deadSopenharmony_ci linear space prior to filtering and converted back to sRGB after 5565bd8deadSopenharmony_ci filtering is clear. If an implementation naively simply performed 5575bd8deadSopenharmony_ci linear filtering on (non-linear) sRGB components as if they were 5585bd8deadSopenharmony_ci in a linear space, the result tends to be a subtle darkening of 5595bd8deadSopenharmony_ci the texture images as mipmap generation continues recursively. 5605bd8deadSopenharmony_ci This darkening is an inappropriate basis that the resolved 5615bd8deadSopenharmony_ci "best way" above would avoid. 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ciNew Procedures and Functions 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci None 5665bd8deadSopenharmony_ci 5675bd8deadSopenharmony_ciNew Tokens 5685bd8deadSopenharmony_ci 5695bd8deadSopenharmony_ci Accepted by the <internalformat> parameter of TexImage1D, TexImage2D, 5705bd8deadSopenharmony_ci TexImage3D, CopyTexImage1D, CopyTexImage2D: 5715bd8deadSopenharmony_ci 5725bd8deadSopenharmony_ci SRGB_EXT 0x8C40 5735bd8deadSopenharmony_ci SRGB8_EXT 0x8C41 5745bd8deadSopenharmony_ci SRGB_ALPHA_EXT 0x8C42 5755bd8deadSopenharmony_ci SRGB8_ALPHA8_EXT 0x8C43 5765bd8deadSopenharmony_ci SLUMINANCE_ALPHA_EXT 0x8C44 5775bd8deadSopenharmony_ci SLUMINANCE8_ALPHA8_EXT 0x8C45 5785bd8deadSopenharmony_ci SLUMINANCE_EXT 0x8C46 5795bd8deadSopenharmony_ci SLUMINANCE8_EXT 0x8C47 5805bd8deadSopenharmony_ci COMPRESSED_SRGB_EXT 0x8C48 5815bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_EXT 0x8C49 5825bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_EXT 0x8C4A 5835bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B 5845bd8deadSopenharmony_ci 5855bd8deadSopenharmony_ci Accepted by the <internalformat> parameter of TexImage2D, 5865bd8deadSopenharmony_ci CopyTexImage2D, and CompressedTexImage2DARB and the <format> parameter 5875bd8deadSopenharmony_ci of CompressedTexSubImage2DARB: 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C 5905bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D 5915bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E 5925bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ci None 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 Specification (Rasterization) 5995bd8deadSopenharmony_ci 6005bd8deadSopenharmony_ci -- Section 3.8.1, Texture Image Specification: 6015bd8deadSopenharmony_ci 6025bd8deadSopenharmony_ci Add 4 new rows to Table 3.16 (page 154). 6035bd8deadSopenharmony_ci 6045bd8deadSopenharmony_ci Sized Base R G B A L I D 6055bd8deadSopenharmony_ci Internal Format Internal Format bits bits bits bits bits bits bits 6065bd8deadSopenharmony_ci --------------------- --------------- ---- ---- ---- ---- ---- ---- ---- 6075bd8deadSopenharmony_ci SRGB8_EXT RGB 8 8 8 6085bd8deadSopenharmony_ci SRGB8_ALPHA8_EXT RGBA 8 8 8 8 6095bd8deadSopenharmony_ci SLUMINANCE_EXT LUMINANCE 8 6105bd8deadSopenharmony_ci SLUMINANCE_ALPHA8_EXT LUMINANCE_ALPHA 8 8 6115bd8deadSopenharmony_ci 6125bd8deadSopenharmony_ci Add 4 new rows to Table 3.17 (page 155). 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci Compressed Internal Format Base Internal Format 6155bd8deadSopenharmony_ci ----------------------------------- -------------------- 6165bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT RGB 6175bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT RGBA 6185bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT RGBA 6195bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT RGBA 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci Add 4 new rows to Table 3.18 (page 155). 6225bd8deadSopenharmony_ci 6235bd8deadSopenharmony_ci Generic Compressed Internal Format Base Internal Format 6245bd8deadSopenharmony_ci ---------------------------------- -------------------- 6255bd8deadSopenharmony_ci COMPRESSED_SRGB_EXT RGB 6265bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_EXT RGBA 6275bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_EXT LUMINANCE 6285bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_ALPHA_EXT LUMINANCE_ALPHA 6295bd8deadSopenharmony_ci 6305bd8deadSopenharmony_ci -- Section 3.8.x, sRGB Texture Color Conversion 6315bd8deadSopenharmony_ci 6325bd8deadSopenharmony_ci Insert this section AFTER section 3.8.14 Texture Comparison Modes 6335bd8deadSopenharmony_ci and BEFORE section 3.8.15 Texture Application. 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci "If the currently bound texture's internal format is one 6365bd8deadSopenharmony_ci of SRGB_EXT, SRGB8_EXT, SRGB_ALPHA_EXT, SRGB8_ALPHA8_EXT, 6375bd8deadSopenharmony_ci SLUMINANCE_ALPHA_EXT, SLUMINANCE8_ALPHA8_EXT, SLUMINANCE_EXT, 6385bd8deadSopenharmony_ci SLUMINANCE8_EXT, COMPRESSED_SRGB_EXT, COMPRESSED_SRGB_ALPHA_EXT, 6395bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_EXT COMPRESSED_SLUMINANCE_ALPHA_EXT, 6405bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 6415bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 6425bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, the red, green, and blue 6435bd8deadSopenharmony_ci components are converted from an sRGB color space to a linear color 6445bd8deadSopenharmony_ci space as part of filtering described in sections 3.8.8 and 3.8.9. 6455bd8deadSopenharmony_ci Any alpha component is left unchanged. Ideally, implementations 6465bd8deadSopenharmony_ci should perform this color conversion on each sample prior to filtering 6475bd8deadSopenharmony_ci but implementations are allowed to perform this conversion after 6485bd8deadSopenharmony_ci filtering (though this post-filtering approach is inferior to 6495bd8deadSopenharmony_ci converting from sRGB prior to filtering). 6505bd8deadSopenharmony_ci 6515bd8deadSopenharmony_ci The conversion from an sRGB encoded component, cs, to a linear 6525bd8deadSopenharmony_ci component, cl, is as follows. 6535bd8deadSopenharmony_ci 6545bd8deadSopenharmony_ci { cs / 12.92, cs <= 0.04045 6555bd8deadSopenharmony_ci cl = { 6565bd8deadSopenharmony_ci { ((cs + 0.055)/1.055)^2.4, cs > 0.04045 6575bd8deadSopenharmony_ci 6585bd8deadSopenharmony_ci Assume cs is the sRGB component in the range [0,1]." 6595bd8deadSopenharmony_ci 6605bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 6615bd8deadSopenharmony_ciand the Frame Buffer) 6625bd8deadSopenharmony_ci 6635bd8deadSopenharmony_ci None 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 Specification (Special Functions) 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci None 6685bd8deadSopenharmony_ci 6695bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 Specification (State and State Requests) 6705bd8deadSopenharmony_ci 6715bd8deadSopenharmony_ci None 6725bd8deadSopenharmony_ci 6735bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language specification 6745bd8deadSopenharmony_ci 6755bd8deadSopenharmony_ci None 6765bd8deadSopenharmony_ci 6775bd8deadSopenharmony_ciAdditions to the GLX Specification 6785bd8deadSopenharmony_ci 6795bd8deadSopenharmony_ci None 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ciDependencies on ARB_texture_compression and OpenGL 1.3 or later 6825bd8deadSopenharmony_ci 6835bd8deadSopenharmony_ci If ARB_texture_compression or OpenGL 1.3 or later is NOT supported, 6845bd8deadSopenharmony_ci ignore the new COMPRESSED_* tokens, the additions to tables 3.17 6855bd8deadSopenharmony_ci and 3.18, and the errors associated with the Compressed* commands. 6865bd8deadSopenharmony_ci 6875bd8deadSopenharmony_ciDependencies on EXT_texture_compression_s3tc 6885bd8deadSopenharmony_ci 6895bd8deadSopenharmony_ci If EXT_texture_compression_s3tc is NOT supported, ignore the new 6905bd8deadSopenharmony_ci COMPRESSED_*_S3TC_DXT* tokens, the additions to table 3.17, errors 6915bd8deadSopenharmony_ci related to the COMPRESSED_*_S3TC_DXT* tokens, and related discussion. 6925bd8deadSopenharmony_ci 6935bd8deadSopenharmony_ci Add COMPRESSED_SRGB_S3TC_DXT1_EXT, 6945bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 6955bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and 6965bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT to token lists in the section 6975bd8deadSopenharmony_ci 3.8.2 specification language added by EXT_texture_compression_s3tc 6985bd8deadSopenharmony_ci when the internal formats COMPRESSED_RGB_S3TC_DXT1_EXT, 6995bd8deadSopenharmony_ci COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, and 7005bd8deadSopenharmony_ci COMPRESSED_RGBA_S3TC_DXT5_EXT are listed. 7015bd8deadSopenharmony_ci 7025bd8deadSopenharmony_ciDependencies on NV_texture_compression_vtc 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci If NV_texture_compression_vtc IS supported, allow the following 7055bd8deadSopenharmony_ci tokens to be accepted by the <internalformat> parameter 7065bd8deadSopenharmony_ci of CompressedTexImage3DARB and the <format> parameter of 7075bd8deadSopenharmony_ci CompressedTexSubImage3DARB: 7085bd8deadSopenharmony_ci 7095bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT 7105bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 7115bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 7125bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 7135bd8deadSopenharmony_ci 7145bd8deadSopenharmony_ciGLX Protocol 7155bd8deadSopenharmony_ci 7165bd8deadSopenharmony_ci None. 7175bd8deadSopenharmony_ci 7185bd8deadSopenharmony_ciErrors 7195bd8deadSopenharmony_ci 7205bd8deadSopenharmony_ci Relaxation of INVALID_ENUM errors 7215bd8deadSopenharmony_ci --------------------------------- 7225bd8deadSopenharmony_ci 7235bd8deadSopenharmony_ci TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, 7245bd8deadSopenharmony_ci CompressedTexImage2DARB, CompressedTexSubImage2DARB now accept the 7255bd8deadSopenharmony_ci new tokens as listed in the "New Tokens" section. 7265bd8deadSopenharmony_ci 7275bd8deadSopenharmony_ci New errors 7285bd8deadSopenharmony_ci ---------- 7295bd8deadSopenharmony_ci 7305bd8deadSopenharmony_ci INVALID_OPERATION is generated by CompressedTexImage2DARB if 7315bd8deadSopenharmony_ci if <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7325bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7335bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7345bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and <border> is not equal to 7355bd8deadSopenharmony_ci zero. 7365bd8deadSopenharmony_ci 7375bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexSubImage2D 7385bd8deadSopenharmony_ci CopyTexSubImage2D, or CompressedTexSubImage2D if INTERNAL_FORMAT is 7395bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7405bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7415bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply: 7425bd8deadSopenharmony_ci <width> is not a multiple of four or equal to TEXTURE_WIDTH; <height> 7435bd8deadSopenharmony_ci is not a multiple of four or equal to TEXTURE_HEIGHT; <xoffset> 7445bd8deadSopenharmony_ci or <yoffset> is not a multiple of four. 7455bd8deadSopenharmony_ci 7465bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexImage1DARB if 7475bd8deadSopenharmony_ci <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7485bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7495bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7505bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexSubImage1DARB if <format> is 7535bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7545bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7555bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. 7565bd8deadSopenharmony_ci 7575bd8deadSopenharmony_ci Errors if NV_texture_compression_vtc is NOT supported 7585bd8deadSopenharmony_ci ----------------------------------------------------- 7595bd8deadSopenharmony_ci 7605bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexImage3DARB if 7615bd8deadSopenharmony_ci <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7625bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7635bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7645bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. 7655bd8deadSopenharmony_ci 7665bd8deadSopenharmony_ci INVALID_ENUM is generated by CompressedTexSubImage3DARB if <format> is 7675bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7685bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7695bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. 7705bd8deadSopenharmony_ci 7715bd8deadSopenharmony_ci Errors if NV_texture_compression_vtc IS supported 7725bd8deadSopenharmony_ci ----------------------------------------------------- 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ci INVALID_OPERATION is generated by CompressedTexImage3DARB 7755bd8deadSopenharmony_ci if <internalformat> is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7765bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7775bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7785bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and <border> is not equal to 7795bd8deadSopenharmony_ci zero. 7805bd8deadSopenharmony_ci 7815bd8deadSopenharmony_ci INVALID_OPERATION is generated by TexSubImage3D or CopyTexSubImage3D 7825bd8deadSopenharmony_ci if INTERNAL_FORMAT is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7835bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7845bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7855bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply: 7865bd8deadSopenharmony_ci <width> is not a multiple of four or equal to TEXTURE_WIDTH; <height> 7875bd8deadSopenharmony_ci is not a multiple of four or equal to TEXTURE_HEIGHT; <xoffset> 7885bd8deadSopenharmony_ci or <yoffset> is not a multiple of four. 7895bd8deadSopenharmony_ci 7905bd8deadSopenharmony_ci INVALID_OPERATION is generated by CompressedTexSubImage3D 7915bd8deadSopenharmony_ci if INTERNAL_FORMAT is COMPRESSED_SRGB_S3TC_DXT1_EXT, 7925bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 7935bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 7945bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply: 7955bd8deadSopenharmony_ci <width> is not a multiple of four or equal to TEXTURE_WIDTH; <height> 7965bd8deadSopenharmony_ci is not a multiple of four or equal to TEXTURE_HEIGHT; <depth> is not 7975bd8deadSopenharmony_ci a multiple of four or equal to TEXTURE_DEPTH; <xoffset> <yoffset>, 7985bd8deadSopenharmony_ci or <zoffset> is not a multiple of four. 7995bd8deadSopenharmony_ci 8005bd8deadSopenharmony_ciNew State 8015bd8deadSopenharmony_ci 8025bd8deadSopenharmony_ci In table 6.17, Textures (page 278), increment the 42 in "n x Z42*" 8035bd8deadSopenharmony_ci by 16 (or 12 if EXT_texture_compression_s3tc is not supported). 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci [NOTE: The OpenGL 2.0 specification actually should read "n x Z48*" 8065bd8deadSopenharmony_ci because of the 6 generic compressed internal formats in table 3.18.] 8075bd8deadSopenharmony_ci 8085bd8deadSopenharmony_ciNew Implementation Dependent State 8095bd8deadSopenharmony_ci 8105bd8deadSopenharmony_ci None 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ciNVIDIA Implementation Details 8135bd8deadSopenharmony_ci 8145bd8deadSopenharmony_ci GeForce FX, Quadro FX, and GeForce 6 and 7 Series GPUs store 8155bd8deadSopenharmony_ci sRGB texels at 8 bits per component. sRGB conversion occurs 8165bd8deadSopenharmony_ci post-filtering. 8175bd8deadSopenharmony_ci 8185bd8deadSopenharmony_ciRevision History 8195bd8deadSopenharmony_ci 8205bd8deadSopenharmony_ci 0.8: Add issue 24 with recommendation for sRGB mipmap generation. 8215bd8deadSopenharmony_ci 8225bd8deadSopenharmony_ci 0.7: Add issue 23 about alternative implementation based on 8235bd8deadSopenharmony_ci either GL_RGB12 or GL_RGB16 based on discussions with Jeremy 8245bd8deadSopenharmony_ci Sandmel. 8255bd8deadSopenharmony_ci 8265bd8deadSopenharmony_ci 0.6: Add issue 22 about GL_COMPRESSED_TEXTURE_FORMATS. 8275bd8deadSopenharmony_ci 8285bd8deadSopenharmony_ci 0.5: Fix grammar, add issues 20 and 21 based on Brian Paul's 8295bd8deadSopenharmony_ci feedback. 8305bd8deadSopenharmony_ci 8315bd8deadSopenharmony_ci 0.4: Update issue 18 based on Matrox feedback. 8325bd8deadSopenharmony_ci 8335bd8deadSopenharmony_ci 0.3: Update NV_texture_expand_normal interaction. 834