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" |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 37 | #include "texformat.h" |
Brian Paul | 3623733 | 2004-04-22 00:54:53 +0000 | [diff] [blame] | 38 | #include "texstore.h" |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 39 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 40 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 41 | #if FEATURE_EXT_texture_sRGB |
| 42 | |
| 43 | /** |
| 44 | * Convert an 8-bit sRGB value from non-linear space to a |
| 45 | * linear RGB value in [0, 1]. |
| 46 | * Implemented with a 256-entry lookup table. |
| 47 | */ |
| 48 | static INLINE GLfloat |
| 49 | nonlinear_to_linear(GLubyte cs8) |
| 50 | { |
| 51 | static GLfloat table[256]; |
| 52 | static GLboolean tableReady = GL_FALSE; |
| 53 | if (!tableReady) { |
| 54 | /* compute lookup table now */ |
| 55 | GLuint i; |
| 56 | for (i = 0; i < 256; i++) { |
| 57 | const GLfloat cs = UBYTE_TO_FLOAT(i); |
| 58 | if (cs <= 0.04045) { |
Michal Krol | 9614eac | 2008-07-15 11:15:27 +0200 | [diff] [blame] | 59 | table[i] = cs / 12.92f; |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 60 | } |
| 61 | else { |
Michal Krol | 9614eac | 2008-07-15 11:15:27 +0200 | [diff] [blame] | 62 | table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | tableReady = GL_TRUE; |
| 66 | } |
| 67 | return table[cs8]; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 72 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 73 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 74 | /* Texel fetch routines for all supported formats |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 75 | */ |
| 76 | #define DIM 1 |
| 77 | #include "texformat_tmp.h" |
| 78 | |
| 79 | #define DIM 2 |
| 80 | #include "texformat_tmp.h" |
| 81 | |
| 82 | #define DIM 3 |
| 83 | #include "texformat_tmp.h" |
| 84 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 85 | /** |
| 86 | * Null texel fetch function. |
| 87 | * |
| 88 | * Have to have this so the FetchTexel function pointer is never NULL. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 89 | */ |
| 90 | static void fetch_null_texel( const struct gl_texture_image *texImage, |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 91 | GLint i, GLint j, GLint k, GLchan *texel ) |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 92 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 93 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 94 | texel[RCOMP] = 0; |
| 95 | texel[GCOMP] = 0; |
| 96 | texel[BCOMP] = 0; |
| 97 | texel[ACOMP] = 0; |
| 98 | _mesa_warning(NULL, "fetch_null_texel() called!"); |
| 99 | } |
| 100 | |
| 101 | static void fetch_null_texelf( const struct gl_texture_image *texImage, |
| 102 | GLint i, GLint j, GLint k, GLfloat *texel ) |
| 103 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 104 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 105 | texel[RCOMP] = 0.0; |
| 106 | texel[GCOMP] = 0.0; |
| 107 | texel[BCOMP] = 0.0; |
| 108 | texel[ACOMP] = 0.0; |
| 109 | _mesa_warning(NULL, "fetch_null_texelf() called!"); |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 112 | static void store_null_texel(struct gl_texture_image *texImage, |
| 113 | GLint i, GLint j, GLint k, const void *texel) |
| 114 | { |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 115 | (void) texImage; |
| 116 | (void) i; |
| 117 | (void) j; |
| 118 | (void) k; |
| 119 | (void) texel; |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 120 | /* no-op */ |
| 121 | } |
| 122 | |
| 123 | |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 124 | /** |
| 125 | * Notes about the predefined gl_texture_formats: |
| 126 | * |
| 127 | * 1. There are 1D, 2D and 3D functions for fetching texels from texture |
| 128 | * images, returning both GLchan values and GLfloat values. (six |
| 129 | * functions in total) |
| 130 | * You don't have to provide both the GLchan and GLfloat functions; |
| 131 | * just one or the other is OK. Mesa will use an "adaptor" to convert |
| 132 | * between GLchan/GLfloat when needed. |
| 133 | * Since the adaptors have small performance penalty, we provide both |
| 134 | * GLchan and GLfloat functions for some common formats like RGB, RGBA. |
| 135 | */ |
| 136 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 137 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 138 | /***************************************************************/ |
| 139 | /** \name Default GLchan-based formats */ |
| 140 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 141 | |
| 142 | const struct gl_texture_format _mesa_texformat_rgba = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 143 | MESA_FORMAT_RGBA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 144 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 145 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 146 | CHAN_BITS, /* RedBits */ |
| 147 | CHAN_BITS, /* GreenBits */ |
| 148 | CHAN_BITS, /* BlueBits */ |
| 149 | CHAN_BITS, /* AlphaBits */ |
| 150 | 0, /* LuminanceBits */ |
| 151 | 0, /* IntensityBits */ |
| 152 | 0, /* IndexBits */ |
| 153 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 154 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 155 | 4 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 156 | _mesa_texstore_rgba, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 157 | fetch_texel_1d_rgba, /* FetchTexel1D */ |
| 158 | fetch_texel_2d_rgba, /* FetchTexel2D */ |
| 159 | fetch_texel_3d_rgba, /* FetchTexel3D */ |
| 160 | fetch_texel_1d_f_rgba, /* FetchTexel1Df */ |
| 161 | fetch_texel_2d_f_rgba, /* FetchTexel2Df */ |
| 162 | fetch_texel_3d_f_rgba, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 163 | store_texel_rgba /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | const struct gl_texture_format _mesa_texformat_rgb = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 167 | MESA_FORMAT_RGB, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 168 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 169 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 170 | CHAN_BITS, /* RedBits */ |
| 171 | CHAN_BITS, /* GreenBits */ |
| 172 | CHAN_BITS, /* BlueBits */ |
| 173 | 0, /* AlphaBits */ |
| 174 | 0, /* LuminanceBits */ |
| 175 | 0, /* IntensityBits */ |
| 176 | 0, /* IndexBits */ |
| 177 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 178 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 179 | 3 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 180 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 181 | fetch_texel_1d_rgb, /* FetchTexel1D */ |
| 182 | fetch_texel_2d_rgb, /* FetchTexel2D */ |
| 183 | fetch_texel_3d_rgb, /* FetchTexel3D */ |
| 184 | fetch_texel_1d_f_rgb, /* FetchTexel1Df */ |
| 185 | fetch_texel_2d_f_rgb, /* FetchTexel2Df */ |
| 186 | fetch_texel_3d_f_rgb, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 187 | store_texel_rgb /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | const struct gl_texture_format _mesa_texformat_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 191 | MESA_FORMAT_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 192 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 193 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 194 | 0, /* RedBits */ |
| 195 | 0, /* GreenBits */ |
| 196 | 0, /* BlueBits */ |
| 197 | CHAN_BITS, /* AlphaBits */ |
| 198 | 0, /* LuminanceBits */ |
| 199 | 0, /* IntensityBits */ |
| 200 | 0, /* IndexBits */ |
| 201 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 202 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 203 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 204 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 205 | fetch_texel_1d_alpha, /* FetchTexel1D */ |
| 206 | fetch_texel_2d_alpha, /* FetchTexel2D */ |
| 207 | fetch_texel_3d_alpha, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 208 | NULL, /* FetchTexel1Df */ |
| 209 | NULL, /* FetchTexel2Df */ |
| 210 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 211 | store_texel_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 212 | }; |
| 213 | |
| 214 | const struct gl_texture_format _mesa_texformat_luminance = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 215 | MESA_FORMAT_LUMINANCE, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 216 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 217 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 218 | 0, /* RedBits */ |
| 219 | 0, /* GreenBits */ |
| 220 | 0, /* BlueBits */ |
| 221 | 0, /* AlphaBits */ |
| 222 | CHAN_BITS, /* LuminanceBits */ |
| 223 | 0, /* IntensityBits */ |
| 224 | 0, /* IndexBits */ |
| 225 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 226 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 227 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 228 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 229 | fetch_texel_1d_luminance, /* FetchTexel1D */ |
| 230 | fetch_texel_2d_luminance, /* FetchTexel2D */ |
| 231 | fetch_texel_3d_luminance, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 232 | NULL, /* FetchTexel1Df */ |
| 233 | NULL, /* FetchTexel2Df */ |
| 234 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 235 | store_texel_luminance /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 236 | }; |
| 237 | |
| 238 | const struct gl_texture_format _mesa_texformat_luminance_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 239 | MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 240 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 241 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 242 | 0, /* RedBits */ |
| 243 | 0, /* GreenBits */ |
| 244 | 0, /* BlueBits */ |
| 245 | CHAN_BITS, /* AlphaBits */ |
| 246 | CHAN_BITS, /* LuminanceBits */ |
| 247 | 0, /* IntensityBits */ |
| 248 | 0, /* IndexBits */ |
| 249 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 250 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 251 | 2 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 252 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 253 | fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ |
| 254 | fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ |
| 255 | fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 256 | NULL, /* FetchTexel1Df */ |
| 257 | NULL, /* FetchTexel2Df */ |
| 258 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 259 | store_texel_luminance_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 260 | }; |
| 261 | |
| 262 | const struct gl_texture_format _mesa_texformat_intensity = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 263 | MESA_FORMAT_INTENSITY, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 264 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 265 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 266 | 0, /* RedBits */ |
| 267 | 0, /* GreenBits */ |
| 268 | 0, /* BlueBits */ |
| 269 | 0, /* AlphaBits */ |
| 270 | 0, /* LuminanceBits */ |
| 271 | CHAN_BITS, /* IntensityBits */ |
| 272 | 0, /* IndexBits */ |
| 273 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 274 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 275 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 276 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 277 | fetch_texel_1d_intensity, /* FetchTexel1D */ |
| 278 | fetch_texel_2d_intensity, /* FetchTexel2D */ |
| 279 | fetch_texel_3d_intensity, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 280 | NULL, /* FetchTexel1Df */ |
| 281 | NULL, /* FetchTexel2Df */ |
| 282 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 283 | store_texel_intensity /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 284 | }; |
| 285 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 286 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 287 | #if FEATURE_EXT_texture_sRGB |
| 288 | |
| 289 | const struct gl_texture_format _mesa_texformat_srgb8 = { |
| 290 | MESA_FORMAT_SRGB8, /* MesaFormat */ |
| 291 | GL_RGB, /* BaseFormat */ |
| 292 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 293 | 8, /* RedBits */ |
| 294 | 8, /* GreenBits */ |
| 295 | 8, /* BlueBits */ |
| 296 | 0, /* AlphaBits */ |
| 297 | 0, /* LuminanceBits */ |
| 298 | 0, /* IntensityBits */ |
| 299 | 0, /* IndexBits */ |
| 300 | 0, /* DepthBits */ |
| 301 | 0, /* StencilBits */ |
| 302 | 3, /* TexelBytes */ |
| 303 | _mesa_texstore_srgb8, /* StoreTexImageFunc */ |
| 304 | NULL, /* FetchTexel1D */ |
| 305 | NULL, /* FetchTexel2D */ |
| 306 | NULL, /* FetchTexel3D */ |
| 307 | fetch_texel_1d_srgb8, /* FetchTexel1Df */ |
| 308 | fetch_texel_2d_srgb8, /* FetchTexel2Df */ |
| 309 | fetch_texel_3d_srgb8, /* FetchTexel3Df */ |
| 310 | store_texel_srgb8 /* StoreTexel */ |
| 311 | }; |
| 312 | |
| 313 | const struct gl_texture_format _mesa_texformat_srgba8 = { |
| 314 | MESA_FORMAT_SRGBA8, /* MesaFormat */ |
| 315 | GL_RGBA, /* BaseFormat */ |
| 316 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 317 | 8, /* RedBits */ |
| 318 | 8, /* GreenBits */ |
| 319 | 8, /* BlueBits */ |
| 320 | 8, /* AlphaBits */ |
| 321 | 0, /* LuminanceBits */ |
| 322 | 0, /* IntensityBits */ |
| 323 | 0, /* IndexBits */ |
| 324 | 0, /* DepthBits */ |
| 325 | 0, /* StencilBits */ |
| 326 | 4, /* TexelBytes */ |
| 327 | _mesa_texstore_srgba8, /* StoreTexImageFunc */ |
| 328 | NULL, /* FetchTexel1D */ |
| 329 | NULL, /* FetchTexel2D */ |
| 330 | NULL, /* FetchTexel3D */ |
| 331 | fetch_texel_1d_srgba8, /* FetchTexel1Df */ |
| 332 | fetch_texel_2d_srgba8, /* FetchTexel2Df */ |
| 333 | fetch_texel_3d_srgba8, /* FetchTexel3Df */ |
| 334 | store_texel_srgba8 /* StoreTexel */ |
| 335 | }; |
| 336 | |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 337 | const struct gl_texture_format _mesa_texformat_sargb8 = { |
| 338 | MESA_FORMAT_SARGB8, /* MesaFormat */ |
| 339 | GL_RGBA, /* BaseFormat */ |
| 340 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 341 | 8, /* RedBits */ |
| 342 | 8, /* GreenBits */ |
| 343 | 8, /* BlueBits */ |
| 344 | 8, /* AlphaBits */ |
| 345 | 0, /* LuminanceBits */ |
| 346 | 0, /* IntensityBits */ |
| 347 | 0, /* IndexBits */ |
| 348 | 0, /* DepthBits */ |
| 349 | 0, /* StencilBits */ |
| 350 | 4, /* TexelBytes */ |
| 351 | _mesa_texstore_sargb8, /* StoreTexImageFunc */ |
| 352 | NULL, /* FetchTexel1D */ |
| 353 | NULL, /* FetchTexel2D */ |
| 354 | NULL, /* FetchTexel3D */ |
| 355 | fetch_texel_1d_sargb8, /* FetchTexel1Df */ |
| 356 | fetch_texel_2d_sargb8, /* FetchTexel2Df */ |
| 357 | fetch_texel_3d_sargb8, /* FetchTexel3Df */ |
| 358 | store_texel_sargb8 /* StoreTexel */ |
| 359 | }; |
| 360 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 361 | const struct gl_texture_format _mesa_texformat_sl8 = { |
| 362 | MESA_FORMAT_SL8, /* MesaFormat */ |
| 363 | GL_LUMINANCE, /* BaseFormat */ |
| 364 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 365 | 0, /* RedBits */ |
| 366 | 0, /* GreenBits */ |
| 367 | 0, /* BlueBits */ |
| 368 | 0, /* AlphaBits */ |
| 369 | 8, /* LuminanceBits */ |
| 370 | 0, /* IntensityBits */ |
| 371 | 0, /* IndexBits */ |
| 372 | 0, /* DepthBits */ |
| 373 | 0, /* StencilBits */ |
| 374 | 1, /* TexelBytes */ |
| 375 | _mesa_texstore_sl8, /* StoreTexImageFunc */ |
| 376 | NULL, /* FetchTexel1D */ |
| 377 | NULL, /* FetchTexel2D */ |
| 378 | NULL, /* FetchTexel3D */ |
| 379 | fetch_texel_1d_sl8, /* FetchTexel1Df */ |
| 380 | fetch_texel_2d_sl8, /* FetchTexel2Df */ |
| 381 | fetch_texel_3d_sl8, /* FetchTexel3Df */ |
| 382 | store_texel_sl8 /* StoreTexel */ |
| 383 | }; |
| 384 | |
| 385 | const struct gl_texture_format _mesa_texformat_sla8 = { |
| 386 | MESA_FORMAT_SLA8, /* MesaFormat */ |
| 387 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 388 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 389 | 0, /* RedBits */ |
| 390 | 0, /* GreenBits */ |
| 391 | 0, /* BlueBits */ |
| 392 | 8, /* AlphaBits */ |
| 393 | 8, /* LuminanceBits */ |
| 394 | 0, /* IntensityBits */ |
| 395 | 0, /* IndexBits */ |
| 396 | 0, /* DepthBits */ |
| 397 | 0, /* StencilBits */ |
| 398 | 2, /* TexelBytes */ |
| 399 | _mesa_texstore_sla8, /* StoreTexImageFunc */ |
| 400 | NULL, /* FetchTexel1D */ |
| 401 | NULL, /* FetchTexel2D */ |
| 402 | NULL, /* FetchTexel3D */ |
| 403 | fetch_texel_1d_sla8, /* FetchTexel1Df */ |
| 404 | fetch_texel_2d_sla8, /* FetchTexel2Df */ |
| 405 | fetch_texel_3d_sla8, /* FetchTexel3Df */ |
| 406 | store_texel_sla8 /* StoreTexel */ |
| 407 | }; |
| 408 | |
| 409 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 410 | |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 411 | const struct gl_texture_format _mesa_texformat_rgba_float32 = { |
| 412 | MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ |
| 413 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 414 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 415 | 8 * sizeof(GLfloat), /* RedBits */ |
| 416 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 417 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 418 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 419 | 0, /* LuminanceBits */ |
| 420 | 0, /* IntensityBits */ |
| 421 | 0, /* IndexBits */ |
| 422 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 423 | 0, /* StencilBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 424 | 4 * sizeof(GLfloat), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 425 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 426 | NULL, /* FetchTexel1D */ |
| 427 | NULL, /* FetchTexel1D */ |
| 428 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 429 | fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ |
| 430 | fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ |
| 431 | fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 432 | store_texel_rgba_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | const struct gl_texture_format _mesa_texformat_rgba_float16 = { |
| 436 | MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ |
| 437 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 438 | GL_FLOAT, /* DataType */ |
| 439 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 440 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 441 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
| 442 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 443 | 0, /* LuminanceBits */ |
| 444 | 0, /* IntensityBits */ |
| 445 | 0, /* IndexBits */ |
| 446 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 447 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 448 | 4 * sizeof(GLhalfARB), /* TexelBytes */ |
| 449 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 450 | NULL, /* FetchTexel1D */ |
| 451 | NULL, /* FetchTexel1D */ |
| 452 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 453 | fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ |
| 454 | fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ |
| 455 | fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 456 | store_texel_rgba_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 457 | }; |
| 458 | |
| 459 | const struct gl_texture_format _mesa_texformat_rgb_float32 = { |
| 460 | MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ |
| 461 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 462 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 463 | 8 * sizeof(GLfloat), /* RedBits */ |
| 464 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 465 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 466 | 0, /* AlphaBits */ |
| 467 | 0, /* LuminanceBits */ |
| 468 | 0, /* IntensityBits */ |
| 469 | 0, /* IndexBits */ |
| 470 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 471 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 472 | 3 * sizeof(GLfloat), /* TexelBytes */ |
| 473 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 474 | NULL, /* FetchTexel1D */ |
| 475 | NULL, /* FetchTexel1D */ |
| 476 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 477 | fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ |
| 478 | fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ |
| 479 | fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 480 | store_texel_rgb_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 481 | }; |
| 482 | |
| 483 | const struct gl_texture_format _mesa_texformat_rgb_float16 = { |
| 484 | MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ |
| 485 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 486 | GL_FLOAT, /* DataType */ |
| 487 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 488 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 489 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 490 | 0, /* AlphaBits */ |
| 491 | 0, /* LuminanceBits */ |
| 492 | 0, /* IntensityBits */ |
| 493 | 0, /* IndexBits */ |
| 494 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 495 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 496 | 3 * sizeof(GLhalfARB), /* TexelBytes */ |
| 497 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 498 | NULL, /* FetchTexel1D */ |
| 499 | NULL, /* FetchTexel1D */ |
| 500 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 501 | fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ |
| 502 | fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 503 | fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ |
| 504 | store_texel_rgb_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 505 | }; |
| 506 | |
| 507 | const struct gl_texture_format _mesa_texformat_alpha_float32 = { |
| 508 | MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ |
| 509 | GL_ALPHA, /* BaseFormat */ |
| 510 | GL_FLOAT, /* DataType */ |
| 511 | 0, /* RedBits */ |
| 512 | 0, /* GreenBits */ |
| 513 | 0, /* BlueBits */ |
| 514 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 515 | 0, /* LuminanceBits */ |
| 516 | 0, /* IntensityBits */ |
| 517 | 0, /* IndexBits */ |
| 518 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 519 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 520 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 521 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 522 | NULL, /* FetchTexel1D */ |
| 523 | NULL, /* FetchTexel1D */ |
| 524 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 525 | fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ |
| 526 | fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 527 | fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ |
| 528 | store_texel_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 529 | }; |
| 530 | |
| 531 | const struct gl_texture_format _mesa_texformat_alpha_float16 = { |
| 532 | MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ |
| 533 | GL_ALPHA, /* BaseFormat */ |
| 534 | GL_FLOAT, /* DataType */ |
| 535 | 0, /* RedBits */ |
| 536 | 0, /* GreenBits */ |
| 537 | 0, /* BlueBits */ |
| 538 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 539 | 0, /* LuminanceBits */ |
| 540 | 0, /* IntensityBits */ |
| 541 | 0, /* IndexBits */ |
| 542 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 543 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 544 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 545 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 546 | NULL, /* FetchTexel1D */ |
| 547 | NULL, /* FetchTexel1D */ |
| 548 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 549 | fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ |
| 550 | fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 551 | fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ |
| 552 | store_texel_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 553 | }; |
| 554 | |
| 555 | const struct gl_texture_format _mesa_texformat_luminance_float32 = { |
| 556 | MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ |
| 557 | GL_LUMINANCE, /* BaseFormat */ |
| 558 | GL_FLOAT, /* DataType */ |
| 559 | 0, /* RedBits */ |
| 560 | 0, /* GreenBits */ |
| 561 | 0, /* BlueBits */ |
| 562 | 0, /* AlphaBits */ |
| 563 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 564 | 0, /* IntensityBits */ |
| 565 | 0, /* IndexBits */ |
| 566 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 567 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 568 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 569 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 570 | NULL, /* FetchTexel1D */ |
| 571 | NULL, /* FetchTexel2D */ |
| 572 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 573 | fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ |
| 574 | fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 575 | fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ |
| 576 | store_texel_luminance_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 577 | }; |
| 578 | |
| 579 | const struct gl_texture_format _mesa_texformat_luminance_float16 = { |
| 580 | MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ |
| 581 | GL_LUMINANCE, /* BaseFormat */ |
| 582 | GL_FLOAT, /* DataType */ |
| 583 | 0, /* RedBits */ |
| 584 | 0, /* GreenBits */ |
| 585 | 0, /* BlueBits */ |
| 586 | 0, /* AlphaBits */ |
| 587 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 588 | 0, /* IntensityBits */ |
| 589 | 0, /* IndexBits */ |
| 590 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 591 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 592 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 593 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 594 | NULL, /* FetchTexel1D */ |
| 595 | NULL, /* FetchTexel2D */ |
| 596 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 597 | fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ |
| 598 | fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 599 | fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ |
| 600 | store_texel_luminance_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 601 | }; |
| 602 | |
| 603 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { |
| 604 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ |
| 605 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 606 | GL_FLOAT, /* DataType */ |
| 607 | 0, /* RedBits */ |
| 608 | 0, /* GreenBits */ |
| 609 | 0, /* BlueBits */ |
| 610 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 611 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 612 | 0, /* IntensityBits */ |
| 613 | 0, /* IndexBits */ |
| 614 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 615 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 616 | 2 * sizeof(GLfloat), /* TexelBytes */ |
| 617 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 618 | NULL, /* FetchTexel1D */ |
| 619 | NULL, /* FetchTexel2D */ |
| 620 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 621 | fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ |
| 622 | fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 623 | fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ |
| 624 | store_texel_luminance_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 625 | }; |
| 626 | |
| 627 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { |
| 628 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ |
| 629 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 630 | GL_FLOAT, /* DataType */ |
| 631 | 0, /* RedBits */ |
| 632 | 0, /* GreenBits */ |
| 633 | 0, /* BlueBits */ |
| 634 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 635 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 636 | 0, /* IntensityBits */ |
| 637 | 0, /* IndexBits */ |
| 638 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 639 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 640 | 2 * sizeof(GLhalfARB), /* TexelBytes */ |
| 641 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 642 | NULL, /* FetchTexel1D */ |
| 643 | NULL, /* FetchTexel2D */ |
| 644 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 645 | fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ |
| 646 | fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 647 | fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ |
| 648 | store_texel_luminance_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 649 | }; |
| 650 | |
| 651 | const struct gl_texture_format _mesa_texformat_intensity_float32 = { |
| 652 | MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ |
| 653 | GL_INTENSITY, /* BaseFormat */ |
| 654 | GL_FLOAT, /* DataType */ |
| 655 | 0, /* RedBits */ |
| 656 | 0, /* GreenBits */ |
| 657 | 0, /* BlueBits */ |
| 658 | 0, /* AlphaBits */ |
| 659 | 0, /* LuminanceBits */ |
| 660 | 8 * sizeof(GLfloat), /* IntensityBits */ |
| 661 | 0, /* IndexBits */ |
| 662 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 663 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 664 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 665 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 666 | NULL, /* FetchTexel1D */ |
| 667 | NULL, /* FetchTexel2D */ |
| 668 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 669 | fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ |
| 670 | fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 671 | fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ |
| 672 | store_texel_intensity_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 673 | }; |
| 674 | |
| 675 | const struct gl_texture_format _mesa_texformat_intensity_float16 = { |
| 676 | MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ |
| 677 | GL_INTENSITY, /* BaseFormat */ |
| 678 | GL_FLOAT, /* DataType */ |
| 679 | 0, /* RedBits */ |
| 680 | 0, /* GreenBits */ |
| 681 | 0, /* BlueBits */ |
| 682 | 0, /* AlphaBits */ |
| 683 | 0, /* LuminanceBits */ |
| 684 | 8 * sizeof(GLhalfARB), /* IntensityBits */ |
| 685 | 0, /* IndexBits */ |
| 686 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 687 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 688 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 689 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 690 | NULL, /* FetchTexel1D */ |
| 691 | NULL, /* FetchTexel2D */ |
| 692 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 693 | fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ |
| 694 | fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 695 | fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ |
| 696 | store_texel_intensity_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 697 | }; |
| 698 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 699 | const struct gl_texture_format _mesa_texformat_dudv8 = { |
| 700 | MESA_FORMAT_DUDV8, /* MesaFormat */ |
| 701 | GL_DUDV_ATI, /* BaseFormat */ |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 702 | GL_SIGNED_NORMALIZED, /* DataType */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 703 | /* maybe should add dudvBits field, but spec seems to be |
| 704 | lacking the ability to query with GetTexLevelParameter anyway */ |
| 705 | 0, /* RedBits */ |
| 706 | 0, /* GreenBits */ |
| 707 | 0, /* BlueBits */ |
| 708 | 0, /* AlphaBits */ |
| 709 | 0, /* LuminanceBits */ |
| 710 | 0, /* IntensityBits */ |
| 711 | 0, /* IndexBits */ |
| 712 | 0, /* DepthBits */ |
| 713 | 0, /* StencilBits */ |
| 714 | 2, /* TexelBytes */ |
| 715 | _mesa_texstore_dudv8, /* StoreTexImageFunc */ |
| 716 | NULL, /* FetchTexel1D */ |
Brian Paul | 4681a1d | 2009-03-13 08:36:51 -0600 | [diff] [blame] | 717 | NULL, /* FetchTexel2D */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 718 | NULL, /* FetchTexel3D */ |
Brian Paul | 4681a1d | 2009-03-13 08:36:51 -0600 | [diff] [blame] | 719 | fetch_texel_1d_dudv8, /* FetchTexel1Df */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 720 | fetch_texel_2d_dudv8, /* FetchTexel2Df */ |
Brian Paul | 4681a1d | 2009-03-13 08:36:51 -0600 | [diff] [blame] | 721 | fetch_texel_3d_dudv8, /* FetchTexel3Df */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 722 | NULL /* StoreTexel */ |
| 723 | }; |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 724 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 725 | const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { |
| 726 | MESA_FORMAT_SIGNED_RGBA8888, /* MesaFormat */ |
| 727 | GL_RGBA, /* BaseFormat */ |
| 728 | GL_SIGNED_NORMALIZED, /* DataType */ |
| 729 | 8, /* RedBits */ |
| 730 | 8, /* GreenBits */ |
| 731 | 8, /* BlueBits */ |
| 732 | 8, /* AlphaBits */ |
| 733 | 0, /* LuminanceBits */ |
| 734 | 0, /* IntensityBits */ |
| 735 | 0, /* IndexBits */ |
| 736 | 0, /* DepthBits */ |
| 737 | 0, /* StencilBits */ |
| 738 | 4, /* TexelBytes */ |
| 739 | _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ |
| 740 | NULL, /* FetchTexel1D */ |
| 741 | NULL, /* FetchTexel2D */ |
| 742 | NULL, /* FetchTexel3D */ |
| 743 | fetch_texel_1d_signed_rgba8888, /* FetchTexel1Df */ |
| 744 | fetch_texel_2d_signed_rgba8888, /* FetchTexel2Df */ |
| 745 | fetch_texel_3d_signed_rgba8888, /* FetchTexel3Df */ |
| 746 | store_texel_signed_rgba8888 /* StoreTexel */ |
| 747 | }; |
| 748 | |
Roland Scheidegger | bb386a1 | 2009-03-27 21:59:33 +0100 | [diff] [blame^] | 749 | const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { |
| 750 | MESA_FORMAT_SIGNED_RGBA8888_REV, /* MesaFormat */ |
| 751 | GL_RGBA, /* BaseFormat */ |
| 752 | GL_SIGNED_NORMALIZED, /* DataType */ |
| 753 | 8, /* RedBits */ |
| 754 | 8, /* GreenBits */ |
| 755 | 8, /* BlueBits */ |
| 756 | 8, /* AlphaBits */ |
| 757 | 0, /* LuminanceBits */ |
| 758 | 0, /* IntensityBits */ |
| 759 | 0, /* IndexBits */ |
| 760 | 0, /* DepthBits */ |
| 761 | 0, /* StencilBits */ |
| 762 | 4, /* TexelBytes */ |
| 763 | _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ |
| 764 | NULL, /* FetchTexel1D */ |
| 765 | NULL, /* FetchTexel2D */ |
| 766 | NULL, /* FetchTexel3D */ |
| 767 | fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */ |
| 768 | fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */ |
| 769 | fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */ |
| 770 | store_texel_signed_rgba8888_rev /* StoreTexel */ |
| 771 | }; |
| 772 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 773 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 774 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 775 | |
| 776 | /***************************************************************/ |
| 777 | /** \name Hardware formats */ |
| 778 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 779 | |
| 780 | const struct gl_texture_format _mesa_texformat_rgba8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 781 | MESA_FORMAT_RGBA8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 782 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 783 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 784 | 8, /* RedBits */ |
| 785 | 8, /* GreenBits */ |
| 786 | 8, /* BlueBits */ |
| 787 | 8, /* AlphaBits */ |
| 788 | 0, /* LuminanceBits */ |
| 789 | 0, /* IntensityBits */ |
| 790 | 0, /* IndexBits */ |
| 791 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 792 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 793 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 794 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 795 | fetch_texel_1d_rgba8888, /* FetchTexel1D */ |
| 796 | fetch_texel_2d_rgba8888, /* FetchTexel2D */ |
| 797 | fetch_texel_3d_rgba8888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 798 | NULL, /* FetchTexel1Df */ |
| 799 | NULL, /* FetchTexel2Df */ |
| 800 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 801 | store_texel_rgba8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 802 | }; |
| 803 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 804 | const struct gl_texture_format _mesa_texformat_rgba8888_rev = { |
| 805 | MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 806 | GL_RGBA, /* BaseFormat */ |
| 807 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 808 | 8, /* RedBits */ |
| 809 | 8, /* GreenBits */ |
| 810 | 8, /* BlueBits */ |
| 811 | 8, /* AlphaBits */ |
| 812 | 0, /* LuminanceBits */ |
| 813 | 0, /* IntensityBits */ |
| 814 | 0, /* IndexBits */ |
| 815 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 816 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 817 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 818 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
| 819 | fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ |
| 820 | fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ |
| 821 | fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 822 | NULL, /* FetchTexel1Df */ |
| 823 | NULL, /* FetchTexel2Df */ |
| 824 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 825 | store_texel_rgba8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 826 | }; |
| 827 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 828 | const struct gl_texture_format _mesa_texformat_argb8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 829 | MESA_FORMAT_ARGB8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 830 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 831 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 832 | 8, /* RedBits */ |
| 833 | 8, /* GreenBits */ |
| 834 | 8, /* BlueBits */ |
| 835 | 8, /* AlphaBits */ |
| 836 | 0, /* LuminanceBits */ |
| 837 | 0, /* IntensityBits */ |
| 838 | 0, /* IndexBits */ |
| 839 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 840 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 841 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 842 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 843 | fetch_texel_1d_argb8888, /* FetchTexel1D */ |
| 844 | fetch_texel_2d_argb8888, /* FetchTexel2D */ |
| 845 | fetch_texel_3d_argb8888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 846 | NULL, /* FetchTexel1Df */ |
| 847 | NULL, /* FetchTexel2Df */ |
| 848 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 849 | store_texel_argb8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 850 | }; |
| 851 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 852 | const struct gl_texture_format _mesa_texformat_argb8888_rev = { |
| 853 | MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 854 | GL_RGBA, /* BaseFormat */ |
| 855 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 856 | 8, /* RedBits */ |
| 857 | 8, /* GreenBits */ |
| 858 | 8, /* BlueBits */ |
| 859 | 8, /* AlphaBits */ |
| 860 | 0, /* LuminanceBits */ |
| 861 | 0, /* IntensityBits */ |
| 862 | 0, /* IndexBits */ |
| 863 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 864 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 865 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 866 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
| 867 | fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ |
| 868 | fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ |
| 869 | fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 870 | NULL, /* FetchTexel1Df */ |
| 871 | NULL, /* FetchTexel2Df */ |
| 872 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 873 | store_texel_argb8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 874 | }; |
| 875 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 876 | const struct gl_texture_format _mesa_texformat_rgb888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 877 | MESA_FORMAT_RGB888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 878 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 879 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 880 | 8, /* RedBits */ |
| 881 | 8, /* GreenBits */ |
| 882 | 8, /* BlueBits */ |
| 883 | 0, /* AlphaBits */ |
| 884 | 0, /* LuminanceBits */ |
| 885 | 0, /* IntensityBits */ |
| 886 | 0, /* IndexBits */ |
| 887 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 888 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 889 | 3, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 890 | _mesa_texstore_rgb888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 891 | fetch_texel_1d_rgb888, /* FetchTexel1D */ |
| 892 | fetch_texel_2d_rgb888, /* FetchTexel2D */ |
| 893 | fetch_texel_3d_rgb888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 894 | NULL, /* FetchTexel1Df */ |
| 895 | NULL, /* FetchTexel2Df */ |
| 896 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 897 | store_texel_rgb888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 898 | }; |
| 899 | |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 900 | const struct gl_texture_format _mesa_texformat_bgr888 = { |
| 901 | MESA_FORMAT_BGR888, /* MesaFormat */ |
| 902 | GL_RGB, /* BaseFormat */ |
| 903 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 904 | 8, /* RedBits */ |
| 905 | 8, /* GreenBits */ |
| 906 | 8, /* BlueBits */ |
| 907 | 0, /* AlphaBits */ |
| 908 | 0, /* LuminanceBits */ |
| 909 | 0, /* IntensityBits */ |
| 910 | 0, /* IndexBits */ |
| 911 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 912 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 913 | 3, /* TexelBytes */ |
| 914 | _mesa_texstore_bgr888, /* StoreTexImageFunc */ |
| 915 | fetch_texel_1d_bgr888, /* FetchTexel1D */ |
| 916 | fetch_texel_2d_bgr888, /* FetchTexel2D */ |
| 917 | fetch_texel_3d_bgr888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 918 | NULL, /* FetchTexel1Df */ |
| 919 | NULL, /* FetchTexel2Df */ |
| 920 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 921 | store_texel_bgr888 /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 922 | }; |
| 923 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 924 | const struct gl_texture_format _mesa_texformat_rgb565 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 925 | MESA_FORMAT_RGB565, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 926 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 927 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 928 | 5, /* RedBits */ |
| 929 | 6, /* GreenBits */ |
| 930 | 5, /* BlueBits */ |
| 931 | 0, /* AlphaBits */ |
| 932 | 0, /* LuminanceBits */ |
| 933 | 0, /* IntensityBits */ |
| 934 | 0, /* IndexBits */ |
| 935 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 936 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 937 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 938 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 939 | fetch_texel_1d_rgb565, /* FetchTexel1D */ |
| 940 | fetch_texel_2d_rgb565, /* FetchTexel2D */ |
| 941 | fetch_texel_3d_rgb565, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 942 | NULL, /* FetchTexel1Df */ |
| 943 | NULL, /* FetchTexel2Df */ |
| 944 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 945 | store_texel_rgb565 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 946 | }; |
| 947 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 948 | const struct gl_texture_format _mesa_texformat_rgb565_rev = { |
| 949 | MESA_FORMAT_RGB565_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 950 | GL_RGB, /* BaseFormat */ |
| 951 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 952 | 5, /* RedBits */ |
| 953 | 6, /* GreenBits */ |
| 954 | 5, /* BlueBits */ |
| 955 | 0, /* AlphaBits */ |
| 956 | 0, /* LuminanceBits */ |
| 957 | 0, /* IntensityBits */ |
| 958 | 0, /* IndexBits */ |
| 959 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 960 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 961 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 962 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
| 963 | fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ |
| 964 | fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ |
| 965 | fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 966 | NULL, /* FetchTexel1Df */ |
| 967 | NULL, /* FetchTexel2Df */ |
| 968 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 969 | store_texel_rgb565_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 970 | }; |
| 971 | |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 972 | const struct gl_texture_format _mesa_texformat_rgba4444 = { |
| 973 | MESA_FORMAT_RGBA4444, /* MesaFormat */ |
| 974 | GL_RGBA, /* BaseFormat */ |
| 975 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 976 | 4, /* RedBits */ |
| 977 | 4, /* GreenBits */ |
| 978 | 4, /* BlueBits */ |
| 979 | 4, /* AlphaBits */ |
| 980 | 0, /* LuminanceBits */ |
| 981 | 0, /* IntensityBits */ |
| 982 | 0, /* IndexBits */ |
| 983 | 0, /* DepthBits */ |
| 984 | 0, /* StencilBits */ |
| 985 | 2, /* TexelBytes */ |
| 986 | _mesa_texstore_rgba4444, /* StoreTexImageFunc */ |
| 987 | fetch_texel_1d_rgba4444, /* FetchTexel1D */ |
| 988 | fetch_texel_2d_rgba4444, /* FetchTexel2D */ |
| 989 | fetch_texel_3d_rgba4444, /* FetchTexel3D */ |
| 990 | NULL, /* FetchTexel1Df */ |
| 991 | NULL, /* FetchTexel2Df */ |
| 992 | NULL, /* FetchTexel3Df */ |
| 993 | store_texel_rgba4444 /* StoreTexel */ |
| 994 | }; |
| 995 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 996 | const struct gl_texture_format _mesa_texformat_argb4444 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 997 | MESA_FORMAT_ARGB4444, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 998 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 999 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1000 | 4, /* RedBits */ |
| 1001 | 4, /* GreenBits */ |
| 1002 | 4, /* BlueBits */ |
| 1003 | 4, /* AlphaBits */ |
| 1004 | 0, /* LuminanceBits */ |
| 1005 | 0, /* IntensityBits */ |
| 1006 | 0, /* IndexBits */ |
| 1007 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1008 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1009 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1010 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1011 | fetch_texel_1d_argb4444, /* FetchTexel1D */ |
| 1012 | fetch_texel_2d_argb4444, /* FetchTexel2D */ |
| 1013 | fetch_texel_3d_argb4444, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1014 | NULL, /* FetchTexel1Df */ |
| 1015 | NULL, /* FetchTexel2Df */ |
| 1016 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1017 | store_texel_argb4444 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1018 | }; |
| 1019 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1020 | const struct gl_texture_format _mesa_texformat_argb4444_rev = { |
| 1021 | MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1022 | GL_RGBA, /* BaseFormat */ |
| 1023 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1024 | 4, /* RedBits */ |
| 1025 | 4, /* GreenBits */ |
| 1026 | 4, /* BlueBits */ |
| 1027 | 4, /* AlphaBits */ |
| 1028 | 0, /* LuminanceBits */ |
| 1029 | 0, /* IntensityBits */ |
| 1030 | 0, /* IndexBits */ |
| 1031 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1032 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1033 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1034 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
| 1035 | fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ |
| 1036 | fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ |
| 1037 | fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1038 | NULL, /* FetchTexel1Df */ |
| 1039 | NULL, /* FetchTexel2Df */ |
| 1040 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1041 | store_texel_argb4444_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1042 | }; |
| 1043 | |
Thomas Hellstrom | dbda49a | 2009-01-20 11:12:17 +0100 | [diff] [blame] | 1044 | const struct gl_texture_format _mesa_texformat_rgba5551 = { |
| 1045 | MESA_FORMAT_RGBA5551, /* MesaFormat */ |
| 1046 | GL_RGBA, /* BaseFormat */ |
| 1047 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1048 | 5, /* RedBits */ |
| 1049 | 5, /* GreenBits */ |
| 1050 | 5, /* BlueBits */ |
| 1051 | 1, /* AlphaBits */ |
| 1052 | 0, /* LuminanceBits */ |
| 1053 | 0, /* IntensityBits */ |
| 1054 | 0, /* IndexBits */ |
| 1055 | 0, /* DepthBits */ |
| 1056 | 0, /* StencilBits */ |
| 1057 | 2, /* TexelBytes */ |
| 1058 | _mesa_texstore_rgba5551, /* StoreTexImageFunc */ |
| 1059 | fetch_texel_1d_rgba5551, /* FetchTexel1D */ |
| 1060 | fetch_texel_2d_rgba5551, /* FetchTexel2D */ |
| 1061 | fetch_texel_3d_rgba5551, /* FetchTexel3D */ |
| 1062 | NULL, /* FetchTexel1Df */ |
| 1063 | NULL, /* FetchTexel2Df */ |
| 1064 | NULL, /* FetchTexel3Df */ |
| 1065 | store_texel_rgba5551 /* StoreTexel */ |
| 1066 | }; |
| 1067 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1068 | const struct gl_texture_format _mesa_texformat_argb1555 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1069 | MESA_FORMAT_ARGB1555, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1070 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1071 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1072 | 5, /* RedBits */ |
| 1073 | 5, /* GreenBits */ |
| 1074 | 5, /* BlueBits */ |
| 1075 | 1, /* AlphaBits */ |
| 1076 | 0, /* LuminanceBits */ |
| 1077 | 0, /* IntensityBits */ |
| 1078 | 0, /* IndexBits */ |
| 1079 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1080 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1081 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1082 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1083 | fetch_texel_1d_argb1555, /* FetchTexel1D */ |
| 1084 | fetch_texel_2d_argb1555, /* FetchTexel2D */ |
| 1085 | fetch_texel_3d_argb1555, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1086 | NULL, /* FetchTexel1Df */ |
| 1087 | NULL, /* FetchTexel2Df */ |
| 1088 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1089 | store_texel_argb1555 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1090 | }; |
| 1091 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1092 | const struct gl_texture_format _mesa_texformat_argb1555_rev = { |
| 1093 | MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1094 | GL_RGBA, /* BaseFormat */ |
| 1095 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1096 | 5, /* RedBits */ |
| 1097 | 5, /* GreenBits */ |
| 1098 | 5, /* BlueBits */ |
| 1099 | 1, /* AlphaBits */ |
| 1100 | 0, /* LuminanceBits */ |
| 1101 | 0, /* IntensityBits */ |
| 1102 | 0, /* IndexBits */ |
| 1103 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1104 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1105 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1106 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
| 1107 | fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ |
| 1108 | fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ |
| 1109 | fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1110 | NULL, /* FetchTexel1Df */ |
| 1111 | NULL, /* FetchTexel2Df */ |
| 1112 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1113 | store_texel_argb1555_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1114 | }; |
| 1115 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1116 | const struct gl_texture_format _mesa_texformat_al88 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1117 | MESA_FORMAT_AL88, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1118 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1119 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1120 | 0, /* RedBits */ |
| 1121 | 0, /* GreenBits */ |
| 1122 | 0, /* BlueBits */ |
| 1123 | 8, /* AlphaBits */ |
| 1124 | 8, /* LuminanceBits */ |
| 1125 | 0, /* IntensityBits */ |
| 1126 | 0, /* IndexBits */ |
| 1127 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1128 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1129 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1130 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1131 | fetch_texel_1d_al88, /* FetchTexel1D */ |
| 1132 | fetch_texel_2d_al88, /* FetchTexel2D */ |
| 1133 | fetch_texel_3d_al88, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1134 | NULL, /* FetchTexel1Df */ |
| 1135 | NULL, /* FetchTexel2Df */ |
| 1136 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1137 | store_texel_al88 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1138 | }; |
| 1139 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1140 | const struct gl_texture_format _mesa_texformat_al88_rev = { |
| 1141 | MESA_FORMAT_AL88_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1142 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 1143 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1144 | 0, /* RedBits */ |
| 1145 | 0, /* GreenBits */ |
| 1146 | 0, /* BlueBits */ |
| 1147 | 8, /* AlphaBits */ |
| 1148 | 8, /* LuminanceBits */ |
| 1149 | 0, /* IntensityBits */ |
| 1150 | 0, /* IndexBits */ |
| 1151 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1152 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1153 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1154 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
| 1155 | fetch_texel_1d_al88_rev, /* FetchTexel1D */ |
| 1156 | fetch_texel_2d_al88_rev, /* FetchTexel2D */ |
| 1157 | fetch_texel_3d_al88_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1158 | NULL, /* FetchTexel1Df */ |
| 1159 | NULL, /* FetchTexel2Df */ |
| 1160 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1161 | store_texel_al88_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1162 | }; |
| 1163 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1164 | const struct gl_texture_format _mesa_texformat_rgb332 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1165 | MESA_FORMAT_RGB332, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1166 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1167 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1168 | 3, /* RedBits */ |
| 1169 | 3, /* GreenBits */ |
| 1170 | 2, /* BlueBits */ |
| 1171 | 0, /* AlphaBits */ |
| 1172 | 0, /* LuminanceBits */ |
| 1173 | 0, /* IntensityBits */ |
| 1174 | 0, /* IndexBits */ |
| 1175 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1176 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1177 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1178 | _mesa_texstore_rgb332, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1179 | fetch_texel_1d_rgb332, /* FetchTexel1D */ |
| 1180 | fetch_texel_2d_rgb332, /* FetchTexel2D */ |
| 1181 | fetch_texel_3d_rgb332, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1182 | NULL, /* FetchTexel1Df */ |
| 1183 | NULL, /* FetchTexel2Df */ |
| 1184 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1185 | store_texel_rgb332 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1186 | }; |
| 1187 | |
| 1188 | const struct gl_texture_format _mesa_texformat_a8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1189 | MESA_FORMAT_A8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1190 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1191 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1192 | 0, /* RedBits */ |
| 1193 | 0, /* GreenBits */ |
| 1194 | 0, /* BlueBits */ |
| 1195 | 8, /* AlphaBits */ |
| 1196 | 0, /* LuminanceBits */ |
| 1197 | 0, /* IntensityBits */ |
| 1198 | 0, /* IndexBits */ |
| 1199 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1200 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1201 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1202 | _mesa_texstore_a8, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1203 | fetch_texel_1d_a8, /* FetchTexel1D */ |
| 1204 | fetch_texel_2d_a8, /* FetchTexel2D */ |
| 1205 | fetch_texel_3d_a8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1206 | NULL, /* FetchTexel1Df */ |
| 1207 | NULL, /* FetchTexel2Df */ |
| 1208 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1209 | store_texel_a8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1210 | }; |
| 1211 | |
| 1212 | const struct gl_texture_format _mesa_texformat_l8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1213 | MESA_FORMAT_L8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1214 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1215 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1216 | 0, /* RedBits */ |
| 1217 | 0, /* GreenBits */ |
| 1218 | 0, /* BlueBits */ |
| 1219 | 0, /* AlphaBits */ |
| 1220 | 8, /* LuminanceBits */ |
| 1221 | 0, /* IntensityBits */ |
| 1222 | 0, /* IndexBits */ |
| 1223 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1224 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1225 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1226 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1227 | fetch_texel_1d_l8, /* FetchTexel1D */ |
| 1228 | fetch_texel_2d_l8, /* FetchTexel2D */ |
| 1229 | fetch_texel_3d_l8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1230 | NULL, /* FetchTexel1Df */ |
| 1231 | NULL, /* FetchTexel2Df */ |
| 1232 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1233 | store_texel_l8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1234 | }; |
| 1235 | |
| 1236 | const struct gl_texture_format _mesa_texformat_i8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1237 | MESA_FORMAT_I8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1238 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1239 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1240 | 0, /* RedBits */ |
| 1241 | 0, /* GreenBits */ |
| 1242 | 0, /* BlueBits */ |
| 1243 | 0, /* AlphaBits */ |
| 1244 | 0, /* LuminanceBits */ |
| 1245 | 8, /* IntensityBits */ |
| 1246 | 0, /* IndexBits */ |
| 1247 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1248 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1249 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1250 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1251 | fetch_texel_1d_i8, /* FetchTexel1D */ |
| 1252 | fetch_texel_2d_i8, /* FetchTexel2D */ |
| 1253 | fetch_texel_3d_i8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1254 | NULL, /* FetchTexel1Df */ |
| 1255 | NULL, /* FetchTexel2Df */ |
| 1256 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1257 | store_texel_i8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1258 | }; |
| 1259 | |
| 1260 | const struct gl_texture_format _mesa_texformat_ci8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1261 | MESA_FORMAT_CI8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1262 | GL_COLOR_INDEX, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1263 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1264 | 0, /* RedBits */ |
| 1265 | 0, /* GreenBits */ |
| 1266 | 0, /* BlueBits */ |
| 1267 | 0, /* AlphaBits */ |
| 1268 | 0, /* LuminanceBits */ |
| 1269 | 0, /* IntensityBits */ |
| 1270 | 8, /* IndexBits */ |
| 1271 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1272 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1273 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1274 | _mesa_texstore_ci8, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1275 | fetch_texel_1d_ci8, /* FetchTexel1D */ |
| 1276 | fetch_texel_2d_ci8, /* FetchTexel2D */ |
| 1277 | fetch_texel_3d_ci8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1278 | NULL, /* FetchTexel1Df */ |
| 1279 | NULL, /* FetchTexel2Df */ |
| 1280 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1281 | store_texel_ci8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1282 | }; |
| 1283 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1284 | const struct gl_texture_format _mesa_texformat_ycbcr = { |
| 1285 | MESA_FORMAT_YCBCR, /* MesaFormat */ |
| 1286 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1287 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1288 | 0, /* RedBits */ |
| 1289 | 0, /* GreenBits */ |
| 1290 | 0, /* BlueBits */ |
| 1291 | 0, /* AlphaBits */ |
| 1292 | 0, /* LuminanceBits */ |
| 1293 | 0, /* IntensityBits */ |
| 1294 | 0, /* IndexBits */ |
| 1295 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1296 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1297 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1298 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1299 | fetch_texel_1d_ycbcr, /* FetchTexel1D */ |
| 1300 | fetch_texel_2d_ycbcr, /* FetchTexel2D */ |
| 1301 | fetch_texel_3d_ycbcr, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1302 | NULL, /* FetchTexel1Df */ |
| 1303 | NULL, /* FetchTexel2Df */ |
| 1304 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1305 | store_texel_ycbcr /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1306 | }; |
| 1307 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1308 | const struct gl_texture_format _mesa_texformat_ycbcr_rev = { |
| 1309 | MESA_FORMAT_YCBCR_REV, /* MesaFormat */ |
| 1310 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1311 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1312 | 0, /* RedBits */ |
| 1313 | 0, /* GreenBits */ |
| 1314 | 0, /* BlueBits */ |
| 1315 | 0, /* AlphaBits */ |
| 1316 | 0, /* LuminanceBits */ |
| 1317 | 0, /* IntensityBits */ |
| 1318 | 0, /* IndexBits */ |
| 1319 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1320 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1321 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1322 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1323 | fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ |
| 1324 | fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ |
| 1325 | fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1326 | NULL, /* FetchTexel1Df */ |
| 1327 | NULL, /* FetchTexel2Df */ |
| 1328 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1329 | store_texel_ycbcr_rev /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1330 | }; |
| 1331 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1332 | const struct gl_texture_format _mesa_texformat_z24_s8 = { |
| 1333 | MESA_FORMAT_Z24_S8, /* MesaFormat */ |
| 1334 | GL_DEPTH_STENCIL_EXT, /* BaseFormat */ |
| 1335 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1336 | 0, /* RedBits */ |
| 1337 | 0, /* GreenBits */ |
| 1338 | 0, /* BlueBits */ |
| 1339 | 0, /* AlphaBits */ |
| 1340 | 0, /* LuminanceBits */ |
| 1341 | 0, /* IntensityBits */ |
| 1342 | 0, /* IndexBits */ |
| 1343 | 24, /* DepthBits */ |
| 1344 | 8, /* StencilBits */ |
| 1345 | 4, /* TexelBytes */ |
Brian Paul | 2794507 | 2005-10-01 16:09:26 +0000 | [diff] [blame] | 1346 | _mesa_texstore_z24_s8, /* StoreTexImageFunc */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1347 | NULL, /* FetchTexel1D */ |
| 1348 | NULL, /* FetchTexel2D */ |
| 1349 | NULL, /* FetchTexel3D */ |
| 1350 | fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ |
| 1351 | fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ |
| 1352 | fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ |
| 1353 | store_texel_z24_s8 /* StoreTexel */ |
| 1354 | }; |
| 1355 | |
Jakob Bornecrantz | dc44bb8 | 2008-09-04 10:35:01 +0800 | [diff] [blame] | 1356 | const struct gl_texture_format _mesa_texformat_s8_z24 = { |
| 1357 | MESA_FORMAT_S8_Z24, /* MesaFormat */ |
| 1358 | GL_DEPTH_STENCIL_EXT, /* BaseFormat */ |
| 1359 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1360 | 0, /* RedBits */ |
| 1361 | 0, /* GreenBits */ |
| 1362 | 0, /* BlueBits */ |
| 1363 | 0, /* AlphaBits */ |
| 1364 | 0, /* LuminanceBits */ |
| 1365 | 0, /* IntensityBits */ |
| 1366 | 0, /* IndexBits */ |
| 1367 | 24, /* DepthBits */ |
| 1368 | 8, /* StencilBits */ |
| 1369 | 4, /* TexelBytes */ |
| 1370 | _mesa_texstore_s8_z24, /* StoreTexImageFunc */ |
| 1371 | NULL, /* FetchTexel1D */ |
| 1372 | NULL, /* FetchTexel2D */ |
| 1373 | NULL, /* FetchTexel3D */ |
| 1374 | fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ |
| 1375 | fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ |
| 1376 | fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ |
| 1377 | store_texel_s8_z24 /* StoreTexel */ |
| 1378 | }; |
| 1379 | |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1380 | const struct gl_texture_format _mesa_texformat_z16 = { |
| 1381 | MESA_FORMAT_Z16, /* MesaFormat */ |
| 1382 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
| 1383 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1384 | 0, /* RedBits */ |
| 1385 | 0, /* GreenBits */ |
| 1386 | 0, /* BlueBits */ |
| 1387 | 0, /* AlphaBits */ |
| 1388 | 0, /* LuminanceBits */ |
| 1389 | 0, /* IntensityBits */ |
| 1390 | 0, /* IndexBits */ |
| 1391 | sizeof(GLushort) * 8, /* DepthBits */ |
| 1392 | 0, /* StencilBits */ |
| 1393 | sizeof(GLushort), /* TexelBytes */ |
| 1394 | _mesa_texstore_z16, /* StoreTexImageFunc */ |
| 1395 | NULL, /* FetchTexel1D */ |
| 1396 | NULL, /* FetchTexel1D */ |
| 1397 | NULL, /* FetchTexel1D */ |
| 1398 | fetch_texel_1d_f_z16, /* FetchTexel1Df */ |
| 1399 | fetch_texel_2d_f_z16, /* FetchTexel2Df */ |
| 1400 | fetch_texel_3d_f_z16, /* FetchTexel3Df */ |
| 1401 | store_texel_z16 /* StoreTexel */ |
| 1402 | }; |
| 1403 | |
| 1404 | const struct gl_texture_format _mesa_texformat_z32 = { |
| 1405 | MESA_FORMAT_Z32, /* MesaFormat */ |
| 1406 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
| 1407 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1408 | 0, /* RedBits */ |
| 1409 | 0, /* GreenBits */ |
| 1410 | 0, /* BlueBits */ |
| 1411 | 0, /* AlphaBits */ |
| 1412 | 0, /* LuminanceBits */ |
| 1413 | 0, /* IntensityBits */ |
| 1414 | 0, /* IndexBits */ |
| 1415 | sizeof(GLuint) * 8, /* DepthBits */ |
| 1416 | 0, /* StencilBits */ |
| 1417 | sizeof(GLuint), /* TexelBytes */ |
| 1418 | _mesa_texstore_z32, /* StoreTexImageFunc */ |
| 1419 | NULL, /* FetchTexel1D */ |
| 1420 | NULL, /* FetchTexel1D */ |
| 1421 | NULL, /* FetchTexel1D */ |
| 1422 | fetch_texel_1d_f_z32, /* FetchTexel1Df */ |
| 1423 | fetch_texel_2d_f_z32, /* FetchTexel2Df */ |
| 1424 | fetch_texel_3d_f_z32, /* FetchTexel3Df */ |
| 1425 | store_texel_z32 /* StoreTexel */ |
| 1426 | }; |
| 1427 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1428 | /*@}*/ |
| 1429 | |
| 1430 | |
| 1431 | /***************************************************************/ |
| 1432 | /** \name Null format (useful for proxy textures) */ |
| 1433 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1434 | |
| 1435 | const struct gl_texture_format _mesa_null_texformat = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1436 | -1, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1437 | 0, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1438 | GL_NONE, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1439 | 0, /* RedBits */ |
| 1440 | 0, /* GreenBits */ |
| 1441 | 0, /* BlueBits */ |
| 1442 | 0, /* AlphaBits */ |
| 1443 | 0, /* LuminanceBits */ |
| 1444 | 0, /* IntensityBits */ |
| 1445 | 0, /* IndexBits */ |
| 1446 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1447 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1448 | 0, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1449 | NULL, /* StoreTexImageFunc */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1450 | fetch_null_texel, /* FetchTexel1D */ |
| 1451 | fetch_null_texel, /* FetchTexel2D */ |
| 1452 | fetch_null_texel, /* FetchTexel3D */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1453 | fetch_null_texelf, /* FetchTexel1Df */ |
| 1454 | fetch_null_texelf, /* FetchTexel2Df */ |
| 1455 | fetch_null_texelf, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1456 | store_null_texel /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1457 | }; |
| 1458 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1459 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1460 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1461 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1462 | /** |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1463 | * Choose an appropriate texture format given the format, type and |
| 1464 | * internalFormat parameters passed to glTexImage(). |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1465 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1466 | * \param ctx the GL context. |
| 1467 | * \param internalFormat user's prefered internal texture format. |
| 1468 | * \param format incoming image pixel format. |
| 1469 | * \param type incoming image data type. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1470 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1471 | * \return a pointer to a gl_texture_format object which describes the |
| 1472 | * choosen texture format, or NULL on failure. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1473 | * |
| 1474 | * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1475 | * will typically override this function with a specialized version. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1476 | */ |
Brian Paul | 7d58f44 | 2001-04-04 21:54:20 +0000 | [diff] [blame] | 1477 | const struct gl_texture_format * |
| 1478 | _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, |
| 1479 | GLenum format, GLenum type ) |
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 | (void) format; |
| 1482 | (void) type; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1483 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1484 | switch (internalFormat) { |
| 1485 | /* RGBA formats */ |
| 1486 | case 4: |
| 1487 | case GL_RGBA: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1488 | case GL_RGB10_A2: |
| 1489 | case GL_RGBA12: |
| 1490 | case GL_RGBA16: |
| 1491 | return &_mesa_texformat_rgba; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1492 | case GL_RGBA8: |
| 1493 | return &_mesa_texformat_rgba8888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1494 | case GL_RGB5_A1: |
| 1495 | return &_mesa_texformat_argb1555; |
| 1496 | case GL_RGBA2: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1497 | return &_mesa_texformat_argb4444_rev; /* just to test another format*/ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1498 | case GL_RGBA4: |
| 1499 | return &_mesa_texformat_argb4444; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1500 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1501 | /* RGB formats */ |
| 1502 | case 3: |
| 1503 | case GL_RGB: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1504 | case GL_RGB10: |
| 1505 | case GL_RGB12: |
| 1506 | case GL_RGB16: |
| 1507 | return &_mesa_texformat_rgb; |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1508 | case GL_RGB8: |
| 1509 | return &_mesa_texformat_rgb888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1510 | case GL_R3_G3_B2: |
| 1511 | return &_mesa_texformat_rgb332; |
| 1512 | case GL_RGB4: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1513 | return &_mesa_texformat_rgb565_rev; /* just to test another format */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1514 | case GL_RGB5: |
| 1515 | return &_mesa_texformat_rgb565; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1516 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1517 | /* Alpha formats */ |
| 1518 | case GL_ALPHA: |
| 1519 | case GL_ALPHA4: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1520 | case GL_ALPHA12: |
| 1521 | case GL_ALPHA16: |
| 1522 | return &_mesa_texformat_alpha; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1523 | case GL_ALPHA8: |
| 1524 | return &_mesa_texformat_a8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1525 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1526 | /* Luminance formats */ |
| 1527 | case 1: |
| 1528 | case GL_LUMINANCE: |
| 1529 | case GL_LUMINANCE4: |
| 1530 | case GL_LUMINANCE12: |
| 1531 | case GL_LUMINANCE16: |
| 1532 | return &_mesa_texformat_luminance; |
| 1533 | case GL_LUMINANCE8: |
| 1534 | return &_mesa_texformat_l8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1535 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1536 | /* Luminance/Alpha formats */ |
| 1537 | case 2: |
| 1538 | case GL_LUMINANCE_ALPHA: |
| 1539 | case GL_LUMINANCE4_ALPHA4: |
| 1540 | case GL_LUMINANCE6_ALPHA2: |
| 1541 | case GL_LUMINANCE12_ALPHA4: |
| 1542 | case GL_LUMINANCE12_ALPHA12: |
| 1543 | case GL_LUMINANCE16_ALPHA16: |
| 1544 | return &_mesa_texformat_luminance_alpha; |
| 1545 | case GL_LUMINANCE8_ALPHA8: |
| 1546 | return &_mesa_texformat_al88; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1547 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1548 | case GL_INTENSITY: |
| 1549 | case GL_INTENSITY4: |
| 1550 | case GL_INTENSITY12: |
| 1551 | case GL_INTENSITY16: |
| 1552 | return &_mesa_texformat_intensity; |
| 1553 | case GL_INTENSITY8: |
| 1554 | return &_mesa_texformat_i8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1555 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1556 | case GL_COLOR_INDEX: |
| 1557 | case GL_COLOR_INDEX1_EXT: |
| 1558 | case GL_COLOR_INDEX2_EXT: |
| 1559 | case GL_COLOR_INDEX4_EXT: |
| 1560 | case GL_COLOR_INDEX12_EXT: |
| 1561 | case GL_COLOR_INDEX16_EXT: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1562 | case GL_COLOR_INDEX8_EXT: |
| 1563 | return &_mesa_texformat_ci8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1564 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1565 | default: |
| 1566 | ; /* fallthrough */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1567 | } |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1568 | |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1569 | if (ctx->Extensions.ARB_depth_texture) { |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1570 | switch (internalFormat) { |
| 1571 | case GL_DEPTH_COMPONENT: |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1572 | case GL_DEPTH_COMPONENT24: |
| 1573 | case GL_DEPTH_COMPONENT32: |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1574 | return &_mesa_texformat_z32; |
Ian Romanick | 4741dbc | 2008-10-01 15:51:56 -0700 | [diff] [blame] | 1575 | case GL_DEPTH_COMPONENT16: |
Brian Paul | a9bcf75 | 2006-04-06 04:23:58 +0000 | [diff] [blame] | 1576 | return &_mesa_texformat_z16; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1577 | default: |
| 1578 | ; /* fallthrough */ |
| 1579 | } |
| 1580 | } |
| 1581 | |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1582 | switch (internalFormat) { |
| 1583 | case GL_COMPRESSED_ALPHA_ARB: |
| 1584 | return &_mesa_texformat_alpha; |
| 1585 | case GL_COMPRESSED_LUMINANCE_ARB: |
| 1586 | return &_mesa_texformat_luminance; |
| 1587 | case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: |
| 1588 | return &_mesa_texformat_luminance_alpha; |
| 1589 | case GL_COMPRESSED_INTENSITY_ARB: |
| 1590 | return &_mesa_texformat_intensity; |
| 1591 | case GL_COMPRESSED_RGB_ARB: |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1592 | #if FEATURE_texture_fxt1 |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1593 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1594 | return &_mesa_texformat_rgb_fxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1595 | #endif |
| 1596 | #if FEATURE_texture_s3tc |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1597 | if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1598 | ctx->Extensions.S3_s3tc) |
| 1599 | return &_mesa_texformat_rgb_dxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1600 | #endif |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1601 | return &_mesa_texformat_rgb; |
| 1602 | case GL_COMPRESSED_RGBA_ARB: |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1603 | #if FEATURE_texture_fxt1 |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1604 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1605 | return &_mesa_texformat_rgba_fxt1; |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1606 | #endif |
| 1607 | #if FEATURE_texture_s3tc |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1608 | if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1609 | ctx->Extensions.S3_s3tc) |
| 1610 | return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1611 | #endif |
Ian Romanick | 33fa5e4 | 2009-01-27 17:36:03 -0800 | [diff] [blame] | 1612 | return &_mesa_texformat_rgba; |
| 1613 | default: |
| 1614 | ; /* fallthrough */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1615 | } |
| 1616 | |
| 1617 | if (ctx->Extensions.MESA_ycbcr_texture) { |
| 1618 | if (internalFormat == GL_YCBCR_MESA) { |
| 1619 | if (type == GL_UNSIGNED_SHORT_8_8_MESA) |
| 1620 | return &_mesa_texformat_ycbcr; |
| 1621 | else |
| 1622 | return &_mesa_texformat_ycbcr_rev; |
| 1623 | } |
| 1624 | } |
| 1625 | |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1626 | #if FEATURE_texture_fxt1 |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1627 | if (ctx->Extensions.TDFX_texture_compression_FXT1) { |
| 1628 | switch (internalFormat) { |
| 1629 | case GL_COMPRESSED_RGB_FXT1_3DFX: |
| 1630 | return &_mesa_texformat_rgb_fxt1; |
| 1631 | case GL_COMPRESSED_RGBA_FXT1_3DFX: |
| 1632 | return &_mesa_texformat_rgba_fxt1; |
| 1633 | default: |
| 1634 | ; /* fallthrough */ |
| 1635 | } |
| 1636 | } |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1637 | #endif |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1638 | |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1639 | #if FEATURE_texture_s3tc |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1640 | if (ctx->Extensions.EXT_texture_compression_s3tc) { |
| 1641 | switch (internalFormat) { |
| 1642 | case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
| 1643 | return &_mesa_texformat_rgb_dxt1; |
| 1644 | case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
| 1645 | return &_mesa_texformat_rgba_dxt1; |
| 1646 | case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
| 1647 | return &_mesa_texformat_rgba_dxt3; |
| 1648 | case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
| 1649 | return &_mesa_texformat_rgba_dxt5; |
| 1650 | default: |
| 1651 | ; /* fallthrough */ |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | if (ctx->Extensions.S3_s3tc) { |
| 1656 | switch (internalFormat) { |
| 1657 | case GL_RGB_S3TC: |
| 1658 | case GL_RGB4_S3TC: |
| 1659 | return &_mesa_texformat_rgb_dxt1; |
| 1660 | case GL_RGBA_S3TC: |
| 1661 | case GL_RGBA4_S3TC: |
| 1662 | return &_mesa_texformat_rgba_dxt3; |
| 1663 | default: |
| 1664 | ; /* fallthrough */ |
| 1665 | } |
| 1666 | } |
Keith Whitwell | 34a61c6 | 2008-09-21 19:29:15 -0700 | [diff] [blame] | 1667 | #endif |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1668 | |
| 1669 | if (ctx->Extensions.ARB_texture_float) { |
| 1670 | switch (internalFormat) { |
| 1671 | case GL_ALPHA16F_ARB: |
| 1672 | return &_mesa_texformat_alpha_float16; |
| 1673 | case GL_ALPHA32F_ARB: |
| 1674 | return &_mesa_texformat_alpha_float32; |
| 1675 | case GL_LUMINANCE16F_ARB: |
| 1676 | return &_mesa_texformat_luminance_float16; |
| 1677 | case GL_LUMINANCE32F_ARB: |
| 1678 | return &_mesa_texformat_luminance_float32; |
| 1679 | case GL_LUMINANCE_ALPHA16F_ARB: |
| 1680 | return &_mesa_texformat_luminance_alpha_float16; |
| 1681 | case GL_LUMINANCE_ALPHA32F_ARB: |
| 1682 | return &_mesa_texformat_luminance_alpha_float32; |
| 1683 | case GL_INTENSITY16F_ARB: |
| 1684 | return &_mesa_texformat_intensity_float16; |
| 1685 | case GL_INTENSITY32F_ARB: |
| 1686 | return &_mesa_texformat_intensity_float32; |
| 1687 | case GL_RGB16F_ARB: |
| 1688 | return &_mesa_texformat_rgb_float16; |
| 1689 | case GL_RGB32F_ARB: |
| 1690 | return &_mesa_texformat_rgb_float32; |
| 1691 | case GL_RGBA16F_ARB: |
| 1692 | return &_mesa_texformat_rgba_float16; |
| 1693 | case GL_RGBA32F_ARB: |
| 1694 | return &_mesa_texformat_rgba_float32; |
| 1695 | default: |
| 1696 | ; /* fallthrough */ |
| 1697 | } |
| 1698 | } |
| 1699 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame] | 1700 | if (ctx->Extensions.EXT_packed_depth_stencil) { |
| 1701 | switch (internalFormat) { |
| 1702 | case GL_DEPTH_STENCIL_EXT: |
| 1703 | case GL_DEPTH24_STENCIL8_EXT: |
| 1704 | return &_mesa_texformat_z24_s8; |
| 1705 | default: |
| 1706 | ; /* fallthrough */ |
| 1707 | } |
| 1708 | } |
| 1709 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 1710 | if (ctx->Extensions.ATI_envmap_bumpmap) { |
| 1711 | switch (internalFormat) { |
| 1712 | case GL_DUDV_ATI: |
| 1713 | case GL_DU8DV8_ATI: |
| 1714 | return &_mesa_texformat_dudv8; |
| 1715 | default: |
| 1716 | ; /* fallthrough */ |
| 1717 | } |
| 1718 | } |
| 1719 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1720 | if (ctx->Extensions.MESA_texture_signed_rgba) { |
| 1721 | switch (internalFormat) { |
| 1722 | case GL_RGBA_SNORM: |
| 1723 | case GL_RGBA8_SNORM: |
| 1724 | return &_mesa_texformat_signed_rgba8888; |
| 1725 | default: |
| 1726 | ; /* fallthrough */ |
| 1727 | } |
| 1728 | } |
| 1729 | |
| 1730 | |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1731 | #if FEATURE_EXT_texture_sRGB |
| 1732 | if (ctx->Extensions.EXT_texture_sRGB) { |
| 1733 | switch (internalFormat) { |
| 1734 | case GL_SRGB_EXT: |
| 1735 | case GL_SRGB8_EXT: |
| 1736 | return &_mesa_texformat_srgb8; |
| 1737 | case GL_SRGB_ALPHA_EXT: |
| 1738 | case GL_SRGB8_ALPHA8_EXT: |
| 1739 | return &_mesa_texformat_srgba8; |
| 1740 | case GL_SLUMINANCE_EXT: |
| 1741 | case GL_SLUMINANCE8_EXT: |
| 1742 | return &_mesa_texformat_sl8; |
| 1743 | case GL_SLUMINANCE_ALPHA_EXT: |
| 1744 | case GL_SLUMINANCE8_ALPHA8_EXT: |
| 1745 | return &_mesa_texformat_sla8; |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1746 | case GL_COMPRESSED_SLUMINANCE_EXT: |
| 1747 | return &_mesa_texformat_sl8; |
| 1748 | case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: |
| 1749 | return &_mesa_texformat_sla8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1750 | case GL_COMPRESSED_SRGB_EXT: |
| 1751 | #if FEATURE_texture_s3tc |
| 1752 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1753 | return &_mesa_texformat_srgb_dxt1; |
| 1754 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1755 | return &_mesa_texformat_srgb8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1756 | case GL_COMPRESSED_SRGB_ALPHA_EXT: |
| 1757 | #if FEATURE_texture_s3tc |
| 1758 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1759 | return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */ |
| 1760 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1761 | return &_mesa_texformat_srgba8; |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1762 | #if FEATURE_texture_s3tc |
| 1763 | case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: |
| 1764 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1765 | return &_mesa_texformat_srgb_dxt1; |
| 1766 | break; |
| 1767 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: |
| 1768 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1769 | return &_mesa_texformat_srgba_dxt1; |
| 1770 | break; |
| 1771 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: |
| 1772 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1773 | return &_mesa_texformat_srgba_dxt3; |
| 1774 | break; |
| 1775 | case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: |
| 1776 | if (ctx->Extensions.EXT_texture_compression_s3tc) |
| 1777 | return &_mesa_texformat_srgba_dxt5; |
| 1778 | break; |
| 1779 | #endif |
Brian Paul | 8d214bc | 2006-08-03 03:20:52 +0000 | [diff] [blame] | 1780 | default: |
| 1781 | ; /* fallthrough */ |
| 1782 | } |
| 1783 | } |
| 1784 | #endif /* FEATURE_EXT_texture_sRGB */ |
| 1785 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1786 | _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); |
| 1787 | return NULL; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1788 | } |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1789 | |
| 1790 | |
| 1791 | |
| 1792 | /** |
| 1793 | * Return datatype and number of components per texel for the |
| 1794 | * given gl_texture_format. |
| 1795 | */ |
| 1796 | void |
| 1797 | _mesa_format_to_type_and_comps(const struct gl_texture_format *format, |
| 1798 | GLenum *datatype, GLuint *comps) |
| 1799 | { |
| 1800 | switch (format->MesaFormat) { |
| 1801 | case MESA_FORMAT_RGBA8888: |
| 1802 | case MESA_FORMAT_RGBA8888_REV: |
| 1803 | case MESA_FORMAT_ARGB8888: |
| 1804 | case MESA_FORMAT_ARGB8888_REV: |
| 1805 | *datatype = CHAN_TYPE; |
| 1806 | *comps = 4; |
| 1807 | return; |
| 1808 | case MESA_FORMAT_RGB888: |
| 1809 | case MESA_FORMAT_BGR888: |
| 1810 | *datatype = GL_UNSIGNED_BYTE; |
| 1811 | *comps = 3; |
| 1812 | return; |
| 1813 | case MESA_FORMAT_RGB565: |
| 1814 | case MESA_FORMAT_RGB565_REV: |
| 1815 | *datatype = GL_UNSIGNED_SHORT_5_6_5; |
| 1816 | *comps = 3; |
| 1817 | return; |
| 1818 | |
| 1819 | case MESA_FORMAT_ARGB4444: |
| 1820 | case MESA_FORMAT_ARGB4444_REV: |
| 1821 | *datatype = GL_UNSIGNED_SHORT_4_4_4_4; |
| 1822 | *comps = 4; |
| 1823 | return; |
| 1824 | |
| 1825 | case MESA_FORMAT_ARGB1555: |
| 1826 | case MESA_FORMAT_ARGB1555_REV: |
| 1827 | *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; |
Xiang, Haihao | 241c0bf | 2009-01-06 15:30:34 +0800 | [diff] [blame] | 1828 | *comps = 4; |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1829 | return; |
| 1830 | |
| 1831 | case MESA_FORMAT_AL88: |
| 1832 | case MESA_FORMAT_AL88_REV: |
| 1833 | *datatype = GL_UNSIGNED_BYTE; |
| 1834 | *comps = 2; |
| 1835 | return; |
| 1836 | case MESA_FORMAT_RGB332: |
| 1837 | *datatype = GL_UNSIGNED_BYTE_3_3_2; |
| 1838 | *comps = 3; |
| 1839 | return; |
| 1840 | |
| 1841 | case MESA_FORMAT_A8: |
| 1842 | case MESA_FORMAT_L8: |
| 1843 | case MESA_FORMAT_I8: |
| 1844 | case MESA_FORMAT_CI8: |
| 1845 | *datatype = GL_UNSIGNED_BYTE; |
| 1846 | *comps = 1; |
| 1847 | return; |
| 1848 | |
| 1849 | case MESA_FORMAT_YCBCR: |
| 1850 | case MESA_FORMAT_YCBCR_REV: |
| 1851 | *datatype = GL_UNSIGNED_SHORT; |
| 1852 | *comps = 2; |
| 1853 | return; |
| 1854 | |
| 1855 | case MESA_FORMAT_Z24_S8: |
| 1856 | *datatype = GL_UNSIGNED_INT; |
| 1857 | *comps = 1; /* XXX OK? */ |
| 1858 | return; |
| 1859 | |
Jakob Bornecrantz | 2e3e518 | 2008-06-09 16:29:57 +0200 | [diff] [blame] | 1860 | case MESA_FORMAT_S8_Z24: |
| 1861 | *datatype = GL_UNSIGNED_INT; |
| 1862 | *comps = 1; /* XXX OK? */ |
| 1863 | return; |
| 1864 | |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1865 | case MESA_FORMAT_Z16: |
| 1866 | *datatype = GL_UNSIGNED_SHORT; |
| 1867 | *comps = 1; |
| 1868 | return; |
| 1869 | |
| 1870 | case MESA_FORMAT_Z32: |
| 1871 | *datatype = GL_UNSIGNED_INT; |
| 1872 | *comps = 1; |
| 1873 | return; |
| 1874 | |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 1875 | case MESA_FORMAT_DUDV8: |
| 1876 | *datatype = GL_BYTE; |
| 1877 | *comps = 2; |
| 1878 | return; |
| 1879 | |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1880 | case MESA_FORMAT_SIGNED_RGBA8888: |
Roland Scheidegger | bb386a1 | 2009-03-27 21:59:33 +0100 | [diff] [blame^] | 1881 | case MESA_FORMAT_SIGNED_RGBA8888_REV: |
Roland Scheidegger | c6a6cc1 | 2009-03-27 19:39:52 +0100 | [diff] [blame] | 1882 | *datatype = GL_BYTE; |
| 1883 | *comps = 4; |
| 1884 | return; |
| 1885 | |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1886 | #if FEATURE_EXT_texture_sRGB |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1887 | case MESA_FORMAT_SRGB8: |
| 1888 | *datatype = GL_UNSIGNED_BYTE; |
| 1889 | *comps = 3; |
| 1890 | return; |
| 1891 | case MESA_FORMAT_SRGBA8: |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1892 | case MESA_FORMAT_SARGB8: |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1893 | *datatype = GL_UNSIGNED_BYTE; |
| 1894 | *comps = 4; |
| 1895 | return; |
| 1896 | case MESA_FORMAT_SL8: |
| 1897 | *datatype = GL_UNSIGNED_BYTE; |
| 1898 | *comps = 1; |
| 1899 | return; |
| 1900 | case MESA_FORMAT_SLA8: |
| 1901 | *datatype = GL_UNSIGNED_BYTE; |
| 1902 | *comps = 2; |
| 1903 | return; |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1904 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1905 | |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1906 | #if FEATURE_texture_fxt1 |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1907 | case MESA_FORMAT_RGB_FXT1: |
| 1908 | case MESA_FORMAT_RGBA_FXT1: |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1909 | #endif |
| 1910 | #if FEATURE_texture_s3tc |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1911 | case MESA_FORMAT_RGB_DXT1: |
| 1912 | case MESA_FORMAT_RGBA_DXT1: |
| 1913 | case MESA_FORMAT_RGBA_DXT3: |
| 1914 | case MESA_FORMAT_RGBA_DXT5: |
Roland Scheidegger | 5bd093b | 2008-12-12 05:06:48 +0100 | [diff] [blame] | 1915 | #if FEATURE_EXT_texture_sRGB |
| 1916 | case MESA_FORMAT_SRGB_DXT1: |
| 1917 | case MESA_FORMAT_SRGBA_DXT1: |
| 1918 | case MESA_FORMAT_SRGBA_DXT3: |
| 1919 | case MESA_FORMAT_SRGBA_DXT5: |
| 1920 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1921 | /* XXX generate error instead? */ |
| 1922 | *datatype = GL_UNSIGNED_BYTE; |
| 1923 | *comps = 0; |
| 1924 | return; |
Brian Paul | e961a5d | 2008-06-12 16:55:28 -0600 | [diff] [blame] | 1925 | #endif |
Brian | 12dc9c9 | 2008-02-08 16:46:12 -0700 | [diff] [blame] | 1926 | |
| 1927 | case MESA_FORMAT_RGBA: |
| 1928 | *datatype = CHAN_TYPE; |
| 1929 | *comps = 4; |
| 1930 | return; |
| 1931 | case MESA_FORMAT_RGB: |
| 1932 | *datatype = CHAN_TYPE; |
| 1933 | *comps = 3; |
| 1934 | return; |
| 1935 | case MESA_FORMAT_LUMINANCE_ALPHA: |
| 1936 | *datatype = CHAN_TYPE; |
| 1937 | *comps = 2; |
| 1938 | return; |
| 1939 | case MESA_FORMAT_ALPHA: |
| 1940 | case MESA_FORMAT_LUMINANCE: |
| 1941 | case MESA_FORMAT_INTENSITY: |
| 1942 | *datatype = CHAN_TYPE; |
| 1943 | *comps = 1; |
| 1944 | return; |
| 1945 | |
| 1946 | case MESA_FORMAT_RGBA_FLOAT32: |
| 1947 | *datatype = GL_FLOAT; |
| 1948 | *comps = 4; |
| 1949 | return; |
| 1950 | case MESA_FORMAT_RGBA_FLOAT16: |
| 1951 | *datatype = GL_HALF_FLOAT_ARB; |
| 1952 | *comps = 4; |
| 1953 | return; |
| 1954 | case MESA_FORMAT_RGB_FLOAT32: |
| 1955 | *datatype = GL_FLOAT; |
| 1956 | *comps = 3; |
| 1957 | return; |
| 1958 | case MESA_FORMAT_RGB_FLOAT16: |
| 1959 | *datatype = GL_HALF_FLOAT_ARB; |
| 1960 | *comps = 3; |
| 1961 | return; |
| 1962 | case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: |
| 1963 | *datatype = GL_FLOAT; |
| 1964 | *comps = 2; |
| 1965 | return; |
| 1966 | case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: |
| 1967 | *datatype = GL_HALF_FLOAT_ARB; |
| 1968 | *comps = 2; |
| 1969 | return; |
| 1970 | case MESA_FORMAT_ALPHA_FLOAT32: |
| 1971 | case MESA_FORMAT_LUMINANCE_FLOAT32: |
| 1972 | case MESA_FORMAT_INTENSITY_FLOAT32: |
| 1973 | *datatype = GL_FLOAT; |
| 1974 | *comps = 1; |
| 1975 | return; |
| 1976 | case MESA_FORMAT_ALPHA_FLOAT16: |
| 1977 | case MESA_FORMAT_LUMINANCE_FLOAT16: |
| 1978 | case MESA_FORMAT_INTENSITY_FLOAT16: |
| 1979 | *datatype = GL_HALF_FLOAT_ARB; |
| 1980 | *comps = 1; |
| 1981 | return; |
| 1982 | |
| 1983 | default: |
| 1984 | _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); |
| 1985 | *datatype = 0; |
| 1986 | *comps = 1; |
| 1987 | } |
| 1988 | } |