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