Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 4618a9b | 2005-09-08 15:28:45 +0000 | [diff] [blame] | 3 | * Version: 6.5 |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 4 | * |
Brian Paul | 4618a9b | 2005-09-08 15:28:45 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2005 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 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 40 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 41 | /* Texel fetch routines for all supported formats |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 42 | */ |
| 43 | #define DIM 1 |
| 44 | #include "texformat_tmp.h" |
| 45 | |
| 46 | #define DIM 2 |
| 47 | #include "texformat_tmp.h" |
| 48 | |
| 49 | #define DIM 3 |
| 50 | #include "texformat_tmp.h" |
| 51 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 52 | /** |
| 53 | * Null texel fetch function. |
| 54 | * |
| 55 | * Have to have this so the FetchTexel function pointer is never NULL. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 56 | */ |
| 57 | static void fetch_null_texel( const struct gl_texture_image *texImage, |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 58 | GLint i, GLint j, GLint k, GLchan *texel ) |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 59 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 60 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 61 | texel[RCOMP] = 0; |
| 62 | texel[GCOMP] = 0; |
| 63 | texel[BCOMP] = 0; |
| 64 | texel[ACOMP] = 0; |
| 65 | _mesa_warning(NULL, "fetch_null_texel() called!"); |
| 66 | } |
| 67 | |
| 68 | static void fetch_null_texelf( const struct gl_texture_image *texImage, |
| 69 | GLint i, GLint j, GLint k, GLfloat *texel ) |
| 70 | { |
Brian Paul | a6c423d | 2004-08-25 15:59:48 +0000 | [diff] [blame] | 71 | (void) texImage; (void) i; (void) j; (void) k; |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 72 | texel[RCOMP] = 0.0; |
| 73 | texel[GCOMP] = 0.0; |
| 74 | texel[BCOMP] = 0.0; |
| 75 | texel[ACOMP] = 0.0; |
| 76 | _mesa_warning(NULL, "fetch_null_texelf() called!"); |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 79 | static void store_null_texel(struct gl_texture_image *texImage, |
| 80 | GLint i, GLint j, GLint k, const void *texel) |
| 81 | { |
| 82 | /* no-op */ |
| 83 | } |
| 84 | |
| 85 | |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 86 | /** |
| 87 | * Notes about the predefined gl_texture_formats: |
| 88 | * |
| 89 | * 1. There are 1D, 2D and 3D functions for fetching texels from texture |
| 90 | * images, returning both GLchan values and GLfloat values. (six |
| 91 | * functions in total) |
| 92 | * You don't have to provide both the GLchan and GLfloat functions; |
| 93 | * just one or the other is OK. Mesa will use an "adaptor" to convert |
| 94 | * between GLchan/GLfloat when needed. |
| 95 | * Since the adaptors have small performance penalty, we provide both |
| 96 | * GLchan and GLfloat functions for some common formats like RGB, RGBA. |
| 97 | */ |
| 98 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 99 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 100 | /***************************************************************/ |
| 101 | /** \name Default GLchan-based formats */ |
| 102 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 103 | |
| 104 | const struct gl_texture_format _mesa_texformat_rgba = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 105 | MESA_FORMAT_RGBA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 106 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 107 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 108 | CHAN_BITS, /* RedBits */ |
| 109 | CHAN_BITS, /* GreenBits */ |
| 110 | CHAN_BITS, /* BlueBits */ |
| 111 | CHAN_BITS, /* AlphaBits */ |
| 112 | 0, /* LuminanceBits */ |
| 113 | 0, /* IntensityBits */ |
| 114 | 0, /* IndexBits */ |
| 115 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 116 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 117 | 4 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 118 | _mesa_texstore_rgba, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 119 | fetch_texel_1d_rgba, /* FetchTexel1D */ |
| 120 | fetch_texel_2d_rgba, /* FetchTexel2D */ |
| 121 | fetch_texel_3d_rgba, /* FetchTexel3D */ |
| 122 | fetch_texel_1d_f_rgba, /* FetchTexel1Df */ |
| 123 | fetch_texel_2d_f_rgba, /* FetchTexel2Df */ |
| 124 | fetch_texel_3d_f_rgba, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 125 | store_texel_rgba /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | const struct gl_texture_format _mesa_texformat_rgb = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 129 | MESA_FORMAT_RGB, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 130 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 131 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 132 | CHAN_BITS, /* RedBits */ |
| 133 | CHAN_BITS, /* GreenBits */ |
| 134 | CHAN_BITS, /* BlueBits */ |
| 135 | 0, /* AlphaBits */ |
| 136 | 0, /* LuminanceBits */ |
| 137 | 0, /* IntensityBits */ |
| 138 | 0, /* IndexBits */ |
| 139 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 140 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 141 | 3 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 142 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 143 | fetch_texel_1d_rgb, /* FetchTexel1D */ |
| 144 | fetch_texel_2d_rgb, /* FetchTexel2D */ |
| 145 | fetch_texel_3d_rgb, /* FetchTexel3D */ |
| 146 | fetch_texel_1d_f_rgb, /* FetchTexel1Df */ |
| 147 | fetch_texel_2d_f_rgb, /* FetchTexel2Df */ |
| 148 | fetch_texel_3d_f_rgb, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 149 | store_texel_rgb /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | const struct gl_texture_format _mesa_texformat_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 153 | MESA_FORMAT_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 154 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 155 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 156 | 0, /* RedBits */ |
| 157 | 0, /* GreenBits */ |
| 158 | 0, /* BlueBits */ |
| 159 | CHAN_BITS, /* AlphaBits */ |
| 160 | 0, /* LuminanceBits */ |
| 161 | 0, /* IntensityBits */ |
| 162 | 0, /* IndexBits */ |
| 163 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 164 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 165 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 166 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 167 | fetch_texel_1d_alpha, /* FetchTexel1D */ |
| 168 | fetch_texel_2d_alpha, /* FetchTexel2D */ |
| 169 | fetch_texel_3d_alpha, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 170 | NULL, /* FetchTexel1Df */ |
| 171 | NULL, /* FetchTexel2Df */ |
| 172 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 173 | store_texel_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | const struct gl_texture_format _mesa_texformat_luminance = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 177 | MESA_FORMAT_LUMINANCE, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 178 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 179 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 180 | 0, /* RedBits */ |
| 181 | 0, /* GreenBits */ |
| 182 | 0, /* BlueBits */ |
| 183 | 0, /* AlphaBits */ |
| 184 | CHAN_BITS, /* LuminanceBits */ |
| 185 | 0, /* IntensityBits */ |
| 186 | 0, /* IndexBits */ |
| 187 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 188 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 189 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 190 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 191 | fetch_texel_1d_luminance, /* FetchTexel1D */ |
| 192 | fetch_texel_2d_luminance, /* FetchTexel2D */ |
| 193 | fetch_texel_3d_luminance, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 194 | NULL, /* FetchTexel1Df */ |
| 195 | NULL, /* FetchTexel2Df */ |
| 196 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 197 | store_texel_luminance /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 198 | }; |
| 199 | |
| 200 | const struct gl_texture_format _mesa_texformat_luminance_alpha = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 201 | MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 202 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 203 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 204 | 0, /* RedBits */ |
| 205 | 0, /* GreenBits */ |
| 206 | 0, /* BlueBits */ |
| 207 | CHAN_BITS, /* AlphaBits */ |
| 208 | CHAN_BITS, /* LuminanceBits */ |
| 209 | 0, /* IntensityBits */ |
| 210 | 0, /* IndexBits */ |
| 211 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 212 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 213 | 2 * sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 214 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 215 | fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ |
| 216 | fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ |
| 217 | fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 218 | NULL, /* FetchTexel1Df */ |
| 219 | NULL, /* FetchTexel2Df */ |
| 220 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 221 | store_texel_luminance_alpha /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 222 | }; |
| 223 | |
| 224 | const struct gl_texture_format _mesa_texformat_intensity = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 225 | MESA_FORMAT_INTENSITY, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 226 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 227 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 228 | 0, /* RedBits */ |
| 229 | 0, /* GreenBits */ |
| 230 | 0, /* BlueBits */ |
| 231 | 0, /* AlphaBits */ |
| 232 | 0, /* LuminanceBits */ |
| 233 | CHAN_BITS, /* IntensityBits */ |
| 234 | 0, /* IndexBits */ |
| 235 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 236 | 0, /* StencilBits */ |
Brian Paul | 6e16715 | 2004-04-22 23:51:15 +0000 | [diff] [blame] | 237 | sizeof(GLchan), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 238 | _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 239 | fetch_texel_1d_intensity, /* FetchTexel1D */ |
| 240 | fetch_texel_2d_intensity, /* FetchTexel2D */ |
| 241 | fetch_texel_3d_intensity, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 242 | NULL, /* FetchTexel1Df */ |
| 243 | NULL, /* FetchTexel2Df */ |
| 244 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 245 | store_texel_intensity /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 246 | }; |
| 247 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 248 | const struct gl_texture_format _mesa_texformat_depth_component_float32 = { |
| 249 | MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 250 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 251 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 252 | 0, /* RedBits */ |
| 253 | 0, /* GreenBits */ |
| 254 | 0, /* BlueBits */ |
| 255 | 0, /* AlphaBits */ |
| 256 | 0, /* LuminanceBits */ |
| 257 | 0, /* IntensityBits */ |
| 258 | 0, /* IndexBits */ |
| 259 | sizeof(GLfloat) * 8, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 260 | sizeof(GLfloat) * 8, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 261 | sizeof(GLfloat), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 262 | _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 263 | NULL, /* FetchTexel1D */ |
| 264 | NULL, /* FetchTexel1D */ |
| 265 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 266 | fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */ |
| 267 | fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */ |
| 268 | fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 269 | store_texel_depth_component_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 270 | }; |
| 271 | |
| 272 | const struct gl_texture_format _mesa_texformat_depth_component16 = { |
| 273 | MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */ |
| 274 | GL_DEPTH_COMPONENT, /* BaseFormat */ |
| 275 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 276 | 0, /* RedBits */ |
| 277 | 0, /* GreenBits */ |
| 278 | 0, /* BlueBits */ |
| 279 | 0, /* AlphaBits */ |
| 280 | 0, /* LuminanceBits */ |
| 281 | 0, /* IntensityBits */ |
| 282 | 0, /* IndexBits */ |
| 283 | sizeof(GLushort) * 8, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 284 | sizeof(GLushort) * 8, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 285 | sizeof(GLushort), /* TexelBytes */ |
| 286 | _mesa_texstore_depth_component16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 287 | NULL, /* FetchTexel1D */ |
| 288 | NULL, /* FetchTexel1D */ |
| 289 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 290 | fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */ |
| 291 | fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */ |
| 292 | fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 293 | store_texel_depth_component16 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 294 | }; |
| 295 | |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 296 | const struct gl_texture_format _mesa_texformat_rgba_float32 = { |
| 297 | MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ |
| 298 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 299 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 300 | 8 * sizeof(GLfloat), /* RedBits */ |
| 301 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 302 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 303 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 304 | 0, /* LuminanceBits */ |
| 305 | 0, /* IntensityBits */ |
| 306 | 0, /* IndexBits */ |
| 307 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 308 | 0, /* StencilBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 309 | 4 * sizeof(GLfloat), /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 310 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 311 | NULL, /* FetchTexel1D */ |
| 312 | NULL, /* FetchTexel1D */ |
| 313 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 314 | fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ |
| 315 | fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ |
| 316 | fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 317 | store_texel_rgba_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 318 | }; |
| 319 | |
| 320 | const struct gl_texture_format _mesa_texformat_rgba_float16 = { |
| 321 | MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ |
| 322 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 323 | GL_FLOAT, /* DataType */ |
| 324 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 325 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 326 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
| 327 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 328 | 0, /* LuminanceBits */ |
| 329 | 0, /* IntensityBits */ |
| 330 | 0, /* IndexBits */ |
| 331 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 332 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 333 | 4 * sizeof(GLhalfARB), /* TexelBytes */ |
| 334 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 335 | NULL, /* FetchTexel1D */ |
| 336 | NULL, /* FetchTexel1D */ |
| 337 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 338 | fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ |
| 339 | fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ |
| 340 | fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 341 | store_texel_rgba_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 342 | }; |
| 343 | |
| 344 | const struct gl_texture_format _mesa_texformat_rgb_float32 = { |
| 345 | MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ |
| 346 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 347 | GL_FLOAT, /* DataType */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 348 | 8 * sizeof(GLfloat), /* RedBits */ |
| 349 | 8 * sizeof(GLfloat), /* GreenBits */ |
| 350 | 8 * sizeof(GLfloat), /* BlueBits */ |
| 351 | 0, /* AlphaBits */ |
| 352 | 0, /* LuminanceBits */ |
| 353 | 0, /* IntensityBits */ |
| 354 | 0, /* IndexBits */ |
| 355 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 356 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 357 | 3 * sizeof(GLfloat), /* TexelBytes */ |
| 358 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 359 | NULL, /* FetchTexel1D */ |
| 360 | NULL, /* FetchTexel1D */ |
| 361 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 362 | fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ |
| 363 | fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ |
| 364 | fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 365 | store_texel_rgb_f32 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | const struct gl_texture_format _mesa_texformat_rgb_float16 = { |
| 369 | MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ |
| 370 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 371 | GL_FLOAT, /* DataType */ |
| 372 | 8 * sizeof(GLhalfARB), /* RedBits */ |
| 373 | 8 * sizeof(GLhalfARB), /* GreenBits */ |
| 374 | 8 * sizeof(GLhalfARB), /* BlueBits */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 375 | 0, /* AlphaBits */ |
| 376 | 0, /* LuminanceBits */ |
| 377 | 0, /* IntensityBits */ |
| 378 | 0, /* IndexBits */ |
| 379 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 380 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 381 | 3 * sizeof(GLhalfARB), /* TexelBytes */ |
| 382 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 383 | NULL, /* FetchTexel1D */ |
| 384 | NULL, /* FetchTexel1D */ |
| 385 | NULL, /* FetchTexel1D */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 386 | fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ |
| 387 | fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 388 | fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ |
| 389 | store_texel_rgb_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 390 | }; |
| 391 | |
| 392 | const struct gl_texture_format _mesa_texformat_alpha_float32 = { |
| 393 | MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ |
| 394 | GL_ALPHA, /* BaseFormat */ |
| 395 | GL_FLOAT, /* DataType */ |
| 396 | 0, /* RedBits */ |
| 397 | 0, /* GreenBits */ |
| 398 | 0, /* BlueBits */ |
| 399 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 400 | 0, /* LuminanceBits */ |
| 401 | 0, /* IntensityBits */ |
| 402 | 0, /* IndexBits */ |
| 403 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 404 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 405 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 406 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 407 | NULL, /* FetchTexel1D */ |
| 408 | NULL, /* FetchTexel1D */ |
| 409 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 410 | fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ |
| 411 | fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 412 | fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ |
| 413 | store_texel_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | const struct gl_texture_format _mesa_texformat_alpha_float16 = { |
| 417 | MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ |
| 418 | GL_ALPHA, /* BaseFormat */ |
| 419 | GL_FLOAT, /* DataType */ |
| 420 | 0, /* RedBits */ |
| 421 | 0, /* GreenBits */ |
| 422 | 0, /* BlueBits */ |
| 423 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 424 | 0, /* LuminanceBits */ |
| 425 | 0, /* IntensityBits */ |
| 426 | 0, /* IndexBits */ |
| 427 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 428 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 429 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 430 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 431 | NULL, /* FetchTexel1D */ |
| 432 | NULL, /* FetchTexel1D */ |
| 433 | NULL, /* FetchTexel1D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 434 | fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ |
| 435 | fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 436 | fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ |
| 437 | store_texel_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 438 | }; |
| 439 | |
| 440 | const struct gl_texture_format _mesa_texformat_luminance_float32 = { |
| 441 | MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ |
| 442 | GL_LUMINANCE, /* BaseFormat */ |
| 443 | GL_FLOAT, /* DataType */ |
| 444 | 0, /* RedBits */ |
| 445 | 0, /* GreenBits */ |
| 446 | 0, /* BlueBits */ |
| 447 | 0, /* AlphaBits */ |
| 448 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 449 | 0, /* IntensityBits */ |
| 450 | 0, /* IndexBits */ |
| 451 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 452 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 453 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 454 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 455 | NULL, /* FetchTexel1D */ |
| 456 | NULL, /* FetchTexel2D */ |
| 457 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 458 | fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ |
| 459 | fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 460 | fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ |
| 461 | store_texel_luminance_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 462 | }; |
| 463 | |
| 464 | const struct gl_texture_format _mesa_texformat_luminance_float16 = { |
| 465 | MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ |
| 466 | GL_LUMINANCE, /* BaseFormat */ |
| 467 | GL_FLOAT, /* DataType */ |
| 468 | 0, /* RedBits */ |
| 469 | 0, /* GreenBits */ |
| 470 | 0, /* BlueBits */ |
| 471 | 0, /* AlphaBits */ |
| 472 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 473 | 0, /* IntensityBits */ |
| 474 | 0, /* IndexBits */ |
| 475 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 476 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 477 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 478 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 479 | NULL, /* FetchTexel1D */ |
| 480 | NULL, /* FetchTexel2D */ |
| 481 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 482 | fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ |
| 483 | fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 484 | fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ |
| 485 | store_texel_luminance_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 486 | }; |
| 487 | |
| 488 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { |
| 489 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ |
| 490 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 491 | GL_FLOAT, /* DataType */ |
| 492 | 0, /* RedBits */ |
| 493 | 0, /* GreenBits */ |
| 494 | 0, /* BlueBits */ |
| 495 | 8 * sizeof(GLfloat), /* AlphaBits */ |
| 496 | 8 * sizeof(GLfloat), /* LuminanceBits */ |
| 497 | 0, /* IntensityBits */ |
| 498 | 0, /* IndexBits */ |
| 499 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 500 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 501 | 2 * sizeof(GLfloat), /* TexelBytes */ |
| 502 | _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 503 | NULL, /* FetchTexel1D */ |
| 504 | NULL, /* FetchTexel2D */ |
| 505 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 506 | fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ |
| 507 | fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 508 | fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ |
| 509 | store_texel_luminance_alpha_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { |
| 513 | MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ |
| 514 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 515 | GL_FLOAT, /* DataType */ |
| 516 | 0, /* RedBits */ |
| 517 | 0, /* GreenBits */ |
| 518 | 0, /* BlueBits */ |
| 519 | 8 * sizeof(GLhalfARB), /* AlphaBits */ |
| 520 | 8 * sizeof(GLhalfARB), /* LuminanceBits */ |
| 521 | 0, /* IntensityBits */ |
| 522 | 0, /* IndexBits */ |
| 523 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 524 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 525 | 2 * sizeof(GLhalfARB), /* TexelBytes */ |
| 526 | _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 527 | NULL, /* FetchTexel1D */ |
| 528 | NULL, /* FetchTexel2D */ |
| 529 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 530 | fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ |
| 531 | fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 532 | fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ |
| 533 | store_texel_luminance_alpha_f16 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 534 | }; |
| 535 | |
| 536 | const struct gl_texture_format _mesa_texformat_intensity_float32 = { |
| 537 | MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ |
| 538 | GL_INTENSITY, /* BaseFormat */ |
| 539 | GL_FLOAT, /* DataType */ |
| 540 | 0, /* RedBits */ |
| 541 | 0, /* GreenBits */ |
| 542 | 0, /* BlueBits */ |
| 543 | 0, /* AlphaBits */ |
| 544 | 0, /* LuminanceBits */ |
| 545 | 8 * sizeof(GLfloat), /* IntensityBits */ |
| 546 | 0, /* IndexBits */ |
| 547 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 548 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 549 | 1 * sizeof(GLfloat), /* TexelBytes */ |
| 550 | _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 551 | NULL, /* FetchTexel1D */ |
| 552 | NULL, /* FetchTexel2D */ |
| 553 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 554 | fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ |
| 555 | fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 556 | fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ |
| 557 | store_texel_intensity_f32 /* StoreTexel */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 558 | }; |
| 559 | |
| 560 | const struct gl_texture_format _mesa_texformat_intensity_float16 = { |
| 561 | MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ |
| 562 | GL_INTENSITY, /* BaseFormat */ |
| 563 | GL_FLOAT, /* DataType */ |
| 564 | 0, /* RedBits */ |
| 565 | 0, /* GreenBits */ |
| 566 | 0, /* BlueBits */ |
| 567 | 0, /* AlphaBits */ |
| 568 | 0, /* LuminanceBits */ |
| 569 | 8 * sizeof(GLhalfARB), /* IntensityBits */ |
| 570 | 0, /* IndexBits */ |
| 571 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 572 | 0, /* StencilBits */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 573 | 1 * sizeof(GLhalfARB), /* TexelBytes */ |
| 574 | _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 575 | NULL, /* FetchTexel1D */ |
| 576 | NULL, /* FetchTexel2D */ |
| 577 | NULL, /* FetchTexel3D */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 578 | fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ |
| 579 | fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 580 | fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ |
| 581 | store_texel_intensity_f16 /* StoreTexel */ |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 582 | }; |
| 583 | |
| 584 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 585 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 586 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 587 | |
| 588 | /***************************************************************/ |
| 589 | /** \name Hardware formats */ |
| 590 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 591 | |
| 592 | const struct gl_texture_format _mesa_texformat_rgba8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 593 | MESA_FORMAT_RGBA8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 594 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 595 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 596 | 8, /* RedBits */ |
| 597 | 8, /* GreenBits */ |
| 598 | 8, /* BlueBits */ |
| 599 | 8, /* AlphaBits */ |
| 600 | 0, /* LuminanceBits */ |
| 601 | 0, /* IntensityBits */ |
| 602 | 0, /* IndexBits */ |
| 603 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 604 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 605 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 606 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 607 | fetch_texel_1d_rgba8888, /* FetchTexel1D */ |
| 608 | fetch_texel_2d_rgba8888, /* FetchTexel2D */ |
| 609 | fetch_texel_3d_rgba8888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 610 | NULL, /* FetchTexel1Df */ |
| 611 | NULL, /* FetchTexel2Df */ |
| 612 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 613 | store_texel_rgba8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 614 | }; |
| 615 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 616 | const struct gl_texture_format _mesa_texformat_rgba8888_rev = { |
| 617 | MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 618 | GL_RGBA, /* BaseFormat */ |
| 619 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 620 | 8, /* RedBits */ |
| 621 | 8, /* GreenBits */ |
| 622 | 8, /* BlueBits */ |
| 623 | 8, /* AlphaBits */ |
| 624 | 0, /* LuminanceBits */ |
| 625 | 0, /* IntensityBits */ |
| 626 | 0, /* IndexBits */ |
| 627 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 628 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 629 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 630 | _mesa_texstore_rgba8888, /* StoreTexImageFunc */ |
| 631 | fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ |
| 632 | fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ |
| 633 | fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 634 | NULL, /* FetchTexel1Df */ |
| 635 | NULL, /* FetchTexel2Df */ |
| 636 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 637 | store_texel_rgba8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 638 | }; |
| 639 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 640 | const struct gl_texture_format _mesa_texformat_argb8888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 641 | MESA_FORMAT_ARGB8888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 642 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 643 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 644 | 8, /* RedBits */ |
| 645 | 8, /* GreenBits */ |
| 646 | 8, /* BlueBits */ |
| 647 | 8, /* AlphaBits */ |
| 648 | 0, /* LuminanceBits */ |
| 649 | 0, /* IntensityBits */ |
| 650 | 0, /* IndexBits */ |
| 651 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 652 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 653 | 4, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 654 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 655 | fetch_texel_1d_argb8888, /* FetchTexel1D */ |
| 656 | fetch_texel_2d_argb8888, /* FetchTexel2D */ |
| 657 | fetch_texel_3d_argb8888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 658 | NULL, /* FetchTexel1Df */ |
| 659 | NULL, /* FetchTexel2Df */ |
| 660 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 661 | store_texel_argb8888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 662 | }; |
| 663 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 664 | const struct gl_texture_format _mesa_texformat_argb8888_rev = { |
| 665 | MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 666 | GL_RGBA, /* BaseFormat */ |
| 667 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 668 | 8, /* RedBits */ |
| 669 | 8, /* GreenBits */ |
| 670 | 8, /* BlueBits */ |
| 671 | 8, /* AlphaBits */ |
| 672 | 0, /* LuminanceBits */ |
| 673 | 0, /* IntensityBits */ |
| 674 | 0, /* IndexBits */ |
| 675 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 676 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 677 | 4, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 678 | _mesa_texstore_argb8888, /* StoreTexImageFunc */ |
| 679 | fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ |
| 680 | fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ |
| 681 | fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 682 | NULL, /* FetchTexel1Df */ |
| 683 | NULL, /* FetchTexel2Df */ |
| 684 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 685 | store_texel_argb8888_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 686 | }; |
| 687 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 688 | const struct gl_texture_format _mesa_texformat_rgb888 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 689 | MESA_FORMAT_RGB888, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 690 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 691 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 692 | 8, /* RedBits */ |
| 693 | 8, /* GreenBits */ |
| 694 | 8, /* BlueBits */ |
| 695 | 0, /* AlphaBits */ |
| 696 | 0, /* LuminanceBits */ |
| 697 | 0, /* IntensityBits */ |
| 698 | 0, /* IndexBits */ |
| 699 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 700 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 701 | 3, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 702 | _mesa_texstore_rgb888, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 703 | fetch_texel_1d_rgb888, /* FetchTexel1D */ |
| 704 | fetch_texel_2d_rgb888, /* FetchTexel2D */ |
| 705 | fetch_texel_3d_rgb888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 706 | NULL, /* FetchTexel1Df */ |
| 707 | NULL, /* FetchTexel2Df */ |
| 708 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 709 | store_texel_rgb888 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 710 | }; |
| 711 | |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 712 | const struct gl_texture_format _mesa_texformat_bgr888 = { |
| 713 | MESA_FORMAT_BGR888, /* MesaFormat */ |
| 714 | GL_RGB, /* BaseFormat */ |
| 715 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 716 | 8, /* RedBits */ |
| 717 | 8, /* GreenBits */ |
| 718 | 8, /* BlueBits */ |
| 719 | 0, /* AlphaBits */ |
| 720 | 0, /* LuminanceBits */ |
| 721 | 0, /* IntensityBits */ |
| 722 | 0, /* IndexBits */ |
| 723 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 724 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 725 | 3, /* TexelBytes */ |
| 726 | _mesa_texstore_bgr888, /* StoreTexImageFunc */ |
| 727 | fetch_texel_1d_bgr888, /* FetchTexel1D */ |
| 728 | fetch_texel_2d_bgr888, /* FetchTexel2D */ |
| 729 | fetch_texel_3d_bgr888, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 730 | NULL, /* FetchTexel1Df */ |
| 731 | NULL, /* FetchTexel2Df */ |
| 732 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 733 | store_texel_bgr888 /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 734 | }; |
| 735 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 736 | const struct gl_texture_format _mesa_texformat_rgb565 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 737 | MESA_FORMAT_RGB565, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 738 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 739 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 740 | 5, /* RedBits */ |
| 741 | 6, /* GreenBits */ |
| 742 | 5, /* BlueBits */ |
| 743 | 0, /* AlphaBits */ |
| 744 | 0, /* LuminanceBits */ |
| 745 | 0, /* IntensityBits */ |
| 746 | 0, /* IndexBits */ |
| 747 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 748 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 749 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 750 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 751 | fetch_texel_1d_rgb565, /* FetchTexel1D */ |
| 752 | fetch_texel_2d_rgb565, /* FetchTexel2D */ |
| 753 | fetch_texel_3d_rgb565, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 754 | NULL, /* FetchTexel1Df */ |
| 755 | NULL, /* FetchTexel2Df */ |
| 756 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 757 | store_texel_rgb565 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 758 | }; |
| 759 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 760 | const struct gl_texture_format _mesa_texformat_rgb565_rev = { |
| 761 | MESA_FORMAT_RGB565_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 762 | GL_RGB, /* BaseFormat */ |
| 763 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 764 | 5, /* RedBits */ |
| 765 | 6, /* GreenBits */ |
| 766 | 5, /* BlueBits */ |
| 767 | 0, /* AlphaBits */ |
| 768 | 0, /* LuminanceBits */ |
| 769 | 0, /* IntensityBits */ |
| 770 | 0, /* IndexBits */ |
| 771 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 772 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 773 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 774 | _mesa_texstore_rgb565, /* StoreTexImageFunc */ |
| 775 | fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ |
| 776 | fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ |
| 777 | fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 778 | NULL, /* FetchTexel1Df */ |
| 779 | NULL, /* FetchTexel2Df */ |
| 780 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 781 | store_texel_rgb565_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 782 | }; |
| 783 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 784 | const struct gl_texture_format _mesa_texformat_argb4444 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 785 | MESA_FORMAT_ARGB4444, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 786 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 787 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 788 | 4, /* RedBits */ |
| 789 | 4, /* GreenBits */ |
| 790 | 4, /* BlueBits */ |
| 791 | 4, /* AlphaBits */ |
| 792 | 0, /* LuminanceBits */ |
| 793 | 0, /* IntensityBits */ |
| 794 | 0, /* IndexBits */ |
| 795 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 796 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 797 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 798 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 799 | fetch_texel_1d_argb4444, /* FetchTexel1D */ |
| 800 | fetch_texel_2d_argb4444, /* FetchTexel2D */ |
| 801 | fetch_texel_3d_argb4444, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 802 | NULL, /* FetchTexel1Df */ |
| 803 | NULL, /* FetchTexel2Df */ |
| 804 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 805 | store_texel_argb4444 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 806 | }; |
| 807 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 808 | const struct gl_texture_format _mesa_texformat_argb4444_rev = { |
| 809 | MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 810 | GL_RGBA, /* BaseFormat */ |
| 811 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 812 | 4, /* RedBits */ |
| 813 | 4, /* GreenBits */ |
| 814 | 4, /* BlueBits */ |
| 815 | 4, /* AlphaBits */ |
| 816 | 0, /* LuminanceBits */ |
| 817 | 0, /* IntensityBits */ |
| 818 | 0, /* IndexBits */ |
| 819 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 820 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 821 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 822 | _mesa_texstore_argb4444, /* StoreTexImageFunc */ |
| 823 | fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ |
| 824 | fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ |
| 825 | fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 826 | NULL, /* FetchTexel1Df */ |
| 827 | NULL, /* FetchTexel2Df */ |
| 828 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 829 | store_texel_argb4444_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 830 | }; |
| 831 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 832 | const struct gl_texture_format _mesa_texformat_argb1555 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 833 | MESA_FORMAT_ARGB1555, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 834 | GL_RGBA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 835 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 836 | 5, /* RedBits */ |
| 837 | 5, /* GreenBits */ |
| 838 | 5, /* BlueBits */ |
| 839 | 1, /* AlphaBits */ |
| 840 | 0, /* LuminanceBits */ |
| 841 | 0, /* IntensityBits */ |
| 842 | 0, /* IndexBits */ |
| 843 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 844 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 845 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 846 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 847 | fetch_texel_1d_argb1555, /* FetchTexel1D */ |
| 848 | fetch_texel_2d_argb1555, /* FetchTexel2D */ |
| 849 | fetch_texel_3d_argb1555, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 850 | NULL, /* FetchTexel1Df */ |
| 851 | NULL, /* FetchTexel2Df */ |
| 852 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 853 | store_texel_argb1555 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 854 | }; |
| 855 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 856 | const struct gl_texture_format _mesa_texformat_argb1555_rev = { |
| 857 | MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 858 | GL_RGBA, /* BaseFormat */ |
| 859 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 860 | 5, /* RedBits */ |
| 861 | 5, /* GreenBits */ |
| 862 | 5, /* BlueBits */ |
| 863 | 1, /* AlphaBits */ |
| 864 | 0, /* LuminanceBits */ |
| 865 | 0, /* IntensityBits */ |
| 866 | 0, /* IndexBits */ |
| 867 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 868 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 869 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 870 | _mesa_texstore_argb1555, /* StoreTexImageFunc */ |
| 871 | fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ |
| 872 | fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ |
| 873 | fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 874 | NULL, /* FetchTexel1Df */ |
| 875 | NULL, /* FetchTexel2Df */ |
| 876 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 877 | store_texel_argb1555_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 878 | }; |
| 879 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 880 | const struct gl_texture_format _mesa_texformat_al88 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 881 | MESA_FORMAT_AL88, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 882 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 883 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 884 | 0, /* RedBits */ |
| 885 | 0, /* GreenBits */ |
| 886 | 0, /* BlueBits */ |
| 887 | 8, /* AlphaBits */ |
| 888 | 8, /* LuminanceBits */ |
| 889 | 0, /* IntensityBits */ |
| 890 | 0, /* IndexBits */ |
| 891 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 892 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 893 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 894 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 895 | fetch_texel_1d_al88, /* FetchTexel1D */ |
| 896 | fetch_texel_2d_al88, /* FetchTexel2D */ |
| 897 | fetch_texel_3d_al88, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 898 | NULL, /* FetchTexel1Df */ |
| 899 | NULL, /* FetchTexel2Df */ |
| 900 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 901 | store_texel_al88 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 902 | }; |
| 903 | |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 904 | const struct gl_texture_format _mesa_texformat_al88_rev = { |
| 905 | MESA_FORMAT_AL88_REV, /* MesaFormat */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 906 | GL_LUMINANCE_ALPHA, /* BaseFormat */ |
| 907 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 908 | 0, /* RedBits */ |
| 909 | 0, /* GreenBits */ |
| 910 | 0, /* BlueBits */ |
| 911 | 8, /* AlphaBits */ |
| 912 | 8, /* LuminanceBits */ |
| 913 | 0, /* IntensityBits */ |
| 914 | 0, /* IndexBits */ |
| 915 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 916 | 0, /* StencilBits */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 917 | 2, /* TexelBytes */ |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 918 | _mesa_texstore_al88, /* StoreTexImageFunc */ |
| 919 | fetch_texel_1d_al88_rev, /* FetchTexel1D */ |
| 920 | fetch_texel_2d_al88_rev, /* FetchTexel2D */ |
| 921 | fetch_texel_3d_al88_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 922 | NULL, /* FetchTexel1Df */ |
| 923 | NULL, /* FetchTexel2Df */ |
| 924 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 925 | store_texel_al88_rev /* StoreTexel */ |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 926 | }; |
| 927 | |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 928 | const struct gl_texture_format _mesa_texformat_rgb332 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 929 | MESA_FORMAT_RGB332, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 930 | GL_RGB, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 931 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 932 | 3, /* RedBits */ |
| 933 | 3, /* GreenBits */ |
| 934 | 2, /* BlueBits */ |
| 935 | 0, /* AlphaBits */ |
| 936 | 0, /* LuminanceBits */ |
| 937 | 0, /* IntensityBits */ |
| 938 | 0, /* IndexBits */ |
| 939 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 940 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 941 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 942 | _mesa_texstore_rgb332, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 943 | fetch_texel_1d_rgb332, /* FetchTexel1D */ |
| 944 | fetch_texel_2d_rgb332, /* FetchTexel2D */ |
| 945 | fetch_texel_3d_rgb332, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 946 | NULL, /* FetchTexel1Df */ |
| 947 | NULL, /* FetchTexel2Df */ |
| 948 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 949 | store_texel_rgb332 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 950 | }; |
| 951 | |
| 952 | const struct gl_texture_format _mesa_texformat_a8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 953 | MESA_FORMAT_A8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 954 | GL_ALPHA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 955 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 956 | 0, /* RedBits */ |
| 957 | 0, /* GreenBits */ |
| 958 | 0, /* BlueBits */ |
| 959 | 8, /* AlphaBits */ |
| 960 | 0, /* LuminanceBits */ |
| 961 | 0, /* IntensityBits */ |
| 962 | 0, /* IndexBits */ |
| 963 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 964 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 965 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 966 | _mesa_texstore_a8, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 967 | fetch_texel_1d_a8, /* FetchTexel1D */ |
| 968 | fetch_texel_2d_a8, /* FetchTexel2D */ |
| 969 | fetch_texel_3d_a8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 970 | NULL, /* FetchTexel1Df */ |
| 971 | NULL, /* FetchTexel2Df */ |
| 972 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 973 | store_texel_a8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 974 | }; |
| 975 | |
| 976 | const struct gl_texture_format _mesa_texformat_l8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 977 | MESA_FORMAT_L8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 978 | GL_LUMINANCE, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 979 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 980 | 0, /* RedBits */ |
| 981 | 0, /* GreenBits */ |
| 982 | 0, /* BlueBits */ |
| 983 | 0, /* AlphaBits */ |
| 984 | 8, /* LuminanceBits */ |
| 985 | 0, /* IntensityBits */ |
| 986 | 0, /* IndexBits */ |
| 987 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 988 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 989 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 990 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 991 | fetch_texel_1d_l8, /* FetchTexel1D */ |
| 992 | fetch_texel_2d_l8, /* FetchTexel2D */ |
| 993 | fetch_texel_3d_l8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 994 | NULL, /* FetchTexel1Df */ |
| 995 | NULL, /* FetchTexel2Df */ |
| 996 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 997 | store_texel_l8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 998 | }; |
| 999 | |
| 1000 | const struct gl_texture_format _mesa_texformat_i8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1001 | MESA_FORMAT_I8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1002 | GL_INTENSITY, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1003 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1004 | 0, /* RedBits */ |
| 1005 | 0, /* GreenBits */ |
| 1006 | 0, /* BlueBits */ |
| 1007 | 0, /* AlphaBits */ |
| 1008 | 0, /* LuminanceBits */ |
| 1009 | 8, /* IntensityBits */ |
| 1010 | 0, /* IndexBits */ |
| 1011 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1012 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1013 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1014 | _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1015 | fetch_texel_1d_i8, /* FetchTexel1D */ |
| 1016 | fetch_texel_2d_i8, /* FetchTexel2D */ |
| 1017 | fetch_texel_3d_i8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1018 | NULL, /* FetchTexel1Df */ |
| 1019 | NULL, /* FetchTexel2Df */ |
| 1020 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1021 | store_texel_i8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1022 | }; |
| 1023 | |
| 1024 | const struct gl_texture_format _mesa_texformat_ci8 = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1025 | MESA_FORMAT_CI8, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1026 | GL_COLOR_INDEX, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1027 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1028 | 0, /* RedBits */ |
| 1029 | 0, /* GreenBits */ |
| 1030 | 0, /* BlueBits */ |
| 1031 | 0, /* AlphaBits */ |
| 1032 | 0, /* LuminanceBits */ |
| 1033 | 0, /* IntensityBits */ |
| 1034 | 8, /* IndexBits */ |
| 1035 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1036 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1037 | 1, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1038 | _mesa_texstore_ci8, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1039 | fetch_texel_1d_ci8, /* FetchTexel1D */ |
| 1040 | fetch_texel_2d_ci8, /* FetchTexel2D */ |
| 1041 | fetch_texel_3d_ci8, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1042 | NULL, /* FetchTexel1Df */ |
| 1043 | NULL, /* FetchTexel2Df */ |
| 1044 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1045 | store_texel_ci8 /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1046 | }; |
| 1047 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1048 | const struct gl_texture_format _mesa_texformat_ycbcr = { |
| 1049 | MESA_FORMAT_YCBCR, /* MesaFormat */ |
| 1050 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1051 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1052 | 0, /* RedBits */ |
| 1053 | 0, /* GreenBits */ |
| 1054 | 0, /* BlueBits */ |
| 1055 | 0, /* AlphaBits */ |
| 1056 | 0, /* LuminanceBits */ |
| 1057 | 0, /* IntensityBits */ |
| 1058 | 0, /* IndexBits */ |
| 1059 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1060 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1061 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1062 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1063 | fetch_texel_1d_ycbcr, /* FetchTexel1D */ |
| 1064 | fetch_texel_2d_ycbcr, /* FetchTexel2D */ |
| 1065 | fetch_texel_3d_ycbcr, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1066 | NULL, /* FetchTexel1Df */ |
| 1067 | NULL, /* FetchTexel2Df */ |
| 1068 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1069 | store_texel_ycbcr /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1070 | }; |
| 1071 | |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1072 | const struct gl_texture_format _mesa_texformat_ycbcr_rev = { |
| 1073 | MESA_FORMAT_YCBCR_REV, /* MesaFormat */ |
| 1074 | GL_YCBCR_MESA, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1075 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1076 | 0, /* RedBits */ |
| 1077 | 0, /* GreenBits */ |
| 1078 | 0, /* BlueBits */ |
| 1079 | 0, /* AlphaBits */ |
| 1080 | 0, /* LuminanceBits */ |
| 1081 | 0, /* IntensityBits */ |
| 1082 | 0, /* IndexBits */ |
| 1083 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1084 | 0, /* StencilBits */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1085 | 2, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1086 | _mesa_texstore_ycbcr, /* StoreTexImageFunc */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1087 | fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ |
| 1088 | fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ |
| 1089 | fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ |
Brian Paul | 63b5b8e | 2005-09-15 01:55:40 +0000 | [diff] [blame] | 1090 | NULL, /* FetchTexel1Df */ |
| 1091 | NULL, /* FetchTexel2Df */ |
| 1092 | NULL, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1093 | store_texel_ycbcr_rev /* StoreTexel */ |
Brian Paul | c5b9950 | 2002-09-21 16:51:25 +0000 | [diff] [blame] | 1094 | }; |
| 1095 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1096 | const struct gl_texture_format _mesa_texformat_z24_s8 = { |
| 1097 | MESA_FORMAT_Z24_S8, /* MesaFormat */ |
| 1098 | GL_DEPTH_STENCIL_EXT, /* BaseFormat */ |
| 1099 | GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ |
| 1100 | 0, /* RedBits */ |
| 1101 | 0, /* GreenBits */ |
| 1102 | 0, /* BlueBits */ |
| 1103 | 0, /* AlphaBits */ |
| 1104 | 0, /* LuminanceBits */ |
| 1105 | 0, /* IntensityBits */ |
| 1106 | 0, /* IndexBits */ |
| 1107 | 24, /* DepthBits */ |
| 1108 | 8, /* StencilBits */ |
| 1109 | 4, /* TexelBytes */ |
| 1110 | NULL/*_mesa_texstore_z24_s8*/, /* StoreTexImageFunc */ |
| 1111 | NULL, /* FetchTexel1D */ |
| 1112 | NULL, /* FetchTexel2D */ |
| 1113 | NULL, /* FetchTexel3D */ |
| 1114 | fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ |
| 1115 | fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ |
| 1116 | fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ |
| 1117 | store_texel_z24_s8 /* StoreTexel */ |
| 1118 | }; |
| 1119 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1120 | /*@}*/ |
| 1121 | |
| 1122 | |
| 1123 | /***************************************************************/ |
| 1124 | /** \name Null format (useful for proxy textures) */ |
| 1125 | /*@{*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1126 | |
| 1127 | const struct gl_texture_format _mesa_null_texformat = { |
Gareth Hughes | 38f2866 | 2001-03-28 20:40:51 +0000 | [diff] [blame] | 1128 | -1, /* MesaFormat */ |
Brian Paul | 1c85aa3 | 2001-04-20 16:46:04 +0000 | [diff] [blame] | 1129 | 0, /* BaseFormat */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1130 | GL_NONE, /* DataType */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1131 | 0, /* RedBits */ |
| 1132 | 0, /* GreenBits */ |
| 1133 | 0, /* BlueBits */ |
| 1134 | 0, /* AlphaBits */ |
| 1135 | 0, /* LuminanceBits */ |
| 1136 | 0, /* IntensityBits */ |
| 1137 | 0, /* IndexBits */ |
| 1138 | 0, /* DepthBits */ |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1139 | 0, /* StencilBits */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1140 | 0, /* TexelBytes */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1141 | NULL, /* StoreTexImageFunc */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1142 | fetch_null_texel, /* FetchTexel1D */ |
| 1143 | fetch_null_texel, /* FetchTexel2D */ |
| 1144 | fetch_null_texel, /* FetchTexel3D */ |
Brian Paul | 4f295ce | 2004-01-23 01:59:54 +0000 | [diff] [blame] | 1145 | fetch_null_texelf, /* FetchTexel1Df */ |
| 1146 | fetch_null_texelf, /* FetchTexel2Df */ |
| 1147 | fetch_null_texelf, /* FetchTexel3Df */ |
Brian Paul | e4b2356 | 2005-05-04 20:11:35 +0000 | [diff] [blame] | 1148 | store_null_texel /* StoreTexel */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1149 | }; |
| 1150 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1151 | /*@}*/ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1152 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1153 | |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1154 | /** |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1155 | * Choose an appropriate texture format given the format, type and |
| 1156 | * internalFormat parameters passed to glTexImage(). |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1157 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1158 | * \param ctx the GL context. |
| 1159 | * \param internalFormat user's prefered internal texture format. |
| 1160 | * \param format incoming image pixel format. |
| 1161 | * \param type incoming image data type. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1162 | * |
Brian Paul | fe03108 | 2004-01-24 17:02:19 +0000 | [diff] [blame] | 1163 | * \return a pointer to a gl_texture_format object which describes the |
| 1164 | * choosen texture format, or NULL on failure. |
Keith Whitwell | 6dc8557 | 2003-07-17 13:43:59 +0000 | [diff] [blame] | 1165 | * |
| 1166 | * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1167 | * will typically override this function with a specialized version. |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1168 | */ |
Brian Paul | 7d58f44 | 2001-04-04 21:54:20 +0000 | [diff] [blame] | 1169 | const struct gl_texture_format * |
| 1170 | _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, |
| 1171 | GLenum format, GLenum type ) |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1172 | { |
Brian Paul | 7d58f44 | 2001-04-04 21:54:20 +0000 | [diff] [blame] | 1173 | (void) format; |
| 1174 | (void) type; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1175 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1176 | switch (internalFormat) { |
| 1177 | /* RGBA formats */ |
| 1178 | case 4: |
| 1179 | case GL_RGBA: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1180 | case GL_RGB10_A2: |
| 1181 | case GL_RGBA12: |
| 1182 | case GL_RGBA16: |
| 1183 | return &_mesa_texformat_rgba; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1184 | case GL_RGBA8: |
| 1185 | return &_mesa_texformat_rgba8888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1186 | case GL_RGB5_A1: |
| 1187 | return &_mesa_texformat_argb1555; |
| 1188 | case GL_RGBA2: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1189 | return &_mesa_texformat_argb4444_rev; /* just to test another format*/ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1190 | case GL_RGBA4: |
| 1191 | return &_mesa_texformat_argb4444; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1192 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1193 | /* RGB formats */ |
| 1194 | case 3: |
| 1195 | case GL_RGB: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1196 | case GL_RGB10: |
| 1197 | case GL_RGB12: |
| 1198 | case GL_RGB16: |
| 1199 | return &_mesa_texformat_rgb; |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1200 | case GL_RGB8: |
| 1201 | return &_mesa_texformat_rgb888; |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1202 | case GL_R3_G3_B2: |
| 1203 | return &_mesa_texformat_rgb332; |
| 1204 | case GL_RGB4: |
Brian Paul | defb035 | 2004-05-13 15:26:51 +0000 | [diff] [blame] | 1205 | return &_mesa_texformat_rgb565_rev; /* just to test another format */ |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1206 | case GL_RGB5: |
| 1207 | return &_mesa_texformat_rgb565; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1208 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1209 | /* Alpha formats */ |
| 1210 | case GL_ALPHA: |
| 1211 | case GL_ALPHA4: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1212 | case GL_ALPHA12: |
| 1213 | case GL_ALPHA16: |
| 1214 | return &_mesa_texformat_alpha; |
Brian Paul | a156b49 | 2004-05-12 01:50:30 +0000 | [diff] [blame] | 1215 | case GL_ALPHA8: |
| 1216 | return &_mesa_texformat_a8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1217 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1218 | /* Luminance formats */ |
| 1219 | case 1: |
| 1220 | case GL_LUMINANCE: |
| 1221 | case GL_LUMINANCE4: |
| 1222 | case GL_LUMINANCE12: |
| 1223 | case GL_LUMINANCE16: |
| 1224 | return &_mesa_texformat_luminance; |
| 1225 | case GL_LUMINANCE8: |
| 1226 | return &_mesa_texformat_l8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1227 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1228 | /* Luminance/Alpha formats */ |
| 1229 | case 2: |
| 1230 | case GL_LUMINANCE_ALPHA: |
| 1231 | case GL_LUMINANCE4_ALPHA4: |
| 1232 | case GL_LUMINANCE6_ALPHA2: |
| 1233 | case GL_LUMINANCE12_ALPHA4: |
| 1234 | case GL_LUMINANCE12_ALPHA12: |
| 1235 | case GL_LUMINANCE16_ALPHA16: |
| 1236 | return &_mesa_texformat_luminance_alpha; |
| 1237 | case GL_LUMINANCE8_ALPHA8: |
| 1238 | return &_mesa_texformat_al88; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1239 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1240 | case GL_INTENSITY: |
| 1241 | case GL_INTENSITY4: |
| 1242 | case GL_INTENSITY12: |
| 1243 | case GL_INTENSITY16: |
| 1244 | return &_mesa_texformat_intensity; |
| 1245 | case GL_INTENSITY8: |
| 1246 | return &_mesa_texformat_i8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1247 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1248 | case GL_COLOR_INDEX: |
| 1249 | case GL_COLOR_INDEX1_EXT: |
| 1250 | case GL_COLOR_INDEX2_EXT: |
| 1251 | case GL_COLOR_INDEX4_EXT: |
| 1252 | case GL_COLOR_INDEX12_EXT: |
| 1253 | case GL_COLOR_INDEX16_EXT: |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1254 | case GL_COLOR_INDEX8_EXT: |
| 1255 | return &_mesa_texformat_ci8; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1256 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1257 | default: |
| 1258 | ; /* fallthrough */ |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1259 | } |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1260 | |
Brian Paul | 4618a9b | 2005-09-08 15:28:45 +0000 | [diff] [blame] | 1261 | if (ctx->Extensions.SGIX_depth_texture || |
| 1262 | ctx->Extensions.ARB_depth_texture) { |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1263 | switch (internalFormat) { |
| 1264 | case GL_DEPTH_COMPONENT: |
| 1265 | case GL_DEPTH_COMPONENT24_SGIX: |
| 1266 | case GL_DEPTH_COMPONENT32_SGIX: |
| 1267 | return &_mesa_texformat_depth_component_float32; |
| 1268 | case GL_DEPTH_COMPONENT16_SGIX: |
| 1269 | return &_mesa_texformat_depth_component16; |
| 1270 | default: |
| 1271 | ; /* fallthrough */ |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | if (ctx->Extensions.ARB_texture_compression) { |
| 1276 | switch (internalFormat) { |
| 1277 | case GL_COMPRESSED_ALPHA_ARB: |
| 1278 | return &_mesa_texformat_alpha; |
| 1279 | case GL_COMPRESSED_LUMINANCE_ARB: |
| 1280 | return &_mesa_texformat_luminance; |
| 1281 | case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: |
| 1282 | return &_mesa_texformat_luminance_alpha; |
| 1283 | case GL_COMPRESSED_INTENSITY_ARB: |
| 1284 | return &_mesa_texformat_intensity; |
| 1285 | case GL_COMPRESSED_RGB_ARB: |
| 1286 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1287 | return &_mesa_texformat_rgb_fxt1; |
| 1288 | else if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1289 | ctx->Extensions.S3_s3tc) |
| 1290 | return &_mesa_texformat_rgb_dxt1; |
| 1291 | else |
| 1292 | return &_mesa_texformat_rgb; |
| 1293 | case GL_COMPRESSED_RGBA_ARB: |
| 1294 | if (ctx->Extensions.TDFX_texture_compression_FXT1) |
| 1295 | return &_mesa_texformat_rgba_fxt1; |
| 1296 | else if (ctx->Extensions.EXT_texture_compression_s3tc || |
| 1297 | ctx->Extensions.S3_s3tc) |
| 1298 | return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ |
| 1299 | else |
| 1300 | return &_mesa_texformat_rgba; |
| 1301 | default: |
| 1302 | ; /* fallthrough */ |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | if (ctx->Extensions.MESA_ycbcr_texture) { |
| 1307 | if (internalFormat == GL_YCBCR_MESA) { |
| 1308 | if (type == GL_UNSIGNED_SHORT_8_8_MESA) |
| 1309 | return &_mesa_texformat_ycbcr; |
| 1310 | else |
| 1311 | return &_mesa_texformat_ycbcr_rev; |
| 1312 | } |
| 1313 | } |
| 1314 | |
| 1315 | if (ctx->Extensions.TDFX_texture_compression_FXT1) { |
| 1316 | switch (internalFormat) { |
| 1317 | case GL_COMPRESSED_RGB_FXT1_3DFX: |
| 1318 | return &_mesa_texformat_rgb_fxt1; |
| 1319 | case GL_COMPRESSED_RGBA_FXT1_3DFX: |
| 1320 | return &_mesa_texformat_rgba_fxt1; |
| 1321 | default: |
| 1322 | ; /* fallthrough */ |
| 1323 | } |
| 1324 | } |
| 1325 | |
| 1326 | if (ctx->Extensions.EXT_texture_compression_s3tc) { |
| 1327 | switch (internalFormat) { |
| 1328 | case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
| 1329 | return &_mesa_texformat_rgb_dxt1; |
| 1330 | case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
| 1331 | return &_mesa_texformat_rgba_dxt1; |
| 1332 | case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
| 1333 | return &_mesa_texformat_rgba_dxt3; |
| 1334 | case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
| 1335 | return &_mesa_texformat_rgba_dxt5; |
| 1336 | default: |
| 1337 | ; /* fallthrough */ |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | if (ctx->Extensions.S3_s3tc) { |
| 1342 | switch (internalFormat) { |
| 1343 | case GL_RGB_S3TC: |
| 1344 | case GL_RGB4_S3TC: |
| 1345 | return &_mesa_texformat_rgb_dxt1; |
| 1346 | case GL_RGBA_S3TC: |
| 1347 | case GL_RGBA4_S3TC: |
| 1348 | return &_mesa_texformat_rgba_dxt3; |
| 1349 | default: |
| 1350 | ; /* fallthrough */ |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | if (ctx->Extensions.ARB_texture_float) { |
| 1355 | switch (internalFormat) { |
| 1356 | case GL_ALPHA16F_ARB: |
| 1357 | return &_mesa_texformat_alpha_float16; |
| 1358 | case GL_ALPHA32F_ARB: |
| 1359 | return &_mesa_texformat_alpha_float32; |
| 1360 | case GL_LUMINANCE16F_ARB: |
| 1361 | return &_mesa_texformat_luminance_float16; |
| 1362 | case GL_LUMINANCE32F_ARB: |
| 1363 | return &_mesa_texformat_luminance_float32; |
| 1364 | case GL_LUMINANCE_ALPHA16F_ARB: |
| 1365 | return &_mesa_texformat_luminance_alpha_float16; |
| 1366 | case GL_LUMINANCE_ALPHA32F_ARB: |
| 1367 | return &_mesa_texformat_luminance_alpha_float32; |
| 1368 | case GL_INTENSITY16F_ARB: |
| 1369 | return &_mesa_texformat_intensity_float16; |
| 1370 | case GL_INTENSITY32F_ARB: |
| 1371 | return &_mesa_texformat_intensity_float32; |
| 1372 | case GL_RGB16F_ARB: |
| 1373 | return &_mesa_texformat_rgb_float16; |
| 1374 | case GL_RGB32F_ARB: |
| 1375 | return &_mesa_texformat_rgb_float32; |
| 1376 | case GL_RGBA16F_ARB: |
| 1377 | return &_mesa_texformat_rgba_float16; |
| 1378 | case GL_RGBA32F_ARB: |
| 1379 | return &_mesa_texformat_rgba_float32; |
| 1380 | default: |
| 1381 | ; /* fallthrough */ |
| 1382 | } |
| 1383 | } |
| 1384 | |
Brian Paul | 1ad7b99 | 2005-09-28 02:29:50 +0000 | [diff] [blame^] | 1385 | if (ctx->Extensions.EXT_packed_depth_stencil) { |
| 1386 | switch (internalFormat) { |
| 1387 | case GL_DEPTH_STENCIL_EXT: |
| 1388 | case GL_DEPTH24_STENCIL8_EXT: |
| 1389 | return &_mesa_texformat_z24_s8; |
| 1390 | default: |
| 1391 | ; /* fallthrough */ |
| 1392 | } |
| 1393 | } |
| 1394 | |
Brian Paul | f959f6e | 2004-04-22 00:27:31 +0000 | [diff] [blame] | 1395 | _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); |
| 1396 | return NULL; |
Gareth Hughes | 2c3d34c | 2001-03-18 08:53:49 +0000 | [diff] [blame] | 1397 | } |