Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 3 | * Version: 6.5.1 |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 4 | * |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 6 | * Copyright (c) 2008 VMware, Inc. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation |
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | * and/or sell copies of the Software, and to permit persons to whom the |
| 13 | * Software is furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included |
| 16 | * in all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 22 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 24 | */ |
| 25 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 26 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 27 | /** |
| 28 | * \file texformat.c |
| 29 | * Texture formats. |
| 30 | * |
| 31 | * \author Gareth Hughes |
| 32 | */ |
| 33 | |
| 34 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 35 | #include "colormac.h" |
| 36 | #include "context.h" |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 37 | #include "texcompress.h" |
| 38 | #include "texcompress_fxt1.h" |
| 39 | #include "texcompress_s3tc.h" |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 40 | #include "texformat.h" |
Brian Paul | 3623733 | 2004-04-22 00:54:53 +0000 | [diff] [blame] | 41 | #include "texstore.h" |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 42 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 43 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 44 | #if FEATURE_EXT_texture_sRGB |
| 45 | |
| 46 | /** |
| 47 | * Convert an 8-bit sRGB value from non-linear space to a |
| 48 | * linear RGB value in [0, 1]. |
| 49 | * Implemented with a 256-entry lookup table. |
| 50 | */ |
| 51 | static INLINE GLfloat |
| 52 | nonlinear_to_linear(GLubyte cs8) |
| 53 | { |
| 54 | static GLfloat table[256]; |
| 55 | static GLboolean tableReady = GL_FALSE; |
| 56 | if (!tableReady) { |
| 57 | /* compute lookup table now */ |
| 58 | GLuint i; |
| 59 | for (i = 0; i < 256; i++) { |
| 60 | const GLfloat cs = UBYTE_TO_FLOAT(i); |
| 61 | if (cs <= 0.04045) { |
Michal Krol | 9614eac | 2008-07-15 11:15:27 +0200 | [diff] [blame] | 62 | table[i] = cs / 12.92f; |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 63 | } |
| 64 | else { |
Michal Krol | 9614eac | 2008-07-15 11:15:27 +0200 | [diff] [blame] | 65 | table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | tableReady = GL_TRUE; |
| 69 | } |
| 70 | return table[cs8]; |
| 71 | } |
| 72 | |
| 73 | |
| 74 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 75 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 76 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 77 | /* Texel fetch routines for all supported formats |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 78 | */ |
| 79 | #define DIM 1 |
| 80 | #include "texformat_tmp.h" |
| 81 | |
| 82 | #define DIM 2 |
| 83 | #include "texformat_tmp.h" |
| 84 | |
| 85 | #define DIM 3 |
| 86 | #include "texformat_tmp.h" |
| 87 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 88 | /** |
| 89 | * Null texel fetch function. |
| 90 | * |
| 91 | * Have to have this so the FetchTexel function pointer is never NULL. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 92 | */ |
| 93 | static void fetch_null_texel( const struct gl_texture_image *texImage, |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 94 | GLint i, GLint j, GLint k, GLchan *texel ) |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 95 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 96 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 97 | texel[RCOMP] = 0; |
| 98 | texel[GCOMP] = 0; |
| 99 | texel[BCOMP] = 0; |
| 100 | texel[ACOMP] = 0; |
| 101 | _mesa_warning(NULL, "fetch_null_texel() called!"); |
| 102 | } |
| 103 | |
| 104 | static void fetch_null_texelf( const struct gl_texture_image *texImage, |
| 105 | GLint i, GLint j, GLint k, GLfloat *texel ) |
| 106 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 107 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 108 | texel[RCOMP] = 0.0; |
| 109 | texel[GCOMP] = 0.0; |
| 110 | texel[BCOMP] = 0.0; |
| 111 | texel[ACOMP] = 0.0; |
| 112 | _mesa_warning(NULL, "fetch_null_texelf() called!"); |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 113 | } |
| 114 | |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 115 | static void store_null_texel(struct gl_texture_image *texImage, |
| 116 | GLint i, GLint j, GLint k, const void *texel) |
| 117 | { |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 118 | (void) texImage; |
| 119 | (void) i; |
| 120 | (void) j; |
| 121 | (void) k; |
| 122 | (void) texel; |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 123 | /* no-op */ |
| 124 | } |
| 125 | |
| 126 | |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 127 | /** |
| 128 | * Notes about the predefined gl_texture_formats: |
| 129 | * |
| 130 | * 1. There are 1D, 2D and 3D functions for fetching texels from texture |
| 131 | * images, returning both GLchan values and GLfloat values. (six |
| 132 | * functions in total) |
| 133 | * You don't have to provide both the GLchan and GLfloat functions; |
| 134 | * just one or the other is OK. Mesa will use an "adaptor" to convert |
| 135 | * between GLchan/GLfloat when needed. |
| 136 | * Since the adaptors have small performance penalty, we provide both |
| 137 | * GLchan and GLfloat functions for some common formats like RGB, RGBA. |
| 138 | */ |
| 139 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 140 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 141 | /***************************************************************/ |
| 142 | /** \name Default GLchan-based formats */ |
| 143 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 144 | |
| 145 | const struct gl_texture_format _mesa_texformat_rgba = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 146 | MESA_FORMAT_RGBA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 147 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 148 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 149 | CHAN_BITS, /* RedBits */ |
| 150 | CHAN_BITS, /* GreenBits */ |
| 151 | CHAN_BITS, /* BlueBits */ |
| 152 | CHAN_BITS, /* AlphaBits */ |
| 153 | 0, /* LuminanceBits */ |
| 154 | 0, /* IntensityBits */ |
| 155 | 0, /* IndexBits */ |
| 156 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 157 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 158 | 4 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 159 | _mesa_texstore_rgba, /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 160 | NULL, /* FetchTexel1D */ |
| 161 | NULL, /* FetchTexel2D */ |
| 162 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 163 | NULL, /* FetchTexel1Df */ |
| 164 | NULL, /* FetchTexel2Df */ |
| 165 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 166 | store_texel_rgba /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | const struct gl_texture_format _mesa_texformat_rgb = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 170 | MESA_FORMAT_RGB, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 171 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 172 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 173 | CHAN_BITS, /* RedBits */ |
| 174 | CHAN_BITS, /* GreenBits */ |
| 175 | CHAN_BITS, /* BlueBits */ |
| 176 | 0, /* AlphaBits */ |
| 177 | 0, /* LuminanceBits */ |
| 178 | 0, /* IntensityBits */ |
| 179 | 0, /* IndexBits */ |
| 180 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 181 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 182 | 3 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 183 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 184 | NULL, /* FetchTexel1D */ |
| 185 | NULL, /* FetchTexel2D */ |
| 186 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 187 | NULL, /* FetchTexel1Df */ |
| 188 | NULL, /* FetchTexel2Df */ |
| 189 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 190 | store_texel_rgb /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | const struct gl_texture_format _mesa_texformat_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 194 | MESA_FORMAT_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 195 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 196 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 197 | 0, /* RedBits */ |
| 198 | 0, /* GreenBits */ |
| 199 | 0, /* BlueBits */ |
| 200 | CHAN_BITS, /* AlphaBits */ |
| 201 | 0, /* LuminanceBits */ |
| 202 | 0, /* IntensityBits */ |
| 203 | 0, /* IndexBits */ |
| 204 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 205 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 206 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 207 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 208 | NULL, /* FetchTexel1D */ |
| 209 | NULL, /* FetchTexel2D */ |
| 210 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 211 | NULL, /* FetchTexel1Df */ |
| 212 | NULL, /* FetchTexel2Df */ |
| 213 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 214 | store_texel_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | const struct gl_texture_format _mesa_texformat_luminance = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 218 | MESA_FORMAT_LUMINANCE, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 219 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 220 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 221 | 0, /* RedBits */ |
| 222 | 0, /* GreenBits */ |
| 223 | 0, /* BlueBits */ |
| 224 | 0, /* AlphaBits */ |
| 225 | CHAN_BITS, /* LuminanceBits */ |
| 226 | 0, /* IntensityBits */ |
| 227 | 0, /* IndexBits */ |
| 228 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 229 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 230 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 231 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 232 | NULL, /* FetchTexel1D */ |
| 233 | NULL, /* FetchTexel2D */ |
| 234 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 235 | NULL, /* FetchTexel1Df */ |
| 236 | NULL, /* FetchTexel2Df */ |
| 237 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 238 | store_texel_luminance /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 239 | }; |
| 240 | |
| 241 | const struct gl_texture_format _mesa_texformat_luminance_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 242 | MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 243 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 244 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 245 | 0, /* RedBits */ |
| 246 | 0, /* GreenBits */ |
| 247 | 0, /* BlueBits */ |
| 248 | CHAN_BITS, /* AlphaBits */ |
| 249 | CHAN_BITS, /* LuminanceBits */ |
| 250 | 0, /* IntensityBits */ |
| 251 | 0, /* IndexBits */ |
| 252 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 253 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 254 | 2 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 255 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 256 | NULL, /* FetchTexel1D */ |
| 257 | NULL, /* FetchTexel2D */ |
| 258 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 259 | NULL, /* FetchTexel1Df */ |
| 260 | NULL, /* FetchTexel2Df */ |
| 261 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 262 | store_texel_luminance_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | const struct gl_texture_format _mesa_texformat_intensity = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 266 | MESA_FORMAT_INTENSITY, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 267 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 268 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 269 | 0, /* RedBits */ |
| 270 | 0, /* GreenBits */ |
| 271 | 0, /* BlueBits */ |
| 272 | 0, /* AlphaBits */ |
| 273 | 0, /* LuminanceBits */ |
| 274 | CHAN_BITS, /* IntensityBits */ |
| 275 | 0, /* IndexBits */ |
| 276 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 277 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 278 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 279 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 280 | NULL, /* FetchTexel1D */ |
| 281 | NULL, /* FetchTexel2D */ |
| 282 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 283 | NULL, /* FetchTexel1Df */ |
| 284 | NULL, /* FetchTexel2Df */ |
| 285 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 286 | store_texel_intensity /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 287 | }; |
| 288 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 289 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 290 | #if FEATURE_EXT_texture_sRGB |
| 291 | |
| 292 | const struct gl_texture_format _mesa_texformat_srgb8 = { |
| 293 | MESA_FORMAT_SRGB8, /* MesaFormat */ |
| 294 | GL_RGB, /* BaseFormat */ |
| 295 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 296 | 8, /* RedBits */ |
| 297 | 8, /* GreenBits */ |
| 298 | 8, /* BlueBits */ |
| 299 | 0, /* AlphaBits */ |
| 300 | 0, /* LuminanceBits */ |
| 301 | 0, /* IntensityBits */ |
| 302 | 0, /* IndexBits */ |
| 303 | 0, /* DepthBits */ |
| 304 | 0, /* StencilBits */ |
| 305 | 3, /* TexelBytes */ |
| 306 | _mesa_texstore_srgb8, /* StoreTexImageFunc */ |
| 307 | NULL, /* FetchTexel1D */ |
| 308 | NULL, /* FetchTexel2D */ |
| 309 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 310 | NULL, /* FetchTexel1Df */ |
| 311 | NULL, /* FetchTexel2Df */ |
| 312 | NULL, /* FetchTexel3Df */ |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 313 | store_texel_srgb8 /* StoreTexel */ |
| 314 | }; |
| 315 | |
| 316 | const struct gl_texture_format _mesa_texformat_srgba8 = { |
| 317 | MESA_FORMAT_SRGBA8, /* MesaFormat */ |
| 318 | GL_RGBA, /* BaseFormat */ |
| 319 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 320 | 8, /* RedBits */ |
| 321 | 8, /* GreenBits */ |
| 322 | 8, /* BlueBits */ |
| 323 | 8, /* AlphaBits */ |
| 324 | 0, /* LuminanceBits */ |
| 325 | 0, /* IntensityBits */ |
| 326 | 0, /* IndexBits */ |
| 327 | 0, /* DepthBits */ |
| 328 | 0, /* StencilBits */ |
| 329 | 4, /* TexelBytes */ |
| 330 | _mesa_texstore_srgba8, /* StoreTexImageFunc */ |
| 331 | NULL, /* FetchTexel1D */ |
| 332 | NULL, /* FetchTexel2D */ |
| 333 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 334 | NULL, /* FetchTexel1Df */ |
| 335 | NULL, /* FetchTexel2Df */ |
| 336 | NULL, /* FetchTexel3Df */ |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 337 | store_texel_srgba8 /* StoreTexel */ |
| 338 | }; |
| 339 | |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 340 | const struct gl_texture_format _mesa_texformat_sargb8 = { |
| 341 | MESA_FORMAT_SARGB8, /* MesaFormat */ |
| 342 | GL_RGBA, /* BaseFormat */ |
| 343 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 344 | 8, /* RedBits */ |
| 345 | 8, /* GreenBits */ |
| 346 | 8, /* BlueBits */ |
| 347 | 8, /* AlphaBits */ |
| 348 | 0, /* LuminanceBits */ |
| 349 | 0, /* IntensityBits */ |
| 350 | 0, /* IndexBits */ |
| 351 | 0, /* DepthBits */ |
| 352 | 0, /* StencilBits */ |
| 353 | 4, /* TexelBytes */ |
| 354 | _mesa_texstore_sargb8, /* StoreTexImageFunc */ |
| 355 | NULL, /* FetchTexel1D */ |
| 356 | NULL, /* FetchTexel2D */ |
| 357 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 358 | NULL, /* FetchTexel1Df */ |
| 359 | NULL, /* FetchTexel2Df */ |
| 360 | NULL, /* FetchTexel3Df */ |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 361 | store_texel_sargb8 /* StoreTexel */ |
| 362 | }; |
| 363 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 364 | const struct gl_texture_format _mesa_texformat_sl8 = { |
| 365 | MESA_FORMAT_SL8, /* MesaFormat */ |
| 366 | GL_LUMINANCE, /* BaseFormat */ |
| 367 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 368 | 0, /* RedBits */ |
| 369 | 0, /* GreenBits */ |
| 370 | 0, /* BlueBits */ |
| 371 | 0, /* AlphaBits */ |
| 372 | 8, /* LuminanceBits */ |
| 373 | 0, /* IntensityBits */ |
| 374 | 0, /* IndexBits */ |
| 375 | 0, /* DepthBits */ |
| 376 | 0, /* StencilBits */ |
| 377 | 1, /* TexelBytes */ |
| 378 | _mesa_texstore_sl8, /* StoreTexImageFunc */ |
| 379 | NULL, /* FetchTexel1D */ |
| 380 | NULL, /* FetchTexel2D */ |
| 381 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 382 | NULL, /* FetchTexel1Df */ |
| 383 | NULL, /* FetchTexel2Df */ |
| 384 | NULL, /* FetchTexel3Df */ |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 385 | store_texel_sl8 /* StoreTexel */ |
| 386 | }; |
| 387 | |
Roland Scheidegger | 02a579f | 2009-03-28 01:19:49 +0100 | [diff] [blame] | 388 | /* Note: this format name looks like a misnomer, make it sal8? */ |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 389 | const struct gl_texture_format _mesa_texformat_sla8 = { |
| 390 | MESA_FORMAT_SLA8, /* MesaFormat */ |
| 391 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 392 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 393 | 0, /* RedBits */ |
| 394 | 0, /* GreenBits */ |
| 395 | 0, /* BlueBits */ |
| 396 | 8, /* AlphaBits */ |
| 397 | 8, /* LuminanceBits */ |
| 398 | 0, /* IntensityBits */ |
| 399 | 0, /* IndexBits */ |
| 400 | 0, /* DepthBits */ |
| 401 | 0, /* StencilBits */ |
| 402 | 2, /* TexelBytes */ |
| 403 | _mesa_texstore_sla8, /* StoreTexImageFunc */ |
| 404 | NULL, /* FetchTexel1D */ |
| 405 | NULL, /* FetchTexel2D */ |
| 406 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 407 | NULL, /* FetchTexel1Df */ |
| 408 | NULL, /* FetchTexel2Df */ |
| 409 | NULL, /* FetchTexel3Df */ |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 410 | store_texel_sla8 /* StoreTexel */ |
| 411 | }; |
| 412 | |
| 413 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 414 | |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 415 | const struct gl_texture_format _mesa_texformat_rgba_float32 = { |
| 416 | MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ |
| 417 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 418 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 419 | 8 * sizeof(GLfloat), /* RedBits */ |
| 420 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 421 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 422 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 423 | 0, /* LuminanceBits */ |
| 424 | 0, /* IntensityBits */ |
| 425 | 0, /* IndexBits */ |
| 426 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 427 | 0, /* StencilBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 428 | 4 * sizeof(GLfloat), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 429 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 430 | NULL, /* FetchTexel1D */ |
| 431 | NULL, /* FetchTexel1D */ |
| 432 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 433 | NULL, /* FetchTexel1Df */ |
| 434 | NULL, /* FetchTexel1Df */ |
| 435 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 436 | store_texel_rgba_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 437 | }; |
| 438 | |
| 439 | const struct gl_texture_format _mesa_texformat_rgba_float16 = { |
| 440 | MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ |
| 441 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 442 | GL_FLOAT, /* DataType */ |
| 443 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 444 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 445 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
| 446 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 447 | 0, /* LuminanceBits */ |
| 448 | 0, /* IntensityBits */ |
| 449 | 0, /* IndexBits */ |
| 450 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 451 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 452 | 4 * sizeof(GLhalfARB), /* TexelBytes */ |
| 453 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 454 | NULL, /* FetchTexel1D */ |
| 455 | NULL, /* FetchTexel1D */ |
| 456 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 457 | NULL, /* FetchTexel1Df */ |
| 458 | NULL, /* FetchTexel1Df */ |
| 459 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 460 | store_texel_rgba_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 461 | }; |
| 462 | |
| 463 | const struct gl_texture_format _mesa_texformat_rgb_float32 = { |
| 464 | MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ |
| 465 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 466 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 467 | 8 * sizeof(GLfloat), /* RedBits */ |
| 468 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 469 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 470 | 0, /* AlphaBits */ |
| 471 | 0, /* LuminanceBits */ |
| 472 | 0, /* IntensityBits */ |
| 473 | 0, /* IndexBits */ |
| 474 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 475 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 476 | 3 * sizeof(GLfloat), /* TexelBytes */ |
| 477 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 478 | NULL, /* FetchTexel1D */ |
| 479 | NULL, /* FetchTexel1D */ |
| 480 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 481 | NULL, /* FetchTexel1Df */ |
| 482 | NULL, /* FetchTexel1Df */ |
| 483 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 484 | store_texel_rgb_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 485 | }; |
| 486 | |
| 487 | const struct gl_texture_format _mesa_texformat_rgb_float16 = { |
| 488 | MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ |
| 489 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 490 | GL_FLOAT, /* DataType */ |
| 491 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 492 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 493 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 494 | 0, /* AlphaBits */ |
| 495 | 0, /* LuminanceBits */ |
| 496 | 0, /* IntensityBits */ |
| 497 | 0, /* IndexBits */ |
| 498 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 499 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 500 | 3 * sizeof(GLhalfARB), /* TexelBytes */ |
| 501 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 502 | NULL, /* FetchTexel1D */ |
| 503 | NULL, /* FetchTexel1D */ |
| 504 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 505 | NULL, /* FetchTexel1Df */ |
| 506 | NULL, /* FetchTexel1Df */ |
| 507 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 508 | store_texel_rgb_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 509 | }; |
| 510 | |
| 511 | const struct gl_texture_format _mesa_texformat_alpha_float32 = { |
| 512 | MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ |
| 513 | GL_ALPHA, /* BaseFormat */ |
| 514 | GL_FLOAT, /* DataType */ |
| 515 | 0, /* RedBits */ |
| 516 | 0, /* GreenBits */ |
| 517 | 0, /* BlueBits */ |
| 518 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 519 | 0, /* LuminanceBits */ |
| 520 | 0, /* IntensityBits */ |
| 521 | 0, /* IndexBits */ |
| 522 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 523 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 524 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 525 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 526 | NULL, /* FetchTexel1D */ |
| 527 | NULL, /* FetchTexel1D */ |
| 528 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 529 | NULL, /* FetchTexel1Df */ |
| 530 | NULL, /* FetchTexel1Df */ |
| 531 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 532 | store_texel_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 533 | }; |
| 534 | |
| 535 | const struct gl_texture_format _mesa_texformat_alpha_float16 = { |
| 536 | MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ |
| 537 | GL_ALPHA, /* BaseFormat */ |
| 538 | GL_FLOAT, /* DataType */ |
| 539 | 0, /* RedBits */ |
| 540 | 0, /* GreenBits */ |
| 541 | 0, /* BlueBits */ |
| 542 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 543 | 0, /* LuminanceBits */ |
| 544 | 0, /* IntensityBits */ |
| 545 | 0, /* IndexBits */ |
| 546 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 547 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 548 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 549 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 550 | NULL, /* FetchTexel1D */ |
| 551 | NULL, /* FetchTexel1D */ |
| 552 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 553 | NULL, /* FetchTexel1Df */ |
| 554 | NULL, /* FetchTexel1Df */ |
| 555 | NULL, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 556 | store_texel_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 557 | }; |
| 558 | |
| 559 | const struct gl_texture_format _mesa_texformat_luminance_float32 = { |
| 560 | MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ |
| 561 | GL_LUMINANCE, /* BaseFormat */ |
| 562 | GL_FLOAT, /* DataType */ |
| 563 | 0, /* RedBits */ |
| 564 | 0, /* GreenBits */ |
| 565 | 0, /* BlueBits */ |
| 566 | 0, /* AlphaBits */ |
| 567 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 568 | 0, /* IntensityBits */ |
| 569 | 0, /* IndexBits */ |
| 570 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 571 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 572 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 573 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 574 | NULL, /* FetchTexel1D */ |
| 575 | NULL, /* FetchTexel2D */ |
| 576 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 577 | NULL, /* FetchTexel1Df */ |
| 578 | NULL, /* FetchTexel2Df */ |
| 579 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 580 | store_texel_luminance_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 581 | }; |
| 582 | |
| 583 | const struct gl_texture_format _mesa_texformat_luminance_float16 = { |
| 584 | MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ |
| 585 | GL_LUMINANCE, /* BaseFormat */ |
| 586 | GL_FLOAT, /* DataType */ |
| 587 | 0, /* RedBits */ |
| 588 | 0, /* GreenBits */ |
| 589 | 0, /* BlueBits */ |
| 590 | 0, /* AlphaBits */ |
| 591 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 592 | 0, /* IntensityBits */ |
| 593 | 0, /* IndexBits */ |
| 594 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 595 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 596 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 597 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 598 | NULL, /* FetchTexel1D */ |
| 599 | NULL, /* FetchTexel2D */ |
| 600 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 601 | NULL, /* FetchTexel1Df */ |
| 602 | NULL, /* FetchTexel2Df */ |
| 603 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 604 | store_texel_luminance_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 605 | }; |
| 606 | |
| 607 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { |
| 608 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ |
| 609 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 610 | GL_FLOAT, /* DataType */ |
| 611 | 0, /* RedBits */ |
| 612 | 0, /* GreenBits */ |
| 613 | 0, /* BlueBits */ |
| 614 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 615 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 616 | 0, /* IntensityBits */ |
| 617 | 0, /* IndexBits */ |
| 618 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 619 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 620 | 2 * sizeof(GLfloat), /* TexelBytes */ |
| 621 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 622 | NULL, /* FetchTexel1D */ |
| 623 | NULL, /* FetchTexel2D */ |
| 624 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 625 | NULL, /* FetchTexel1Df */ |
| 626 | NULL, /* FetchTexel2Df */ |
| 627 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 628 | store_texel_luminance_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 629 | }; |
| 630 | |
| 631 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { |
| 632 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ |
| 633 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 634 | GL_FLOAT, /* DataType */ |
| 635 | 0, /* RedBits */ |
| 636 | 0, /* GreenBits */ |
| 637 | 0, /* BlueBits */ |
| 638 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 639 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 640 | 0, /* IntensityBits */ |
| 641 | 0, /* IndexBits */ |
| 642 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 643 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 644 | 2 * sizeof(GLhalfARB), /* TexelBytes */ |
| 645 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 646 | NULL, /* FetchTexel1D */ |
| 647 | NULL, /* FetchTexel2D */ |
| 648 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 649 | NULL, /* FetchTexel1Df */ |
| 650 | NULL, /* FetchTexel2Df */ |
| 651 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 652 | store_texel_luminance_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 653 | }; |
| 654 | |
| 655 | const struct gl_texture_format _mesa_texformat_intensity_float32 = { |
| 656 | MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ |
| 657 | GL_INTENSITY, /* BaseFormat */ |
| 658 | GL_FLOAT, /* DataType */ |
| 659 | 0, /* RedBits */ |
| 660 | 0, /* GreenBits */ |
| 661 | 0, /* BlueBits */ |
| 662 | 0, /* AlphaBits */ |
| 663 | 0, /* LuminanceBits */ |
| 664 | 8 * sizeof(GLfloat), /* IntensityBits */ |
| 665 | 0, /* IndexBits */ |
| 666 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 667 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 668 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 669 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 670 | NULL, /* FetchTexel1D */ |
| 671 | NULL, /* FetchTexel2D */ |
| 672 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 673 | NULL, /* FetchTexel1Df */ |
| 674 | NULL, /* FetchTexel2Df */ |
| 675 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 676 | store_texel_intensity_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 677 | }; |
| 678 | |
| 679 | const struct gl_texture_format _mesa_texformat_intensity_float16 = { |
| 680 | MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ |
| 681 | GL_INTENSITY, /* BaseFormat */ |
| 682 | GL_FLOAT, /* DataType */ |
| 683 | 0, /* RedBits */ |
| 684 | 0, /* GreenBits */ |
| 685 | 0, /* BlueBits */ |
| 686 | 0, /* AlphaBits */ |
| 687 | 0, /* LuminanceBits */ |
| 688 | 8 * sizeof(GLhalfARB), /* IntensityBits */ |
| 689 | 0, /* IndexBits */ |
| 690 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 691 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 692 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 693 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 694 | NULL, /* FetchTexel1D */ |
| 695 | NULL, /* FetchTexel2D */ |
| 696 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 697 | NULL, /* FetchTexel1Df */ |
| 698 | NULL, /* FetchTexel2Df */ |
| 699 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 700 | store_texel_intensity_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 701 | }; |
| 702 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 703 | const struct gl_texture_format _mesa_texformat_dudv8 = { |
| 704 | MESA_FORMAT_DUDV8, /* MesaFormat */ |
| 705 | GL_DUDV_ATI, /* BaseFormat */ |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 706 | GL_SIGNED_NORMALIZED, /* DataType */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 707 | /* maybe should add dudvBits field, but spec seems to be |
| 708 | lacking the ability to query with GetTexLevelParameter anyway */ |
| 709 | 0, /* RedBits */ |
| 710 | 0, /* GreenBits */ |
| 711 | 0, /* BlueBits */ |
| 712 | 0, /* AlphaBits */ |
| 713 | 0, /* LuminanceBits */ |
| 714 | 0, /* IntensityBits */ |
| 715 | 0, /* IndexBits */ |
| 716 | 0, /* DepthBits */ |
| 717 | 0, /* StencilBits */ |
| 718 | 2, /* TexelBytes */ |
| 719 | _mesa_texstore_dudv8, /* StoreTexImageFunc */ |
| 720 | NULL, /* FetchTexel1D */ |
Brian Paul | 4681a1d | 2009-03-13 08:36:51 -0600 | [diff] [blame] | 721 | NULL, /* FetchTexel2D */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 722 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 723 | NULL, /* FetchTexel1Df */ |
| 724 | NULL, /* FetchTexel2Df */ |
| 725 | NULL, /* FetchTexel3Df */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 726 | NULL /* StoreTexel */ |
| 727 | }; |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 728 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 729 | const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { |
| 730 | MESA_FORMAT_SIGNED_RGBA8888, /* MesaFormat */ |
| 731 | GL_RGBA, /* BaseFormat */ |
| 732 | GL_SIGNED_NORMALIZED, /* DataType */ |
| 733 | 8, /* RedBits */ |
| 734 | 8, /* GreenBits */ |
| 735 | 8, /* BlueBits */ |
| 736 | 8, /* AlphaBits */ |
| 737 | 0, /* LuminanceBits */ |
| 738 | 0, /* IntensityBits */ |
| 739 | 0, /* IndexBits */ |
| 740 | 0, /* DepthBits */ |
| 741 | 0, /* StencilBits */ |
| 742 | 4, /* TexelBytes */ |
| 743 | _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ |
| 744 | NULL, /* FetchTexel1D */ |
| 745 | NULL, /* FetchTexel2D */ |
| 746 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 747 | NULL, /* FetchTexel1Df */ |
| 748 | NULL, /* FetchTexel2Df */ |
| 749 | NULL, /* FetchTexel3Df */ |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 750 | store_texel_signed_rgba8888 /* StoreTexel */ |
| 751 | }; |
| 752 | |
Roland Scheidegger | bb386a1 | 2009-03-27 21:59:33 +0100 | [diff] [blame] | 753 | const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { |
| 754 | MESA_FORMAT_SIGNED_RGBA8888_REV, /* MesaFormat */ |
| 755 | GL_RGBA, /* BaseFormat */ |
| 756 | GL_SIGNED_NORMALIZED, /* DataType */ |
| 757 | 8, /* RedBits */ |
| 758 | 8, /* GreenBits */ |
| 759 | 8, /* BlueBits */ |
| 760 | 8, /* AlphaBits */ |
| 761 | 0, /* LuminanceBits */ |
| 762 | 0, /* IntensityBits */ |
| 763 | 0, /* IndexBits */ |
| 764 | 0, /* DepthBits */ |
| 765 | 0, /* StencilBits */ |
| 766 | 4, /* TexelBytes */ |
| 767 | _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ |
| 768 | NULL, /* FetchTexel1D */ |
| 769 | NULL, /* FetchTexel2D */ |
| 770 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 771 | NULL, /* FetchTexel1Df */ |
| 772 | NULL, /* FetchTexel2Df */ |
| 773 | NULL, /* FetchTexel3Df */ |
Roland Scheidegger | bb386a1 | 2009-03-27 21:59:33 +0100 | [diff] [blame] | 774 | store_texel_signed_rgba8888_rev /* StoreTexel */ |
| 775 | }; |
| 776 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 777 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 778 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 779 | |
| 780 | /***************************************************************/ |
| 781 | /** \name Hardware formats */ |
| 782 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 783 | |
| 784 | const struct gl_texture_format _mesa_texformat_rgba8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 785 | MESA_FORMAT_RGBA8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 786 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 787 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 788 | 8, /* RedBits */ |
| 789 | 8, /* GreenBits */ |
| 790 | 8, /* BlueBits */ |
| 791 | 8, /* AlphaBits */ |
| 792 | 0, /* LuminanceBits */ |
| 793 | 0, /* IntensityBits */ |
| 794 | 0, /* IndexBits */ |
| 795 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 796 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 797 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 798 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 799 | NULL, /* FetchTexel1D */ |
| 800 | NULL, /* FetchTexel2D */ |
| 801 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 802 | NULL, /* FetchTexel1Df */ |
| 803 | NULL, /* FetchTexel2Df */ |
| 804 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 805 | store_texel_rgba8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 806 | }; |
| 807 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 808 | const struct gl_texture_format _mesa_texformat_rgba8888_rev = { |
| 809 | MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 810 | GL_RGBA, /* BaseFormat */ |
| 811 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 812 | 8, /* RedBits */ |
| 813 | 8, /* GreenBits */ |
| 814 | 8, /* BlueBits */ |
| 815 | 8, /* AlphaBits */ |
| 816 | 0, /* LuminanceBits */ |
| 817 | 0, /* IntensityBits */ |
| 818 | 0, /* IndexBits */ |
| 819 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 820 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 821 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 822 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 823 | NULL, /* FetchTexel1D */ |
| 824 | NULL, /* FetchTexel2D */ |
| 825 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 826 | NULL, /* FetchTexel1Df */ |
| 827 | NULL, /* FetchTexel2Df */ |
| 828 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 829 | store_texel_rgba8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 830 | }; |
| 831 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 832 | const struct gl_texture_format _mesa_texformat_argb8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 833 | MESA_FORMAT_ARGB8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 834 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 835 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 836 | 8, /* RedBits */ |
| 837 | 8, /* GreenBits */ |
| 838 | 8, /* BlueBits */ |
| 839 | 8, /* AlphaBits */ |
| 840 | 0, /* LuminanceBits */ |
| 841 | 0, /* IntensityBits */ |
| 842 | 0, /* IndexBits */ |
| 843 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 844 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 845 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 846 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 847 | NULL, /* FetchTexel1D */ |
| 848 | NULL, /* FetchTexel2D */ |
| 849 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 850 | NULL, /* FetchTexel1Df */ |
| 851 | NULL, /* FetchTexel2Df */ |
| 852 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 853 | store_texel_argb8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 854 | }; |
| 855 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 856 | const struct gl_texture_format _mesa_texformat_argb8888_rev = { |
| 857 | MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 858 | GL_RGBA, /* BaseFormat */ |
| 859 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 860 | 8, /* RedBits */ |
| 861 | 8, /* GreenBits */ |
| 862 | 8, /* BlueBits */ |
| 863 | 8, /* AlphaBits */ |
| 864 | 0, /* LuminanceBits */ |
| 865 | 0, /* IntensityBits */ |
| 866 | 0, /* IndexBits */ |
| 867 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 868 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 869 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 870 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 871 | NULL, /* FetchTexel1D */ |
| 872 | NULL, /* FetchTexel2D */ |
| 873 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 874 | NULL, /* FetchTexel1Df */ |
| 875 | NULL, /* FetchTexel2Df */ |
| 876 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 877 | store_texel_argb8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 878 | }; |
| 879 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 880 | const struct gl_texture_format _mesa_texformat_rgb888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 881 | MESA_FORMAT_RGB888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 882 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 883 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 884 | 8, /* RedBits */ |
| 885 | 8, /* GreenBits */ |
| 886 | 8, /* BlueBits */ |
| 887 | 0, /* AlphaBits */ |
| 888 | 0, /* LuminanceBits */ |
| 889 | 0, /* IntensityBits */ |
| 890 | 0, /* IndexBits */ |
| 891 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 892 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 893 | 3, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 894 | _mesa_texstore_rgb888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 895 | NULL, /* FetchTexel1D */ |
| 896 | NULL, /* FetchTexel2D */ |
| 897 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 898 | NULL, /* FetchTexel1Df */ |
| 899 | NULL, /* FetchTexel2Df */ |
| 900 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 901 | store_texel_rgb888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 902 | }; |
| 903 | |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 904 | const struct gl_texture_format _mesa_texformat_bgr888 = { |
| 905 | MESA_FORMAT_BGR888, /* MesaFormat */ |
| 906 | GL_RGB, /* BaseFormat */ |
| 907 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 908 | 8, /* RedBits */ |
| 909 | 8, /* GreenBits */ |
| 910 | 8, /* BlueBits */ |
| 911 | 0, /* AlphaBits */ |
| 912 | 0, /* LuminanceBits */ |
| 913 | 0, /* IntensityBits */ |
| 914 | 0, /* IndexBits */ |
| 915 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 916 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 917 | 3, /* TexelBytes */ |
| 918 | _mesa_texstore_bgr888, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 919 | NULL, /* FetchTexel1D */ |
| 920 | NULL, /* FetchTexel2D */ |
| 921 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 922 | NULL, /* FetchTexel1Df */ |
| 923 | NULL, /* FetchTexel2Df */ |
| 924 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 925 | store_texel_bgr888 /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 926 | }; |
| 927 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 928 | const struct gl_texture_format _mesa_texformat_rgb565 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 929 | MESA_FORMAT_RGB565, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 930 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 931 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 932 | 5, /* RedBits */ |
| 933 | 6, /* GreenBits */ |
| 934 | 5, /* BlueBits */ |
| 935 | 0, /* AlphaBits */ |
| 936 | 0, /* LuminanceBits */ |
| 937 | 0, /* IntensityBits */ |
| 938 | 0, /* IndexBits */ |
| 939 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 940 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 941 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 942 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 943 | NULL, /* FetchTexel1D */ |
| 944 | NULL, /* FetchTexel2D */ |
| 945 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 946 | NULL, /* FetchTexel1Df */ |
| 947 | NULL, /* FetchTexel2Df */ |
| 948 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 949 | store_texel_rgb565 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 950 | }; |
| 951 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 952 | const struct gl_texture_format _mesa_texformat_rgb565_rev = { |
| 953 | MESA_FORMAT_RGB565_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 954 | GL_RGB, /* BaseFormat */ |
| 955 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 956 | 5, /* RedBits */ |
| 957 | 6, /* GreenBits */ |
| 958 | 5, /* BlueBits */ |
| 959 | 0, /* AlphaBits */ |
| 960 | 0, /* LuminanceBits */ |
| 961 | 0, /* IntensityBits */ |
| 962 | 0, /* IndexBits */ |
| 963 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 964 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 965 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 966 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 967 | NULL, /* FetchTexel1D */ |
| 968 | NULL, /* FetchTexel2D */ |
| 969 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 970 | NULL, /* FetchTexel1Df */ |
| 971 | NULL, /* FetchTexel2Df */ |
| 972 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 973 | store_texel_rgb565_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 974 | }; |
| 975 | |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 976 | const struct gl_texture_format _mesa_texformat_rgba4444 = { |
| 977 | MESA_FORMAT_RGBA4444, /* MesaFormat */ |
| 978 | GL_RGBA, /* BaseFormat */ |
| 979 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 980 | 4, /* RedBits */ |
| 981 | 4, /* GreenBits */ |
| 982 | 4, /* BlueBits */ |
| 983 | 4, /* AlphaBits */ |
| 984 | 0, /* LuminanceBits */ |
| 985 | 0, /* IntensityBits */ |
| 986 | 0, /* IndexBits */ |
| 987 | 0, /* DepthBits */ |
| 988 | 0, /* StencilBits */ |
| 989 | 2, /* TexelBytes */ |
| 990 | _mesa_texstore_rgba4444, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 991 | NULL, /* FetchTexel1D */ |
| 992 | NULL, /* FetchTexel2D */ |
| 993 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 994 | NULL, /* FetchTexel1Df */ |
| 995 | NULL, /* FetchTexel2Df */ |
| 996 | NULL, /* FetchTexel3Df */ |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 997 | store_texel_rgba4444 /* StoreTexel */ |
| 998 | }; |
| 999 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1000 | const struct gl_texture_format _mesa_texformat_argb4444 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1001 | MESA_FORMAT_ARGB4444, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1002 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1003 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1004 | 4, /* RedBits */ |
| 1005 | 4, /* GreenBits */ |
| 1006 | 4, /* BlueBits */ |
| 1007 | 4, /* AlphaBits */ |
| 1008 | 0, /* LuminanceBits */ |
| 1009 | 0, /* IntensityBits */ |
| 1010 | 0, /* IndexBits */ |
| 1011 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1012 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1013 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1014 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1015 | NULL, /* FetchTexel1D */ |
| 1016 | NULL, /* FetchTexel2D */ |
| 1017 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1018 | NULL, /* FetchTexel1Df */ |
| 1019 | NULL, /* FetchTexel2Df */ |
| 1020 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1021 | store_texel_argb4444 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1022 | }; |
| 1023 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1024 | const struct gl_texture_format _mesa_texformat_argb4444_rev = { |
| 1025 | MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1026 | GL_RGBA, /* BaseFormat */ |
| 1027 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1028 | 4, /* RedBits */ |
| 1029 | 4, /* GreenBits */ |
| 1030 | 4, /* BlueBits */ |
| 1031 | 4, /* AlphaBits */ |
| 1032 | 0, /* LuminanceBits */ |
| 1033 | 0, /* IntensityBits */ |
| 1034 | 0, /* IndexBits */ |
| 1035 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1036 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1037 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1038 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1039 | NULL, /* FetchTexel1D */ |
| 1040 | NULL, /* FetchTexel2D */ |
| 1041 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1042 | NULL, /* FetchTexel1Df */ |
| 1043 | NULL, /* FetchTexel2Df */ |
| 1044 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1045 | store_texel_argb4444_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1046 | }; |
| 1047 | |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 1048 | const struct gl_texture_format _mesa_texformat_rgba5551 = { |
| 1049 | MESA_FORMAT_RGBA5551, /* MesaFormat */ |
| 1050 | GL_RGBA, /* BaseFormat */ |
| 1051 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1052 | 5, /* RedBits */ |
| 1053 | 5, /* GreenBits */ |
| 1054 | 5, /* BlueBits */ |
| 1055 | 1, /* AlphaBits */ |
| 1056 | 0, /* LuminanceBits */ |
| 1057 | 0, /* IntensityBits */ |
| 1058 | 0, /* IndexBits */ |
| 1059 | 0, /* DepthBits */ |
| 1060 | 0, /* StencilBits */ |
| 1061 | 2, /* TexelBytes */ |
| 1062 | _mesa_texstore_rgba5551, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1063 | NULL, /* FetchTexel1D */ |
| 1064 | NULL, /* FetchTexel2D */ |
| 1065 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1066 | NULL, /* FetchTexel1Df */ |
| 1067 | NULL, /* FetchTexel2Df */ |
| 1068 | NULL, /* FetchTexel3Df */ |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 1069 | store_texel_rgba5551 /* StoreTexel */ |
| 1070 | }; |
| 1071 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1072 | const struct gl_texture_format _mesa_texformat_argb1555 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1073 | MESA_FORMAT_ARGB1555, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1074 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1075 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1076 | 5, /* RedBits */ |
| 1077 | 5, /* GreenBits */ |
| 1078 | 5, /* BlueBits */ |
| 1079 | 1, /* AlphaBits */ |
| 1080 | 0, /* LuminanceBits */ |
| 1081 | 0, /* IntensityBits */ |
| 1082 | 0, /* IndexBits */ |
| 1083 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1084 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1085 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1086 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1087 | NULL, /* FetchTexel1D */ |
| 1088 | NULL, /* FetchTexel2D */ |
| 1089 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1090 | NULL, /* FetchTexel1Df */ |
| 1091 | NULL, /* FetchTexel2Df */ |
| 1092 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1093 | store_texel_argb1555 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1094 | }; |
| 1095 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1096 | const struct gl_texture_format _mesa_texformat_argb1555_rev = { |
| 1097 | MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1098 | GL_RGBA, /* BaseFormat */ |
| 1099 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1100 | 5, /* RedBits */ |
| 1101 | 5, /* GreenBits */ |
| 1102 | 5, /* BlueBits */ |
| 1103 | 1, /* AlphaBits */ |
| 1104 | 0, /* LuminanceBits */ |
| 1105 | 0, /* IntensityBits */ |
| 1106 | 0, /* IndexBits */ |
| 1107 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1108 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1109 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1110 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1111 | NULL, /* FetchTexel1D */ |
| 1112 | NULL, /* FetchTexel2D */ |
| 1113 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1114 | NULL, /* FetchTexel1Df */ |
| 1115 | NULL, /* FetchTexel2Df */ |
| 1116 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1117 | store_texel_argb1555_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1118 | }; |
| 1119 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1120 | const struct gl_texture_format _mesa_texformat_al88 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1121 | MESA_FORMAT_AL88, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1122 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1123 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1124 | 0, /* RedBits */ |
| 1125 | 0, /* GreenBits */ |
| 1126 | 0, /* BlueBits */ |
| 1127 | 8, /* AlphaBits */ |
| 1128 | 8, /* LuminanceBits */ |
| 1129 | 0, /* IntensityBits */ |
| 1130 | 0, /* IndexBits */ |
| 1131 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1132 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1133 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1134 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1135 | NULL, /* FetchTexel1D */ |
| 1136 | NULL, /* FetchTexel2D */ |
| 1137 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1138 | NULL, /* FetchTexel1Df */ |
| 1139 | NULL, /* FetchTexel2Df */ |
| 1140 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1141 | store_texel_al88 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1142 | }; |
| 1143 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1144 | const struct gl_texture_format _mesa_texformat_al88_rev = { |
| 1145 | MESA_FORMAT_AL88_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1146 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 1147 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1148 | 0, /* RedBits */ |
| 1149 | 0, /* GreenBits */ |
| 1150 | 0, /* BlueBits */ |
| 1151 | 8, /* AlphaBits */ |
| 1152 | 8, /* LuminanceBits */ |
| 1153 | 0, /* IntensityBits */ |
| 1154 | 0, /* IndexBits */ |
| 1155 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1156 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1157 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1158 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1159 | NULL, /* FetchTexel1D */ |
| 1160 | NULL, /* FetchTexel2D */ |
| 1161 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1162 | NULL, /* FetchTexel1Df */ |
| 1163 | NULL, /* FetchTexel2Df */ |
| 1164 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1165 | store_texel_al88_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1166 | }; |
| 1167 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1168 | const struct gl_texture_format _mesa_texformat_rgb332 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1169 | MESA_FORMAT_RGB332, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1170 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1171 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1172 | 3, /* RedBits */ |
| 1173 | 3, /* GreenBits */ |
| 1174 | 2, /* BlueBits */ |
| 1175 | 0, /* AlphaBits */ |
| 1176 | 0, /* LuminanceBits */ |
| 1177 | 0, /* IntensityBits */ |
| 1178 | 0, /* IndexBits */ |
| 1179 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1180 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1181 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1182 | _mesa_texstore_rgb332, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1183 | NULL, /* FetchTexel1D */ |
| 1184 | NULL, /* FetchTexel2D */ |
| 1185 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1186 | NULL, /* FetchTexel1Df */ |
| 1187 | NULL, /* FetchTexel2Df */ |
| 1188 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1189 | store_texel_rgb332 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1190 | }; |
| 1191 | |
| 1192 | const struct gl_texture_format _mesa_texformat_a8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1193 | MESA_FORMAT_A8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1194 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1195 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1196 | 0, /* RedBits */ |
| 1197 | 0, /* GreenBits */ |
| 1198 | 0, /* BlueBits */ |
| 1199 | 8, /* AlphaBits */ |
| 1200 | 0, /* LuminanceBits */ |
| 1201 | 0, /* IntensityBits */ |
| 1202 | 0, /* IndexBits */ |
| 1203 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1204 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1205 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1206 | _mesa_texstore_a8, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1207 | NULL, /* FetchTexel1D */ |
| 1208 | NULL, /* FetchTexel2D */ |
| 1209 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1210 | NULL, /* FetchTexel1Df */ |
| 1211 | NULL, /* FetchTexel2Df */ |
| 1212 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1213 | store_texel_a8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1214 | }; |
| 1215 | |
| 1216 | const struct gl_texture_format _mesa_texformat_l8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1217 | MESA_FORMAT_L8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1218 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1219 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1220 | 0, /* RedBits */ |
| 1221 | 0, /* GreenBits */ |
| 1222 | 0, /* BlueBits */ |
| 1223 | 0, /* AlphaBits */ |
| 1224 | 8, /* LuminanceBits */ |
| 1225 | 0, /* IntensityBits */ |
| 1226 | 0, /* IndexBits */ |
| 1227 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1228 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1229 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1230 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1231 | NULL, /* FetchTexel1D */ |
| 1232 | NULL, /* FetchTexel2D */ |
| 1233 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1234 | NULL, /* FetchTexel1Df */ |
| 1235 | NULL, /* FetchTexel2Df */ |
| 1236 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1237 | store_texel_l8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1238 | }; |
| 1239 | |
| 1240 | const struct gl_texture_format _mesa_texformat_i8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1241 | MESA_FORMAT_I8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1242 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1243 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1244 | 0, /* RedBits */ |
| 1245 | 0, /* GreenBits */ |
| 1246 | 0, /* BlueBits */ |
| 1247 | 0, /* AlphaBits */ |
| 1248 | 0, /* LuminanceBits */ |
| 1249 | 8, /* IntensityBits */ |
| 1250 | 0, /* IndexBits */ |
| 1251 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1252 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1253 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1254 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1255 | NULL, /* FetchTexel1D */ |
| 1256 | NULL, /* FetchTexel2D */ |
| 1257 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1258 | NULL, /* FetchTexel1Df */ |
| 1259 | NULL, /* FetchTexel2Df */ |
| 1260 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1261 | store_texel_i8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1262 | }; |
| 1263 | |
| 1264 | const struct gl_texture_format _mesa_texformat_ci8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1265 | MESA_FORMAT_CI8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1266 | GL_COLOR_INDEX, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1267 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1268 | 0, /* RedBits */ |
| 1269 | 0, /* GreenBits */ |
| 1270 | 0, /* BlueBits */ |
| 1271 | 0, /* AlphaBits */ |
| 1272 | 0, /* LuminanceBits */ |
| 1273 | 0, /* IntensityBits */ |
| 1274 | 8, /* IndexBits */ |
| 1275 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1276 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1277 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1278 | _mesa_texstore_ci8, /* StoreTexImageFunc */ |
Brian Paul | cb5bd7d | 2009-03-08 20:53:41 -0600 | [diff] [blame] | 1279 | NULL, /* FetchTexel1D */ |
| 1280 | NULL, /* FetchTexel2D */ |
| 1281 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1282 | NULL, /* FetchTexel1Df */ |
| 1283 | NULL, /* FetchTexel2Df */ |
| 1284 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1285 | store_texel_ci8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1286 | }; |
| 1287 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1288 | const struct gl_texture_format _mesa_texformat_ycbcr = { |
| 1289 | MESA_FORMAT_YCBCR, /* MesaFormat */ |
| 1290 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1291 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1292 | 0, /* RedBits */ |
| 1293 | 0, /* GreenBits */ |
| 1294 | 0, /* BlueBits */ |
| 1295 | 0, /* AlphaBits */ |
| 1296 | 0, /* LuminanceBits */ |
| 1297 | 0, /* IntensityBits */ |
| 1298 | 0, /* IndexBits */ |
| 1299 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1300 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1301 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1302 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 1303 | NULL, /* FetchTexel1D */ |
| 1304 | NULL, /* FetchTexel2D */ |
| 1305 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1306 | NULL, /* FetchTexel1Df */ |
| 1307 | NULL, /* FetchTexel2Df */ |
| 1308 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1309 | store_texel_ycbcr /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1310 | }; |
| 1311 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1312 | const struct gl_texture_format _mesa_texformat_ycbcr_rev = { |
| 1313 | MESA_FORMAT_YCBCR_REV, /* MesaFormat */ |
| 1314 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1315 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1316 | 0, /* RedBits */ |
| 1317 | 0, /* GreenBits */ |
| 1318 | 0, /* BlueBits */ |
| 1319 | 0, /* AlphaBits */ |
| 1320 | 0, /* LuminanceBits */ |
| 1321 | 0, /* IntensityBits */ |
| 1322 | 0, /* IndexBits */ |
| 1323 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1324 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1325 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1326 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 6111283 | 2009-03-09 20:34:24 -0600 | [diff] [blame] | 1327 | NULL, /* FetchTexel1D */ |
| 1328 | NULL, /* FetchTexel2D */ |
| 1329 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1330 | NULL, /* FetchTexel1Df */ |
| 1331 | NULL, /* FetchTexel2Df */ |
| 1332 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1333 | store_texel_ycbcr_rev /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1334 | }; |
| 1335 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1336 | const struct gl_texture_format _mesa_texformat_z24_s8 = { |
| 1337 | MESA_FORMAT_Z24_S8, /* MesaFormat */ |
| 1338 | GL_DEPTH_STENCIL_EXT, /* BaseFormat */ |
| 1339 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1340 | 0, /* RedBits */ |
| 1341 | 0, /* GreenBits */ |
| 1342 | 0, /* BlueBits */ |
| 1343 | 0, /* AlphaBits */ |
| 1344 | 0, /* LuminanceBits */ |
| 1345 | 0, /* IntensityBits */ |
| 1346 | 0, /* IndexBits */ |
| 1347 | 24, /* DepthBits */ |
| 1348 | 8, /* StencilBits */ |
| 1349 | 4, /* TexelBytes */ |
Brian Paul | 2794507 | 2005-10-01 16:09:26 +0000 | [diff] [blame] | 1350 | _mesa_texstore_z24_s8, /* StoreTexImageFunc */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1351 | NULL, /* FetchTexel1D */ |
| 1352 | NULL, /* FetchTexel2D */ |
| 1353 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1354 | NULL, /* FetchTexel1Df */ |
| 1355 | NULL, /* FetchTexel2Df */ |
| 1356 | NULL, /* FetchTexel3Df */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1357 | store_texel_z24_s8 /* StoreTexel */ |
| 1358 | }; |
| 1359 | |
Jakob Bornecrantz | dc44bb8 | 2008-09-04 10:35:01 +0800 | [diff] [blame] | 1360 | const struct gl_texture_format _mesa_texformat_s8_z24 = { |
| 1361 | MESA_FORMAT_S8_Z24, /* MesaFormat */ |
| 1362 | GL_DEPTH_STENCIL_EXT, /* BaseFormat */ |
| 1363 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1364 | 0, /* RedBits */ |
| 1365 | 0, /* GreenBits */ |
| 1366 | 0, /* BlueBits */ |
| 1367 | 0, /* AlphaBits */ |
| 1368 | 0, /* LuminanceBits */ |
| 1369 | 0, /* IntensityBits */ |
| 1370 | 0, /* IndexBits */ |
| 1371 | 24, /* DepthBits */ |
| 1372 | 8, /* StencilBits */ |
| 1373 | 4, /* TexelBytes */ |
| 1374 | _mesa_texstore_s8_z24, /* StoreTexImageFunc */ |
| 1375 | NULL, /* FetchTexel1D */ |
| 1376 | NULL, /* FetchTexel2D */ |
| 1377 | NULL, /* FetchTexel3D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1378 | NULL, /* FetchTexel1Df */ |
| 1379 | NULL, /* FetchTexel2Df */ |
| 1380 | NULL, /* FetchTexel3Df */ |
Jakob Bornecrantz | dc44bb8 | 2008-09-04 10:35:01 +0800 | [diff] [blame] | 1381 | store_texel_s8_z24 /* StoreTexel */ |
| 1382 | }; |
| 1383 | |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1384 | const struct gl_texture_format _mesa_texformat_z16 = { |
| 1385 | MESA_FORMAT_Z16, /* MesaFormat */ |
| 1386 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
| 1387 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1388 | 0, /* RedBits */ |
| 1389 | 0, /* GreenBits */ |
| 1390 | 0, /* BlueBits */ |
| 1391 | 0, /* AlphaBits */ |
| 1392 | 0, /* LuminanceBits */ |
| 1393 | 0, /* IntensityBits */ |
| 1394 | 0, /* IndexBits */ |
| 1395 | sizeof(GLushort) * 8, /* DepthBits */ |
| 1396 | 0, /* StencilBits */ |
| 1397 | sizeof(GLushort), /* TexelBytes */ |
| 1398 | _mesa_texstore_z16, /* StoreTexImageFunc */ |
| 1399 | NULL, /* FetchTexel1D */ |
| 1400 | NULL, /* FetchTexel1D */ |
| 1401 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1402 | NULL, /* FetchTexel1Df */ |
| 1403 | NULL, /* FetchTexel1Df */ |
| 1404 | NULL, /* FetchTexel1Df */ |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1405 | store_texel_z16 /* StoreTexel */ |
| 1406 | }; |
| 1407 | |
| 1408 | const struct gl_texture_format _mesa_texformat_z32 = { |
| 1409 | MESA_FORMAT_Z32, /* MesaFormat */ |
| 1410 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
| 1411 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1412 | 0, /* RedBits */ |
| 1413 | 0, /* GreenBits */ |
| 1414 | 0, /* BlueBits */ |
| 1415 | 0, /* AlphaBits */ |
| 1416 | 0, /* LuminanceBits */ |
| 1417 | 0, /* IntensityBits */ |
| 1418 | 0, /* IndexBits */ |
| 1419 | sizeof(GLuint) * 8, /* DepthBits */ |
| 1420 | 0, /* StencilBits */ |
| 1421 | sizeof(GLuint), /* TexelBytes */ |
| 1422 | _mesa_texstore_z32, /* StoreTexImageFunc */ |
| 1423 | NULL, /* FetchTexel1D */ |
| 1424 | NULL, /* FetchTexel1D */ |
| 1425 | NULL, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1426 | NULL, /* FetchTexel1Df */ |
| 1427 | NULL, /* FetchTexel1Df */ |
| 1428 | NULL, /* FetchTexel1Df */ |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1429 | store_texel_z32 /* StoreTexel */ |
| 1430 | }; |
| 1431 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1432 | /*@}*/ |
| 1433 | |
| 1434 | |
| 1435 | /***************************************************************/ |
| 1436 | /** \name Null format (useful for proxy textures) */ |
| 1437 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1438 | |
| 1439 | const struct gl_texture_format _mesa_null_texformat = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1440 | -1, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1441 | 0, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1442 | GL_NONE, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1443 | 0, /* RedBits */ |
| 1444 | 0, /* GreenBits */ |
| 1445 | 0, /* BlueBits */ |
| 1446 | 0, /* AlphaBits */ |
| 1447 | 0, /* LuminanceBits */ |
| 1448 | 0, /* IntensityBits */ |
| 1449 | 0, /* IndexBits */ |
| 1450 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1451 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1452 | 0, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1453 | NULL, /* StoreTexImageFunc */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1454 | fetch_null_texel, /* FetchTexel1D */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1455 | fetch_null_texel, /* FetchTexel1D */ |
| 1456 | fetch_null_texel, /* FetchTexel1D */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1457 | fetch_null_texelf, /* FetchTexel1Df */ |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1458 | fetch_null_texelf, /* FetchTexel1Df */ |
| 1459 | fetch_null_texelf, /* FetchTexel1Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1460 | store_null_texel /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1461 | }; |
| 1462 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1463 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1464 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1465 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1466 | /** |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1467 | * Choose an appropriate texture format given the format, type and |
| 1468 | * internalFormat parameters passed to glTexImage(). |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1469 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1470 | * \param ctx the GL context. |
| 1471 | * \param internalFormat user's prefered internal texture format. |
| 1472 | * \param format incoming image pixel format. |
| 1473 | * \param type incoming image data type. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1474 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1475 | * \return a pointer to a gl_texture_format object which describes the |
| 1476 | * choosen texture format, or NULL on failure. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1477 | * |
| 1478 | * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1479 | * will typically override this function with a specialized version. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1480 | */ |
Brian Paul | 7d58f44 | 2001-04-04 21:54:20 +0000 | [diff] [blame] | 1481 | const struct gl_texture_format * |
| 1482 | _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, |
| 1483 | GLenum format, GLenum type ) |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1484 | { |
Brian Paul | 7d58f44 | 2001-04-04 21:54:20 +0000 | [diff] [blame] | 1485 | (void) format; |
| 1486 | (void) type; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1487 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1488 | switch (internalFormat) { |
| 1489 | /* RGBA formats */ |
| 1490 | case 4: |
| 1491 | case GL_RGBA: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1492 | case GL_RGB10_A2: |
| 1493 | case GL_RGBA12: |
| 1494 | case GL_RGBA16: |
| 1495 | return &_mesa_texformat_rgba; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1496 | case GL_RGBA8: |
| 1497 | return &_mesa_texformat_rgba8888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1498 | case GL_RGB5_A1: |
| 1499 | return &_mesa_texformat_argb1555; |
| 1500 | case GL_RGBA2: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1501 | return &_mesa_texformat_argb4444_rev; /* just to test another format*/ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1502 | case GL_RGBA4: |
| 1503 | return &_mesa_texformat_argb4444; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1504 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1505 | /* RGB formats */ |
| 1506 | case 3: |
| 1507 | case GL_RGB: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1508 | case GL_RGB10: |
| 1509 | case GL_RGB12: |
| 1510 | case GL_RGB16: |
| 1511 | return &_mesa_texformat_rgb; |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1512 | case GL_RGB8: |
| 1513 | return &_mesa_texformat_rgb888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1514 | case GL_R3_G3_B2: |
| 1515 | return &_mesa_texformat_rgb332; |
| 1516 | case GL_RGB4: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1517 | return &_mesa_texformat_rgb565_rev; /* just to test another format */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1518 | case GL_RGB5: |
| 1519 | return &_mesa_texformat_rgb565; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1520 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1521 | /* Alpha formats */ |
| 1522 | case GL_ALPHA: |
| 1523 | case GL_ALPHA4: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1524 | case GL_ALPHA12: |
| 1525 | case GL_ALPHA16: |
| 1526 | return &_mesa_texformat_alpha; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1527 | case GL_ALPHA8: |
| 1528 | return &_mesa_texformat_a8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1529 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1530 | /* Luminance formats */ |
| 1531 | case 1: |
| 1532 | case GL_LUMINANCE: |
| 1533 | case GL_LUMINANCE4: |
| 1534 | case GL_LUMINANCE12: |
| 1535 | case GL_LUMINANCE16: |
| 1536 | return &_mesa_texformat_luminance; |
| 1537 | case GL_LUMINANCE8: |
| 1538 | return &_mesa_texformat_l8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1539 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1540 | /* Luminance/Alpha formats */ |
| 1541 | case 2: |
| 1542 | case GL_LUMINANCE_ALPHA: |
| 1543 | case GL_LUMINANCE4_ALPHA4: |
| 1544 | case GL_LUMINANCE6_ALPHA2: |
| 1545 | case GL_LUMINANCE12_ALPHA4: |
| 1546 | case GL_LUMINANCE12_ALPHA12: |
| 1547 | case GL_LUMINANCE16_ALPHA16: |
| 1548 | return &_mesa_texformat_luminance_alpha; |
| 1549 | case GL_LUMINANCE8_ALPHA8: |
| 1550 | return &_mesa_texformat_al88; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1551 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1552 | case GL_INTENSITY: |
| 1553 | case GL_INTENSITY4: |
| 1554 | case GL_INTENSITY12: |
| 1555 | case GL_INTENSITY16: |
| 1556 | return &_mesa_texformat_intensity; |
| 1557 | case GL_INTENSITY8: |
| 1558 | return &_mesa_texformat_i8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1559 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1560 | case GL_COLOR_INDEX: |
| 1561 | case GL_COLOR_INDEX1_EXT: |
| 1562 | case GL_COLOR_INDEX2_EXT: |
| 1563 | case GL_COLOR_INDEX4_EXT: |
| 1564 | case GL_COLOR_INDEX12_EXT: |
| 1565 | case GL_COLOR_INDEX16_EXT: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1566 | case GL_COLOR_INDEX8_EXT: |
| 1567 | return &_mesa_texformat_ci8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1568 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1569 | default: |
| 1570 | ; /* fallthrough */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1571 | } |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1572 | |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1573 | if (ctx->Extensions.ARB_depth_texture) { |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1574 | switch (internalFormat) { |
| 1575 | case GL_DEPTH_COMPONENT: |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1576 | case GL_DEPTH_COMPONENT24: |
| 1577 | case GL_DEPTH_COMPONENT32: |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1578 | return &_mesa_texformat_z32; |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1579 | case GL_DEPTH_COMPONENT16: |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1580 | return &_mesa_texformat_z16; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1581 | default: |
| 1582 | ; /* fallthrough */ |
| 1583 | } |
| 1584 | } |
| 1585 | |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1586 | switch (internalFormat) { |
| 1587 | case GL_COMPRESSED_ALPHA_ARB: |
| 1588 | return &_mesa_texformat_alpha; |
| 1589 | case GL_COMPRESSED_LUMINANCE_ARB: |
| 1590 | return &_mesa_texformat_luminance; |
| 1591 | case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: |
| 1592 | return &_mesa_texformat_luminance_alpha; |
| 1593 | case GL_COMPRESSED_INTENSITY_ARB: |
| 1594 | return &_mesa_texformat_intensity; |
| 1595 | case GL_COMPRESSED_RGB_ARB: |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1596 | #if FEATURE_texture_fxt1 |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1597 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1598 | return &_mesa_texformat_rgb_fxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1599 | #endif |
| 1600 | #if FEATURE_texture_s3tc |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1601 | if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1602 | ctx->Extensions.S3_s3tc) |
| 1603 | return &_mesa_texformat_rgb_dxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1604 | #endif |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1605 | return &_mesa_texformat_rgb; |
| 1606 | case GL_COMPRESSED_RGBA_ARB: |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1607 | #if FEATURE_texture_fxt1 |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1608 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1609 | return &_mesa_texformat_rgba_fxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1610 | #endif |
| 1611 | #if FEATURE_texture_s3tc |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1612 | if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1613 | ctx->Extensions.S3_s3tc) |
| 1614 | return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1615 | #endif |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1616 | return &_mesa_texformat_rgba; |
| 1617 | default: |
| 1618 | ; /* fallthrough */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1619 | } |
| 1620 | |
| 1621 | if (ctx->Extensions.MESA_ycbcr_texture) { |
| 1622 | if (internalFormat == GL_YCBCR_MESA) { |
| 1623 | if (type == GL_UNSIGNED_SHORT_8_8_MESA) |
| 1624 | return &_mesa_texformat_ycbcr; |
| 1625 | else |
| 1626 | return &_mesa_texformat_ycbcr_rev; |
| 1627 | } |
| 1628 | } |
| 1629 | |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1630 | #if FEATURE_texture_fxt1 |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1631 | if (ctx->Extensions.TDFX_texture_compression_FXT1) { |
| 1632 | switch (internalFormat) { |
| 1633 | case GL_COMPRESSED_RGB_FXT1_3DFX: |
| 1634 | return &_mesa_texformat_rgb_fxt1; |
| 1635 | case GL_COMPRESSED_RGBA_FXT1_3DFX: |
| 1636 | return &_mesa_texformat_rgba_fxt1; |
| 1637 | default: |
| 1638 | ; /* fallthrough */ |
| 1639 | } |
| 1640 | } |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1641 | #endif |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1642 | |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1643 | #if FEATURE_texture_s3tc |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1644 | if (ctx->Extensions.EXT_texture_compression_s3tc) { |
| 1645 | switch (internalFormat) { |
| 1646 | case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
| 1647 | return &_mesa_texformat_rgb_dxt1; |
| 1648 | case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
| 1649 | return &_mesa_texformat_rgba_dxt1; |
| 1650 | case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
| 1651 | return &_mesa_texformat_rgba_dxt3; |
| 1652 | case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
| 1653 | return &_mesa_texformat_rgba_dxt5; |
| 1654 | default: |
| 1655 | ; /* fallthrough */ |
| 1656 | } |
| 1657 | } |
| 1658 | |
| 1659 | if (ctx->Extensions.S3_s3tc) { |
| 1660 | switch (internalFormat) { |
| 1661 | case GL_RGB_S3TC: |
| 1662 | case GL_RGB4_S3TC: |
| 1663 | return &_mesa_texformat_rgb_dxt1; |
| 1664 | case GL_RGBA_S3TC: |
| 1665 | case GL_RGBA4_S3TC: |
| 1666 | return &_mesa_texformat_rgba_dxt3; |
| 1667 | default: |
| 1668 | ; /* fallthrough */ |
| 1669 | } |
| 1670 | } |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1671 | #endif |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1672 | |
| 1673 | if (ctx->Extensions.ARB_texture_float) { |
| 1674 | switch (internalFormat) { |
| 1675 | case GL_ALPHA16F_ARB: |
| 1676 | return &_mesa_texformat_alpha_float16; |
| 1677 | case GL_ALPHA32F_ARB: |
| 1678 | return &_mesa_texformat_alpha_float32; |
| 1679 | case GL_LUMINANCE16F_ARB: |
| 1680 | return &_mesa_texformat_luminance_float16; |
| 1681 | case GL_LUMINANCE32F_ARB: |
| 1682 | return &_mesa_texformat_luminance_float32; |
| 1683 | case GL_LUMINANCE_ALPHA16F_ARB: |
| 1684 | return &_mesa_texformat_luminance_alpha_float16; |
| 1685 | case GL_LUMINANCE_ALPHA32F_ARB: |
| 1686 | return &_mesa_texformat_luminance_alpha_float32; |
| 1687 | case GL_INTENSITY16F_ARB: |
| 1688 | return &_mesa_texformat_intensity_float16; |
| 1689 | case GL_INTENSITY32F_ARB: |
| 1690 | return &_mesa_texformat_intensity_float32; |
| 1691 | case GL_RGB16F_ARB: |
| 1692 | return &_mesa_texformat_rgb_float16; |
| 1693 | case GL_RGB32F_ARB: |
| 1694 | return &_mesa_texformat_rgb_float32; |
| 1695 | case GL_RGBA16F_ARB: |
| 1696 | return &_mesa_texformat_rgba_float16; |
| 1697 | case GL_RGBA32F_ARB: |
| 1698 | return &_mesa_texformat_rgba_float32; |
| 1699 | default: |
| 1700 | ; /* fallthrough */ |
| 1701 | } |
| 1702 | } |
| 1703 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1704 | if (ctx->Extensions.EXT_packed_depth_stencil) { |
| 1705 | switch (internalFormat) { |
| 1706 | case GL_DEPTH_STENCIL_EXT: |
| 1707 | case GL_DEPTH24_STENCIL8_EXT: |
| 1708 | return &_mesa_texformat_z24_s8; |
| 1709 | default: |
| 1710 | ; /* fallthrough */ |
| 1711 | } |
| 1712 | } |
| 1713 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 1714 | if (ctx->Extensions.ATI_envmap_bumpmap) { |
| 1715 | switch (internalFormat) { |
| 1716 | case GL_DUDV_ATI: |
| 1717 | case GL_DU8DV8_ATI: |
| 1718 | return &_mesa_texformat_dudv8; |
| 1719 | default: |
| 1720 | ; /* fallthrough */ |
| 1721 | } |
| 1722 | } |
| 1723 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1724 | if (ctx->Extensions.MESA_texture_signed_rgba) { |
| 1725 | switch (internalFormat) { |
| 1726 | case GL_RGBA_SNORM: |
| 1727 | case GL_RGBA8_SNORM: |
| 1728 | return &_mesa_texformat_signed_rgba8888; |
| 1729 | default: |
| 1730 | ; /* fallthrough */ |
| 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1735 | #if FEATURE_EXT_texture_sRGB |
| 1736 | if (ctx->Extensions.EXT_texture_sRGB) { |
| 1737 | switch (internalFormat) { |
| 1738 | case GL_SRGB_EXT: |
| 1739 | case GL_SRGB8_EXT: |
| 1740 | return &_mesa_texformat_srgb8; |
| 1741 | case GL_SRGB_ALPHA_EXT: |
| 1742 | case GL_SRGB8_ALPHA8_EXT: |
| 1743 | return &_mesa_texformat_srgba8; |
| 1744 | case GL_SLUMINANCE_EXT: |
| 1745 | case GL_SLUMINANCE8_EXT: |
| 1746 | return &_mesa_texformat_sl8; |
| 1747 | case GL_SLUMINANCE_ALPHA_EXT: |
| 1748 | case GL_SLUMINANCE8_ALPHA8_EXT: |
| 1749 | return &_mesa_texformat_sla8; |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1750 | case GL_COMPRESSED_SLUMINANCE_EXT: |
| 1751 | return &_mesa_texformat_sl8; |
| 1752 | case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: |
| 1753 | return &_mesa_texformat_sla8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1754 | case GL_COMPRESSED_SRGB_EXT: |
| 1755 | #if FEATURE_texture_s3tc |
| 1756 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1757 | return &_mesa_texformat_srgb_dxt1; |
| 1758 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1759 | return &_mesa_texformat_srgb8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1760 | case GL_COMPRESSED_SRGB_ALPHA_EXT: |
| 1761 | #if FEATURE_texture_s3tc |
| 1762 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1763 | return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */ |
| 1764 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1765 | return &_mesa_texformat_srgba8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1766 | #if FEATURE_texture_s3tc |
| 1767 | case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: |
| 1768 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1769 | return &_mesa_texformat_srgb_dxt1; |
| 1770 | break; |
| 1771 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: |
| 1772 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1773 | return &_mesa_texformat_srgba_dxt1; |
| 1774 | break; |
| 1775 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: |
| 1776 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1777 | return &_mesa_texformat_srgba_dxt3; |
| 1778 | break; |
| 1779 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: |
| 1780 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1781 | return &_mesa_texformat_srgba_dxt5; |
| 1782 | break; |
| 1783 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1784 | default: |
| 1785 | ; /* fallthrough */ |
| 1786 | } |
| 1787 | } |
| 1788 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 1789 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1790 | _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); |
| 1791 | return NULL; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1792 | } |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1793 | |
| 1794 | |
| 1795 | |
| 1796 | /** |
| 1797 | * Return datatype and number of components per texel for the |
| 1798 | * given gl_texture_format. |
| 1799 | */ |
| 1800 | void |
| 1801 | _mesa_format_to_type_and_comps(const struct gl_texture_format *format, |
| 1802 | GLenum *datatype, GLuint *comps) |
| 1803 | { |
| 1804 | switch (format->MesaFormat) { |
| 1805 | case MESA_FORMAT_RGBA8888: |
| 1806 | case MESA_FORMAT_RGBA8888_REV: |
| 1807 | case MESA_FORMAT_ARGB8888: |
| 1808 | case MESA_FORMAT_ARGB8888_REV: |
| 1809 | *datatype = CHAN_TYPE; |
| 1810 | *comps = 4; |
| 1811 | return; |
| 1812 | case MESA_FORMAT_RGB888: |
| 1813 | case MESA_FORMAT_BGR888: |
| 1814 | *datatype = GL_UNSIGNED_BYTE; |
| 1815 | *comps = 3; |
| 1816 | return; |
| 1817 | case MESA_FORMAT_RGB565: |
| 1818 | case MESA_FORMAT_RGB565_REV: |
| 1819 | *datatype = GL_UNSIGNED_SHORT_5_6_5; |
| 1820 | *comps = 3; |
| 1821 | return; |
| 1822 | |
| 1823 | case MESA_FORMAT_ARGB4444: |
| 1824 | case MESA_FORMAT_ARGB4444_REV: |
| 1825 | *datatype = GL_UNSIGNED_SHORT_4_4_4_4; |
| 1826 | *comps = 4; |
| 1827 | return; |
| 1828 | |
| 1829 | case MESA_FORMAT_ARGB1555: |
| 1830 | case MESA_FORMAT_ARGB1555_REV: |
| 1831 | *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; |
Xiang, Haihao | 241c0bf | 2009-01-06 15:30:34 +0800 | [diff] [blame] | 1832 | *comps = 4; |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1833 | return; |
| 1834 | |
| 1835 | case MESA_FORMAT_AL88: |
| 1836 | case MESA_FORMAT_AL88_REV: |
| 1837 | *datatype = GL_UNSIGNED_BYTE; |
| 1838 | *comps = 2; |
| 1839 | return; |
| 1840 | case MESA_FORMAT_RGB332: |
| 1841 | *datatype = GL_UNSIGNED_BYTE_3_3_2; |
| 1842 | *comps = 3; |
| 1843 | return; |
| 1844 | |
| 1845 | case MESA_FORMAT_A8: |
| 1846 | case MESA_FORMAT_L8: |
| 1847 | case MESA_FORMAT_I8: |
| 1848 | case MESA_FORMAT_CI8: |
| 1849 | *datatype = GL_UNSIGNED_BYTE; |
| 1850 | *comps = 1; |
| 1851 | return; |
| 1852 | |
| 1853 | case MESA_FORMAT_YCBCR: |
| 1854 | case MESA_FORMAT_YCBCR_REV: |
| 1855 | *datatype = GL_UNSIGNED_SHORT; |
| 1856 | *comps = 2; |
| 1857 | return; |
| 1858 | |
| 1859 | case MESA_FORMAT_Z24_S8: |
| 1860 | *datatype = GL_UNSIGNED_INT; |
| 1861 | *comps = 1; /* XXX OK? */ |
| 1862 | return; |
| 1863 | |
Jakob Bornecrantz | 2e3e518 | 2008-06-09 16:29:57 +0200 | [diff] [blame] | 1864 | case MESA_FORMAT_S8_Z24: |
| 1865 | *datatype = GL_UNSIGNED_INT; |
| 1866 | *comps = 1; /* XXX OK? */ |
| 1867 | return; |
| 1868 | |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1869 | case MESA_FORMAT_Z16: |
| 1870 | *datatype = GL_UNSIGNED_SHORT; |
| 1871 | *comps = 1; |
| 1872 | return; |
| 1873 | |
| 1874 | case MESA_FORMAT_Z32: |
| 1875 | *datatype = GL_UNSIGNED_INT; |
| 1876 | *comps = 1; |
| 1877 | return; |
| 1878 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 1879 | case MESA_FORMAT_DUDV8: |
| 1880 | *datatype = GL_BYTE; |
| 1881 | *comps = 2; |
| 1882 | return; |
| 1883 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1884 | case MESA_FORMAT_SIGNED_RGBA8888: |
Roland Scheidegger | bb386a1 | 2009-03-27 21:59:33 +0100 | [diff] [blame] | 1885 | case MESA_FORMAT_SIGNED_RGBA8888_REV: |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1886 | *datatype = GL_BYTE; |
| 1887 | *comps = 4; |
| 1888 | return; |
| 1889 | |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1890 | #if FEATURE_EXT_texture_sRGB |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1891 | case MESA_FORMAT_SRGB8: |
| 1892 | *datatype = GL_UNSIGNED_BYTE; |
| 1893 | *comps = 3; |
| 1894 | return; |
| 1895 | case MESA_FORMAT_SRGBA8: |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1896 | case MESA_FORMAT_SARGB8: |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1897 | *datatype = GL_UNSIGNED_BYTE; |
| 1898 | *comps = 4; |
| 1899 | return; |
| 1900 | case MESA_FORMAT_SL8: |
| 1901 | *datatype = GL_UNSIGNED_BYTE; |
| 1902 | *comps = 1; |
| 1903 | return; |
| 1904 | case MESA_FORMAT_SLA8: |
| 1905 | *datatype = GL_UNSIGNED_BYTE; |
| 1906 | *comps = 2; |
| 1907 | return; |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1908 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1909 | |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1910 | #if FEATURE_texture_fxt1 |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1911 | case MESA_FORMAT_RGB_FXT1: |
| 1912 | case MESA_FORMAT_RGBA_FXT1: |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1913 | #endif |
| 1914 | #if FEATURE_texture_s3tc |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1915 | case MESA_FORMAT_RGB_DXT1: |
| 1916 | case MESA_FORMAT_RGBA_DXT1: |
| 1917 | case MESA_FORMAT_RGBA_DXT3: |
| 1918 | case MESA_FORMAT_RGBA_DXT5: |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1919 | #if FEATURE_EXT_texture_sRGB |
| 1920 | case MESA_FORMAT_SRGB_DXT1: |
| 1921 | case MESA_FORMAT_SRGBA_DXT1: |
| 1922 | case MESA_FORMAT_SRGBA_DXT3: |
| 1923 | case MESA_FORMAT_SRGBA_DXT5: |
| 1924 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1925 | /* XXX generate error instead? */ |
| 1926 | *datatype = GL_UNSIGNED_BYTE; |
| 1927 | *comps = 0; |
| 1928 | return; |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1929 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1930 | |
| 1931 | case MESA_FORMAT_RGBA: |
| 1932 | *datatype = CHAN_TYPE; |
| 1933 | *comps = 4; |
| 1934 | return; |
| 1935 | case MESA_FORMAT_RGB: |
| 1936 | *datatype = CHAN_TYPE; |
| 1937 | *comps = 3; |
| 1938 | return; |
| 1939 | case MESA_FORMAT_LUMINANCE_ALPHA: |
| 1940 | *datatype = CHAN_TYPE; |
| 1941 | *comps = 2; |
| 1942 | return; |
| 1943 | case MESA_FORMAT_ALPHA: |
| 1944 | case MESA_FORMAT_LUMINANCE: |
| 1945 | case MESA_FORMAT_INTENSITY: |
| 1946 | *datatype = CHAN_TYPE; |
| 1947 | *comps = 1; |
| 1948 | return; |
| 1949 | |
| 1950 | case MESA_FORMAT_RGBA_FLOAT32: |
| 1951 | *datatype = GL_FLOAT; |
| 1952 | *comps = 4; |
| 1953 | return; |
| 1954 | case MESA_FORMAT_RGBA_FLOAT16: |
| 1955 | *datatype = GL_HALF_FLOAT_ARB; |
| 1956 | *comps = 4; |
| 1957 | return; |
| 1958 | case MESA_FORMAT_RGB_FLOAT32: |
| 1959 | *datatype = GL_FLOAT; |
| 1960 | *comps = 3; |
| 1961 | return; |
| 1962 | case MESA_FORMAT_RGB_FLOAT16: |
| 1963 | *datatype = GL_HALF_FLOAT_ARB; |
| 1964 | *comps = 3; |
| 1965 | return; |
| 1966 | case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: |
| 1967 | *datatype = GL_FLOAT; |
| 1968 | *comps = 2; |
| 1969 | return; |
| 1970 | case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: |
| 1971 | *datatype = GL_HALF_FLOAT_ARB; |
| 1972 | *comps = 2; |
| 1973 | return; |
| 1974 | case MESA_FORMAT_ALPHA_FLOAT32: |
| 1975 | case MESA_FORMAT_LUMINANCE_FLOAT32: |
| 1976 | case MESA_FORMAT_INTENSITY_FLOAT32: |
| 1977 | *datatype = GL_FLOAT; |
| 1978 | *comps = 1; |
| 1979 | return; |
| 1980 | case MESA_FORMAT_ALPHA_FLOAT16: |
| 1981 | case MESA_FORMAT_LUMINANCE_FLOAT16: |
| 1982 | case MESA_FORMAT_INTENSITY_FLOAT16: |
| 1983 | *datatype = GL_HALF_FLOAT_ARB; |
| 1984 | *comps = 1; |
| 1985 | return; |
| 1986 | |
| 1987 | default: |
| 1988 | _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); |
| 1989 | *datatype = 0; |
| 1990 | *comps = 1; |
| 1991 | } |
| 1992 | } |
Brian Paul | da5722b | 2009-09-27 18:09:23 -0600 | [diff] [blame^] | 1993 | |
| 1994 | |
| 1995 | |
| 1996 | /** |
| 1997 | * Table to map MESA_FORMAT_ to texel fetch/store funcs. |
| 1998 | * XXX this is somewhat temporary. |
| 1999 | */ |
| 2000 | static struct { |
| 2001 | GLuint Name; |
| 2002 | FetchTexelFuncF Fetch1D; |
| 2003 | FetchTexelFuncF Fetch2D; |
| 2004 | FetchTexelFuncF Fetch3D; |
| 2005 | StoreTexelFunc StoreTexel; |
| 2006 | } |
| 2007 | texfetch_funcs[MESA_FORMAT_COUNT] = |
| 2008 | { |
| 2009 | { |
| 2010 | MESA_FORMAT_RGBA, |
| 2011 | fetch_texel_1d_f_rgba, |
| 2012 | fetch_texel_2d_f_rgba, |
| 2013 | fetch_texel_3d_f_rgba, |
| 2014 | store_texel_rgba |
| 2015 | }, |
| 2016 | { |
| 2017 | MESA_FORMAT_RGB, |
| 2018 | fetch_texel_1d_f_rgb, |
| 2019 | fetch_texel_2d_f_rgb, |
| 2020 | fetch_texel_3d_f_rgb, |
| 2021 | store_texel_rgb |
| 2022 | }, |
| 2023 | { |
| 2024 | MESA_FORMAT_ALPHA, |
| 2025 | fetch_texel_1d_f_alpha, |
| 2026 | fetch_texel_2d_f_alpha, |
| 2027 | fetch_texel_3d_f_alpha, |
| 2028 | store_texel_alpha |
| 2029 | }, |
| 2030 | { |
| 2031 | MESA_FORMAT_LUMINANCE, |
| 2032 | fetch_texel_1d_f_luminance, |
| 2033 | fetch_texel_2d_f_luminance, |
| 2034 | fetch_texel_3d_f_luminance, |
| 2035 | store_texel_luminance |
| 2036 | }, |
| 2037 | { |
| 2038 | MESA_FORMAT_LUMINANCE_ALPHA, |
| 2039 | fetch_texel_1d_f_luminance_alpha, |
| 2040 | fetch_texel_2d_f_luminance_alpha, |
| 2041 | fetch_texel_3d_f_luminance_alpha, |
| 2042 | store_texel_luminance_alpha |
| 2043 | }, |
| 2044 | { |
| 2045 | MESA_FORMAT_INTENSITY, |
| 2046 | fetch_texel_1d_f_intensity, |
| 2047 | fetch_texel_2d_f_intensity, |
| 2048 | fetch_texel_3d_f_intensity, |
| 2049 | store_texel_intensity |
| 2050 | }, |
| 2051 | { |
| 2052 | MESA_FORMAT_SRGB8, |
| 2053 | fetch_texel_1d_srgb8, |
| 2054 | fetch_texel_2d_srgb8, |
| 2055 | fetch_texel_3d_srgb8, |
| 2056 | store_texel_srgb8 |
| 2057 | }, |
| 2058 | { |
| 2059 | MESA_FORMAT_SRGBA8, |
| 2060 | fetch_texel_1d_srgba8, |
| 2061 | fetch_texel_2d_srgba8, |
| 2062 | fetch_texel_3d_srgba8, |
| 2063 | store_texel_srgba8 |
| 2064 | }, |
| 2065 | { |
| 2066 | MESA_FORMAT_SARGB8, |
| 2067 | fetch_texel_1d_sargb8, |
| 2068 | fetch_texel_2d_sargb8, |
| 2069 | fetch_texel_3d_sargb8, |
| 2070 | store_texel_sargb8 |
| 2071 | }, |
| 2072 | { |
| 2073 | MESA_FORMAT_SL8, |
| 2074 | fetch_texel_1d_sl8, |
| 2075 | fetch_texel_2d_sl8, |
| 2076 | fetch_texel_3d_sl8, |
| 2077 | store_texel_sl8 |
| 2078 | }, |
| 2079 | { |
| 2080 | MESA_FORMAT_SLA8, |
| 2081 | fetch_texel_1d_sla8, |
| 2082 | fetch_texel_2d_sla8, |
| 2083 | fetch_texel_3d_sla8, |
| 2084 | store_texel_sla8 |
| 2085 | }, |
| 2086 | { |
| 2087 | MESA_FORMAT_RGB_FXT1, |
| 2088 | NULL, |
| 2089 | _mesa_fetch_texel_2d_f_rgb_fxt1, |
| 2090 | NULL, |
| 2091 | NULL |
| 2092 | }, |
| 2093 | { |
| 2094 | MESA_FORMAT_RGBA_FXT1, |
| 2095 | NULL, |
| 2096 | _mesa_fetch_texel_2d_f_rgba_fxt1, |
| 2097 | NULL, |
| 2098 | NULL |
| 2099 | }, |
| 2100 | { |
| 2101 | MESA_FORMAT_RGB_DXT1, |
| 2102 | NULL, |
| 2103 | _mesa_fetch_texel_2d_f_rgb_dxt1, |
| 2104 | NULL, |
| 2105 | NULL |
| 2106 | }, |
| 2107 | { |
| 2108 | MESA_FORMAT_RGBA_DXT1, |
| 2109 | NULL, |
| 2110 | _mesa_fetch_texel_2d_f_rgba_dxt1, |
| 2111 | NULL, |
| 2112 | NULL |
| 2113 | }, |
| 2114 | { |
| 2115 | MESA_FORMAT_RGBA_DXT3, |
| 2116 | NULL, |
| 2117 | _mesa_fetch_texel_2d_f_rgba_dxt3, |
| 2118 | NULL, |
| 2119 | NULL |
| 2120 | }, |
| 2121 | { |
| 2122 | MESA_FORMAT_RGBA_DXT5, |
| 2123 | NULL, |
| 2124 | _mesa_fetch_texel_2d_f_rgba_dxt5, |
| 2125 | NULL, |
| 2126 | NULL |
| 2127 | }, |
| 2128 | { |
| 2129 | MESA_FORMAT_SRGB_DXT1, |
| 2130 | NULL, |
| 2131 | _mesa_fetch_texel_2d_f_srgb_dxt1, |
| 2132 | NULL, |
| 2133 | NULL |
| 2134 | }, |
| 2135 | { |
| 2136 | MESA_FORMAT_SRGBA_DXT1, |
| 2137 | NULL, |
| 2138 | _mesa_fetch_texel_2d_f_srgba_dxt1, |
| 2139 | NULL, |
| 2140 | NULL |
| 2141 | }, |
| 2142 | { |
| 2143 | MESA_FORMAT_SRGBA_DXT3, |
| 2144 | NULL, |
| 2145 | _mesa_fetch_texel_2d_f_srgba_dxt3, |
| 2146 | NULL, |
| 2147 | NULL |
| 2148 | }, |
| 2149 | { |
| 2150 | MESA_FORMAT_SRGBA_DXT5, |
| 2151 | NULL, |
| 2152 | _mesa_fetch_texel_2d_f_srgba_dxt5, |
| 2153 | NULL, |
| 2154 | NULL |
| 2155 | }, |
| 2156 | { |
| 2157 | MESA_FORMAT_RGBA_FLOAT32, |
| 2158 | fetch_texel_1d_f_rgba_f32, |
| 2159 | fetch_texel_2d_f_rgba_f32, |
| 2160 | fetch_texel_3d_f_rgba_f32, |
| 2161 | store_texel_rgba_f32 |
| 2162 | }, |
| 2163 | { |
| 2164 | MESA_FORMAT_RGBA_FLOAT16, |
| 2165 | fetch_texel_1d_f_rgba_f16, |
| 2166 | fetch_texel_2d_f_rgba_f16, |
| 2167 | fetch_texel_3d_f_rgba_f16, |
| 2168 | store_texel_rgba_f16 |
| 2169 | }, |
| 2170 | { |
| 2171 | MESA_FORMAT_RGB_FLOAT32, |
| 2172 | fetch_texel_1d_f_rgb_f32, |
| 2173 | fetch_texel_2d_f_rgb_f32, |
| 2174 | fetch_texel_3d_f_rgb_f32, |
| 2175 | store_texel_rgb_f32 |
| 2176 | }, |
| 2177 | { |
| 2178 | MESA_FORMAT_RGB_FLOAT16, |
| 2179 | fetch_texel_1d_f_rgb_f16, |
| 2180 | fetch_texel_2d_f_rgb_f16, |
| 2181 | fetch_texel_3d_f_rgb_f16, |
| 2182 | store_texel_rgb_f16 |
| 2183 | }, |
| 2184 | { |
| 2185 | MESA_FORMAT_ALPHA_FLOAT32, |
| 2186 | fetch_texel_1d_f_alpha_f32, |
| 2187 | fetch_texel_2d_f_alpha_f32, |
| 2188 | fetch_texel_3d_f_alpha_f32, |
| 2189 | store_texel_alpha_f32 |
| 2190 | }, |
| 2191 | { |
| 2192 | MESA_FORMAT_ALPHA_FLOAT16, |
| 2193 | fetch_texel_1d_f_alpha_f16, |
| 2194 | fetch_texel_2d_f_alpha_f16, |
| 2195 | fetch_texel_3d_f_alpha_f16, |
| 2196 | store_texel_alpha_f16 |
| 2197 | }, |
| 2198 | { |
| 2199 | MESA_FORMAT_LUMINANCE_FLOAT32, |
| 2200 | fetch_texel_1d_f_luminance_f32, |
| 2201 | fetch_texel_2d_f_luminance_f32, |
| 2202 | fetch_texel_3d_f_luminance_f32, |
| 2203 | store_texel_luminance_f32 |
| 2204 | }, |
| 2205 | { |
| 2206 | MESA_FORMAT_LUMINANCE_FLOAT16, |
| 2207 | fetch_texel_1d_f_luminance_f16, |
| 2208 | fetch_texel_2d_f_luminance_f16, |
| 2209 | fetch_texel_3d_f_luminance_f16, |
| 2210 | store_texel_luminance_f16 |
| 2211 | }, |
| 2212 | { |
| 2213 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, |
| 2214 | fetch_texel_1d_f_luminance_alpha_f32, |
| 2215 | fetch_texel_2d_f_luminance_alpha_f32, |
| 2216 | fetch_texel_3d_f_luminance_alpha_f32, |
| 2217 | store_texel_luminance_alpha_f32 |
| 2218 | }, |
| 2219 | { |
| 2220 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, |
| 2221 | fetch_texel_1d_f_luminance_alpha_f16, |
| 2222 | fetch_texel_2d_f_luminance_alpha_f16, |
| 2223 | fetch_texel_3d_f_luminance_alpha_f16, |
| 2224 | store_texel_luminance_alpha_f16 |
| 2225 | }, |
| 2226 | { |
| 2227 | MESA_FORMAT_INTENSITY_FLOAT32, |
| 2228 | fetch_texel_1d_f_intensity_f32, |
| 2229 | fetch_texel_2d_f_intensity_f32, |
| 2230 | fetch_texel_3d_f_intensity_f32, |
| 2231 | store_texel_intensity_f32 |
| 2232 | }, |
| 2233 | { |
| 2234 | MESA_FORMAT_INTENSITY_FLOAT16, |
| 2235 | fetch_texel_1d_f_intensity_f16, |
| 2236 | fetch_texel_2d_f_intensity_f16, |
| 2237 | fetch_texel_3d_f_intensity_f16, |
| 2238 | store_texel_intensity_f16 |
| 2239 | }, |
| 2240 | { |
| 2241 | MESA_FORMAT_DUDV8, |
| 2242 | fetch_texel_1d_dudv8, |
| 2243 | fetch_texel_2d_dudv8, |
| 2244 | fetch_texel_3d_dudv8, |
| 2245 | NULL |
| 2246 | }, |
| 2247 | { |
| 2248 | MESA_FORMAT_SIGNED_RGBA8888, |
| 2249 | fetch_texel_1d_signed_rgba8888, |
| 2250 | fetch_texel_2d_signed_rgba8888, |
| 2251 | fetch_texel_3d_signed_rgba8888, |
| 2252 | store_texel_signed_rgba8888 |
| 2253 | }, |
| 2254 | { |
| 2255 | MESA_FORMAT_SIGNED_RGBA8888_REV, |
| 2256 | fetch_texel_1d_signed_rgba8888_rev, |
| 2257 | fetch_texel_2d_signed_rgba8888_rev, |
| 2258 | fetch_texel_3d_signed_rgba8888_rev, |
| 2259 | store_texel_signed_rgba8888_rev |
| 2260 | }, |
| 2261 | { |
| 2262 | MESA_FORMAT_RGBA8888, |
| 2263 | fetch_texel_1d_f_rgba8888, |
| 2264 | fetch_texel_2d_f_rgba8888, |
| 2265 | fetch_texel_3d_f_rgba8888, |
| 2266 | store_texel_rgba8888 |
| 2267 | }, |
| 2268 | { |
| 2269 | MESA_FORMAT_RGBA8888_REV, |
| 2270 | fetch_texel_1d_f_rgba8888_rev, |
| 2271 | fetch_texel_2d_f_rgba8888_rev, |
| 2272 | fetch_texel_3d_f_rgba8888_rev, |
| 2273 | store_texel_rgba8888_rev |
| 2274 | }, |
| 2275 | { |
| 2276 | MESA_FORMAT_ARGB8888, |
| 2277 | fetch_texel_1d_f_argb8888, |
| 2278 | fetch_texel_2d_f_argb8888, |
| 2279 | fetch_texel_3d_f_argb8888, |
| 2280 | store_texel_argb8888 |
| 2281 | }, |
| 2282 | { |
| 2283 | MESA_FORMAT_ARGB8888_REV, |
| 2284 | fetch_texel_1d_f_argb8888_rev, |
| 2285 | fetch_texel_2d_f_argb8888_rev, |
| 2286 | fetch_texel_3d_f_argb8888_rev, |
| 2287 | store_texel_argb8888_rev |
| 2288 | }, |
| 2289 | { |
| 2290 | MESA_FORMAT_RGB888, |
| 2291 | fetch_texel_1d_f_rgb888, |
| 2292 | fetch_texel_2d_f_rgb888, |
| 2293 | fetch_texel_3d_f_rgb888, |
| 2294 | store_texel_rgb888 |
| 2295 | }, |
| 2296 | { |
| 2297 | MESA_FORMAT_BGR888, |
| 2298 | fetch_texel_1d_f_bgr888, |
| 2299 | fetch_texel_2d_f_bgr888, |
| 2300 | fetch_texel_3d_f_bgr888, |
| 2301 | store_texel_bgr888 |
| 2302 | }, |
| 2303 | { |
| 2304 | MESA_FORMAT_RGB565, |
| 2305 | fetch_texel_1d_f_rgb565, |
| 2306 | fetch_texel_2d_f_rgb565, |
| 2307 | fetch_texel_3d_f_rgb565, |
| 2308 | store_texel_rgb565 |
| 2309 | }, |
| 2310 | { |
| 2311 | MESA_FORMAT_RGB565_REV, |
| 2312 | fetch_texel_1d_f_rgb565_rev, |
| 2313 | fetch_texel_2d_f_rgb565_rev, |
| 2314 | fetch_texel_3d_f_rgb565_rev, |
| 2315 | store_texel_rgb565_rev |
| 2316 | }, |
| 2317 | { |
| 2318 | MESA_FORMAT_RGBA4444, |
| 2319 | fetch_texel_1d_f_rgba4444, |
| 2320 | fetch_texel_2d_f_rgba4444, |
| 2321 | fetch_texel_3d_f_rgba4444, |
| 2322 | store_texel_rgba4444 |
| 2323 | }, |
| 2324 | { |
| 2325 | MESA_FORMAT_ARGB4444, |
| 2326 | fetch_texel_1d_f_argb4444, |
| 2327 | fetch_texel_2d_f_argb4444, |
| 2328 | fetch_texel_3d_f_argb4444, |
| 2329 | store_texel_argb4444 |
| 2330 | }, |
| 2331 | { |
| 2332 | MESA_FORMAT_ARGB4444_REV, |
| 2333 | fetch_texel_1d_f_argb4444_rev, |
| 2334 | fetch_texel_2d_f_argb4444_rev, |
| 2335 | fetch_texel_3d_f_argb4444_rev, |
| 2336 | store_texel_argb4444_rev |
| 2337 | }, |
| 2338 | { |
| 2339 | MESA_FORMAT_RGBA5551, |
| 2340 | fetch_texel_1d_f_rgba5551, |
| 2341 | fetch_texel_2d_f_rgba5551, |
| 2342 | fetch_texel_3d_f_rgba5551, |
| 2343 | store_texel_rgba5551 |
| 2344 | }, |
| 2345 | { |
| 2346 | MESA_FORMAT_ARGB1555, |
| 2347 | fetch_texel_1d_f_argb1555, |
| 2348 | fetch_texel_2d_f_argb1555, |
| 2349 | fetch_texel_3d_f_argb1555, |
| 2350 | store_texel_argb1555 |
| 2351 | }, |
| 2352 | { |
| 2353 | MESA_FORMAT_ARGB1555_REV, |
| 2354 | fetch_texel_1d_f_argb1555_rev, |
| 2355 | fetch_texel_2d_f_argb1555_rev, |
| 2356 | fetch_texel_3d_f_argb1555_rev, |
| 2357 | store_texel_argb1555_rev |
| 2358 | }, |
| 2359 | { |
| 2360 | MESA_FORMAT_AL88, |
| 2361 | fetch_texel_1d_f_al88, |
| 2362 | fetch_texel_2d_f_al88, |
| 2363 | fetch_texel_3d_f_al88, |
| 2364 | store_texel_al88 |
| 2365 | }, |
| 2366 | { |
| 2367 | MESA_FORMAT_AL88_REV, |
| 2368 | fetch_texel_1d_f_al88_rev, |
| 2369 | fetch_texel_2d_f_al88_rev, |
| 2370 | fetch_texel_3d_f_al88_rev, |
| 2371 | store_texel_al88_rev |
| 2372 | }, |
| 2373 | { |
| 2374 | MESA_FORMAT_RGB332, |
| 2375 | fetch_texel_1d_f_rgb332, |
| 2376 | fetch_texel_2d_f_rgb332, |
| 2377 | fetch_texel_3d_f_rgb332, |
| 2378 | store_texel_rgb332 |
| 2379 | }, |
| 2380 | { |
| 2381 | MESA_FORMAT_A8, |
| 2382 | fetch_texel_1d_f_a8, |
| 2383 | fetch_texel_2d_f_a8, |
| 2384 | fetch_texel_3d_f_a8, |
| 2385 | store_texel_a8 |
| 2386 | }, |
| 2387 | { |
| 2388 | MESA_FORMAT_L8, |
| 2389 | fetch_texel_1d_f_l8, |
| 2390 | fetch_texel_2d_f_l8, |
| 2391 | fetch_texel_3d_f_l8, |
| 2392 | store_texel_l8 |
| 2393 | }, |
| 2394 | { |
| 2395 | MESA_FORMAT_I8, |
| 2396 | fetch_texel_1d_f_i8, |
| 2397 | fetch_texel_2d_f_i8, |
| 2398 | fetch_texel_3d_f_i8, |
| 2399 | store_texel_i8 |
| 2400 | }, |
| 2401 | { |
| 2402 | MESA_FORMAT_CI8, |
| 2403 | fetch_texel_1d_f_ci8, |
| 2404 | fetch_texel_2d_f_ci8, |
| 2405 | fetch_texel_3d_f_ci8, |
| 2406 | store_texel_ci8 |
| 2407 | }, |
| 2408 | { |
| 2409 | MESA_FORMAT_YCBCR, |
| 2410 | fetch_texel_1d_f_ycbcr, |
| 2411 | fetch_texel_2d_f_ycbcr, |
| 2412 | fetch_texel_3d_f_ycbcr, |
| 2413 | store_texel_ycbcr |
| 2414 | }, |
| 2415 | { |
| 2416 | MESA_FORMAT_YCBCR_REV, |
| 2417 | fetch_texel_1d_f_ycbcr_rev, |
| 2418 | fetch_texel_2d_f_ycbcr_rev, |
| 2419 | fetch_texel_3d_f_ycbcr_rev, |
| 2420 | store_texel_ycbcr_rev |
| 2421 | }, |
| 2422 | { |
| 2423 | MESA_FORMAT_Z24_S8, |
| 2424 | fetch_texel_1d_f_z24_s8, |
| 2425 | fetch_texel_2d_f_z24_s8, |
| 2426 | fetch_texel_3d_f_z24_s8, |
| 2427 | store_texel_z24_s8 |
| 2428 | }, |
| 2429 | { |
| 2430 | MESA_FORMAT_S8_Z24, |
| 2431 | fetch_texel_1d_f_s8_z24, |
| 2432 | fetch_texel_2d_f_s8_z24, |
| 2433 | fetch_texel_3d_f_s8_z24, |
| 2434 | store_texel_s8_z24 |
| 2435 | }, |
| 2436 | { |
| 2437 | MESA_FORMAT_Z16, |
| 2438 | fetch_texel_1d_f_z16, |
| 2439 | fetch_texel_2d_f_z16, |
| 2440 | fetch_texel_3d_f_z16, |
| 2441 | store_texel_z16 |
| 2442 | }, |
| 2443 | { |
| 2444 | MESA_FORMAT_Z32, |
| 2445 | fetch_texel_1d_f_z32, |
| 2446 | fetch_texel_2d_f_z32, |
| 2447 | fetch_texel_3d_f_z32, |
| 2448 | store_texel_z32 |
| 2449 | } |
| 2450 | }; |
| 2451 | |
| 2452 | |
| 2453 | FetchTexelFuncF |
| 2454 | _mesa_get_texel_fetch_func(GLuint format, GLuint dims) |
| 2455 | { |
| 2456 | GLuint i; |
| 2457 | /* XXX replace loop with direct table lookup */ |
| 2458 | for (i = 0; i < MESA_FORMAT_COUNT; i++) { |
| 2459 | if (texfetch_funcs[i].Name == format) { |
| 2460 | switch (dims) { |
| 2461 | case 1: |
| 2462 | return texfetch_funcs[i].Fetch1D; |
| 2463 | case 2: |
| 2464 | return texfetch_funcs[i].Fetch2D; |
| 2465 | case 3: |
| 2466 | return texfetch_funcs[i].Fetch3D; |
| 2467 | } |
| 2468 | } |
| 2469 | } |
| 2470 | return NULL; |
| 2471 | } |
| 2472 | |
| 2473 | |
| 2474 | StoreTexelFunc |
| 2475 | _mesa_get_texel_store_func(GLuint format) |
| 2476 | { |
| 2477 | GLuint i; |
| 2478 | /* XXX replace loop with direct table lookup */ |
| 2479 | for (i = 0; i < MESA_FORMAT_COUNT; i++) { |
| 2480 | if (texfetch_funcs[i].Name == format) { |
| 2481 | return texfetch_funcs[i].StoreTexel; |
| 2482 | } |
| 2483 | } |
| 2484 | return NULL; |
| 2485 | } |