1Name 2 3 NV_generate_mipmap_sRGB 4 5Name Strings 6 7 GL_NV_generate_mipmap_sRGB 8 9Contributors 10 11 Contributors to EXT_sRGB 12 Contributors to EXT_texture_sRGB 13 14Contact 15 16 Mathias Heyer, NVIDIA (mheyer 'at' nvidia.com 17 18Status 19 20 Complete. 21 22Version 23 24 Date: Sept 14, 2012 25 26Number 27 28 OpenGL ES Extension #144 29 30Dependencies 31 32 This extension requires OpenGL ES 1.0 or greater. It is written based on 33 the wording of the OpenGL ES 2.0.25 (November 2nd 2010) specification. 34 35 This extension requires EXT_sRGB. 36 37Overview 38 39 EXT_sRGB requires GenerateMipmap() to throw INVALID_OPERATION on textures 40 with sRGB encoding. NV_generate_mipmap_sRGB lifts this restriction. 41 42New Procedures and Functions 43 44 None 45 46New Tokens 47 48 None 49 50Additions to Chapter 3 of the OpenGL ES2.0 Specification (Rasterization) 51 52Modify Section 3.7.11: Mipmap Generation 53 54 Remove the following sentence from the end of this section: 55 56 "If the format of a texture is sRGB, the error INVALID_OPERATION is 57 generated." 58 59Errors 60 61 Relaxation of INVALID_OPERATION errors 62 --------------------------------- 63 64 GenerateMipmap does not throw an error if the format of the texture is sRGB 65 66 67New Implementation Dependent State 68 69 None 70 71 72Issues 73 74 1) How should mipmap generation work for sRGB textures? 75 76 RESOLVED: The best way to perform mipmap generation for sRGB 77 textures is by downsampling the sRGB image in a linear color 78 space. 79 80 This involves converting the RGB components of sRGB texels 81 in a given texture image level to linear RGB space, filtering 82 appropriately in that linear RGB space, and then converting the 83 linear RGB values to sRGB for storage in the downsampled texture 84 level image. 85 86 (Remember alpha, when present, is linear even in sRGB texture 87 formats.) 88 89 The OpenGL specification says "No particular filter algorithm 90 is required, though a box filter is recommended as the default 91 filter" meaning there is no requirement for how even non-sRGB 92 mipmaps should be generated. So while the resolution to this 93 issue is technically a recommendation, it is however a strongly 94 advised recommendation. 95 96 The rationale for why sRGB textures should be converted to 97 linear space prior to filtering and converted back to sRGB after 98 filtering is clear. If an implementation naively simply performed 99 linear filtering on (non-linear) sRGB components as if they were 100 in a linear space, the result tends to be a subtle darkening of 101 the texture images as mipmap generation continues recursively. 102 This darkening is an inappropriate basis that the resolved 103 "best way" above would avoid. 104 105 106Revision History 107 #01 9/14/2012 Mathias Heyer First draft. 108