1Name 2 3 OES_texture_npot 4 5Name Strings 6 7 GL_OES_texture_npot 8 9Contact 10 11 Bruce Merry (bruce.merry at arm.com) 12 13Contributors 14 15 Khronos OpenGL ES working group 16 Contributors to ARB_texture_non_power_of_two 17 18Notice 19 20 Copyright (c) 2005-2013 The Khronos Group Inc. Copyright terms at 21 http://www.khronos.org/registry/speccopyright.html 22 23Specification Update Policy 24 25 Khronos-approved extension specifications are updated in response to 26 issues and bugs prioritized by the Khronos OpenGL ES Working Group. For 27 extensions which have been promoted to a core Specification, fixes will 28 first appear in the latest version of that core Specification, and will 29 eventually be backported to the extension document. This policy is 30 described in more detail at 31 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 32 33IP Status 34 35 None. 36 37Status 38 39 Ratified by the Khronos BOP, July 22, 2005. 40 41Version 42 43 Last Modifed Date: 2011-03-07 44 Author Revision: 3 45 46Number 47 48 OpenGL ES Extension #37 49 50Dependencies 51 52 OpenGL ES 1.0 or OpenGL ES 2.0 is required. This extension is 53 written against OpenGL ES 1.1.12 and OpenGL ES 2.0.25. 54 55 This extension interacts with OES_framebuffer_object, OES_texture_3D 56 and APPLE_texture_2D_limited_npot. 57 58Overview 59 60 This extension adds support for the REPEAT and MIRRORED_REPEAT 61 texture wrap modes and the minification filters supported for 62 non-power of two 2D textures, cubemaps and for 3D textures, if 63 the OES_texture_3D extension is supported. 64 65 Section 3.8.2 of the OpenGL ES 2.0 specification describes 66 rules for sampling from an incomplete texture. There were specific 67 rules added for non-power of two textures i.e. if the texture wrap 68 mode is not CLAMP_TO_EDGE or minification filter is not NEAREST or 69 LINEAR and the texture is a non-power-of-two texture, then sampling 70 the texture will return (0, 0, 0, 1). 71 72 These rules are no longer applied by an implementation that supports 73 this extension. 74 75Additions to Chapter 3 of the OpenGL ES 2.0 Full Specification 76 77 In section 3.7.1 (Texture Image Specification), remove the sentence 78 79 "If <level> is greater than zero, and either <width> or <height> 80 is not a power of two, the error INVALID_VALUE is generated." 81 82 In section 3.7.7 (Texture Minification), remove the paragraph 83 84 "If any dimension of any array in a mipmap is not a power of two 85 (e.g. if rounding down as described above is performed), then 86 the mipmap is described as a non-power-of-two texture. 87 Non-power-of-two textures have restrictions on the allowed 88 texture wrap modes and filters, as described in section 3.8.2." 89 90 Change the title of 3.7.10 (Texture Completeness and 91 Non-Power-Of-Two Textures) to "Texture Completeness". 92 93 In section 3.7.11 (Mipmap Generation), remove the sentence 94 95 "If either the width or height of the level zero array are not a 96 power or two, the error INVALID_OPERATION is generated." 97 98 In section 3.8.2 (Shader Execution), remove the bullet points 99 100 " 101 - A two-dimensional sampler is called, the corresponding texture 102 image is a non-power-of-two image (as described in the 103 Mipmapping discussion of section 3.7.7), and either the 104 texture wrap mode is not CLAMP_TO_EDGE, or the minification 105 filter is neither NEAREST nor LINEAR. 106 107 - A cube map sampler is called, any of the corresponding texture 108 images are non-power-of-two images, and either the texture 109 wrap mode is not CLAMP_TO_EDGE, or the minification filter 110 is neither NEAREST nor LINEAR. 111 " 112 113Additions to Chapter 3 of the OpenGL ES 1.1.12 Full Specification 114 115 In section 3.7.1 (Texture Image Specification): 116 117 Replace the discussion of valid dimensions with 118 119 "If w_s and h_s are the specified image width and height, and if w_s 120 or h_s is less than zero, then the error INVALID_VALUE is 121 generated." 122 123 Replace the discussion of image decoding with: 124 125 "We shall refer to the decoded image as the texture array. A 126 texture array has width and height w_s and h_s as defined above." 127 128 Update Figure 3.8's caption: 129 130 "... This is a texture with w_t = 8 and h_t = 4. ..." 131 132 133 In section 3.7.7 (Texture Minification): 134 135 In the subsection "Scale Factor and Level of Detail"... 136 137 Replace the sentence defining the u and v functions with: 138 139 "Let u(x,y) = w_s * s(x,y) and v(x,y) = h_s * t(x,y), where w_s and 140 h_s are equal to the width and height of the image array whose level 141 is zero." 142 143 Replace 2^n and 2^m with w_s and h_s in Equations 3.16 and 3.17. 144 145 { floor(u), s < 1 146 i = { (3.16) 147 { w_s - 1, s = 1 148 149 { floor(v), t < 1 150 j = { (3.17) 151 { h_s - 1, t = 1 152 153 Replace 2^n and 2^m with w_s and h_s in the equations for computing i_0, 154 j_0, i_1, and j_1 used for LINEAR filtering. 155 156 { floor(u - 1/2) mod w_s, TEXTURE_WRAP_S is REPEAT 157 i_0 = { 158 { floor(u - 1/2), otherwise 159 160 { floor(v - 1/2) mod h_s, TEXTURE_WRAP_T is REPEAT 161 j_0 = { 162 { floor(v - 1/2), otherwise 163 164 { (i_0 + 1) mod w_s, TEXTURE_WRAP_S is REPEAT 165 i_1 = { 166 { i_0 + 1, otherwise 167 168 { (j_0 + 1) mod h_s, TEXTURE_WRAP_T is REPEAT 169 j_1 = { 170 { j_0 + 1, otherwise 171 172 In the subsection "Mipmapping", replace the description of the 173 number of sizes of image arrays with 174 175 "If the image array of level zero has dimensions w_t x h_t, then 176 there are floor(log2(max(w_t, h_t))) + 1 image arrays in the mipmap. 177 Each array subsequent to the level zero array has dimensions 178 179 max(1, floor(w_t/2^i)) x max(1, floor(h_t/2^i)) 180 181 until the last array is reached with dimension 1 x 1. 182 183Interactions with OES_framebuffer_object 184 185 If OES_framebuffer_object is supported, then GenerateMipmapOES does 186 not generate an error if the base level is a non-power-of-two image. 187 188Interactions with OES_texture_3D 189 190 If OES_texture_3D is supported, references to width and height 191 should be extended to refer to depth as appropriate, and mipmap 192 generation is permitted for non-power-of-two 3D textures. 193 194Interactions with APPLE_texture_2D_limited_npot 195 196 This extension is a superset of the function in 197 APPLE_texture_2D_limited_npot. Implementations may choose to 198 advertise both extensions, but APPLE_texture_2D_limited_npot is not 199 required to implement this extension on OpenGL ES 1.x. 200 201Issues 202 203 1) How does this extension interact with manual mipmap generation 204 (GenerateMipmap and GenerateMipmapOES)? 205 206 RESOLVED: These are supported for NPOT textures. 207 208 The initial version of this extension did not remove the error when 209 issuing these commands on an non-power-of-two texture, but multiple 210 vendors implemented support for it anyway. 211 212 2) How does this extension interact with automatic mipmap generation 213 in GL ES 1.1 (GENERATE_MIPMAP)? 214 215 RESOLVED: These are supported for NPOT textures. 216 217 3) How should this extension interact with 218 APPLE_texture_2D_limited_npot? 219 220 RESOLVED: it will be a superset, but will not require it. 221 222 4) How should this extension interact with OES_texture_3D? 223 224 RESOLVED: mipmap generation of NPOT 3D textures is supported. 225 226 OES_texture_3D already specifies that OES_texture_npot enables 227 support for mipmapped 3D textures, but it is unclear whether this 228 should also allow mipmap generation for NPOT 3D textures. 229 230 5) How should this extension interact with 231 OES_compressed_paletted_texture? 232 233 UNRESOLVED 234 235 Specifically, it's now possible for a row of texels to not be a 236 multiple of the unit size (bytes for PALETTE4_xxx, 32-bit words for 237 PALETTE8_xxx). Options seem to be 238 239 A) Pad each row to a multiple of the unit size. 240 B) Pad each image to a multiple of the unit size. 241 C) No padding - images can start in the middle of a unit. 242 243New Tokens 244 245 None. 246 247New Procedures and Functions 248 249 None. 250 251Errors 252 253 None. 254 255New State 256 257 None. 258 259Revision History 260 261 3 2011-03-07 Bruce Merry Added issue 5 262 263 2 2011-03-01 Bruce Merry Filled in body and issues 264 265 1 2005-07-06 Aaftab Munshi Created the extension 266