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