15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_texture_sRGB_decode 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_texture_sRGB_decode 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Matt Collins, Apple Inc 125bd8deadSopenharmony_ci Alex Eddy, Apple Inc 135bd8deadSopenharmony_ci Mark Kilgard, NVIDIA 145bd8deadSopenharmony_ci Chris Niederauer, Apple Inc 155bd8deadSopenharmony_ci Richard Schreyer, Apple Inc 165bd8deadSopenharmony_ci Henri Verbeet, CodeWeavers 175bd8deadSopenharmony_ci Brent Wilson, NVIDIA 185bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 195bd8deadSopenharmony_ci Dan Omachi, Apple Inc 205bd8deadSopenharmony_ci Jason Green, TransGaming 215bd8deadSopenharmony_ci Daniel Koch, NVIDIA 225bd8deadSopenharmony_ci Mathias Heyer, NVIDIA 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ciContact 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ci Matt Collins, Apple Inc (matthew.collins 'at' apple.com) 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciStatus 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Shipping on OS X 10.7 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Date: November 8, 2017 355bd8deadSopenharmony_ci Revision: 0.91 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciNumber 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci OpenGL Extension #402 405bd8deadSopenharmony_ci OpenGL ES Extension #152 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciDependencies 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci OpenGL 2.1 or EXT_texture_sRGB requried for OpenGL 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci OpenGL ES 3.0 or EXT_sRGB are required for OpenGL ES 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci OpenGL 3.0 or later interacts with this extension. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci OpenGL ES 2.0 interacts with this extension. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci OpenGL ES 3.0 interacts with this extension. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci ARB_bindless_texture interacts with this extension. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci ARB_sampler_objects interacts with this extension. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci ARB_framebuffer_object interacts with this extension. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci EXT_direct_state_access interacts with this extension. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci EXT_texture_compression_s3tc interacts with this extension. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci EXT_texture_integer interacts with this extension. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci EXT_sRGB interacts with this extension. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci NV_sRGB_formats interacts with this extension. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci NV_generate_mipmap_sRGB interacts with this extension. 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci KHR_texture_compression_astc_ldr interacts with this extension. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci ETC2 texure compression formats interact with this extension. 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci This extension is written against the OpenGL 2.1 (December 1, 2006) 775bd8deadSopenharmony_ci specification. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciOverview 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci The EXT_texture_sRGB extension (promoted to core in OpenGL 2.1) 825bd8deadSopenharmony_ci provides a texture format stored in the sRGB color space. Sampling one 835bd8deadSopenharmony_ci of these textures will always return the color value decoded into a 845bd8deadSopenharmony_ci linear color space. However, an application may wish to sample and 855bd8deadSopenharmony_ci retrieve the undecoded sRGB data from the texture and manipulate 865bd8deadSopenharmony_ci that directly. 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci This extension adds a Texture Parameter and Sampler Object parameter to 895bd8deadSopenharmony_ci allow sRGB textures to be read directly, without decoding. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci The new parameter, TEXTURE_SRGB_DECODE_EXT controls whether the 925bd8deadSopenharmony_ci decoding happens at sample time. It only applies to textures with an 935bd8deadSopenharmony_ci internal format that is sRGB and is ignored for all other textures. 945bd8deadSopenharmony_ci This value defaults to DECODE_EXT, which indicates the texture 955bd8deadSopenharmony_ci should be decoded to linear color space. 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ciNew Procedures and Functions 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci None 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciNew Tokens 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Accepted by the <pname> parameter of TexParameterf, TexParameteri, 1045bd8deadSopenharmony_ci TexParameterfv, TexParameteriv, TexParameterIiv, TexParameterIuiv, 1055bd8deadSopenharmony_ci TexParameterIivEXT, TexParameterIuivEXT, TextureParameterfEXT, 1065bd8deadSopenharmony_ci TextureParameterfvEXT, TextureParameteriEXT, TextureParameterivEXT, 1075bd8deadSopenharmony_ci TextureParameterIivEXT, TextureParameterIuivEXT, 1085bd8deadSopenharmony_ci MultiTexParameterfEXT, MultiTexParameterfvEXT, MultiTexParameteriEXT, 1095bd8deadSopenharmony_ci MultiTexParameterivEXT, MultiTexParameterIivEXT, 1105bd8deadSopenharmony_ci MultiTexParameterIuivEXT, GetTexParameterfv, GetTexParameteriv, 1115bd8deadSopenharmony_ci GetTexParameterIiv, GetTexParameterIuiv, GetTexParameterIivEXT, 1125bd8deadSopenharmony_ci GetTexParameterIuivEXT, GetTextureParameterfEXT, 1135bd8deadSopenharmony_ci GetTextureParameterfvEXT, GetTextureParameteriEXT, 1145bd8deadSopenharmony_ci GetTextureParameterivEXT, GetTextureParameterIivEXT, 1155bd8deadSopenharmony_ci GetTextureParameterIuivEXT, GetMultiTexParameterfEXT, 1165bd8deadSopenharmony_ci GetMultiTexParameterfvEXT, GetMultiTexParameteriEXT, 1175bd8deadSopenharmony_ci GetMultiTexParameterivEXT, GetMultiTexParameterIivEXT, 1185bd8deadSopenharmony_ci GetMultiTexParameterIuivEXT, SamplerParameteri, SamplerParameterf, 1195bd8deadSopenharmony_ci SamplerParameteriv, SamplerParameterfv, SamplerParameterIiv, 1205bd8deadSopenharmony_ci SamplerParameterIuiv, GetSamplerParameteriv, GetSamplerParameterfv, 1215bd8deadSopenharmony_ci GetSamplerParameterIiv, and GetSamplerParameterIuiv: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT 0x8A48 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci Accepted by the <param> parameter of TexParameterf, TexParameteri, 1265bd8deadSopenharmony_ci TexParameterfv, TexParameteriv, TexParameterIiv, TexParameterIuiv, 1275bd8deadSopenharmony_ci TexParameterIivEXT, TexParameterIuivEXT, TextureParameterfEXT, 1285bd8deadSopenharmony_ci TextureParameterfvEXT, TextureParameteriEXT, TextureParameterivEXT, 1295bd8deadSopenharmony_ci TextureParameterIivEXT, TextureParameterIuivEXT, 1305bd8deadSopenharmony_ci MultiTexParameterfEXT, MultiTexParameterfvEXT, MultiTexParameteriEXT, 1315bd8deadSopenharmony_ci MultiTexParameterivEXT, MultiTexParameterIivEXT, 1325bd8deadSopenharmony_ci MultiTexParameterIuivEXT, SamplerParameteri, SamplerParameterf, 1335bd8deadSopenharmony_ci SamplerParameteriv, SamplerParameterfv, SamplerParameterIiv, and 1345bd8deadSopenharmony_ci SamplerParameterIuiv: 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci DECODE_EXT 0x8A49 1375bd8deadSopenharmony_ci SKIP_DECODE_EXT 0x8A4A 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ciAdditions to Chapter 3 of the 2.1 Specification (Rasterization) 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Add 1 new row to Table 3.18 (page 169). 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci Name Type Initial value Legal values 1445bd8deadSopenharmony_ci ---- ---- ------------- ------------ 1455bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT enum DECODE_EXT DECODE_EXT, SKIP_DECODE_EXT 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci-- OpenGL: Section 3.8.8, Texture Minification 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci Add to the end of the "Automatic Mipmap Generation" subsection: 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci If the automatic mipmap generation is applied to a texture 1525bd8deadSopenharmony_ci whose internal format is one of SRGB_EXT, SRGB8_EXT, 1535bd8deadSopenharmony_ci SRGB_ALPHA_EXT, SRGB8_ALPHA8_EXT, SLUMINANCE_ALPHA_EXT, 1545bd8deadSopenharmony_ci SLUMINANCE8_ALPHA8_EXT, SLUMINANCE_EXT, SLUMINANCE8_EXT, 1555bd8deadSopenharmony_ci COMPRESSED_SRGB_EXT, COMPRESSED_SRGB_ALPHA_EXT, 1565bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_EXT, COMPRESSED_SLUMINANCE_ALPHA_EXT, 1575bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 1585bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 1595bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, and the TEXTURE_SRGB_DECODE_EXT 1605bd8deadSopenharmony_ci parameter for the current texture unit is DECODE_EXT, the RGB 1615bd8deadSopenharmony_ci texel components are decoded to a linear components as described 1625bd8deadSopenharmony_ci in section 3.8.15 prior to downsampling; then after downsampling, 1635bd8deadSopenharmony_ci the linear components are re-encoded as sRGB in the following manner: 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci If cl is the linear color component, then the corresponding sRGB 1665bd8deadSopenharmony_ci encoded component is encoded as follows 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci { cl * 12.92, cl < 0.0031308 1695bd8deadSopenharmony_ci cs = { 1705bd8deadSopenharmony_ci { 1.055 * cl^0.41666 - 0.055, cl >= 0.0031308 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci If the automatic mipmap generation is applied to a texture whose 1735bd8deadSopenharmony_ci internal format is one of the sRGB formats listed previously and 1745bd8deadSopenharmony_ci the TEXTURE_SRGB_DECODE_EXT parameter for the texture object is 1755bd8deadSopenharmony_ci SKIP_DECODE_EXT, the sRGB decode and encode steps are skipped during 1765bd8deadSopenharmony_ci mipmap generation. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci-- OpenGL: Section 3.8.15, sRGB Color Decoding 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci (section was previously titled sRGB Color Conversion) 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Replace current text with the following: 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci If the currently bound texture's internal format is one 1855bd8deadSopenharmony_ci of SRGB_EXT, SRGB8_EXT, SRGB_ALPHA_EXT, SRGB8_ALPHA8_EXT, 1865bd8deadSopenharmony_ci SLUMINANCE_ALPHA_EXT, SLUMINANCE8_ALPHA8_EXT, SLUMINANCE_EXT, 1875bd8deadSopenharmony_ci SLUMINANCE8_EXT, COMPRESSED_SRGB_EXT, COMPRESSED_SRGB_ALPHA_EXT, 1885bd8deadSopenharmony_ci COMPRESSED_SLUMINANCE_EXT, COMPRESSED_SLUMINANCE_ALPHA_EXT, 1895bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 1905bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or 1915bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, and the TEXTURE_SRGB_DECODE_EXT 1925bd8deadSopenharmony_ci parameter for the current texture unit is DECODE_EXT, the red, green, and blue 1935bd8deadSopenharmony_ci components are decoded from an sRGB color space to a linear color 1945bd8deadSopenharmony_ci space as part of filtering described in sections 3.8.8 and 3.8.9. 1955bd8deadSopenharmony_ci Any alpha component is left unchanged. Ideally, implementations 1965bd8deadSopenharmony_ci should perform this color decoding on each sample prior to filtering 1975bd8deadSopenharmony_ci but implementations are allowed to perform this decoding after 1985bd8deadSopenharmony_ci filtering (though this post-filtering approach is inferior to 1995bd8deadSopenharmony_ci decoding from sRGB prior to filtering). 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci The decoding from an sRGB encoded component, cs, to a linear 2025bd8deadSopenharmony_ci component, cl, is as follows 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci { 0, cs <= 0 2055bd8deadSopenharmony_ci { 2065bd8deadSopenharmony_ci { cs / 12.92, 0 < cs <= 0.04045 2075bd8deadSopenharmony_ci cl = { 2085bd8deadSopenharmony_ci { ((cs + 0.055)/1.055)^2.4, 0.04045 < cs < 1 2095bd8deadSopenharmony_ci { 2105bd8deadSopenharmony_ci { 1, cs >= 1 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ci Assume cs is the sRGB component in the range [0,1]. 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci If the TEXTURE_SRGB_DECODE_EXT parameter is SKIP_DECODE_EXT, the value 2155bd8deadSopenharmony_ci is returned without decoding. The TEXTURE_SRGB_DECODE_EXT 2165bd8deadSopenharmony_ci parameter state is ignored for any texture with an internal format 2175bd8deadSopenharmony_ci not explicitly listed above, as no decoding needs to be done. 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci--- OpenGL ES 3.2: Section 8.21, sRGB Texture Color Conversion 2205bd8deadSopenharmony_ci--- OpenGL ES 3.0: Section 3.8.16, sRGB Texture Color Conversion 2215bd8deadSopenharmony_ci--- OpenGL ES 2.0: Section 3.7.14, sRGB Texture Color Conversion 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci Add after the first paragraph of the section: 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci "The conversion of sRGB color space components to linear color space is 2265bd8deadSopenharmony_ci always applied if the TEXTURE_SRGB_DECODE_EXT parameter is DECODE_EXT. 2275bd8deadSopenharmony_ci Table X.1 describes whether the conversion is skipped if the 2285bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT parameter is SKIP_DECODE_EXT, depending on 2295bd8deadSopenharmony_ci the function used for the access, whether the access occurs through a 2305bd8deadSopenharmony_ci bindless sampler, and whether the texture is statically accessed 2315bd8deadSopenharmony_ci elsewhere with a texelFetch function." 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci Add a new table X.1, Whether the conversion of sRGB color space 2345bd8deadSopenharmony_ci components to linear color space is skipped when the 2355bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT parameter is SKIP_DECODE_EXT. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci texelFetch other builtin 2385bd8deadSopenharmony_ci -------------------------------------------------------------------- 2395bd8deadSopenharmony_ci non-bindless sampler, n/a yes 2405bd8deadSopenharmony_ci no accesses with 2415bd8deadSopenharmony_ci texelFetch 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci non-bindless sampler, no undefined 2445bd8deadSopenharmony_ci statically accessed with 2455bd8deadSopenharmony_ci texelFetch 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci bindless sampler undefined yes 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ciDependencies on ARB_bindless_texture 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci If ARB_bindless_texture is NOT supported, delete all references to 2525bd8deadSopenharmony_ci bindless samplers. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciDependencies on ARB_sampler_objects or OpenGL 3.3 or later 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci If ARB_sampler_objects or OpenGL 3.3 or later is NOT supported, 2575bd8deadSopenharmony_ci delete all references to SamplerParameter* and GetSamplerParameter*. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ciDependencies on ARB_framebuffer_object or OpenGL 3.0 or later 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci If ARB_framebuffer_object or OpenGL 3.0 or later is supported, the 2625bd8deadSopenharmony_ci explanation in the "Automatic Mipmap Generation" section applies to 2635bd8deadSopenharmony_ci the GenerateMipmap command as well. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ciDependencies on EXT_texture_compression_s3tc 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci If EXT_texture_compression_s3tc is NOT supported, delete 2685bd8deadSopenharmony_ci COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 2695bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and 2705bd8deadSopenharmony_ci COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT from Section 3.8.15. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ciDependencies on EXT_texture_integer 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci If EXT_texture_integer is NOT supported, delete references to 2755bd8deadSopenharmony_ci TexParameterIivEXT, TexParameterIuivEXT, GetTexParameterIivEXT, 2765bd8deadSopenharmony_ci and GetTexParameterIuivEXT. 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ciDependencies on EXT_direct_state_access 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci If EXT_direct_state_access is NOT supported, delete 2815bd8deadSopenharmony_ci references to TextureParameterfEXT, TextureParameterfvEXT, 2825bd8deadSopenharmony_ci TextureParameteriEXT, TextureParameterivEXT, TextureParameterIivEXT, 2835bd8deadSopenharmony_ci TextureParameterIuivEXT, MultiTexParameterfEXT, 2845bd8deadSopenharmony_ci MultiTexParameterfvEXT, MultiTexParameteriEXT, MultiTexParameterivEXT, 2855bd8deadSopenharmony_ci MultiTexParameterIivEXT, MultiTexParameterIuivEXT, 2865bd8deadSopenharmony_ci GetTextureParameterfEXT, GetTextureParameterfvEXT, 2875bd8deadSopenharmony_ci GetTextureParameteriEXT, GetTextureParameterivEXT, 2885bd8deadSopenharmony_ci GetTextureParameterIivEXT, GetTextureParameterIuivEXT, 2895bd8deadSopenharmony_ci GetMultiTexParameterfEXT, GetMultiTexParameterfvEXT, 2905bd8deadSopenharmony_ci GetMultiTexParameteriEXT, GetMultiTexParameterivEXT, 2915bd8deadSopenharmony_ci GetMultiTexParameterIivEXT, and GetMultiTexParameterIuivEXT. 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ciDependencies on OpenGL 3.0 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci If OpenGL 3.0 or later is NOT supported, delete references 2965bd8deadSopenharmony_ci to TexParameterIiv, TexParameterIuiv, GetTexParameterIiv, 2975bd8deadSopenharmony_ci and GetTexParameterIuiv. 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ciInteractions with OpenGL ES 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci If OpenGL ES 3.0 is NOT supported, delete references 3025bd8deadSopenharmony_ci to TexParameterIiv, TexParameterIuiv, GetTexParameterIiv, 3035bd8deadSopenharmony_ci and GetTexParameterIuiv, GetTexParameterfv, GetTexParameteriv. 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci If OpenGL ES 3.0 or NV_generate_mipmap_sRGB is supported, 3065bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT will control the linearization of sRGB 3075bd8deadSopenharmony_ci texture levels while generating the mipmap levels. The section 3085bd8deadSopenharmony_ci "Automatic Mipmap Generation" applies to glGenerateMipmap instead. 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci If neither OpenGL ES 3.0 nor NV_sampler_objects is supported, 3115bd8deadSopenharmony_ci delete all references to SamplerParameter* and GetSamplerParameter*. 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci If NV_sampler_objects is supported, substitue the ARB_sampler_objects 3145bd8deadSopenharmony_ci references with corresponding commands of NV_sampler_objects. 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ciInteractions with KHR_texture_compression_astc_ldr 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci If KHR_texture_compression_astc_ldr is supported, the 3195bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT texture and/or sampler parameter affects the 3205bd8deadSopenharmony_ci COMPRESSED_SRGB8_ALPHA8_ASTC_*_KHR formats as described in the Section 3215bd8deadSopenharmony_ci 3.8.16 edits. 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ciInteractions with ETC2 compressed texture formats 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci If the ETC2 texture compression formats (part of OpenGL ES 3.0 and OpenGL 3265bd8deadSopenharmony_ci 4.3) are supported, the TEXTURE_SRGB_DECODE_EXT texture and/or sampler 3275bd8deadSopenharmony_ci parameter affects the COMPRESSED_SRGB8_*ETC2* formats as described in the 3285bd8deadSopenharmony_ci Section 3.8.16 edits. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ciInteractions with NV_sRGB_formats 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci If NV_sRGB_formats is supported, the TEXTURE_SRGB_DECODE_EXT texture and/or 3335bd8deadSopenharmony_ci sampler parameter affects the new SRGB and SLUMINANCE formats as described 3345bd8deadSopenharmony_ci in the Section 3.7.14 edits. 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ciErrors 3375bd8deadSopenharmony_ci 3385bd8deadSopenharmony_ci INVALID_ENUM is generated if the <pname> parameter of 3395bd8deadSopenharmony_ci TexParameter[i,f,Ii,Iui][v][EXT], MultiTexParameter[i,f,Ii,Iui][v]EXT, 3405bd8deadSopenharmony_ci TextureParameter[i,f,Ii,Iui][v]EXT, SamplerParameter[i,f,Ii,Iui][v] 3415bd8deadSopenharmony_ci is TEXTURE_SRGB_DECODE_EXT when the <param> parameter is not one of 3425bd8deadSopenharmony_ci DECODE_EXT or SKIP_DECODE_EXT. 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ciNew State 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci In table 6.20, Texture Objects, p. 384, add the following: 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec. Attribute 3495bd8deadSopenharmony_ci ---------------------------- ---- -------------------- ------------- ---------------- ----- --------- 3505bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT Z_2 GetTexParameter[if]v DECODE_EXT indicates when 3.8.15 texture 3515bd8deadSopenharmony_ci sRGB textures 3525bd8deadSopenharmony_ci are decoded from 3535bd8deadSopenharmony_ci sRGB or the 3545bd8deadSopenharmony_ci decoding step is 3555bd8deadSopenharmony_ci skipped 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci Add to Table 6.23 of ARB_sampler_objects, "Textures (state per sampler object)": 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec. Attribute 3605bd8deadSopenharmony_ci ---------------------------- ---- ------------------------ ------------- ---------------- ----- --------- 3615bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT Z_2 GetSamplerParameter[if]v DECODE_EXT indicates when 3.8.15 texture 3625bd8deadSopenharmony_ci sRGB textures 3635bd8deadSopenharmony_ci are decoded from 3645bd8deadSopenharmony_ci sRGB or the 3655bd8deadSopenharmony_ci decoding step is 3665bd8deadSopenharmony_ci skipped 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ciIssues 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci 1) What should this extension be called? 3715bd8deadSopenharmony_ci 3725bd8deadSopenharmony_ci RESOLVED: EXT_texture_sRGB_decode 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ci The purpose of this extension is to allow developers to skip 3755bd8deadSopenharmony_ci the sRGB-to-linear decoding detailed in Section 3.8.15. 3765bd8deadSopenharmony_ci Since this is a decoding of the sRGB value into linear space, we 3775bd8deadSopenharmony_ci use that word to describe the pname. The enum indicating this 3785bd8deadSopenharmony_ci decoding is to happen is DECODE, as that is what the GL will do. 3795bd8deadSopenharmony_ci The enum that indicates this decoding is to be skipped is then 3805bd8deadSopenharmony_ci appropriately, SKIP_DECODE. 3815bd8deadSopenharmony_ci 3825bd8deadSopenharmony_ci 2) Should this allow for filters other than NEAREST on undecoded 3835bd8deadSopenharmony_ci sRGB values? 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci RESOLVED: YES 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci Hardware supports this, and it is left up to the programmer. 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci 3) Do we generate an error if TEXTURE_SRGB_DECODE_EXT is changed for normal 3905bd8deadSopenharmony_ci textures? 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci RESOLVED: NO 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci This is similar to the ARB_shadow and ARB_framebuffer_sRGB extensions - the flag 3955bd8deadSopenharmony_ci is ignored for non-sRGB texture internal formats. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci 4) Should we add forward-looking support for ARB_sampler_objects? 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci RESOLVED: YES 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci If ARB_sampler_objects exists in the implementation, the sampler 4025bd8deadSopenharmony_ci objects should also include this parameter per sampler. 4035bd8deadSopenharmony_ci 4045bd8deadSopenharmony_ci 5) What is the expense of changing the sRGB-ness of a texture without 4055bd8deadSopenharmony_ci this extension? 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci RESOLVED: If an application wants to use a texture with sRGB 4085bd8deadSopenharmony_ci texels and then switch to using it with linear filtering (or vice 4095bd8deadSopenharmony_ci versa), OpenGL without this extension requires the application 4105bd8deadSopenharmony_ci to read back all the texels in all the mipmap levels of all the 4115bd8deadSopenharmony_ci images, and respecify a different texture object with a different 4125bd8deadSopenharmony_ci texture format. This is very expensive. 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci With this extension, the driver can simply change the underlying 4155bd8deadSopenharmony_ci hardware texture format associated with the texture to perform 4165bd8deadSopenharmony_ci sRGB conversion on filtering or not. This is very inexpensive. 4175bd8deadSopenharmony_ci 4185bd8deadSopenharmony_ci However, note that the functionality of this extension can also 4195bd8deadSopenharmony_ci be obtained using the more modern approach provided by 4205bd8deadSopenharmony_ci ARB_texture_view (added to OpenGL 4.3) and OES_texture_view. 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci 6) Do any major games or game engines depend on the ability to 4235bd8deadSopenharmony_ci change the sRGB-ness of textures? 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ci RESOLVED: Yes, Valve's Source engine used by Half-Life 2, 4265bd8deadSopenharmony_ci Counter-Strike: Source, and Left 4 Dead; and Unreal Engine 3 4275bd8deadSopenharmony_ci games including Unreal Tournament 3 and BioShock. 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ci These games and their underlying engines repeatedly render linear 4305bd8deadSopenharmony_ci color values into textures and then texture from the rendered 4315bd8deadSopenharmony_ci textures with sRGB texture filtering. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci 7) Why not simply allow changing whether a standard GL_RGBA8 4345bd8deadSopenharmony_ci can perform an sRGB color space conversion for filtering? 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci RESOLVED: Allowing this would create a consistency problem. 4375bd8deadSopenharmony_ci Why would the GL_TEXTURE_SRGB_DECODE_EXT parameter not 4385bd8deadSopenharmony_ci apply to GL_RGB4 or GL_RGB12 textures too? In practice, 4395bd8deadSopenharmony_ci sRGB color conversion for texture filtering is only typically 4405bd8deadSopenharmony_ci supported in hardware for a small subset of texture formats 4415bd8deadSopenharmony_ci (corresponding to the sized internal formats introduced by the 4425bd8deadSopenharmony_ci EXT_texture_sRGB specification). It's essentially only 8-bit 4435bd8deadSopenharmony_ci fixed-point unsigned textures where sRGB color conversion makes 4445bd8deadSopenharmony_ci sense. And the initial value of the parameter (GL_DECODE_EXT) would be 4455bd8deadSopenharmony_ci appropriate for sRGB texture formats but not conventional linear 4465bd8deadSopenharmony_ci texture formats (as no decoding needs to be done). Having the 4475bd8deadSopenharmony_ci 4485bd8deadSopenharmony_ci texture parameter apply just to sRGB texture eliminates the ambiguity 4495bd8deadSopenharmony_ci of which conventional texture formats can and cannot have sRGB decoding 4505bd8deadSopenharmony_ci applied to them. This also eliminates the burden of having every future 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci texture format extension specify whether or not the sRGB decoding parameter 4535bd8deadSopenharmony_ci applies to them. 4545bd8deadSopenharmony_ci 4555bd8deadSopenharmony_ci Direct3D 9 handles this situation by advertising for each surface 4565bd8deadSopenharmony_ci format (which double as texture formats) a D3DUSAGE_QUERY_SRGBREAD 4575bd8deadSopenharmony_ci parameter. In practice, Direct3D 9 implementation only advertise 4585bd8deadSopenharmony_ci the D3DUSAGE_QUERY_SRGBREAD parameter for 8-bit fixed-point 4595bd8deadSopenharmony_ci unsigned RGB or luminance formats, corresponding to the formats 4605bd8deadSopenharmony_ci available from EXT_texture_sRGB. 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ci 8) Does there need to be a control for whether to update (and 4635bd8deadSopenharmony_ci possibly blend) framebuffer pixels in sRGB or linear color space? 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci RESOLVED: The EXT_framebuffer_sRGB extension (made core in OpenGL 4665bd8deadSopenharmony_ci 3.0) already has this capability with the GL_FRAMEBUFFER_SRGB_EXT 4675bd8deadSopenharmony_ci enable. 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci The GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING query parameter 4705bd8deadSopenharmony_ci roughly corresponds to Direct3D 9's D3DUSAGE_QUERY_SRGBWRITE 4715bd8deadSopenharmony_ci parameter. 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci 9) How is the border color handled when toggling sRGB color 4745bd8deadSopenharmony_ci conversion for blending of sRGB textures? 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci RESOLVED: Consistent with the EXT_texture_sRGB specification, the 4775bd8deadSopenharmony_ci border color is always specified as a linear value (never sRGB). 4785bd8deadSopenharmony_ci So changing the TEXTURE_SRGB_DECODE_EXT parameter will 4795bd8deadSopenharmony_ci not affect the resulting sampled border color. 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci If an implementation were to store the texture border color in a 4825bd8deadSopenharmony_ci format consistent with the texel format (including the sRGB color 4835bd8deadSopenharmony_ci space), this would require such implementations to convert the 4845bd8deadSopenharmony_ci (linear) texture border RGB components to sRGB space. 4855bd8deadSopenharmony_ci In this case, this would mean an implementation to re-specify 4865bd8deadSopenharmony_ci the texture border color state in the hardware when the 4875bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT parameter for an sRGB texture 4885bd8deadSopenharmony_ci changed. 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci Alternatively, if the implementation stored the texture 4915bd8deadSopenharmony_ci border color in texture formant-independent format (say 4 4925bd8deadSopenharmony_ci floating-point values) and always treated this as a linear RGB 4935bd8deadSopenharmony_ci color for purposes of texture filtering, no sRGB conversion 4945bd8deadSopenharmony_ci of the texture border color would ever occur. In this case, 4955bd8deadSopenharmony_ci this would mean an implementation would NOT need to re-specify 4965bd8deadSopenharmony_ci the texture border color state in the hardware when the 4975bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT parameter for an sRGB texture 4985bd8deadSopenharmony_ci changed. 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci 10) How is mipmap generation of sRGB textures affected by the 5015bd8deadSopenharmony_ci TEXTURE_SRGB_DECODE_EXT parameter? 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci RESOLVED: When the TEXTURE_SRGB_DECODE parameter is DECODE_EXT 5045bd8deadSopenharmony_ci for an sRGB texture, mipmap generation should decode sRGB texels 5055bd8deadSopenharmony_ci to a linear RGB color space, perform downsampling, then encode 5065bd8deadSopenharmony_ci back to an sRGB color space. (Issue 24 in the EXT_texture_sRGB 5075bd8deadSopenharmony_ci specification provides a rationale for why.) When the parameter 5085bd8deadSopenharmony_ci is SKIP_DECODE_EXT instead, mipmap generation skips the encode 5095bd8deadSopenharmony_ci and decode steps during mipmap generation. By skipping the 5105bd8deadSopenharmony_ci encode and decode steps, sRGB mipmap generation should match 5115bd8deadSopenharmony_ci the mipmap generation for a non-sRGB texture. 5125bd8deadSopenharmony_ci 5135bd8deadSopenharmony_ci The TEXTURE_SRGB_DECODE_EXT texture parameter has no effect on 5145bd8deadSopenharmony_ci mipmap generation of non-sRGB textures. 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci Direct3D 10 and Direct3D 11 expect mipmap generation for sRGB 5175bd8deadSopenharmony_ci textures to be "correctly done" (meaning sRGB decode samples, 5185bd8deadSopenharmony_ci perform weighted average in linear space, then sRGB encode 5195bd8deadSopenharmony_ci the result). 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci Direct3D 9 expects to NOT perform sRGB-correct mipmap generation. 5225bd8deadSopenharmony_ci Hence the ability to generate mipmaps from an sRGB texture 5235bd8deadSopenharmony_ci where you skip the decode (and encode) during mipmap generation 5245bd8deadSopenharmony_ci is important. 5255bd8deadSopenharmony_ci 5265bd8deadSopenharmony_ci 11) Does automatic mipmap generation change the smaller mipmap levels 5275bd8deadSopenharmony_ci when the TEXTURE_SRGB_DECODE texture parameter changes? 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci RESOLVED: No, automatic mipmap generation only happens when the 5305bd8deadSopenharmony_ci base level is changed. 5315bd8deadSopenharmony_ci 5325bd8deadSopenharmony_ci This means if the TEXTURE_SRGB_DECODE parameter is changed from 5335bd8deadSopenharmony_ci DECODE_EXT to SKIP_DECODE_EXT (or vice versa), the texels in the 5345bd8deadSopenharmony_ci smaller mipmap levels are not modified. 5355bd8deadSopenharmony_ci 5365bd8deadSopenharmony_ci Use the glGenerateMipmap command to regenerate mipmaps explicitly 5375bd8deadSopenharmony_ci to reflect a change in the TEXTURE_SRGB_DECODE parameter. 5385bd8deadSopenharmony_ci 5395bd8deadSopenharmony_ci 12) How is this extension expected to be used for Direct3D 9 emulation? 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci RESOLVED: Direct3D texture resources that are created with a 5425bd8deadSopenharmony_ci format supporting either the SRGBREAD or SRGBWRITE capabilities 5435bd8deadSopenharmony_ci should be created as an OpenGL texture object with an sRGB 5445bd8deadSopenharmony_ci internal format. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci This means that normal "linear" RGBA8 textures for Direct3D 9 5475bd8deadSopenharmony_ci should be created as GL_SRGB8_ALPHA8 textures so they can be used 5485bd8deadSopenharmony_ci with samplers where the GL_TEXTURE_SRGB_DECODE_EXT parameter of 5495bd8deadSopenharmony_ci the sampler (assuming ARB_sampler_objects) determines whether 5505bd8deadSopenharmony_ci they operate as linear textures (the GL_SKIP_DECODE_EXT) state 5515bd8deadSopenharmony_ci or sRGB textures (the GL_DECODE_EXT state). 5525bd8deadSopenharmony_ci 5535bd8deadSopenharmony_ci Example for a Direct3D9 CreateTexture with a D3DFMT_A8R8G8B8 format: 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, 5565bd8deadSopenharmony_ci width, height, border, GL_UNSIGNED_BYTE, GL_RGBA, texels); 5575bd8deadSopenharmony_ci glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); 5585bd8deadSopenharmony_ci 5595bd8deadSopenharmony_ci Notice the texture is created with a GL_SRGB_ALPHA8 format but 5605bd8deadSopenharmony_ci immediately switched to GL_SKIP_DECODE_EXT. This is because: 5615bd8deadSopenharmony_ci 5625bd8deadSopenharmony_ci 1a) The format needs to be GL_SRGBA_ALPHA so that when used with 5635bd8deadSopenharmony_ci a sampler configured with the (initial) value of zero (false) 5645bd8deadSopenharmony_ci for D3DSAMP_SRGBTEXTURE, the texture will be filtered without 5655bd8deadSopenharmony_ci sRGB decode. 5665bd8deadSopenharmony_ci 5675bd8deadSopenharmony_ci 1b) Likewise, when D3DSAMP_SRGBTEXTURE is true for a sampler, the 5685bd8deadSopenharmony_ci texture needs to be decoded to sRGB for filtering. In this case, 5695bd8deadSopenharmony_ci the OpenGL translation would use: 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci glSamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT); 5725bd8deadSopenharmony_ci 5735bd8deadSopenharmony_ci 2) Direct3D9's D3DUSAGE_AUTOGENMIPMAP does not generate mipmaps 5745bd8deadSopenharmony_ci in sRGB space (but rather in linear space). 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci When rendering into a surface in Direct3D 9 with the 5775bd8deadSopenharmony_ci D3DRS_SRGBWRITEENABLE render state (set by SetRenderState) set to false, 5785bd8deadSopenharmony_ci the pixel updates (including blending) need to operate with 5795bd8deadSopenharmony_ci GL_FRAMEBUFFER_SRGB disabled. So: 5805bd8deadSopenharmony_ci 5815bd8deadSopenharmony_ci glDisable(GL_FRAMEBUFFER_SRGB); 5825bd8deadSopenharmony_ci 5835bd8deadSopenharmony_ci Likewise when the D3DRS_SRGBWRITEENABLE render state is true, 5845bd8deadSopenharmony_ci OpenGL should operate 5855bd8deadSopenharmony_ci 5865bd8deadSopenharmony_ci glEnable(GL_FRAMEBUFFER_SRGB); 5875bd8deadSopenharmony_ci 5885bd8deadSopenharmony_ci Any texture with an sRGB internal format (for example, 5895bd8deadSopenharmony_ci GL_SRGB8_ALPHA8 for the internal format) will perform sRGB decode 5905bd8deadSopenharmony_ci before blending and encode after blending. This matches the Direct3D9 5915bd8deadSopenharmony_ci semantics when D3DUSAGE_QUERY_SRGBWRITE is true of the resource format. 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci 13) How is this extension expected to be used for Direct3D 10 and 5945bd8deadSopenharmony_ci 11 emulation? 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ci RESOLVED: Direct3D 10 and 11 support non-mutable formats for sRGB 5975bd8deadSopenharmony_ci textures (matching the original behavior of EXT_texture_sRGB, 5985bd8deadSopenharmony_ci unextended by this extension). So the DXGI_FORMAT_*_SRGB 5995bd8deadSopenharmony_ci formats are always decoded from sRGB to linear (and vice versa) 6005bd8deadSopenharmony_ci as necessary. Formats not suffixed with _SRGB are never decoded 6015bd8deadSopenharmony_ci or encoded to sRGB. 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci Direct3D 10 and 11 support "typeless" resources with resource views 6045bd8deadSopenharmony_ci that can have different formats. So you can create a texture 6055bd8deadSopenharmony_ci with a format of DXGI_FORMAT_R8G8B8A8_TYPELESS and then create 6065bd8deadSopenharmony_ci shader resource views with the DXGI_FORMAT_R8G8B8A8_UNORM and 6075bd8deadSopenharmony_ci DXGI_FORMAT_R8G8B8A8_UNORM_SRGB formats on that. This is a much 6085bd8deadSopenharmony_ci more generic approach to decoupling storage and interpretation in 6095bd8deadSopenharmony_ci Direct3D 10 and 11. However support for "typeless" resources 6105bd8deadSopenharmony_ci and resource views is beyond the scope of this extension. 6115bd8deadSopenharmony_ci 6125bd8deadSopenharmony_ci These two questions from Microsoft's Direct3D 10 Frequently Asked 6135bd8deadSopenharmony_ci Questions list provide helpful context: 6145bd8deadSopenharmony_ci 6155bd8deadSopenharmony_ci "Q: Where did the D3DSAMP_SRGBTEXTURE state go? 6165bd8deadSopenharmony_ci 6175bd8deadSopenharmony_ci A: SRGB was removed as part of the sampler state and now 6185bd8deadSopenharmony_ci is tied to the texture format. Binding an SRGB texture will 6195bd8deadSopenharmony_ci result in the same sampling you would get if you specified 6205bd8deadSopenharmony_ci D3DSAMP_SRGBTEXTURE in Direct3D 9. 6215bd8deadSopenharmony_ci 6225bd8deadSopenharmony_ci Q: What are these new SRGB formats? 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci A: SRGB was removed as part of the sampler state and is 6255bd8deadSopenharmony_ci now tied to the texture format. Binding an SRGB texture will 6265bd8deadSopenharmony_ci result in the same sampling you would get if you specified 6275bd8deadSopenharmony_ci D3DSAMP_SRGBTEXTURE in Direct3D 9." 6285bd8deadSopenharmony_ci 6295bd8deadSopenharmony_ci This means that normal "linear" textures, such as 6305bd8deadSopenharmony_ci DXGI_FORMAT_R8G8B8A8_UNORM, would be created as GL_RGBA8 textures 6315bd8deadSopenharmony_ci (not sRGB), so that they will always behave as linear textures 6325bd8deadSopenharmony_ci (never sRGB-decoded). 6335bd8deadSopenharmony_ci 6345bd8deadSopenharmony_ci On the other hand, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB would be 6355bd8deadSopenharmony_ci created as GL_SRGB8_ALPHA8. Its texture sRGB decode parameter 6365bd8deadSopenharmony_ci would be left with the initial value of GL_DECODE_EXT. Mipmap 6375bd8deadSopenharmony_ci generation for a texture using DXGI_FORMAT_R8G8B8A8_UNORM_SRGB 6385bd8deadSopenharmony_ci (GL_RGB8_ALPHA8 in OpenGL) would perform the proper sRGB decode 6395bd8deadSopenharmony_ci and encode needed for automatic mipmap generation. 6405bd8deadSopenharmony_ci 6415bd8deadSopenharmony_ci In Direct3D 10 and 11 emulation, the GL_TEXTURE_SRGB_DECODE_EXT 6425bd8deadSopenharmony_ci parameter of sampler objects would simply be left at its initial 6435bd8deadSopenharmony_ci value of GL_DECODE_EXT. Unlike Direct3D 9 where the sampler 6445bd8deadSopenharmony_ci controlled sRGB decode (via the D3DSAMP_SRGBTEXTURE), that parameter 6455bd8deadSopenharmony_ci is not present in Direct3D 10 and 11 (see the FAQ questions above). 6465bd8deadSopenharmony_ci 6475bd8deadSopenharmony_ci The conclusion of this issue's discussion is that Direct3D 6485bd8deadSopenharmony_ci 10 and 11 emulation software should simply ignore the 6495bd8deadSopenharmony_ci EXT_texture_sRGB_decode extension. This is to be expected 6505bd8deadSopenharmony_ci because the EXT_texture_sRGB_decode extension is meant to match 6515bd8deadSopenharmony_ci the legacy functionality of Direct3D 9. 6525bd8deadSopenharmony_ci 6535bd8deadSopenharmony_ci 14) Why does Table X.1 show "Undefined", and why does it appear in 6545bd8deadSopenharmony_ci different columns depending on whether bindless samplers are used 6555bd8deadSopenharmony_ci or not? 6565bd8deadSopenharmony_ci 6575bd8deadSopenharmony_ci RESOLVED: Conceptually, TEXTURE_SRGB_DECODE_EXT is part of the 6585bd8deadSopenharmony_ci sampler state and should therefore not apply to texelFetch. However, 6595bd8deadSopenharmony_ci not all hardware has the required bit in the sampler state. 6605bd8deadSopenharmony_ci 6615bd8deadSopenharmony_ci With bindless samplers, texture handles are *always* statically 6625bd8deadSopenharmony_ci accessed by texelFetch (because an application could choose to do so 6635bd8deadSopenharmony_ci at any time), so applying the same rules as for non-bindless 6645bd8deadSopenharmony_ci samplers would make the functionality provided in this extension 6655bd8deadSopenharmony_ci useless. 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ciRevision History 6685bd8deadSopenharmony_ci 6695bd8deadSopenharmony_ci Rev. Date Author Changes 6705bd8deadSopenharmony_ci ---- -------- -------- ------------------------------------- 6715bd8deadSopenharmony_ci 0.91 11/08/17 nhaehnle Add interaction with bindless textures 6725bd8deadSopenharmony_ci (API issue #51) 6735bd8deadSopenharmony_ci 0.90 04/27/16 Jon Leech Add interaction with texelFetch builtins 6745bd8deadSopenharmony_ci (Bug 14934) 6755bd8deadSopenharmony_ci 0.89 08/14/13 dkoch Add interactions with ASTC/ETC2/NV_sRGB_formats 6765bd8deadSopenharmony_ci 0.88 07/24/13 mheyer Add OpenGL ES interactions 6775bd8deadSopenharmony_ci 0.87 08/22/11 mjk correction to issue #8 from Jason 6785bd8deadSopenharmony_ci 0.86 08/22/11 mjk corrections from Daniel + more interactions 6795bd8deadSopenharmony_ci 0.85 08/13/11 mjk corrections to issues from Jason and Henri 6805bd8deadSopenharmony_ci 0.84 08/05/11 mjk New issues to explain Direct3D interactions; 6815bd8deadSopenharmony_ci fix table Get Command. 6825bd8deadSopenharmony_ci 0.83 07/15/11 mjk "current texture unit" -> "texture 6835bd8deadSopenharmony_ci object" for mipmap generation 6845bd8deadSopenharmony_ci 0.82 04/12/11 mjk Mipmap generation interactions. 6855bd8deadSopenharmony_ci 0.81 11/18/10 mattc Fixed language in error section. 6865bd8deadSopenharmony_ci Cleaned up which functions take which tokens. 6875bd8deadSopenharmony_ci 0.8 11/18/10 mattc Added issues from EXT_texture_sRGB_decode 6885bd8deadSopenharmony_ci 6895bd8deadSopenharmony_ci for background info. Cleaned up layout. 6905bd8deadSopenharmony_ci 0.71 11/18/10 mattc Adapted apple_texture_linearize_srgb into 6915bd8deadSopenharmony_ci this specification. 692