15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_generate_mipmap_sRGB 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_generate_mipmap_sRGB 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Contributors to EXT_sRGB 125bd8deadSopenharmony_ci Contributors to EXT_texture_sRGB 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContact 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Mathias Heyer, NVIDIA (mheyer 'at' nvidia.com 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Complete. 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Date: Sept 14, 2012 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciNumber 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci OpenGL ES Extension #144 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciDependencies 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci This extension requires OpenGL ES 1.0 or greater. It is written based on 335bd8deadSopenharmony_ci the wording of the OpenGL ES 2.0.25 (November 2nd 2010) specification. 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci This extension requires EXT_sRGB. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciOverview 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci EXT_sRGB requires GenerateMipmap() to throw INVALID_OPERATION on textures 405bd8deadSopenharmony_ci with sRGB encoding. NV_generate_mipmap_sRGB lifts this restriction. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciNew Procedures and Functions 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci None 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciNew Tokens 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci None 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL ES2.0 Specification (Rasterization) 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ciModify Section 3.7.11: Mipmap Generation 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci Remove the following sentence from the end of this section: 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci "If the format of a texture is sRGB, the error INVALID_OPERATION is 575bd8deadSopenharmony_ci generated." 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ciErrors 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci Relaxation of INVALID_OPERATION errors 625bd8deadSopenharmony_ci --------------------------------- 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci GenerateMipmap does not throw an error if the format of the texture is sRGB 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciNew Implementation Dependent State 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci None 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ciIssues 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci 1) How should mipmap generation work for sRGB textures? 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci RESOLVED: The best way to perform mipmap generation for sRGB 775bd8deadSopenharmony_ci textures is by downsampling the sRGB image in a linear color 785bd8deadSopenharmony_ci space. 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci This involves converting the RGB components of sRGB texels 815bd8deadSopenharmony_ci in a given texture image level to linear RGB space, filtering 825bd8deadSopenharmony_ci appropriately in that linear RGB space, and then converting the 835bd8deadSopenharmony_ci linear RGB values to sRGB for storage in the downsampled texture 845bd8deadSopenharmony_ci level image. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci (Remember alpha, when present, is linear even in sRGB texture 875bd8deadSopenharmony_ci formats.) 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci The OpenGL specification says "No particular filter algorithm 905bd8deadSopenharmony_ci is required, though a box filter is recommended as the default 915bd8deadSopenharmony_ci filter" meaning there is no requirement for how even non-sRGB 925bd8deadSopenharmony_ci mipmaps should be generated. So while the resolution to this 935bd8deadSopenharmony_ci issue is technically a recommendation, it is however a strongly 945bd8deadSopenharmony_ci advised recommendation. 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci The rationale for why sRGB textures should be converted to 975bd8deadSopenharmony_ci linear space prior to filtering and converted back to sRGB after 985bd8deadSopenharmony_ci filtering is clear. If an implementation naively simply performed 995bd8deadSopenharmony_ci linear filtering on (non-linear) sRGB components as if they were 1005bd8deadSopenharmony_ci in a linear space, the result tends to be a subtle darkening of 1015bd8deadSopenharmony_ci the texture images as mipmap generation continues recursively. 1025bd8deadSopenharmony_ci This darkening is an inappropriate basis that the resolved 1035bd8deadSopenharmony_ci "best way" above would avoid. 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ciRevision History 1075bd8deadSopenharmony_ci #01 9/14/2012 Mathias Heyer First draft. 108