Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentexformat.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 6.5.1 00004 * 00005 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 00034 #include "colormac.h" 00035 #include "context.h" 00036 #include "texformat.h" 00037 #include "texstore.h" 00038 00039 00040 #if FEATURE_EXT_texture_sRGB 00041 00047 static INLINE GLfloat 00048 nonlinear_to_linear(GLubyte cs8) 00049 { 00050 static GLfloat table[256]; 00051 static GLboolean tableReady = GL_FALSE; 00052 if (!tableReady) { 00053 /* compute lookup table now */ 00054 GLuint i; 00055 for (i = 0; i < 256; i++) { 00056 const GLfloat cs = UBYTE_TO_FLOAT(i); 00057 if (cs <= 0.04045) { 00058 table[i] = cs / 12.92f; 00059 } 00060 else { 00061 table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); 00062 } 00063 } 00064 tableReady = GL_TRUE; 00065 } 00066 return table[cs8]; 00067 } 00068 00069 00070 #endif /* FEATURE_EXT_texture_sRGB */ 00071 00072 00073 /* Texel fetch routines for all supported formats 00074 */ 00075 #define DIM 1 00076 #include "texformat_tmp.h" 00077 00078 #define DIM 2 00079 #include "texformat_tmp.h" 00080 00081 #define DIM 3 00082 #include "texformat_tmp.h" 00083 00089 static void fetch_null_texel( const struct gl_texture_image *texImage, 00090 GLint i, GLint j, GLint k, GLchan *texel ) 00091 { 00092 (void) texImage; (void) i; (void) j; (void) k; 00093 texel[RCOMP] = 0; 00094 texel[GCOMP] = 0; 00095 texel[BCOMP] = 0; 00096 texel[ACOMP] = 0; 00097 _mesa_warning(NULL, "fetch_null_texel() called!"); 00098 } 00099 00100 static void fetch_null_texelf( const struct gl_texture_image *texImage, 00101 GLint i, GLint j, GLint k, GLfloat *texel ) 00102 { 00103 (void) texImage; (void) i; (void) j; (void) k; 00104 texel[RCOMP] = 0.0; 00105 texel[GCOMP] = 0.0; 00106 texel[BCOMP] = 0.0; 00107 texel[ACOMP] = 0.0; 00108 _mesa_warning(NULL, "fetch_null_texelf() called!"); 00109 } 00110 00111 static void store_null_texel(struct gl_texture_image *texImage, 00112 GLint i, GLint j, GLint k, const void *texel) 00113 { 00114 (void) texImage; 00115 (void) i; 00116 (void) j; 00117 (void) k; 00118 (void) texel; 00119 /* no-op */ 00120 } 00121 00122 00137 /***************************************************************/ 00140 00141 const struct gl_texture_format _mesa_texformat_rgba = { 00142 MESA_FORMAT_RGBA, /* MesaFormat */ 00143 GL_RGBA, /* BaseFormat */ 00144 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00145 CHAN_BITS, /* RedBits */ 00146 CHAN_BITS, /* GreenBits */ 00147 CHAN_BITS, /* BlueBits */ 00148 CHAN_BITS, /* AlphaBits */ 00149 0, /* LuminanceBits */ 00150 0, /* IntensityBits */ 00151 0, /* IndexBits */ 00152 0, /* DepthBits */ 00153 0, /* StencilBits */ 00154 4 * sizeof(GLchan), /* TexelBytes */ 00155 _mesa_texstore_rgba, /* StoreTexImageFunc */ 00156 fetch_texel_1d_rgba, /* FetchTexel1D */ 00157 fetch_texel_2d_rgba, /* FetchTexel2D */ 00158 fetch_texel_3d_rgba, /* FetchTexel3D */ 00159 fetch_texel_1d_f_rgba, /* FetchTexel1Df */ 00160 fetch_texel_2d_f_rgba, /* FetchTexel2Df */ 00161 fetch_texel_3d_f_rgba, /* FetchTexel3Df */ 00162 store_texel_rgba /* StoreTexel */ 00163 }; 00164 00165 const struct gl_texture_format _mesa_texformat_rgb = { 00166 MESA_FORMAT_RGB, /* MesaFormat */ 00167 GL_RGB, /* BaseFormat */ 00168 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00169 CHAN_BITS, /* RedBits */ 00170 CHAN_BITS, /* GreenBits */ 00171 CHAN_BITS, /* BlueBits */ 00172 0, /* AlphaBits */ 00173 0, /* LuminanceBits */ 00174 0, /* IntensityBits */ 00175 0, /* IndexBits */ 00176 0, /* DepthBits */ 00177 0, /* StencilBits */ 00178 3 * sizeof(GLchan), /* TexelBytes */ 00179 _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ 00180 fetch_texel_1d_rgb, /* FetchTexel1D */ 00181 fetch_texel_2d_rgb, /* FetchTexel2D */ 00182 fetch_texel_3d_rgb, /* FetchTexel3D */ 00183 fetch_texel_1d_f_rgb, /* FetchTexel1Df */ 00184 fetch_texel_2d_f_rgb, /* FetchTexel2Df */ 00185 fetch_texel_3d_f_rgb, /* FetchTexel3Df */ 00186 store_texel_rgb /* StoreTexel */ 00187 }; 00188 00189 const struct gl_texture_format _mesa_texformat_alpha = { 00190 MESA_FORMAT_ALPHA, /* MesaFormat */ 00191 GL_ALPHA, /* BaseFormat */ 00192 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00193 0, /* RedBits */ 00194 0, /* GreenBits */ 00195 0, /* BlueBits */ 00196 CHAN_BITS, /* AlphaBits */ 00197 0, /* LuminanceBits */ 00198 0, /* IntensityBits */ 00199 0, /* IndexBits */ 00200 0, /* DepthBits */ 00201 0, /* StencilBits */ 00202 sizeof(GLchan), /* TexelBytes */ 00203 _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ 00204 fetch_texel_1d_alpha, /* FetchTexel1D */ 00205 fetch_texel_2d_alpha, /* FetchTexel2D */ 00206 fetch_texel_3d_alpha, /* FetchTexel3D */ 00207 NULL, /* FetchTexel1Df */ 00208 NULL, /* FetchTexel2Df */ 00209 NULL, /* FetchTexel3Df */ 00210 store_texel_alpha /* StoreTexel */ 00211 }; 00212 00213 const struct gl_texture_format _mesa_texformat_luminance = { 00214 MESA_FORMAT_LUMINANCE, /* MesaFormat */ 00215 GL_LUMINANCE, /* BaseFormat */ 00216 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00217 0, /* RedBits */ 00218 0, /* GreenBits */ 00219 0, /* BlueBits */ 00220 0, /* AlphaBits */ 00221 CHAN_BITS, /* LuminanceBits */ 00222 0, /* IntensityBits */ 00223 0, /* IndexBits */ 00224 0, /* DepthBits */ 00225 0, /* StencilBits */ 00226 sizeof(GLchan), /* TexelBytes */ 00227 _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ 00228 fetch_texel_1d_luminance, /* FetchTexel1D */ 00229 fetch_texel_2d_luminance, /* FetchTexel2D */ 00230 fetch_texel_3d_luminance, /* FetchTexel3D */ 00231 NULL, /* FetchTexel1Df */ 00232 NULL, /* FetchTexel2Df */ 00233 NULL, /* FetchTexel3Df */ 00234 store_texel_luminance /* StoreTexel */ 00235 }; 00236 00237 const struct gl_texture_format _mesa_texformat_luminance_alpha = { 00238 MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ 00239 GL_LUMINANCE_ALPHA, /* BaseFormat */ 00240 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00241 0, /* RedBits */ 00242 0, /* GreenBits */ 00243 0, /* BlueBits */ 00244 CHAN_BITS, /* AlphaBits */ 00245 CHAN_BITS, /* LuminanceBits */ 00246 0, /* IntensityBits */ 00247 0, /* IndexBits */ 00248 0, /* DepthBits */ 00249 0, /* StencilBits */ 00250 2 * sizeof(GLchan), /* TexelBytes */ 00251 _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ 00252 fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ 00253 fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ 00254 fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ 00255 NULL, /* FetchTexel1Df */ 00256 NULL, /* FetchTexel2Df */ 00257 NULL, /* FetchTexel3Df */ 00258 store_texel_luminance_alpha /* StoreTexel */ 00259 }; 00260 00261 const struct gl_texture_format _mesa_texformat_intensity = { 00262 MESA_FORMAT_INTENSITY, /* MesaFormat */ 00263 GL_INTENSITY, /* BaseFormat */ 00264 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00265 0, /* RedBits */ 00266 0, /* GreenBits */ 00267 0, /* BlueBits */ 00268 0, /* AlphaBits */ 00269 0, /* LuminanceBits */ 00270 CHAN_BITS, /* IntensityBits */ 00271 0, /* IndexBits */ 00272 0, /* DepthBits */ 00273 0, /* StencilBits */ 00274 sizeof(GLchan), /* TexelBytes */ 00275 _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ 00276 fetch_texel_1d_intensity, /* FetchTexel1D */ 00277 fetch_texel_2d_intensity, /* FetchTexel2D */ 00278 fetch_texel_3d_intensity, /* FetchTexel3D */ 00279 NULL, /* FetchTexel1Df */ 00280 NULL, /* FetchTexel2Df */ 00281 NULL, /* FetchTexel3Df */ 00282 store_texel_intensity /* StoreTexel */ 00283 }; 00284 00285 00286 #if FEATURE_EXT_texture_sRGB 00287 00288 const struct gl_texture_format _mesa_texformat_srgb8 = { 00289 MESA_FORMAT_SRGB8, /* MesaFormat */ 00290 GL_RGB, /* BaseFormat */ 00291 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00292 8, /* RedBits */ 00293 8, /* GreenBits */ 00294 8, /* BlueBits */ 00295 0, /* AlphaBits */ 00296 0, /* LuminanceBits */ 00297 0, /* IntensityBits */ 00298 0, /* IndexBits */ 00299 0, /* DepthBits */ 00300 0, /* StencilBits */ 00301 3, /* TexelBytes */ 00302 _mesa_texstore_srgb8, /* StoreTexImageFunc */ 00303 NULL, /* FetchTexel1D */ 00304 NULL, /* FetchTexel2D */ 00305 NULL, /* FetchTexel3D */ 00306 fetch_texel_1d_srgb8, /* FetchTexel1Df */ 00307 fetch_texel_2d_srgb8, /* FetchTexel2Df */ 00308 fetch_texel_3d_srgb8, /* FetchTexel3Df */ 00309 store_texel_srgb8 /* StoreTexel */ 00310 }; 00311 00312 const struct gl_texture_format _mesa_texformat_srgba8 = { 00313 MESA_FORMAT_SRGBA8, /* MesaFormat */ 00314 GL_RGBA, /* BaseFormat */ 00315 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00316 8, /* RedBits */ 00317 8, /* GreenBits */ 00318 8, /* BlueBits */ 00319 8, /* AlphaBits */ 00320 0, /* LuminanceBits */ 00321 0, /* IntensityBits */ 00322 0, /* IndexBits */ 00323 0, /* DepthBits */ 00324 0, /* StencilBits */ 00325 4, /* TexelBytes */ 00326 _mesa_texstore_srgba8, /* StoreTexImageFunc */ 00327 NULL, /* FetchTexel1D */ 00328 NULL, /* FetchTexel2D */ 00329 NULL, /* FetchTexel3D */ 00330 fetch_texel_1d_srgba8, /* FetchTexel1Df */ 00331 fetch_texel_2d_srgba8, /* FetchTexel2Df */ 00332 fetch_texel_3d_srgba8, /* FetchTexel3Df */ 00333 store_texel_srgba8 /* StoreTexel */ 00334 }; 00335 00336 const struct gl_texture_format _mesa_texformat_sl8 = { 00337 MESA_FORMAT_SL8, /* MesaFormat */ 00338 GL_LUMINANCE, /* BaseFormat */ 00339 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00340 0, /* RedBits */ 00341 0, /* GreenBits */ 00342 0, /* BlueBits */ 00343 0, /* AlphaBits */ 00344 8, /* LuminanceBits */ 00345 0, /* IntensityBits */ 00346 0, /* IndexBits */ 00347 0, /* DepthBits */ 00348 0, /* StencilBits */ 00349 1, /* TexelBytes */ 00350 _mesa_texstore_sl8, /* StoreTexImageFunc */ 00351 NULL, /* FetchTexel1D */ 00352 NULL, /* FetchTexel2D */ 00353 NULL, /* FetchTexel3D */ 00354 fetch_texel_1d_sl8, /* FetchTexel1Df */ 00355 fetch_texel_2d_sl8, /* FetchTexel2Df */ 00356 fetch_texel_3d_sl8, /* FetchTexel3Df */ 00357 store_texel_sl8 /* StoreTexel */ 00358 }; 00359 00360 const struct gl_texture_format _mesa_texformat_sla8 = { 00361 MESA_FORMAT_SLA8, /* MesaFormat */ 00362 GL_LUMINANCE_ALPHA, /* BaseFormat */ 00363 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00364 0, /* RedBits */ 00365 0, /* GreenBits */ 00366 0, /* BlueBits */ 00367 8, /* AlphaBits */ 00368 8, /* LuminanceBits */ 00369 0, /* IntensityBits */ 00370 0, /* IndexBits */ 00371 0, /* DepthBits */ 00372 0, /* StencilBits */ 00373 2, /* TexelBytes */ 00374 _mesa_texstore_sla8, /* StoreTexImageFunc */ 00375 NULL, /* FetchTexel1D */ 00376 NULL, /* FetchTexel2D */ 00377 NULL, /* FetchTexel3D */ 00378 fetch_texel_1d_sla8, /* FetchTexel1Df */ 00379 fetch_texel_2d_sla8, /* FetchTexel2Df */ 00380 fetch_texel_3d_sla8, /* FetchTexel3Df */ 00381 store_texel_sla8 /* StoreTexel */ 00382 }; 00383 00384 #endif /* FEATURE_EXT_texture_sRGB */ 00385 00386 const struct gl_texture_format _mesa_texformat_rgba_float32 = { 00387 MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ 00388 GL_RGBA, /* BaseFormat */ 00389 GL_FLOAT, /* DataType */ 00390 8 * sizeof(GLfloat), /* RedBits */ 00391 8 * sizeof(GLfloat), /* GreenBits */ 00392 8 * sizeof(GLfloat), /* BlueBits */ 00393 8 * sizeof(GLfloat), /* AlphaBits */ 00394 0, /* LuminanceBits */ 00395 0, /* IntensityBits */ 00396 0, /* IndexBits */ 00397 0, /* DepthBits */ 00398 0, /* StencilBits */ 00399 4 * sizeof(GLfloat), /* TexelBytes */ 00400 _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ 00401 NULL, /* FetchTexel1D */ 00402 NULL, /* FetchTexel1D */ 00403 NULL, /* FetchTexel1D */ 00404 fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ 00405 fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ 00406 fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ 00407 store_texel_rgba_f32 /* StoreTexel */ 00408 }; 00409 00410 const struct gl_texture_format _mesa_texformat_rgba_float16 = { 00411 MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ 00412 GL_RGBA, /* BaseFormat */ 00413 GL_FLOAT, /* DataType */ 00414 8 * sizeof(GLhalfARB), /* RedBits */ 00415 8 * sizeof(GLhalfARB), /* GreenBits */ 00416 8 * sizeof(GLhalfARB), /* BlueBits */ 00417 8 * sizeof(GLhalfARB), /* AlphaBits */ 00418 0, /* LuminanceBits */ 00419 0, /* IntensityBits */ 00420 0, /* IndexBits */ 00421 0, /* DepthBits */ 00422 0, /* StencilBits */ 00423 4 * sizeof(GLhalfARB), /* TexelBytes */ 00424 _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ 00425 NULL, /* FetchTexel1D */ 00426 NULL, /* FetchTexel1D */ 00427 NULL, /* FetchTexel1D */ 00428 fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ 00429 fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ 00430 fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ 00431 store_texel_rgba_f16 /* StoreTexel */ 00432 }; 00433 00434 const struct gl_texture_format _mesa_texformat_rgb_float32 = { 00435 MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ 00436 GL_RGB, /* BaseFormat */ 00437 GL_FLOAT, /* DataType */ 00438 8 * sizeof(GLfloat), /* RedBits */ 00439 8 * sizeof(GLfloat), /* GreenBits */ 00440 8 * sizeof(GLfloat), /* BlueBits */ 00441 0, /* AlphaBits */ 00442 0, /* LuminanceBits */ 00443 0, /* IntensityBits */ 00444 0, /* IndexBits */ 00445 0, /* DepthBits */ 00446 0, /* StencilBits */ 00447 3 * sizeof(GLfloat), /* TexelBytes */ 00448 _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ 00449 NULL, /* FetchTexel1D */ 00450 NULL, /* FetchTexel1D */ 00451 NULL, /* FetchTexel1D */ 00452 fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ 00453 fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ 00454 fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ 00455 store_texel_rgb_f32 /* StoreTexel */ 00456 }; 00457 00458 const struct gl_texture_format _mesa_texformat_rgb_float16 = { 00459 MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ 00460 GL_RGB, /* BaseFormat */ 00461 GL_FLOAT, /* DataType */ 00462 8 * sizeof(GLhalfARB), /* RedBits */ 00463 8 * sizeof(GLhalfARB), /* GreenBits */ 00464 8 * sizeof(GLhalfARB), /* BlueBits */ 00465 0, /* AlphaBits */ 00466 0, /* LuminanceBits */ 00467 0, /* IntensityBits */ 00468 0, /* IndexBits */ 00469 0, /* DepthBits */ 00470 0, /* StencilBits */ 00471 3 * sizeof(GLhalfARB), /* TexelBytes */ 00472 _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ 00473 NULL, /* FetchTexel1D */ 00474 NULL, /* FetchTexel1D */ 00475 NULL, /* FetchTexel1D */ 00476 fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ 00477 fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ 00478 fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ 00479 store_texel_rgb_f16 /* StoreTexel */ 00480 }; 00481 00482 const struct gl_texture_format _mesa_texformat_alpha_float32 = { 00483 MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ 00484 GL_ALPHA, /* BaseFormat */ 00485 GL_FLOAT, /* DataType */ 00486 0, /* RedBits */ 00487 0, /* GreenBits */ 00488 0, /* BlueBits */ 00489 8 * sizeof(GLfloat), /* AlphaBits */ 00490 0, /* LuminanceBits */ 00491 0, /* IntensityBits */ 00492 0, /* IndexBits */ 00493 0, /* DepthBits */ 00494 0, /* StencilBits */ 00495 1 * sizeof(GLfloat), /* TexelBytes */ 00496 _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ 00497 NULL, /* FetchTexel1D */ 00498 NULL, /* FetchTexel1D */ 00499 NULL, /* FetchTexel1D */ 00500 fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ 00501 fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ 00502 fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ 00503 store_texel_alpha_f32 /* StoreTexel */ 00504 }; 00505 00506 const struct gl_texture_format _mesa_texformat_alpha_float16 = { 00507 MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ 00508 GL_ALPHA, /* BaseFormat */ 00509 GL_FLOAT, /* DataType */ 00510 0, /* RedBits */ 00511 0, /* GreenBits */ 00512 0, /* BlueBits */ 00513 8 * sizeof(GLhalfARB), /* AlphaBits */ 00514 0, /* LuminanceBits */ 00515 0, /* IntensityBits */ 00516 0, /* IndexBits */ 00517 0, /* DepthBits */ 00518 0, /* StencilBits */ 00519 1 * sizeof(GLhalfARB), /* TexelBytes */ 00520 _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ 00521 NULL, /* FetchTexel1D */ 00522 NULL, /* FetchTexel1D */ 00523 NULL, /* FetchTexel1D */ 00524 fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ 00525 fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ 00526 fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ 00527 store_texel_alpha_f16 /* StoreTexel */ 00528 }; 00529 00530 const struct gl_texture_format _mesa_texformat_luminance_float32 = { 00531 MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ 00532 GL_LUMINANCE, /* BaseFormat */ 00533 GL_FLOAT, /* DataType */ 00534 0, /* RedBits */ 00535 0, /* GreenBits */ 00536 0, /* BlueBits */ 00537 0, /* AlphaBits */ 00538 8 * sizeof(GLfloat), /* LuminanceBits */ 00539 0, /* IntensityBits */ 00540 0, /* IndexBits */ 00541 0, /* DepthBits */ 00542 0, /* StencilBits */ 00543 1 * sizeof(GLfloat), /* TexelBytes */ 00544 _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ 00545 NULL, /* FetchTexel1D */ 00546 NULL, /* FetchTexel2D */ 00547 NULL, /* FetchTexel3D */ 00548 fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ 00549 fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ 00550 fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ 00551 store_texel_luminance_f32 /* StoreTexel */ 00552 }; 00553 00554 const struct gl_texture_format _mesa_texformat_luminance_float16 = { 00555 MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ 00556 GL_LUMINANCE, /* BaseFormat */ 00557 GL_FLOAT, /* DataType */ 00558 0, /* RedBits */ 00559 0, /* GreenBits */ 00560 0, /* BlueBits */ 00561 0, /* AlphaBits */ 00562 8 * sizeof(GLhalfARB), /* LuminanceBits */ 00563 0, /* IntensityBits */ 00564 0, /* IndexBits */ 00565 0, /* DepthBits */ 00566 0, /* StencilBits */ 00567 1 * sizeof(GLhalfARB), /* TexelBytes */ 00568 _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ 00569 NULL, /* FetchTexel1D */ 00570 NULL, /* FetchTexel2D */ 00571 NULL, /* FetchTexel3D */ 00572 fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ 00573 fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ 00574 fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ 00575 store_texel_luminance_f16 /* StoreTexel */ 00576 }; 00577 00578 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { 00579 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ 00580 GL_LUMINANCE_ALPHA, /* BaseFormat */ 00581 GL_FLOAT, /* DataType */ 00582 0, /* RedBits */ 00583 0, /* GreenBits */ 00584 0, /* BlueBits */ 00585 8 * sizeof(GLfloat), /* AlphaBits */ 00586 8 * sizeof(GLfloat), /* LuminanceBits */ 00587 0, /* IntensityBits */ 00588 0, /* IndexBits */ 00589 0, /* DepthBits */ 00590 0, /* StencilBits */ 00591 2 * sizeof(GLfloat), /* TexelBytes */ 00592 _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ 00593 NULL, /* FetchTexel1D */ 00594 NULL, /* FetchTexel2D */ 00595 NULL, /* FetchTexel3D */ 00596 fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ 00597 fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ 00598 fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ 00599 store_texel_luminance_alpha_f32 /* StoreTexel */ 00600 }; 00601 00602 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { 00603 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ 00604 GL_LUMINANCE_ALPHA, /* BaseFormat */ 00605 GL_FLOAT, /* DataType */ 00606 0, /* RedBits */ 00607 0, /* GreenBits */ 00608 0, /* BlueBits */ 00609 8 * sizeof(GLhalfARB), /* AlphaBits */ 00610 8 * sizeof(GLhalfARB), /* LuminanceBits */ 00611 0, /* IntensityBits */ 00612 0, /* IndexBits */ 00613 0, /* DepthBits */ 00614 0, /* StencilBits */ 00615 2 * sizeof(GLhalfARB), /* TexelBytes */ 00616 _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ 00617 NULL, /* FetchTexel1D */ 00618 NULL, /* FetchTexel2D */ 00619 NULL, /* FetchTexel3D */ 00620 fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ 00621 fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ 00622 fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ 00623 store_texel_luminance_alpha_f16 /* StoreTexel */ 00624 }; 00625 00626 const struct gl_texture_format _mesa_texformat_intensity_float32 = { 00627 MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ 00628 GL_INTENSITY, /* BaseFormat */ 00629 GL_FLOAT, /* DataType */ 00630 0, /* RedBits */ 00631 0, /* GreenBits */ 00632 0, /* BlueBits */ 00633 0, /* AlphaBits */ 00634 0, /* LuminanceBits */ 00635 8 * sizeof(GLfloat), /* IntensityBits */ 00636 0, /* IndexBits */ 00637 0, /* DepthBits */ 00638 0, /* StencilBits */ 00639 1 * sizeof(GLfloat), /* TexelBytes */ 00640 _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ 00641 NULL, /* FetchTexel1D */ 00642 NULL, /* FetchTexel2D */ 00643 NULL, /* FetchTexel3D */ 00644 fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ 00645 fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ 00646 fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ 00647 store_texel_intensity_f32 /* StoreTexel */ 00648 }; 00649 00650 const struct gl_texture_format _mesa_texformat_intensity_float16 = { 00651 MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ 00652 GL_INTENSITY, /* BaseFormat */ 00653 GL_FLOAT, /* DataType */ 00654 0, /* RedBits */ 00655 0, /* GreenBits */ 00656 0, /* BlueBits */ 00657 0, /* AlphaBits */ 00658 0, /* LuminanceBits */ 00659 8 * sizeof(GLhalfARB), /* IntensityBits */ 00660 0, /* IndexBits */ 00661 0, /* DepthBits */ 00662 0, /* StencilBits */ 00663 1 * sizeof(GLhalfARB), /* TexelBytes */ 00664 _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ 00665 NULL, /* FetchTexel1D */ 00666 NULL, /* FetchTexel2D */ 00667 NULL, /* FetchTexel3D */ 00668 fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ 00669 fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ 00670 fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ 00671 store_texel_intensity_f16 /* StoreTexel */ 00672 }; 00673 00674 00678 /***************************************************************/ 00681 00682 const struct gl_texture_format _mesa_texformat_rgba8888 = { 00683 MESA_FORMAT_RGBA8888, /* MesaFormat */ 00684 GL_RGBA, /* BaseFormat */ 00685 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00686 8, /* RedBits */ 00687 8, /* GreenBits */ 00688 8, /* BlueBits */ 00689 8, /* AlphaBits */ 00690 0, /* LuminanceBits */ 00691 0, /* IntensityBits */ 00692 0, /* IndexBits */ 00693 0, /* DepthBits */ 00694 0, /* StencilBits */ 00695 4, /* TexelBytes */ 00696 _mesa_texstore_rgba8888, /* StoreTexImageFunc */ 00697 fetch_texel_1d_rgba8888, /* FetchTexel1D */ 00698 fetch_texel_2d_rgba8888, /* FetchTexel2D */ 00699 fetch_texel_3d_rgba8888, /* FetchTexel3D */ 00700 NULL, /* FetchTexel1Df */ 00701 NULL, /* FetchTexel2Df */ 00702 NULL, /* FetchTexel3Df */ 00703 store_texel_rgba8888 /* StoreTexel */ 00704 }; 00705 00706 const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 00707 MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ 00708 GL_RGBA, /* BaseFormat */ 00709 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00710 8, /* RedBits */ 00711 8, /* GreenBits */ 00712 8, /* BlueBits */ 00713 8, /* AlphaBits */ 00714 0, /* LuminanceBits */ 00715 0, /* IntensityBits */ 00716 0, /* IndexBits */ 00717 0, /* DepthBits */ 00718 0, /* StencilBits */ 00719 4, /* TexelBytes */ 00720 _mesa_texstore_rgba8888, /* StoreTexImageFunc */ 00721 fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ 00722 fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ 00723 fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ 00724 NULL, /* FetchTexel1Df */ 00725 NULL, /* FetchTexel2Df */ 00726 NULL, /* FetchTexel3Df */ 00727 store_texel_rgba8888_rev /* StoreTexel */ 00728 }; 00729 00730 const struct gl_texture_format _mesa_texformat_argb8888 = { 00731 MESA_FORMAT_ARGB8888, /* MesaFormat */ 00732 GL_RGBA, /* BaseFormat */ 00733 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00734 8, /* RedBits */ 00735 8, /* GreenBits */ 00736 8, /* BlueBits */ 00737 8, /* AlphaBits */ 00738 0, /* LuminanceBits */ 00739 0, /* IntensityBits */ 00740 0, /* IndexBits */ 00741 0, /* DepthBits */ 00742 0, /* StencilBits */ 00743 4, /* TexelBytes */ 00744 _mesa_texstore_argb8888, /* StoreTexImageFunc */ 00745 fetch_texel_1d_argb8888, /* FetchTexel1D */ 00746 fetch_texel_2d_argb8888, /* FetchTexel2D */ 00747 fetch_texel_3d_argb8888, /* FetchTexel3D */ 00748 NULL, /* FetchTexel1Df */ 00749 NULL, /* FetchTexel2Df */ 00750 NULL, /* FetchTexel3Df */ 00751 store_texel_argb8888 /* StoreTexel */ 00752 }; 00753 00754 const struct gl_texture_format _mesa_texformat_argb8888_rev = { 00755 MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ 00756 GL_RGBA, /* BaseFormat */ 00757 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00758 8, /* RedBits */ 00759 8, /* GreenBits */ 00760 8, /* BlueBits */ 00761 8, /* AlphaBits */ 00762 0, /* LuminanceBits */ 00763 0, /* IntensityBits */ 00764 0, /* IndexBits */ 00765 0, /* DepthBits */ 00766 0, /* StencilBits */ 00767 4, /* TexelBytes */ 00768 _mesa_texstore_argb8888, /* StoreTexImageFunc */ 00769 fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ 00770 fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ 00771 fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ 00772 NULL, /* FetchTexel1Df */ 00773 NULL, /* FetchTexel2Df */ 00774 NULL, /* FetchTexel3Df */ 00775 store_texel_argb8888_rev /* StoreTexel */ 00776 }; 00777 00778 const struct gl_texture_format _mesa_texformat_rgb888 = { 00779 MESA_FORMAT_RGB888, /* MesaFormat */ 00780 GL_RGB, /* BaseFormat */ 00781 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00782 8, /* RedBits */ 00783 8, /* GreenBits */ 00784 8, /* BlueBits */ 00785 0, /* AlphaBits */ 00786 0, /* LuminanceBits */ 00787 0, /* IntensityBits */ 00788 0, /* IndexBits */ 00789 0, /* DepthBits */ 00790 0, /* StencilBits */ 00791 3, /* TexelBytes */ 00792 _mesa_texstore_rgb888, /* StoreTexImageFunc */ 00793 fetch_texel_1d_rgb888, /* FetchTexel1D */ 00794 fetch_texel_2d_rgb888, /* FetchTexel2D */ 00795 fetch_texel_3d_rgb888, /* FetchTexel3D */ 00796 NULL, /* FetchTexel1Df */ 00797 NULL, /* FetchTexel2Df */ 00798 NULL, /* FetchTexel3Df */ 00799 store_texel_rgb888 /* StoreTexel */ 00800 }; 00801 00802 const struct gl_texture_format _mesa_texformat_bgr888 = { 00803 MESA_FORMAT_BGR888, /* MesaFormat */ 00804 GL_RGB, /* BaseFormat */ 00805 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00806 8, /* RedBits */ 00807 8, /* GreenBits */ 00808 8, /* BlueBits */ 00809 0, /* AlphaBits */ 00810 0, /* LuminanceBits */ 00811 0, /* IntensityBits */ 00812 0, /* IndexBits */ 00813 0, /* DepthBits */ 00814 0, /* StencilBits */ 00815 3, /* TexelBytes */ 00816 _mesa_texstore_bgr888, /* StoreTexImageFunc */ 00817 fetch_texel_1d_bgr888, /* FetchTexel1D */ 00818 fetch_texel_2d_bgr888, /* FetchTexel2D */ 00819 fetch_texel_3d_bgr888, /* FetchTexel3D */ 00820 NULL, /* FetchTexel1Df */ 00821 NULL, /* FetchTexel2Df */ 00822 NULL, /* FetchTexel3Df */ 00823 store_texel_bgr888 /* StoreTexel */ 00824 }; 00825 00826 const struct gl_texture_format _mesa_texformat_rgb565 = { 00827 MESA_FORMAT_RGB565, /* MesaFormat */ 00828 GL_RGB, /* BaseFormat */ 00829 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00830 5, /* RedBits */ 00831 6, /* GreenBits */ 00832 5, /* BlueBits */ 00833 0, /* AlphaBits */ 00834 0, /* LuminanceBits */ 00835 0, /* IntensityBits */ 00836 0, /* IndexBits */ 00837 0, /* DepthBits */ 00838 0, /* StencilBits */ 00839 2, /* TexelBytes */ 00840 _mesa_texstore_rgb565, /* StoreTexImageFunc */ 00841 fetch_texel_1d_rgb565, /* FetchTexel1D */ 00842 fetch_texel_2d_rgb565, /* FetchTexel2D */ 00843 fetch_texel_3d_rgb565, /* FetchTexel3D */ 00844 NULL, /* FetchTexel1Df */ 00845 NULL, /* FetchTexel2Df */ 00846 NULL, /* FetchTexel3Df */ 00847 store_texel_rgb565 /* StoreTexel */ 00848 }; 00849 00850 const struct gl_texture_format _mesa_texformat_rgb565_rev = { 00851 MESA_FORMAT_RGB565_REV, /* MesaFormat */ 00852 GL_RGB, /* BaseFormat */ 00853 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00854 5, /* RedBits */ 00855 6, /* GreenBits */ 00856 5, /* BlueBits */ 00857 0, /* AlphaBits */ 00858 0, /* LuminanceBits */ 00859 0, /* IntensityBits */ 00860 0, /* IndexBits */ 00861 0, /* DepthBits */ 00862 0, /* StencilBits */ 00863 2, /* TexelBytes */ 00864 _mesa_texstore_rgb565, /* StoreTexImageFunc */ 00865 fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ 00866 fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ 00867 fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ 00868 NULL, /* FetchTexel1Df */ 00869 NULL, /* FetchTexel2Df */ 00870 NULL, /* FetchTexel3Df */ 00871 store_texel_rgb565_rev /* StoreTexel */ 00872 }; 00873 00874 const struct gl_texture_format _mesa_texformat_rgba4444 = { 00875 MESA_FORMAT_RGBA4444, /* MesaFormat */ 00876 GL_RGBA, /* BaseFormat */ 00877 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00878 4, /* RedBits */ 00879 4, /* GreenBits */ 00880 4, /* BlueBits */ 00881 4, /* AlphaBits */ 00882 0, /* LuminanceBits */ 00883 0, /* IntensityBits */ 00884 0, /* IndexBits */ 00885 0, /* DepthBits */ 00886 0, /* StencilBits */ 00887 2, /* TexelBytes */ 00888 _mesa_texstore_rgba4444, /* StoreTexImageFunc */ 00889 fetch_texel_1d_rgba4444, /* FetchTexel1D */ 00890 fetch_texel_2d_rgba4444, /* FetchTexel2D */ 00891 fetch_texel_3d_rgba4444, /* FetchTexel3D */ 00892 NULL, /* FetchTexel1Df */ 00893 NULL, /* FetchTexel2Df */ 00894 NULL, /* FetchTexel3Df */ 00895 store_texel_rgba4444 /* StoreTexel */ 00896 }; 00897 00898 const struct gl_texture_format _mesa_texformat_argb4444 = { 00899 MESA_FORMAT_ARGB4444, /* MesaFormat */ 00900 GL_RGBA, /* BaseFormat */ 00901 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00902 4, /* RedBits */ 00903 4, /* GreenBits */ 00904 4, /* BlueBits */ 00905 4, /* AlphaBits */ 00906 0, /* LuminanceBits */ 00907 0, /* IntensityBits */ 00908 0, /* IndexBits */ 00909 0, /* DepthBits */ 00910 0, /* StencilBits */ 00911 2, /* TexelBytes */ 00912 _mesa_texstore_argb4444, /* StoreTexImageFunc */ 00913 fetch_texel_1d_argb4444, /* FetchTexel1D */ 00914 fetch_texel_2d_argb4444, /* FetchTexel2D */ 00915 fetch_texel_3d_argb4444, /* FetchTexel3D */ 00916 NULL, /* FetchTexel1Df */ 00917 NULL, /* FetchTexel2Df */ 00918 NULL, /* FetchTexel3Df */ 00919 store_texel_argb4444 /* StoreTexel */ 00920 }; 00921 00922 const struct gl_texture_format _mesa_texformat_argb4444_rev = { 00923 MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ 00924 GL_RGBA, /* BaseFormat */ 00925 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00926 4, /* RedBits */ 00927 4, /* GreenBits */ 00928 4, /* BlueBits */ 00929 4, /* AlphaBits */ 00930 0, /* LuminanceBits */ 00931 0, /* IntensityBits */ 00932 0, /* IndexBits */ 00933 0, /* DepthBits */ 00934 0, /* StencilBits */ 00935 2, /* TexelBytes */ 00936 _mesa_texstore_argb4444, /* StoreTexImageFunc */ 00937 fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ 00938 fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ 00939 fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ 00940 NULL, /* FetchTexel1Df */ 00941 NULL, /* FetchTexel2Df */ 00942 NULL, /* FetchTexel3Df */ 00943 store_texel_argb4444_rev /* StoreTexel */ 00944 }; 00945 00946 const struct gl_texture_format _mesa_texformat_rgba5551 = { 00947 MESA_FORMAT_RGBA5551, /* MesaFormat */ 00948 GL_RGBA, /* BaseFormat */ 00949 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00950 5, /* RedBits */ 00951 5, /* GreenBits */ 00952 5, /* BlueBits */ 00953 1, /* AlphaBits */ 00954 0, /* LuminanceBits */ 00955 0, /* IntensityBits */ 00956 0, /* IndexBits */ 00957 0, /* DepthBits */ 00958 0, /* StencilBits */ 00959 2, /* TexelBytes */ 00960 _mesa_texstore_rgba5551, /* StoreTexImageFunc */ 00961 fetch_texel_1d_rgba5551, /* FetchTexel1D */ 00962 fetch_texel_2d_rgba5551, /* FetchTexel2D */ 00963 fetch_texel_3d_rgba5551, /* FetchTexel3D */ 00964 NULL, /* FetchTexel1Df */ 00965 NULL, /* FetchTexel2Df */ 00966 NULL, /* FetchTexel3Df */ 00967 store_texel_rgba5551 /* StoreTexel */ 00968 }; 00969 00970 const struct gl_texture_format _mesa_texformat_argb1555 = { 00971 MESA_FORMAT_ARGB1555, /* MesaFormat */ 00972 GL_RGBA, /* BaseFormat */ 00973 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00974 5, /* RedBits */ 00975 5, /* GreenBits */ 00976 5, /* BlueBits */ 00977 1, /* AlphaBits */ 00978 0, /* LuminanceBits */ 00979 0, /* IntensityBits */ 00980 0, /* IndexBits */ 00981 0, /* DepthBits */ 00982 0, /* StencilBits */ 00983 2, /* TexelBytes */ 00984 _mesa_texstore_argb1555, /* StoreTexImageFunc */ 00985 fetch_texel_1d_argb1555, /* FetchTexel1D */ 00986 fetch_texel_2d_argb1555, /* FetchTexel2D */ 00987 fetch_texel_3d_argb1555, /* FetchTexel3D */ 00988 NULL, /* FetchTexel1Df */ 00989 NULL, /* FetchTexel2Df */ 00990 NULL, /* FetchTexel3Df */ 00991 store_texel_argb1555 /* StoreTexel */ 00992 }; 00993 00994 const struct gl_texture_format _mesa_texformat_argb1555_rev = { 00995 MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ 00996 GL_RGBA, /* BaseFormat */ 00997 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 00998 5, /* RedBits */ 00999 5, /* GreenBits */ 01000 5, /* BlueBits */ 01001 1, /* AlphaBits */ 01002 0, /* LuminanceBits */ 01003 0, /* IntensityBits */ 01004 0, /* IndexBits */ 01005 0, /* DepthBits */ 01006 0, /* StencilBits */ 01007 2, /* TexelBytes */ 01008 _mesa_texstore_argb1555, /* StoreTexImageFunc */ 01009 fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ 01010 fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ 01011 fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ 01012 NULL, /* FetchTexel1Df */ 01013 NULL, /* FetchTexel2Df */ 01014 NULL, /* FetchTexel3Df */ 01015 store_texel_argb1555_rev /* StoreTexel */ 01016 }; 01017 01018 const struct gl_texture_format _mesa_texformat_al88 = { 01019 MESA_FORMAT_AL88, /* MesaFormat */ 01020 GL_LUMINANCE_ALPHA, /* BaseFormat */ 01021 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01022 0, /* RedBits */ 01023 0, /* GreenBits */ 01024 0, /* BlueBits */ 01025 8, /* AlphaBits */ 01026 8, /* LuminanceBits */ 01027 0, /* IntensityBits */ 01028 0, /* IndexBits */ 01029 0, /* DepthBits */ 01030 0, /* StencilBits */ 01031 2, /* TexelBytes */ 01032 _mesa_texstore_al88, /* StoreTexImageFunc */ 01033 fetch_texel_1d_al88, /* FetchTexel1D */ 01034 fetch_texel_2d_al88, /* FetchTexel2D */ 01035 fetch_texel_3d_al88, /* FetchTexel3D */ 01036 NULL, /* FetchTexel1Df */ 01037 NULL, /* FetchTexel2Df */ 01038 NULL, /* FetchTexel3Df */ 01039 store_texel_al88 /* StoreTexel */ 01040 }; 01041 01042 const struct gl_texture_format _mesa_texformat_al88_rev = { 01043 MESA_FORMAT_AL88_REV, /* MesaFormat */ 01044 GL_LUMINANCE_ALPHA, /* BaseFormat */ 01045 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01046 0, /* RedBits */ 01047 0, /* GreenBits */ 01048 0, /* BlueBits */ 01049 8, /* AlphaBits */ 01050 8, /* LuminanceBits */ 01051 0, /* IntensityBits */ 01052 0, /* IndexBits */ 01053 0, /* DepthBits */ 01054 0, /* StencilBits */ 01055 2, /* TexelBytes */ 01056 _mesa_texstore_al88, /* StoreTexImageFunc */ 01057 fetch_texel_1d_al88_rev, /* FetchTexel1D */ 01058 fetch_texel_2d_al88_rev, /* FetchTexel2D */ 01059 fetch_texel_3d_al88_rev, /* FetchTexel3D */ 01060 NULL, /* FetchTexel1Df */ 01061 NULL, /* FetchTexel2Df */ 01062 NULL, /* FetchTexel3Df */ 01063 store_texel_al88_rev /* StoreTexel */ 01064 }; 01065 01066 const struct gl_texture_format _mesa_texformat_rgb332 = { 01067 MESA_FORMAT_RGB332, /* MesaFormat */ 01068 GL_RGB, /* BaseFormat */ 01069 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01070 3, /* RedBits */ 01071 3, /* GreenBits */ 01072 2, /* BlueBits */ 01073 0, /* AlphaBits */ 01074 0, /* LuminanceBits */ 01075 0, /* IntensityBits */ 01076 0, /* IndexBits */ 01077 0, /* DepthBits */ 01078 0, /* StencilBits */ 01079 1, /* TexelBytes */ 01080 _mesa_texstore_rgb332, /* StoreTexImageFunc */ 01081 fetch_texel_1d_rgb332, /* FetchTexel1D */ 01082 fetch_texel_2d_rgb332, /* FetchTexel2D */ 01083 fetch_texel_3d_rgb332, /* FetchTexel3D */ 01084 NULL, /* FetchTexel1Df */ 01085 NULL, /* FetchTexel2Df */ 01086 NULL, /* FetchTexel3Df */ 01087 store_texel_rgb332 /* StoreTexel */ 01088 }; 01089 01090 const struct gl_texture_format _mesa_texformat_a8 = { 01091 MESA_FORMAT_A8, /* MesaFormat */ 01092 GL_ALPHA, /* BaseFormat */ 01093 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01094 0, /* RedBits */ 01095 0, /* GreenBits */ 01096 0, /* BlueBits */ 01097 8, /* AlphaBits */ 01098 0, /* LuminanceBits */ 01099 0, /* IntensityBits */ 01100 0, /* IndexBits */ 01101 0, /* DepthBits */ 01102 0, /* StencilBits */ 01103 1, /* TexelBytes */ 01104 _mesa_texstore_a8, /* StoreTexImageFunc */ 01105 fetch_texel_1d_a8, /* FetchTexel1D */ 01106 fetch_texel_2d_a8, /* FetchTexel2D */ 01107 fetch_texel_3d_a8, /* FetchTexel3D */ 01108 NULL, /* FetchTexel1Df */ 01109 NULL, /* FetchTexel2Df */ 01110 NULL, /* FetchTexel3Df */ 01111 store_texel_a8 /* StoreTexel */ 01112 }; 01113 01114 const struct gl_texture_format _mesa_texformat_l8 = { 01115 MESA_FORMAT_L8, /* MesaFormat */ 01116 GL_LUMINANCE, /* BaseFormat */ 01117 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01118 0, /* RedBits */ 01119 0, /* GreenBits */ 01120 0, /* BlueBits */ 01121 0, /* AlphaBits */ 01122 8, /* LuminanceBits */ 01123 0, /* IntensityBits */ 01124 0, /* IndexBits */ 01125 0, /* DepthBits */ 01126 0, /* StencilBits */ 01127 1, /* TexelBytes */ 01128 _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ 01129 fetch_texel_1d_l8, /* FetchTexel1D */ 01130 fetch_texel_2d_l8, /* FetchTexel2D */ 01131 fetch_texel_3d_l8, /* FetchTexel3D */ 01132 NULL, /* FetchTexel1Df */ 01133 NULL, /* FetchTexel2Df */ 01134 NULL, /* FetchTexel3Df */ 01135 store_texel_l8 /* StoreTexel */ 01136 }; 01137 01138 const struct gl_texture_format _mesa_texformat_i8 = { 01139 MESA_FORMAT_I8, /* MesaFormat */ 01140 GL_INTENSITY, /* BaseFormat */ 01141 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01142 0, /* RedBits */ 01143 0, /* GreenBits */ 01144 0, /* BlueBits */ 01145 0, /* AlphaBits */ 01146 0, /* LuminanceBits */ 01147 8, /* IntensityBits */ 01148 0, /* IndexBits */ 01149 0, /* DepthBits */ 01150 0, /* StencilBits */ 01151 1, /* TexelBytes */ 01152 _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ 01153 fetch_texel_1d_i8, /* FetchTexel1D */ 01154 fetch_texel_2d_i8, /* FetchTexel2D */ 01155 fetch_texel_3d_i8, /* FetchTexel3D */ 01156 NULL, /* FetchTexel1Df */ 01157 NULL, /* FetchTexel2Df */ 01158 NULL, /* FetchTexel3Df */ 01159 store_texel_i8 /* StoreTexel */ 01160 }; 01161 01162 const struct gl_texture_format _mesa_texformat_ci8 = { 01163 MESA_FORMAT_CI8, /* MesaFormat */ 01164 GL_COLOR_INDEX, /* BaseFormat */ 01165 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01166 0, /* RedBits */ 01167 0, /* GreenBits */ 01168 0, /* BlueBits */ 01169 0, /* AlphaBits */ 01170 0, /* LuminanceBits */ 01171 0, /* IntensityBits */ 01172 8, /* IndexBits */ 01173 0, /* DepthBits */ 01174 0, /* StencilBits */ 01175 1, /* TexelBytes */ 01176 _mesa_texstore_ci8, /* StoreTexImageFunc */ 01177 fetch_texel_1d_ci8, /* FetchTexel1D */ 01178 fetch_texel_2d_ci8, /* FetchTexel2D */ 01179 fetch_texel_3d_ci8, /* FetchTexel3D */ 01180 NULL, /* FetchTexel1Df */ 01181 NULL, /* FetchTexel2Df */ 01182 NULL, /* FetchTexel3Df */ 01183 store_texel_ci8 /* StoreTexel */ 01184 }; 01185 01186 const struct gl_texture_format _mesa_texformat_ycbcr = { 01187 MESA_FORMAT_YCBCR, /* MesaFormat */ 01188 GL_YCBCR_MESA, /* BaseFormat */ 01189 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01190 0, /* RedBits */ 01191 0, /* GreenBits */ 01192 0, /* BlueBits */ 01193 0, /* AlphaBits */ 01194 0, /* LuminanceBits */ 01195 0, /* IntensityBits */ 01196 0, /* IndexBits */ 01197 0, /* DepthBits */ 01198 0, /* StencilBits */ 01199 2, /* TexelBytes */ 01200 _mesa_texstore_ycbcr, /* StoreTexImageFunc */ 01201 fetch_texel_1d_ycbcr, /* FetchTexel1D */ 01202 fetch_texel_2d_ycbcr, /* FetchTexel2D */ 01203 fetch_texel_3d_ycbcr, /* FetchTexel3D */ 01204 NULL, /* FetchTexel1Df */ 01205 NULL, /* FetchTexel2Df */ 01206 NULL, /* FetchTexel3Df */ 01207 store_texel_ycbcr /* StoreTexel */ 01208 }; 01209 01210 const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 01211 MESA_FORMAT_YCBCR_REV, /* MesaFormat */ 01212 GL_YCBCR_MESA, /* BaseFormat */ 01213 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01214 0, /* RedBits */ 01215 0, /* GreenBits */ 01216 0, /* BlueBits */ 01217 0, /* AlphaBits */ 01218 0, /* LuminanceBits */ 01219 0, /* IntensityBits */ 01220 0, /* IndexBits */ 01221 0, /* DepthBits */ 01222 0, /* StencilBits */ 01223 2, /* TexelBytes */ 01224 _mesa_texstore_ycbcr, /* StoreTexImageFunc */ 01225 fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ 01226 fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ 01227 fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ 01228 NULL, /* FetchTexel1Df */ 01229 NULL, /* FetchTexel2Df */ 01230 NULL, /* FetchTexel3Df */ 01231 store_texel_ycbcr_rev /* StoreTexel */ 01232 }; 01233 01234 const struct gl_texture_format _mesa_texformat_z24_s8 = { 01235 MESA_FORMAT_Z24_S8, /* MesaFormat */ 01236 GL_DEPTH_STENCIL_EXT, /* BaseFormat */ 01237 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01238 0, /* RedBits */ 01239 0, /* GreenBits */ 01240 0, /* BlueBits */ 01241 0, /* AlphaBits */ 01242 0, /* LuminanceBits */ 01243 0, /* IntensityBits */ 01244 0, /* IndexBits */ 01245 24, /* DepthBits */ 01246 8, /* StencilBits */ 01247 4, /* TexelBytes */ 01248 _mesa_texstore_z24_s8, /* StoreTexImageFunc */ 01249 NULL, /* FetchTexel1D */ 01250 NULL, /* FetchTexel2D */ 01251 NULL, /* FetchTexel3D */ 01252 fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ 01253 fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ 01254 fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ 01255 store_texel_z24_s8 /* StoreTexel */ 01256 }; 01257 01258 const struct gl_texture_format _mesa_texformat_s8_z24 = { 01259 MESA_FORMAT_S8_Z24, /* MesaFormat */ 01260 GL_DEPTH_STENCIL_EXT, /* BaseFormat */ 01261 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01262 0, /* RedBits */ 01263 0, /* GreenBits */ 01264 0, /* BlueBits */ 01265 0, /* AlphaBits */ 01266 0, /* LuminanceBits */ 01267 0, /* IntensityBits */ 01268 0, /* IndexBits */ 01269 24, /* DepthBits */ 01270 8, /* StencilBits */ 01271 4, /* TexelBytes */ 01272 _mesa_texstore_s8_z24, /* StoreTexImageFunc */ 01273 NULL, /* FetchTexel1D */ 01274 NULL, /* FetchTexel2D */ 01275 NULL, /* FetchTexel3D */ 01276 fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ 01277 fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ 01278 fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ 01279 store_texel_s8_z24 /* StoreTexel */ 01280 }; 01281 01282 const struct gl_texture_format _mesa_texformat_z16 = { 01283 MESA_FORMAT_Z16, /* MesaFormat */ 01284 GL_DEPTH_COMPONENT, /* BaseFormat */ 01285 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01286 0, /* RedBits */ 01287 0, /* GreenBits */ 01288 0, /* BlueBits */ 01289 0, /* AlphaBits */ 01290 0, /* LuminanceBits */ 01291 0, /* IntensityBits */ 01292 0, /* IndexBits */ 01293 sizeof(GLushort) * 8, /* DepthBits */ 01294 0, /* StencilBits */ 01295 sizeof(GLushort), /* TexelBytes */ 01296 _mesa_texstore_z16, /* StoreTexImageFunc */ 01297 NULL, /* FetchTexel1D */ 01298 NULL, /* FetchTexel1D */ 01299 NULL, /* FetchTexel1D */ 01300 fetch_texel_1d_f_z16, /* FetchTexel1Df */ 01301 fetch_texel_2d_f_z16, /* FetchTexel2Df */ 01302 fetch_texel_3d_f_z16, /* FetchTexel3Df */ 01303 store_texel_z16 /* StoreTexel */ 01304 }; 01305 01306 const struct gl_texture_format _mesa_texformat_z32 = { 01307 MESA_FORMAT_Z32, /* MesaFormat */ 01308 GL_DEPTH_COMPONENT, /* BaseFormat */ 01309 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 01310 0, /* RedBits */ 01311 0, /* GreenBits */ 01312 0, /* BlueBits */ 01313 0, /* AlphaBits */ 01314 0, /* LuminanceBits */ 01315 0, /* IntensityBits */ 01316 0, /* IndexBits */ 01317 sizeof(GLuint) * 8, /* DepthBits */ 01318 0, /* StencilBits */ 01319 sizeof(GLuint), /* TexelBytes */ 01320 _mesa_texstore_z32, /* StoreTexImageFunc */ 01321 NULL, /* FetchTexel1D */ 01322 NULL, /* FetchTexel1D */ 01323 NULL, /* FetchTexel1D */ 01324 fetch_texel_1d_f_z32, /* FetchTexel1Df */ 01325 fetch_texel_2d_f_z32, /* FetchTexel2Df */ 01326 fetch_texel_3d_f_z32, /* FetchTexel3Df */ 01327 store_texel_z32 /* StoreTexel */ 01328 }; 01329 01333 /***************************************************************/ 01336 01337 const struct gl_texture_format _mesa_null_texformat = { 01338 -1, /* MesaFormat */ 01339 0, /* BaseFormat */ 01340 GL_NONE, /* DataType */ 01341 0, /* RedBits */ 01342 0, /* GreenBits */ 01343 0, /* BlueBits */ 01344 0, /* AlphaBits */ 01345 0, /* LuminanceBits */ 01346 0, /* IntensityBits */ 01347 0, /* IndexBits */ 01348 0, /* DepthBits */ 01349 0, /* StencilBits */ 01350 0, /* TexelBytes */ 01351 NULL, /* StoreTexImageFunc */ 01352 fetch_null_texel, /* FetchTexel1D */ 01353 fetch_null_texel, /* FetchTexel2D */ 01354 fetch_null_texel, /* FetchTexel3D */ 01355 fetch_null_texelf, /* FetchTexel1Df */ 01356 fetch_null_texelf, /* FetchTexel2Df */ 01357 fetch_null_texelf, /* FetchTexel3Df */ 01358 store_null_texel /* StoreTexel */ 01359 }; 01360 01379 const struct gl_texture_format * 01380 _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 01381 GLenum format, GLenum type ) 01382 { 01383 (void) format; 01384 (void) type; 01385 01386 switch (internalFormat) { 01387 /* RGBA formats */ 01388 case 4: 01389 case GL_RGBA: 01390 case GL_RGB10_A2: 01391 case GL_RGBA12: 01392 case GL_RGBA16: 01393 return &_mesa_texformat_rgba; 01394 case GL_RGBA8: 01395 return &_mesa_texformat_rgba8888; 01396 case GL_RGB5_A1: 01397 return &_mesa_texformat_argb1555; 01398 case GL_RGBA2: 01399 return &_mesa_texformat_argb4444_rev; /* just to test another format*/ 01400 case GL_RGBA4: 01401 return &_mesa_texformat_argb4444; 01402 01403 /* RGB formats */ 01404 case 3: 01405 case GL_RGB: 01406 case GL_RGB10: 01407 case GL_RGB12: 01408 case GL_RGB16: 01409 return &_mesa_texformat_rgb; 01410 case GL_RGB8: 01411 return &_mesa_texformat_rgb888; 01412 case GL_R3_G3_B2: 01413 return &_mesa_texformat_rgb332; 01414 case GL_RGB4: 01415 return &_mesa_texformat_rgb565_rev; /* just to test another format */ 01416 case GL_RGB5: 01417 return &_mesa_texformat_rgb565; 01418 01419 /* Alpha formats */ 01420 case GL_ALPHA: 01421 case GL_ALPHA4: 01422 case GL_ALPHA12: 01423 case GL_ALPHA16: 01424 return &_mesa_texformat_alpha; 01425 case GL_ALPHA8: 01426 return &_mesa_texformat_a8; 01427 01428 /* Luminance formats */ 01429 case 1: 01430 case GL_LUMINANCE: 01431 case GL_LUMINANCE4: 01432 case GL_LUMINANCE12: 01433 case GL_LUMINANCE16: 01434 return &_mesa_texformat_luminance; 01435 case GL_LUMINANCE8: 01436 return &_mesa_texformat_l8; 01437 01438 /* Luminance/Alpha formats */ 01439 case 2: 01440 case GL_LUMINANCE_ALPHA: 01441 case GL_LUMINANCE4_ALPHA4: 01442 case GL_LUMINANCE6_ALPHA2: 01443 case GL_LUMINANCE12_ALPHA4: 01444 case GL_LUMINANCE12_ALPHA12: 01445 case GL_LUMINANCE16_ALPHA16: 01446 return &_mesa_texformat_luminance_alpha; 01447 case GL_LUMINANCE8_ALPHA8: 01448 return &_mesa_texformat_al88; 01449 01450 case GL_INTENSITY: 01451 case GL_INTENSITY4: 01452 case GL_INTENSITY12: 01453 case GL_INTENSITY16: 01454 return &_mesa_texformat_intensity; 01455 case GL_INTENSITY8: 01456 return &_mesa_texformat_i8; 01457 01458 case GL_COLOR_INDEX: 01459 case GL_COLOR_INDEX1_EXT: 01460 case GL_COLOR_INDEX2_EXT: 01461 case GL_COLOR_INDEX4_EXT: 01462 case GL_COLOR_INDEX12_EXT: 01463 case GL_COLOR_INDEX16_EXT: 01464 case GL_COLOR_INDEX8_EXT: 01465 return &_mesa_texformat_ci8; 01466 01467 default: 01468 ; /* fallthrough */ 01469 } 01470 01471 if (ctx->Extensions.ARB_depth_texture) { 01472 switch (internalFormat) { 01473 case GL_DEPTH_COMPONENT: 01474 case GL_DEPTH_COMPONENT24: 01475 case GL_DEPTH_COMPONENT32: 01476 return &_mesa_texformat_z32; 01477 case GL_DEPTH_COMPONENT16: 01478 return &_mesa_texformat_z16; 01479 default: 01480 ; /* fallthrough */ 01481 } 01482 } 01483 01484 if (ctx->Extensions.ARB_texture_compression) { 01485 switch (internalFormat) { 01486 case GL_COMPRESSED_ALPHA_ARB: 01487 return &_mesa_texformat_alpha; 01488 case GL_COMPRESSED_LUMINANCE_ARB: 01489 return &_mesa_texformat_luminance; 01490 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: 01491 return &_mesa_texformat_luminance_alpha; 01492 case GL_COMPRESSED_INTENSITY_ARB: 01493 return &_mesa_texformat_intensity; 01494 case GL_COMPRESSED_RGB_ARB: 01495 #if FEATURE_texture_fxt1 01496 if (ctx->Extensions.TDFX_texture_compression_FXT1) 01497 return &_mesa_texformat_rgb_fxt1; 01498 #endif 01499 #if FEATURE_texture_s3tc 01500 if (ctx->Extensions.EXT_texture_compression_s3tc || 01501 ctx->Extensions.S3_s3tc) 01502 return &_mesa_texformat_rgb_dxt1; 01503 #endif 01504 return &_mesa_texformat_rgb; 01505 case GL_COMPRESSED_RGBA_ARB: 01506 #if FEATURE_texture_fxt1 01507 if (ctx->Extensions.TDFX_texture_compression_FXT1) 01508 return &_mesa_texformat_rgba_fxt1; 01509 #endif 01510 #if FEATURE_texture_s3tc 01511 if (ctx->Extensions.EXT_texture_compression_s3tc || 01512 ctx->Extensions.S3_s3tc) 01513 return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ 01514 #endif 01515 return &_mesa_texformat_rgba; 01516 default: 01517 ; /* fallthrough */ 01518 } 01519 } 01520 01521 if (ctx->Extensions.MESA_ycbcr_texture) { 01522 if (internalFormat == GL_YCBCR_MESA) { 01523 if (type == GL_UNSIGNED_SHORT_8_8_MESA) 01524 return &_mesa_texformat_ycbcr; 01525 else 01526 return &_mesa_texformat_ycbcr_rev; 01527 } 01528 } 01529 01530 #if FEATURE_texture_fxt1 01531 if (ctx->Extensions.TDFX_texture_compression_FXT1) { 01532 switch (internalFormat) { 01533 case GL_COMPRESSED_RGB_FXT1_3DFX: 01534 return &_mesa_texformat_rgb_fxt1; 01535 case GL_COMPRESSED_RGBA_FXT1_3DFX: 01536 return &_mesa_texformat_rgba_fxt1; 01537 default: 01538 ; /* fallthrough */ 01539 } 01540 } 01541 #endif 01542 01543 #if FEATURE_texture_s3tc 01544 if (ctx->Extensions.EXT_texture_compression_s3tc) { 01545 switch (internalFormat) { 01546 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 01547 return &_mesa_texformat_rgb_dxt1; 01548 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: 01549 return &_mesa_texformat_rgba_dxt1; 01550 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: 01551 return &_mesa_texformat_rgba_dxt3; 01552 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: 01553 return &_mesa_texformat_rgba_dxt5; 01554 default: 01555 ; /* fallthrough */ 01556 } 01557 } 01558 01559 if (ctx->Extensions.S3_s3tc) { 01560 switch (internalFormat) { 01561 case GL_RGB_S3TC: 01562 case GL_RGB4_S3TC: 01563 return &_mesa_texformat_rgb_dxt1; 01564 case GL_RGBA_S3TC: 01565 case GL_RGBA4_S3TC: 01566 return &_mesa_texformat_rgba_dxt3; 01567 default: 01568 ; /* fallthrough */ 01569 } 01570 } 01571 #endif 01572 01573 if (ctx->Extensions.ARB_texture_float) { 01574 switch (internalFormat) { 01575 case GL_ALPHA16F_ARB: 01576 return &_mesa_texformat_alpha_float16; 01577 case GL_ALPHA32F_ARB: 01578 return &_mesa_texformat_alpha_float32; 01579 case GL_LUMINANCE16F_ARB: 01580 return &_mesa_texformat_luminance_float16; 01581 case GL_LUMINANCE32F_ARB: 01582 return &_mesa_texformat_luminance_float32; 01583 case GL_LUMINANCE_ALPHA16F_ARB: 01584 return &_mesa_texformat_luminance_alpha_float16; 01585 case GL_LUMINANCE_ALPHA32F_ARB: 01586 return &_mesa_texformat_luminance_alpha_float32; 01587 case GL_INTENSITY16F_ARB: 01588 return &_mesa_texformat_intensity_float16; 01589 case GL_INTENSITY32F_ARB: 01590 return &_mesa_texformat_intensity_float32; 01591 case GL_RGB16F_ARB: 01592 return &_mesa_texformat_rgb_float16; 01593 case GL_RGB32F_ARB: 01594 return &_mesa_texformat_rgb_float32; 01595 case GL_RGBA16F_ARB: 01596 return &_mesa_texformat_rgba_float16; 01597 case GL_RGBA32F_ARB: 01598 return &_mesa_texformat_rgba_float32; 01599 default: 01600 ; /* fallthrough */ 01601 } 01602 } 01603 01604 if (ctx->Extensions.EXT_packed_depth_stencil) { 01605 switch (internalFormat) { 01606 case GL_DEPTH_STENCIL_EXT: 01607 case GL_DEPTH24_STENCIL8_EXT: 01608 return &_mesa_texformat_z24_s8; 01609 default: 01610 ; /* fallthrough */ 01611 } 01612 } 01613 01614 #if FEATURE_EXT_texture_sRGB 01615 if (ctx->Extensions.EXT_texture_sRGB) { 01616 switch (internalFormat) { 01617 case GL_SRGB_EXT: 01618 case GL_SRGB8_EXT: 01619 return &_mesa_texformat_srgb8; 01620 case GL_SRGB_ALPHA_EXT: 01621 case GL_SRGB8_ALPHA8_EXT: 01622 return &_mesa_texformat_srgba8; 01623 case GL_SLUMINANCE_EXT: 01624 case GL_SLUMINANCE8_EXT: 01625 return &_mesa_texformat_sl8; 01626 case GL_SLUMINANCE_ALPHA_EXT: 01627 case GL_SLUMINANCE8_ALPHA8_EXT: 01628 return &_mesa_texformat_sla8; 01629 /* NOTE: not supporting any compression of sRGB at this time */ 01630 case GL_COMPRESSED_SRGB_EXT: 01631 return &_mesa_texformat_srgb8; 01632 case GL_COMPRESSED_SRGB_ALPHA_EXT: 01633 return &_mesa_texformat_srgba8; 01634 case GL_COMPRESSED_SLUMINANCE_EXT: 01635 return &_mesa_texformat_sl8; 01636 case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: 01637 return &_mesa_texformat_sla8; 01638 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: 01639 return &_mesa_texformat_srgb8; 01640 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 01641 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 01642 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 01643 return &_mesa_texformat_srgba8; 01644 default: 01645 ; /* fallthrough */ 01646 } 01647 } 01648 #endif /* FEATURE_EXT_texture_sRGB */ 01649 01650 _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); 01651 return NULL; 01652 } 01653 01654 01655 01660 void 01661 _mesa_format_to_type_and_comps(const struct gl_texture_format *format, 01662 GLenum *datatype, GLuint *comps) 01663 { 01664 switch (format->MesaFormat) { 01665 case MESA_FORMAT_RGBA8888: 01666 case MESA_FORMAT_RGBA8888_REV: 01667 case MESA_FORMAT_ARGB8888: 01668 case MESA_FORMAT_ARGB8888_REV: 01669 *datatype = CHAN_TYPE; 01670 *comps = 4; 01671 return; 01672 case MESA_FORMAT_RGB888: 01673 case MESA_FORMAT_BGR888: 01674 *datatype = GL_UNSIGNED_BYTE; 01675 *comps = 3; 01676 return; 01677 case MESA_FORMAT_RGB565: 01678 case MESA_FORMAT_RGB565_REV: 01679 *datatype = GL_UNSIGNED_SHORT_5_6_5; 01680 *comps = 3; 01681 return; 01682 01683 case MESA_FORMAT_ARGB4444: 01684 case MESA_FORMAT_ARGB4444_REV: 01685 *datatype = GL_UNSIGNED_SHORT_4_4_4_4; 01686 *comps = 4; 01687 return; 01688 01689 case MESA_FORMAT_ARGB1555: 01690 case MESA_FORMAT_ARGB1555_REV: 01691 *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; 01692 *comps = 4; 01693 return; 01694 01695 case MESA_FORMAT_AL88: 01696 case MESA_FORMAT_AL88_REV: 01697 *datatype = GL_UNSIGNED_BYTE; 01698 *comps = 2; 01699 return; 01700 case MESA_FORMAT_RGB332: 01701 *datatype = GL_UNSIGNED_BYTE_3_3_2; 01702 *comps = 3; 01703 return; 01704 01705 case MESA_FORMAT_A8: 01706 case MESA_FORMAT_L8: 01707 case MESA_FORMAT_I8: 01708 case MESA_FORMAT_CI8: 01709 *datatype = GL_UNSIGNED_BYTE; 01710 *comps = 1; 01711 return; 01712 01713 case MESA_FORMAT_YCBCR: 01714 case MESA_FORMAT_YCBCR_REV: 01715 *datatype = GL_UNSIGNED_SHORT; 01716 *comps = 2; 01717 return; 01718 01719 case MESA_FORMAT_Z24_S8: 01720 *datatype = GL_UNSIGNED_INT; 01721 *comps = 1; /* XXX OK? */ 01722 return; 01723 01724 case MESA_FORMAT_Z16: 01725 *datatype = GL_UNSIGNED_SHORT; 01726 *comps = 1; 01727 return; 01728 01729 case MESA_FORMAT_Z32: 01730 *datatype = GL_UNSIGNED_INT; 01731 *comps = 1; 01732 return; 01733 01734 case MESA_FORMAT_SRGB8: 01735 *datatype = GL_UNSIGNED_BYTE; 01736 *comps = 3; 01737 return; 01738 case MESA_FORMAT_SRGBA8: 01739 *datatype = GL_UNSIGNED_BYTE; 01740 *comps = 4; 01741 return; 01742 case MESA_FORMAT_SL8: 01743 *datatype = GL_UNSIGNED_BYTE; 01744 *comps = 1; 01745 return; 01746 case MESA_FORMAT_SLA8: 01747 *datatype = GL_UNSIGNED_BYTE; 01748 *comps = 2; 01749 return; 01750 01751 case MESA_FORMAT_RGB_FXT1: 01752 case MESA_FORMAT_RGBA_FXT1: 01753 case MESA_FORMAT_RGB_DXT1: 01754 case MESA_FORMAT_RGBA_DXT1: 01755 case MESA_FORMAT_RGBA_DXT3: 01756 case MESA_FORMAT_RGBA_DXT5: 01757 /* XXX generate error instead? */ 01758 *datatype = GL_UNSIGNED_BYTE; 01759 *comps = 0; 01760 return; 01761 01762 case MESA_FORMAT_RGBA: 01763 *datatype = CHAN_TYPE; 01764 *comps = 4; 01765 return; 01766 case MESA_FORMAT_RGB: 01767 *datatype = CHAN_TYPE; 01768 *comps = 3; 01769 return; 01770 case MESA_FORMAT_LUMINANCE_ALPHA: 01771 *datatype = CHAN_TYPE; 01772 *comps = 2; 01773 return; 01774 case MESA_FORMAT_ALPHA: 01775 case MESA_FORMAT_LUMINANCE: 01776 case MESA_FORMAT_INTENSITY: 01777 *datatype = CHAN_TYPE; 01778 *comps = 1; 01779 return; 01780 01781 case MESA_FORMAT_RGBA_FLOAT32: 01782 *datatype = GL_FLOAT; 01783 *comps = 4; 01784 return; 01785 case MESA_FORMAT_RGBA_FLOAT16: 01786 *datatype = GL_HALF_FLOAT_ARB; 01787 *comps = 4; 01788 return; 01789 case MESA_FORMAT_RGB_FLOAT32: 01790 *datatype = GL_FLOAT; 01791 *comps = 3; 01792 return; 01793 case MESA_FORMAT_RGB_FLOAT16: 01794 *datatype = GL_HALF_FLOAT_ARB; 01795 *comps = 3; 01796 return; 01797 case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: 01798 *datatype = GL_FLOAT; 01799 *comps = 2; 01800 return; 01801 case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: 01802 *datatype = GL_HALF_FLOAT_ARB; 01803 *comps = 2; 01804 return; 01805 case MESA_FORMAT_ALPHA_FLOAT32: 01806 case MESA_FORMAT_LUMINANCE_FLOAT32: 01807 case MESA_FORMAT_INTENSITY_FLOAT32: 01808 *datatype = GL_FLOAT; 01809 *comps = 1; 01810 return; 01811 case MESA_FORMAT_ALPHA_FLOAT16: 01812 case MESA_FORMAT_LUMINANCE_FLOAT16: 01813 case MESA_FORMAT_INTENSITY_FLOAT16: 01814 *datatype = GL_HALF_FLOAT_ARB; 01815 *comps = 1; 01816 return; 01817 01818 default: 01819 _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); 01820 *datatype = 0; 01821 *comps = 1; 01822 } 01823 } Generated on Fri May 25 2012 04:18:38 for ReactOS by
1.7.6.1
|