15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_framebuffer_sRGB 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_framebuffer_sRGB 85bd8deadSopenharmony_ci GLX_ARB_framebuffer_sRGB 95bd8deadSopenharmony_ci WGL_ARB_framebuffer_sRGB 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ciContributors 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ci Herb (Charles) Kuta, Quantum3D 145bd8deadSopenharmony_ci Alain Bouchard, Matrox 155bd8deadSopenharmony_ci Brian Paul, Tungsten Graphics 165bd8deadSopenharmony_ci Daniel Vogel, Epic Games 175bd8deadSopenharmony_ci Eric Werness, NVIDIA 185bd8deadSopenharmony_ci Kiril Vidimce, Pixar 195bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA 205bd8deadSopenharmony_ci Pat Brown, NVIDIA 215bd8deadSopenharmony_ci Yanjun Zhang, S3 Graphics 225bd8deadSopenharmony_ci Jeremy Sandmel, Apple 235bd8deadSopenharmony_ci Jon Leech 245bd8deadSopenharmony_ci Adam Jackson, Red Hat 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciContact 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNotice 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci Copyright (c) 2008-2013 The Khronos Group Inc. Copyright terms at 335bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciSpecification Update Policy 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 385bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 395bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 405bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 415bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 425bd8deadSopenharmony_ci described in more detail at 435bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ciStatus 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci Approved by the ARB on July 11, 2008 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciVersion 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci Date: September 19, 2019 525bd8deadSopenharmony_ci Revision: 1.3 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciNumber 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci ARB Extension #46 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ciDependencies 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci OpenGL 1.1 is required 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension is written against the OpenGL 2.0 (September 7, 635bd8deadSopenharmony_ci 2004) specification. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci WGL_EXT_extensions_string is required for WGL support. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci WGL_EXT_pixel_format is required for WGL support. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci ARB_color_buffer_float interacts with this extension. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci ARB_framebuffer_object is required. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci EXT_texture_sRGB interacts with this extension. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci ARB_draw_buffers interacts with this extension. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciOverview 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci Conventionally, OpenGL assumes framebuffer color components are stored 805bd8deadSopenharmony_ci in a linear color space. In particular, framebuffer blending is a 815bd8deadSopenharmony_ci linear operation. 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci The sRGB color space is based on typical (non-linear) monitor 845bd8deadSopenharmony_ci characteristics expected in a dimly lit office. It has been 855bd8deadSopenharmony_ci standardized by the International Electrotechnical Commission (IEC) 865bd8deadSopenharmony_ci as IEC 61966-2-1. The sRGB color space roughly corresponds to 2.2 875bd8deadSopenharmony_ci gamma correction. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci This extension adds a framebuffer capability for sRGB framebuffer 905bd8deadSopenharmony_ci update and blending. When blending is disabled but the new sRGB 915bd8deadSopenharmony_ci updated mode is enabled (assume the framebuffer supports the 925bd8deadSopenharmony_ci capability), high-precision linear color component values for red, 935bd8deadSopenharmony_ci green, and blue generated by fragment coloring are encoded for sRGB 945bd8deadSopenharmony_ci prior to being written into the framebuffer. When blending is enabled 955bd8deadSopenharmony_ci along with the new sRGB update mode, red, green, and blue framebuffer 965bd8deadSopenharmony_ci color components are treated as sRGB values that are converted to 975bd8deadSopenharmony_ci linear color values, blended with the high-precision color values 985bd8deadSopenharmony_ci generated by fragment coloring, and then the blend result is encoded 995bd8deadSopenharmony_ci for sRGB just prior to being written into the framebuffer. 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci The primary motivation for this extension is that it allows OpenGL 1025bd8deadSopenharmony_ci applications to render into a framebuffer that is scanned to a monitor 1035bd8deadSopenharmony_ci configured to assume framebuffer color values are sRGB encoded. 1045bd8deadSopenharmony_ci This assumption is roughly true of most PC monitors with default 1055bd8deadSopenharmony_ci gamma correction. This allows applications to achieve faithful 1065bd8deadSopenharmony_ci color reproduction for OpenGL rendering without adjusting the 1075bd8deadSopenharmony_ci monitor's gamma correction. 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ciNew Procedures and Functions 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci None 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ciNew Tokens 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Accepted by the <attribList> parameter of glXChooseVisual and 1165bd8deadSopenharmony_ci glXChooseFBConfig, and by the <attrib> parameter of glXGetConfig 1175bd8deadSopenharmony_ci and glXGetFBConfigAttrib: 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci Accepted by the <piAttributes> parameter of 1225bd8deadSopenharmony_ci wglGetPixelFormatAttribivEXT, wglGetPixelFormatAttribfvEXT, and 1235bd8deadSopenharmony_ci the <piAttribIList> and <pfAttribIList> of wglChoosePixelFormatEXT: 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 1285bd8deadSopenharmony_ci and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 1295bd8deadSopenharmony_ci and GetDoublev: 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci FRAMEBUFFER_SRGB 0x8DB9 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ciAdditions to Chapter 2 of the 2.0 Specification (OpenGL Operation) 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci None 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ciAdditions to Chapter 3 of the 2.0 Specification (Rasterization) 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci None 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ciAdditions to Chapter 4 of the 2.0 Specification (Per-Fragment Operations 1425bd8deadSopenharmony_ciand the Frame Buffer) 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci DELETE the following sentence from section 4.1.8 (Blending) because 1455bd8deadSopenharmony_ci it is moved to the new "sRGB Conversion" section: 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci "Each of these floating-point values is clamped to [0,1] and 1485bd8deadSopenharmony_ci converted back to a fixed-point value in the manner described in 1495bd8deadSopenharmony_ci section 2.14.9." 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci If ARB_color_buffer_float is supported, the following paragraph 1525bd8deadSopenharmony_ci is modified to eliminate the fixed-point clamping and conversion 1535bd8deadSopenharmony_ci because this behavior is moved to the new "sRGB Conversion" section. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci "If the color buffer is fixed-point, the components of the source 1565bd8deadSopenharmony_ci and destination values and blend factors are clamped to [0, 1] 1575bd8deadSopenharmony_ci prior to evaluating the blend equation, the components of the 1585bd8deadSopenharmony_ci blending result are clamped to [0,1] and converted to fixed- 1595bd8deadSopenharmony_ci point values in the manner described in section 2.14.9. If the 1605bd8deadSopenharmony_ci color buffer is floating-point, no clamping occurs. The 1615bd8deadSopenharmony_ci resulting four values are sent to the next operation." 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The modified ARB_color_buffer_float paragraph should read: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci "If the color buffer is fixed-point, the components of the source 1665bd8deadSopenharmony_ci and destination values and blend factors are clamped to [0, 1] 1675bd8deadSopenharmony_ci prior to evaluating the blend equation. If the color buffer is 1685bd8deadSopenharmony_ci floating-point, no clamping occurs. The resulting four values are 1695bd8deadSopenharmony_ci sent to the next operation." 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci Replace the following sentence: 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci "Destination (framebuffer) components are taken to be fixed-point 1745bd8deadSopenharmony_ci values represented according to the scheme in section 2.14.9 (Final 1755bd8deadSopenharmony_ci Color Processing), as are source (fragment) components." 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci with the following sentences: 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci "Destination (framebuffer) components are taken to be fixed-point 1805bd8deadSopenharmony_ci values represented according to the scheme in section 2.14.9 (Final 1815bd8deadSopenharmony_ci Color Processing). If FRAMEBUFFER_SRGB is enabled and the value 1825bd8deadSopenharmony_ci of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer 1835bd8deadSopenharmony_ci attachment corresponding to the destination buffer is SRGB (see 1845bd8deadSopenharmony_ci section 6.1.3), the R 1855bd8deadSopenharmony_ci G, and B destination color values (after conversion from fixed-point 1865bd8deadSopenharmony_ci to floating-point) are considered to be encoded for the sRGB color 1875bd8deadSopenharmony_ci space and hence need to be linearized prior to their use in blending. 1885bd8deadSopenharmony_ci Each R, G, and B component is linearized by some approximation of 1895bd8deadSopenharmony_ci the following: 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci { cs / 12.92, cs <= 0.04045 1925bd8deadSopenharmony_ci cl = { 1935bd8deadSopenharmony_ci { ((cs + 0.055)/1.055)^2.4, cs > 0.04045 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci where cs is the component value prior to linearization and cl is 1965bd8deadSopenharmony_ci the result. Otherwise if FRAMEBUFFER_SRGB is disabled, or the 1975bd8deadSopenharmony_ci value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING is not SRGB, no 1985bd8deadSopenharmony_ci linearization is performed. 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci The resulting linearized R, G, and B and unmodified A values are 2015bd8deadSopenharmony_ci recombined as the destination color used in blending computations. 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci ADD new section 4.1.X "sRGB Conversion" after section 4.1.8 (Blending) 2055bd8deadSopenharmony_ci and before section 4.1.9 (Dithering). With this new section added, 2065bd8deadSopenharmony_ci understand the "next operation" referred to in the section 4.1.8 2075bd8deadSopenharmony_ci (Blending) to now be "sRGB Conversion" (instead of "Dithering"). 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci "If FRAMEBUFFER_SRGB is enabled and the value of 2105bd8deadSopenharmony_ci FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer attachment 2115bd8deadSopenharmony_ci corresponding to the destination buffer is SRGB (see section 6.1.3), 2125bd8deadSopenharmony_ci the R, G, and B values after blending are converted into the non-linear 2135bd8deadSopenharmony_ci sRGB color space by some approximation of the following: 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci { 0.0, 0 <= cl 2165bd8deadSopenharmony_ci { 12.92 * c, 0 < cl < 0.0031308 2175bd8deadSopenharmony_ci cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1 2185bd8deadSopenharmony_ci { 1.0, cl >= 1 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci where cl is the R, G, or B element and cs is the result 2215bd8deadSopenharmony_ci (effectively converted into an sRGB color space). 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci If FRAMEBUFFER_SRGB is disabled or the value of 2245bd8deadSopenharmony_ci FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING is not SRGB, then 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci cs = cl 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci The resulting cs values for R, G, and B and the unmodified A form a 2295bd8deadSopenharmony_ci new RGBA color value. If the color 2305bd8deadSopenharmony_ci buffer is fixed-point, the components of this RGBA color value are 2315bd8deadSopenharmony_ci clamped to [0,1] and then converted to a fixed-point value in the 2325bd8deadSopenharmony_ci manner described in section 2.14.9. The resulting four values are 2335bd8deadSopenharmony_ci sent to the subsequent dithering operation." 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ciAdditions to Chapter 5 of the 2.0 Specification (Special Functions) 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci None 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ciAdditions to Chapter 6 of the 2.0 Specification (State and State Requests) 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci None 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language specification 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci None 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ciAdditions to the GLX Specification 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci If GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB is specified for glXChooseVisual or 2505bd8deadSopenharmony_ci glXChooseFBConfig, it is treated as an exact match. If it is not specified, 2515bd8deadSopenharmony_ci it is treated as GLX_DONT_CARE. Sorting of visuals and fbconfigs by 2525bd8deadSopenharmony_ci GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB is undefined. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciDependencies on ARB_color_buffer_float 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci If ARB_color_buffer_float is not supported, ignore the edits to 2575bd8deadSopenharmony_ci ARB_color_buffer_float language. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ciDependencies on EXT_texture_sRGB and ARB_framebuffer_object 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci If EXT_texture_sRGB and ARB_framebuffer_object are both supported, the 2625bd8deadSopenharmony_ci implementation should set the value of 2635bd8deadSopenharmony_ci FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING to LINEAR when 2645bd8deadSopenharmony_ci rendering to a color texture that is not one of the EXT_texture_sRGB 2655bd8deadSopenharmony_ci introduced internal formats. An implementation can determine whether 2665bd8deadSopenharmony_ci or not it will set the value of 2675bd8deadSopenharmony_ci FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING to SRGB for the 2685bd8deadSopenharmony_ci EXT_texture_sRGB introduced internal formats. Implementations are 2695bd8deadSopenharmony_ci encouraged to allow sRGB update and blending when rendering to sRGB 2705bd8deadSopenharmony_ci textures using ARB_framebuffer_object but this is not required. 2715bd8deadSopenharmony_ci In any case, FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING should indicate 2725bd8deadSopenharmony_ci whether or not sRGB update and blending is supported. 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ciDependencies on ARB_draw_buffers, EXT_texture_sRGB, and ARB_framebuffer_object 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci If ARB_draw_buffers, EXT_texture_sRGB, and ARB_framebuffer_object 2775bd8deadSopenharmony_ci are supported and an application attempts to render to a set of 2785bd8deadSopenharmony_ci color buffers where some but not all of the color buffers are SRGB 2795bd8deadSopenharmony_ci capable, sRGB update and blending only apply to the color buffers 2805bd8deadSopenharmony_ci that are actually sRGB-capable. 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ciGLX Protocol 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci None. 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ciErrors 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci Relaxation of INVALID_ENUM errors 2895bd8deadSopenharmony_ci --------------------------------- 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci Enable, Disable, IsEnabled, GetBooleanv, GetIntegerv, GetFloatv, 2925bd8deadSopenharmony_ci and GetDoublev now accept FRAMEBUFFER_SRGB as allowed in the "New 2935bd8deadSopenharmony_ci Tokens" section. 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ciNew State 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci Add to table 6.20 (Pixel Operations) 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec. Attribute 3005bd8deadSopenharmony_ci ---------------- ---- ----------- ------------- --------------- ----- ------------------- 3015bd8deadSopenharmony_ci FRAMEBUFFER_SRGB B IsEnabled False sRGB update and 4.1.X color-buffer/enable 3025bd8deadSopenharmony_ci blending enable 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ciNew Implementation Dependent State 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci None 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ciIssues 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci 1) What should this extension be called? 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci RESOLVED: ARB_framebuffer_sRGB. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci The "ARB_framebuffer" part indicates the extension is in 3155bd8deadSopenharmony_ci the framebuffer domain and "sRGB" indicates the extension is 3165bd8deadSopenharmony_ci adding a set of sRGB formats. This mimics the naming of the 3175bd8deadSopenharmony_ci EXT_texture_sRGB extension that adds sRGB texture formats. 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci The mixed-case spelling of sRGB is the established usage so 3205bd8deadSopenharmony_ci "_sRGB" is preferred to "_srgb". The "s" stands for standard 3215bd8deadSopenharmony_ci (color space). 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci For token names, we use "SRGB" since token names are uniformly 3245bd8deadSopenharmony_ci capitalized. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci 2) Should alpha be sRGB encoded? 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci RESOLVED: No. Alpha remains linear. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci A rationale for this resolution is found in Alvy Ray's "Should 3315bd8deadSopenharmony_ci Alpha Be Nonlinear If RGB Is?" Tech Memo 17 (December 14, 1998). 3325bd8deadSopenharmony_ci See: ftp://ftp.alvyray.com/Acrobat/17_Nonln.pdf 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci 3) Should the ability to support sRGB framebuffer update and blending 3355bd8deadSopenharmony_ci be an attribute of the framebuffer? 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci RESOLVED: Yes. It should be a capability of some pixel formats 3385bd8deadSopenharmony_ci (mostly likely just RGB8 and RGBA8) that says sRGB blending can 3395bd8deadSopenharmony_ci be enabled. 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci This allows an implementation to simply mark the existing RGB8 3425bd8deadSopenharmony_ci and RGBA8 pixel formats as supporting sRGB blending and then 3435bd8deadSopenharmony_ci just provide the functionality for sRGB update and blending for 3445bd8deadSopenharmony_ci such formats. 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci sRGB support for floating-point formats makes little sense 3475bd8deadSopenharmony_ci (because floating-point already provide a non-linear distribution 3485bd8deadSopenharmony_ci of precision and typically have considerably more precision 3495bd8deadSopenharmony_ci than 8-bit fixed-point framebuffer components allow) and would 3505bd8deadSopenharmony_ci be expensive to support. 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci Requiring sRGB support for all fixed-point buffers means that 3535bd8deadSopenharmony_ci support for 16-bit components or very small 5-bit or 6-bit 3545bd8deadSopenharmony_ci components would require special sRGB conversion hardware. 3555bd8deadSopenharmony_ci Typically sRGB is well-suited for 8-bit fixed-point components 3565bd8deadSopenharmony_ci so we do not want this extension to require expensive tables 3575bd8deadSopenharmony_ci for other component sizes that are unlikely to ever be used. 3585bd8deadSopenharmony_ci Implementations could support sRGB conversion for any color 3595bd8deadSopenharmony_ci framebuffer format but implementations are not required to 3605bd8deadSopenharmony_ci (honestly nor are implementations like to support sRGB on anything 3615bd8deadSopenharmony_ci but 8-bit fixed-point color formats). 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci 4) Should there be an enable for sRGB update and blending? 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci RESOLVED: Yes, and it is disabled by default. The enable only 3665bd8deadSopenharmony_ci applies if a destination buffer's pixel format is capable 3675bd8deadSopenharmony_ci of sRGB update and blending. Otherwise, the enable is silently 3685bd8deadSopenharmony_ci ignored (similar to how the multisample enables are ignored when 3695bd8deadSopenharmony_ci the pixel format lacks multisample supports). 3705bd8deadSopenharmony_ci 3715bd8deadSopenharmony_ci 5) How is sRGB blending done? 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci RESOLVED: Blending is a linear operation so should be performed 3745bd8deadSopenharmony_ci on values in linear spaces. sRGB-encoded values are in a 3755bd8deadSopenharmony_ci non-linear space so sRGB blending should convert sRGB-encoded 3765bd8deadSopenharmony_ci values from the framebuffer to linear values, blend, and then 3775bd8deadSopenharmony_ci sRGB-encode the result to store it in the framebuffer. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci The destination color RGB components are each converted 3805bd8deadSopenharmony_ci from sRGB to a linear value. Blending is then performed. 3815bd8deadSopenharmony_ci The source color and constant color are simply assumed to be 3825bd8deadSopenharmony_ci treated as linear color components. Then the result of blending 3835bd8deadSopenharmony_ci is converted to an sRGB encoding and stored in the framebuffer. 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci 6) What happens if GL_FRAMEBUFFER_SRGB is enabled (and 3865bd8deadSopenharmony_ci GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING is GL_SRGB), but 3875bd8deadSopenharmony_ci GL_BLEND is not enabled? 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci RESOLVED: The color result from fragment coloring (the source 3905bd8deadSopenharmony_ci color) is converted to an sRGB encoding and stored in the 3915bd8deadSopenharmony_ci framebuffer. 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci 7) How are multiple render targets handled? 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci RESOLVED: Render targets that are not sRGB-capable ignore the 3965bd8deadSopenharmony_ci state of the GL_FRAMEBUFFER_SRGB enable for sRGB update and 3975bd8deadSopenharmony_ci blending. Note that unlike EXT_framebuffer_sRGB, the 3985bd8deadSopenharmony_ci sRGB-capable query may be performed on a per-color-attachment 3995bd8deadSopenharmony_ci basis. 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci 8) Should sRGB framebuffer support affect the pixel path? 4025bd8deadSopenharmony_ci 4035bd8deadSopenharmony_ci RESOLVED: No. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci sRGB conversion only applies to color reads for blending and 4065bd8deadSopenharmony_ci color writes. Color reads for glReadPixels, glCopyPixels, 4075bd8deadSopenharmony_ci or glAccum have no sRGB conversion applied. 4085bd8deadSopenharmony_ci 4095bd8deadSopenharmony_ci For pixel path operations, an application could use pixel maps 4105bd8deadSopenharmony_ci or color tables to perform an sRGB-to-linear conversion with 4115bd8deadSopenharmony_ci these lookup tables. 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci 9) Can luminance (single color component) framebuffer formats 4145bd8deadSopenharmony_ci support sRGB blending? 4155bd8deadSopenharmony_ci 4165bd8deadSopenharmony_ci RESOLVED: Yes, if an implementation chooses to advertise such 4175bd8deadSopenharmony_ci a format and set the sRGB attribute for the format too. 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ci Implementations are not obliged to provide such formats. 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci 10) Should all component sizes be supported for sRGB components or 4225bd8deadSopenharmony_ci just 8-bit? 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci RESOLVED: This is at the implementation's discretion since 4255bd8deadSopenharmony_ci the implementation decides what pixel formats such support sRGB 4265bd8deadSopenharmony_ci update and blending. 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci It likely implementations will only provide sRGB-capable 4295bd8deadSopenharmony_ci framebuffer configurations for configurations with 8-bit 4305bd8deadSopenharmony_ci components. 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci 11) What must be specified as far as how do you convert to and from 4335bd8deadSopenharmony_ci sRGB and linear RGB color spaces? 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci RESOLVED: The specification language needs to only supply the 4365bd8deadSopenharmony_ci linear RGB to sRGB conversion (see section 4.9.X above). 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci The sRGB to linear RGB conversion is documented in the 4395bd8deadSopenharmony_ci EXT_texture_sRGB specification. 4405bd8deadSopenharmony_ci 4415bd8deadSopenharmony_ci For completeness, the accepted linear RGB to sRGB conversion 4425bd8deadSopenharmony_ci (the inverse of the function specified in section 3.8.x) is as 4435bd8deadSopenharmony_ci follows: 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci Given a linear RGB component, cl, convert it to an sRGB component, 4465bd8deadSopenharmony_ci cs, in the range [0,1], with this pseudo-code: 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci if (isnan(cl)) { 4495bd8deadSopenharmony_ci /* Map IEEE-754 Not-a-number to zero. */ 4505bd8deadSopenharmony_ci cs = 0.0; 4515bd8deadSopenharmony_ci } else if (cl > 1.0) { 4525bd8deadSopenharmony_ci cs = 1.0; 4535bd8deadSopenharmony_ci } else if (cl < 0.0) { 4545bd8deadSopenharmony_ci cs = 0.0; 4555bd8deadSopenharmony_ci } else if (cl < 0.0031308) { 4565bd8deadSopenharmony_ci cs = 12.92 * cl; 4575bd8deadSopenharmony_ci } else { 4585bd8deadSopenharmony_ci cs = 1.055 * pow(cl, 0.41666) - 0.055; 4595bd8deadSopenharmony_ci } 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci The NaN behavior in the pseudo-code is recommended but not 4625bd8deadSopenharmony_ci specified in the actual specification language. 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci sRGB components are typically stored as unsigned 8-bit 4655bd8deadSopenharmony_ci fixed-point values. If cs is computed with the above 4665bd8deadSopenharmony_ci pseudo-code, cs can be converted to a [0,255] integer with this 4675bd8deadSopenharmony_ci formula: 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci csi = floor(255.0 * cs + 0.5) 4705bd8deadSopenharmony_ci 4715bd8deadSopenharmony_ci 12) Does this extension guarantee images rendered with sRGB textures 4725bd8deadSopenharmony_ci will "look good" when output to a device supporting an sRGB 4735bd8deadSopenharmony_ci color space? 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci RESOLVED: No. 4765bd8deadSopenharmony_ci 4775bd8deadSopenharmony_ci Whether the displayed framebuffer is displayed to a monitor that 4785bd8deadSopenharmony_ci faithfully reproduces the sRGB color space is beyond the scope 4795bd8deadSopenharmony_ci of this extension. This involves the gamma correction and color 4805bd8deadSopenharmony_ci calibration of the physical display device. 4815bd8deadSopenharmony_ci 4825bd8deadSopenharmony_ci 13) How does this extension interact with ARB_framebuffer_object? 4835bd8deadSopenharmony_ci 4845bd8deadSopenharmony_ci RESOLVED: ARB_framebuffer_object is required to provide the 4855bd8deadSopenharmony_ci GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING query used to determine 4865bd8deadSopenharmony_ci if the color texture image is capable of sRGB rendering. 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci This query should be LINEAR for all texture internal formats 4895bd8deadSopenharmony_ci other than sRGB internal formats such as those introduced by 4905bd8deadSopenharmony_ci EXT_texture_sRGB. Implementations of this extension must be able 4915bd8deadSopenharmony_ci to support sRGB update and blending of sRGB textures. 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci 14) How is the constant blend color handled for sRGB framebuffers? 4945bd8deadSopenharmony_ci 4955bd8deadSopenharmony_ci RESOLVED: The constant blend color is specified as four 4965bd8deadSopenharmony_ci floating-point values. Given that the texture border color can 4975bd8deadSopenharmony_ci be specified at such high precision, it is always treated as a 4985bd8deadSopenharmony_ci linear RGBA value. 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci 15) How does glCopyTex[Sub]Image work with sRGB? Suppose we're 5015bd8deadSopenharmony_ci rendering to a floating point pbuffer or framebuffer object and 5025bd8deadSopenharmony_ci do CopyTexImage. Are the linear framebuffer values converted 5035bd8deadSopenharmony_ci to sRGB during the copy? 5045bd8deadSopenharmony_ci 5055bd8deadSopenharmony_ci RESOLVED: No, linear framebuffer values will NOT be automatically 5065bd8deadSopenharmony_ci converted to the sRGB encoding during the copy. If such a 5075bd8deadSopenharmony_ci conversion is desired, as explained in issue 12, the red, green, 5085bd8deadSopenharmony_ci and blue pixel map functionality can be used to implement a 5095bd8deadSopenharmony_ci linear-to-sRGB encoding translation. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci 16) Should this extension explicitly specify the particular 5125bd8deadSopenharmony_ci sRGB-to-linear and linear-to-sRGB conversions it uses? 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci RESOLVED: The conversions are explicitly specified but 5155bd8deadSopenharmony_ci allowance for approximations is provided. The expectation is 5165bd8deadSopenharmony_ci that the implementation is likely to use a table to implement the 5175bd8deadSopenharmony_ci conversions the conversion is necessarily then an approximation. 5185bd8deadSopenharmony_ci 5195bd8deadSopenharmony_ci 17) How does this extension interact with multisampling? 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci RESOLVED: There are no explicit interactions. However, arguably 5225bd8deadSopenharmony_ci if the color samples for multisampling are sRGB encoded, the 5235bd8deadSopenharmony_ci samples should be linearized before being "resolved" for display 5245bd8deadSopenharmony_ci and then recoverted to sRGB if the output device expects sRGB 5255bd8deadSopenharmony_ci encoded color components. 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci This is really a video scan-out issue and beyond the scope 5285bd8deadSopenharmony_ci of this extension which is focused on the rendering issues. 5295bd8deadSopenharmony_ci However some implementation advice is provided: 5305bd8deadSopenharmony_ci 5315bd8deadSopenharmony_ci The implementation sufficiently aware of the gamma correction 5325bd8deadSopenharmony_ci configured for the display device could decide to perform an 5335bd8deadSopenharmony_ci sRGB-correct multisample resolve. Whether this occurs or not 5345bd8deadSopenharmony_ci could be determined by a control panel setting or inferred by 5355bd8deadSopenharmony_ci the application's use of this extension. 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci 18) Why is the sRGB framebuffer GL_FRAMEBUFFER_SRGB enable 5385bd8deadSopenharmony_ci disabled by default? 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci RESOLVED: This extension could have a boolean 5415bd8deadSopenharmony_ci sRGB-versus-non-sRGB pixel format configuration mode that 5425bd8deadSopenharmony_ci determined whether or not sRGB framebuffer update and blending 5435bd8deadSopenharmony_ci occurs. The problem with this approach is 1) it creates may more 5445bd8deadSopenharmony_ci pixel formation configurations because sRGB and non-sRGB versions 5455bd8deadSopenharmony_ci of lots of existing configurations must be advertised, and 2) 5465bd8deadSopenharmony_ci applicaitons unaware of sRGB might unknowingly select an sRGB 5475bd8deadSopenharmony_ci configuration and then generate over-bright rendering. 5485bd8deadSopenharmony_ci 5495bd8deadSopenharmony_ci It seems more appropriate to have a capability for sRGB 5505bd8deadSopenharmony_ci framebuffer update and blending that is disabled by default. 5515bd8deadSopenharmony_ci This allows existing RGB8 and RGBA8 framebuffer configurations 5525bd8deadSopenharmony_ci to be marked as sRGB capable (so no additional configurations 5535bd8deadSopenharmony_ci need be enumerated). Applications that desire sRGB rendering 5545bd8deadSopenharmony_ci should identify an sRGB-capable framebuffer configuration and 5555bd8deadSopenharmony_ci then enable sRGB rendering. 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci This is different from how EXT_texture_sRGB handles sRGB support 5585bd8deadSopenharmony_ci for texture formats. In the EXT_texture_sRGB extension, textures 5595bd8deadSopenharmony_ci are either sRGB or non-sRGB and there is no texture parameter 5605bd8deadSopenharmony_ci to switch textures between the two modes. This makes sense for 5615bd8deadSopenharmony_ci EXT_texture_sRGB because it allows implementations to fake sRGB 5625bd8deadSopenharmony_ci textures with higher-precision linear textures that simply convert 5635bd8deadSopenharmony_ci sRGB-encoded texels to sufficiently precise linear RGB values. 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci Texture formats also don't have the problem enumerated pixel 5665bd8deadSopenharmony_ci format descriptions have where a naive application could stumble 5675bd8deadSopenharmony_ci upon an sRGB-capable pixel format. sRGB textures require 5685bd8deadSopenharmony_ci explicit use of one of the new EXT_texture_sRGB-introduced 5695bd8deadSopenharmony_ci internal formats. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci 19) How does sRGB and this extension interact with digital video 5725bd8deadSopenharmony_ci output standards, in particular DVI? 5735bd8deadSopenharmony_ci 5745bd8deadSopenharmony_ci RESOLVED: The DVI 1.0 specification recommends "as a default 5755bd8deadSopenharmony_ci position that digital moniotrs of all types support a color 5765bd8deadSopenharmony_ci transfer function similar to analog CRT monitors (gamma=2.2) 5775bd8deadSopenharmony_ci which makes up the majority of the compute display market." This 5785bd8deadSopenharmony_ci means DVI output devices should benefit from blending in the 5795bd8deadSopenharmony_ci sRGB color space just like analog monitors. 5805bd8deadSopenharmony_ci 5815bd8deadSopenharmony_ci 20) Why don't the new tokens and entry points in this extension have 5825bd8deadSopenharmony_ci "ARB" suffixes like other ARB extensions? 5835bd8deadSopenharmony_ci 5845bd8deadSopenharmony_ci RESOLVED: Unlike most ARB extensions, this is a strict subset of 5855bd8deadSopenharmony_ci functionality already approved in OpenGL 3.0. This extension 5865bd8deadSopenharmony_ci exists only to support that functionality on older hardware that 5875bd8deadSopenharmony_ci cannot implement a full OpenGL 3.0 driver. Since there are no 5885bd8deadSopenharmony_ci possible behavior changes between the ARB extension and core 5895bd8deadSopenharmony_ci features, source code compatibility is improved by not using 5905bd8deadSopenharmony_ci suffixes on the extension. 5915bd8deadSopenharmony_ci 5925bd8deadSopenharmony_ci This does not apply to the GLX and WGL elements of this 5935bd8deadSopenharmony_ci extension, since those elements are not part of a new core GLX 5945bd8deadSopenharmony_ci or WGL release yet. 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ci 21) Where's the specification language for the GLX and WGL pixel 5975bd8deadSopenharmony_ci format selection interface? 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci TO BE DONE. The {GLX,WGL}_FRAMEBUFFER_SRGB_CAPABLE_ARB pixel 6005bd8deadSopenharmony_ci format attributes are used to select default framebuffers which 6015bd8deadSopenharmony_ci are sRGB-capable in the fairly obvious way, but this language 6025bd8deadSopenharmony_ci was missing in the original EXT_framebuffer_sRGB and needs to be 6035bd8deadSopenharmony_ci added here. 6045bd8deadSopenharmony_ci 6055bd8deadSopenharmony_ciRevision History 6065bd8deadSopenharmony_ci 6075bd8deadSopenharmony_ci Rev. Date Author Changes 6085bd8deadSopenharmony_ci ---- -------- -------- ------------------------------------- 6095bd8deadSopenharmony_ci 1.3 09/19/19 ajax Clarify GLX interaction. 6105bd8deadSopenharmony_ci 1.2 08/11/08 jleech Use per-FBO-attachment state for 6115bd8deadSopenharmony_ci sRGB-capable queries, rather then the 6125bd8deadSopenharmony_ci EXT's single boolean query for the 6135bd8deadSopenharmony_ci entire framebuffer. 6145bd8deadSopenharmony_ci 1.1 08/08/08 jleech Remove ARB suffixes. 6155bd8deadSopenharmony_ci 1 10/21/06 barthold Added revision history 6165bd8deadSopenharmony_ci 0.4 10/20/06 mjk Added issue 19 6175bd8deadSopenharmony_ci 0.3 mjk Internal spec development. 6185bd8deadSopenharmony_ci 619