1Name 2 3 AMD_texture_texture4 4 5Name Strings 6 7 GL_AMD_texture_texture4 8 9Contact 10 11 Bill Licea-Kane, AMD ( Bill.Licea-Kane 'at' amd.com ) 12 13Contributors 14 15 Pierre Boudier 16 Eric Boumaour 17 Alex Chalfin 18 Nick Haemel 19 Evan Hart 20 Bill Licea-Kane 21 Benj Lipchak 22 Lijun Qu 23 24Status 25 26 Complete 27 28Version 29 30 Last Modified Date: Mar 6, 2009 31 Revision: 6 32 33Number 34 35 362 36 37Dependencies 38 39 OpenGL 1.1 is required. 40 41 The extension is written against the OpenGL 2.0 Specification. 42 43 The extension is written against the OpenGL Shading Language V 1.20 44 Specification. 45 46 This extension interacts with EXT_texture_anisotropic. 47 48 49Overview 50 51 This extension adds new shading language built-in texture functions 52 to the shading language. 53 54 These texture functions may be used to access one component textures. 55 56 The texture4 built-in function returns a texture value derived from 57 a 2x2 set of texels in the image array of level levelbase is selected. 58 These texels are selected in the same way as when the value of 59 TEXTURE_MIN_FILTER is LINEAR, but instead of these texels being 60 filtered to generate the texture value, the R, G, B and A texture values 61 are derived directly from these four texels. 62 63IP Status 64 65 No known claims. 66 67New Procedures and Functions 68 69 None 70 71New Tokens 72 73 None 74 75Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL 76Operation) 77 78 None 79 80Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 81 82 Add to section 3.8.8 (P. 174, Prior to "And for a one-dimensional texture"): 83 84 "For a texture4 built-in function (see OpenGL Shading Language), a 2x2 set 85 of texels in the image array of level levelbase is selected. These 86 texels are selected in the same way as when the value of TEXTURE_MIN_FILTER 87 is LINEAR, but instead of these texels being filtered to generate the 88 texture value, the R, G, B and A texture values are derived directly 89 from these four texels, 90 91 TauR = Taui0j1 (3.26a) 92 TauG = Taui1j1 93 TauB = Taui1j0 94 TauA = Taui0j0 95 96 ___________________________________________________________________ 97 | | 98 | 1.0 +---+---+---+---+---+---+---+---+ | 99 | 7| | | | | | | | | | 100 | +---+---+---+---+---+---+---+---+ | 101 | 6| | | | | | R | G | | | 102 | +---+---+---+---+---+---+---+---+ | 103 | 5| | | | | | A | B | | | 104 | +---+---+---+---+---+---+---+---+ | 105 | 4| | | | | | | | | | 106 | +---+---+---+---+---+---+---+---+ | 107 | 3| | | | | | | | | | 108 | +---+---+---+---+---+---+---+---+ | 109 | 2| | | | | | | | | | 110 | +---+---+---+---+---+---+---+---+ | 111 | 1| | | | | | | | | | 112 | +---+---+---+---+---+---+---+---+ | 113 | 0| | | | | | | | | | 114 | 0.0 +---+---+---+---+---+---+---+---+ | 115 | 0 1 2 3 4 5 6 7 | 116 | 0.0 1.0 | 117 | | 118 | Figure 3.10a. An example of an 8x8 texture image and the | 119 | components returned for texture4. | 120 | | 121 |_________________________________________________________________| 122 123 124 To achieve this packing, the use of texture4 is 125 restricted to textures with a single component base internal format of 126 ALPHA, DEPTH_COMPONENT, INTENSITY, or LUMINANCE and cannot be used 127 with a three-dimensional texture (see section 3.8.10)." 128 129 Add to caption of Table 3.21 (p. 184) 130 131 "If the texture4 built-in function is used to access a sampler, 132 texture source components are derived as if the Texture Base 133 Internal Format is RGBA. 134 135 Add to Section 3.11.2, Shader Execution, Texture Access 136 (p. 195) Prior to paragraph beginning "If a fragment shader uses a sampler..." 137 138 Texture4 lookups must be consistent with the texture state; the 139 results of the texture4 lookup are undefined if: 140 141 - The base internal format of the texture not one of ALPHA, 142 DEPTH_COMPONENT, INTENSITY, or LUMINANCE. 143 144 - The wrap modes is not either CLAMP_TO_EDGE or REPEAT. 145 146Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 147Operations and the Frame Buffer) 148 149 None 150 151Additions to Chapter 5 of the OpenGL 2.0 Specification (Special 152Functions) 153 154 None 155 156Additions to Chapter 6 of the OpenGL 2.0 Specification (State and 157State Requests) 158 159 None 160 161Additions to Chapter 1 of the OpenGL Shading Language 1.20 Specification 162(Introduction) 163 164Additions to Chapter 2 of the OpenGL Shading Language 1.20 Specification 165(Overview of OpenGL Shading) 166 167Additions to Chapter 3 of the OpenGL Shading Language 1.20 Specification 168(Basics) 169 170Additions to Chapter 4 of the OpenGL Shading Language 1.20 Specification 171(Variables and Types) 172 173Additions to Chapter 5 of the OpenGL Shading Language 1.20 Specification 174(Operators and Expressions) 175 176Additions to Chapter 6 of the OpenGL Shading Language 1.20 Specification 177(Statements and Structure) 178 179Additions to Chapter 7 of the OpenGL Shading Language 1.20 Specification 180(Built-in Variables) 181 182Additions to Chapter 8 of the OpenGL Shading Language 1.20 Specification 183(Built-in Functions) 184 185 Add to 8.7, Texture Lookup Functions 186 (p. 85) prior to paragraph beginning "In all functions below..." 187 188 Add to 8.7, Texture Lookup Functions, 189 (p. 85) to the texture built-in function table: 190 191 Syntax 192 vec4 texture4( sampler2D sampler, vec2 coord) 193 Description 194 Use the texture coordinate coord to do a texture lookup 195 in the 2D texture currently bound to sampler, and return 196 the four nearest (unfiltered) texels. 197 198Additions to Chapter 9 of the OpenGL Shading Language 1.20 Specification 199(Shading Language Grammar) 200 201Additions to Chapter 10 of the OpenGL Shading Language 1.20 202Specification (Issues) 203 204Errors 205 206 None. 207 208New State 209 210 None. 211 212New Implementation Dependent State 213 214 None 215 216Interactions with EXT_texture_filter_anisotropic 217 218 Texture4 is not an area filter. No LOD calculations are performed 219 and only texels in the baselevel can be returned. 220 221 Therefore, for the texture4 built-in function the preferred implementation 222 would sample four texels even if TEXTURE_MAX_ANISOTROPY_EXT is greater than 1.0. 223 224Issues 225 226 1) How is this related to ATI_texture_nearest_four? 227 228 ATI_texture_nearest_four only set texture filter state. 229 230 This extension adds built-in functions to the shading language 231 that will fetch four texels from the baselevel. 232 233 2) What about extending this to allow texture4 fetches from 234 RG, RGB, and RGBA textures? 235 236 Resolution - defer. This extension only fetches from one component 237 textures. 238 239 3) What about the use of this extension with fixed function? 240 241 Resolution - The built-in functions are added to the shading 242 language only. There is no ability to fetch four texels in 243 fixed function. 244 245 4) What naming convention do we use for the new texture built-in 246 functions? 247 248 Resolution - Even though this extension is written against 249 OpenGL Shading Language 1.20, we use the naming convention 250 for OpenGL Shading Language 1.30. 251 252 5) Should we add built-in texture functions for: 253 * Fetch4 with Absolute LOD? 254 * Fetch4 with Relative LOD? 255 * Fetch4 with coordinate offsets? 256 * Fetch4 with compare? 257 258 Resolved - No. 259 260 6) If the texture is not a single component, or if the 261 wrap modes are not clamp_to_edge or repeat, is the texture 262 treated as incomplete, or are the values returned by the 263 texture4 built-in undefined? 264 265 Unresolved. This draft makes them undefined. 266 267 7) Can both texture *AND* texture4 built-in functions 268 sample from the same sampler in a shader? 269 270 No. 271 272Revision History: 273 274 Date: 03/06/2008 275 Revision: 6 (wwlk) 276 Remove redundant <CR><LF>s (Apple v Microsoft) 277 278 Date: 03/04/2008 279 Revision: 5 (wwlk) 280 General cleanup for posting to registry. 281 282 Date: 01/15/2009 283 Revision: 4 (wwlk) 284 Updated IP Status. 285 286 Date: 06/24/2008 287 Revision: 3 (wwlk) 288 Deleted mip-mapping section. (Inadvertent undelete.) 289 290 Date: 06/24/2008 291 292 Revision: 2 (wwlk) 293 Dropped texture filter state. 294 Document restrictions of texture4. (Baselevel only.) 295 296 297 Date: 06/18/2008 298 Revision: 1 (wwlk) 299 1st draft derived from ATI_texture_nearest_four 300