2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
30 * \author Gareth Hughes
36 #include "texformat.h"
41 /* Texel fetch routines for all supported formats
44 #include "texformat_tmp.h"
47 #include "texformat_tmp.h"
50 #include "texformat_tmp.h"
53 * Null texel fetch function.
55 * Have to have this so the FetchTexel function pointer is never NULL.
57 static void fetch_null_texel( const struct gl_texture_image
*texImage
,
58 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
60 (void) texImage
; (void) i
; (void) j
; (void) k
;
65 _mesa_warning(NULL
, "fetch_null_texel() called!");
68 static void fetch_null_texelf( const struct gl_texture_image
*texImage
,
69 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
71 (void) texImage
; (void) i
; (void) j
; (void) k
;
76 _mesa_warning(NULL
, "fetch_null_texelf() called!");
79 static void store_null_texel(struct gl_texture_image
*texImage
,
80 GLint i
, GLint j
, GLint k
, const void *texel
)
87 * Notes about the predefined gl_texture_formats:
89 * 1. There are 1D, 2D and 3D functions for fetching texels from texture
90 * images, returning both GLchan values and GLfloat values. (six
92 * You don't have to provide both the GLchan and GLfloat functions;
93 * just one or the other is OK. Mesa will use an "adaptor" to convert
94 * between GLchan/GLfloat when needed.
95 * Since the adaptors have small performance penalty, we provide both
96 * GLchan and GLfloat functions for some common formats like RGB, RGBA.
100 /***************************************************************/
101 /** \name Default GLchan-based formats */
104 const struct gl_texture_format _mesa_texformat_rgba
= {
105 MESA_FORMAT_RGBA
, /* MesaFormat */
106 GL_RGBA
, /* BaseFormat */
107 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
108 CHAN_BITS
, /* RedBits */
109 CHAN_BITS
, /* GreenBits */
110 CHAN_BITS
, /* BlueBits */
111 CHAN_BITS
, /* AlphaBits */
112 0, /* LuminanceBits */
113 0, /* IntensityBits */
117 4 * sizeof(GLchan
), /* TexelBytes */
118 _mesa_texstore_rgba
, /* StoreTexImageFunc */
119 fetch_texel_1d_rgba
, /* FetchTexel1D */
120 fetch_texel_2d_rgba
, /* FetchTexel2D */
121 fetch_texel_3d_rgba
, /* FetchTexel3D */
122 fetch_texel_1d_f_rgba
, /* FetchTexel1Df */
123 fetch_texel_2d_f_rgba
, /* FetchTexel2Df */
124 fetch_texel_3d_f_rgba
, /* FetchTexel3Df */
125 store_texel_rgba
/* StoreTexel */
128 const struct gl_texture_format _mesa_texformat_rgb
= {
129 MESA_FORMAT_RGB
, /* MesaFormat */
130 GL_RGB
, /* BaseFormat */
131 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
132 CHAN_BITS
, /* RedBits */
133 CHAN_BITS
, /* GreenBits */
134 CHAN_BITS
, /* BlueBits */
136 0, /* LuminanceBits */
137 0, /* IntensityBits */
141 3 * sizeof(GLchan
), /* TexelBytes */
142 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
143 fetch_texel_1d_rgb
, /* FetchTexel1D */
144 fetch_texel_2d_rgb
, /* FetchTexel2D */
145 fetch_texel_3d_rgb
, /* FetchTexel3D */
146 fetch_texel_1d_f_rgb
, /* FetchTexel1Df */
147 fetch_texel_2d_f_rgb
, /* FetchTexel2Df */
148 fetch_texel_3d_f_rgb
, /* FetchTexel3Df */
149 store_texel_rgb
/* StoreTexel */
152 const struct gl_texture_format _mesa_texformat_alpha
= {
153 MESA_FORMAT_ALPHA
, /* MesaFormat */
154 GL_ALPHA
, /* BaseFormat */
155 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
159 CHAN_BITS
, /* AlphaBits */
160 0, /* LuminanceBits */
161 0, /* IntensityBits */
165 sizeof(GLchan
), /* TexelBytes */
166 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
167 fetch_texel_1d_alpha
, /* FetchTexel1D */
168 fetch_texel_2d_alpha
, /* FetchTexel2D */
169 fetch_texel_3d_alpha
, /* FetchTexel3D */
170 NULL
, /* FetchTexel1Df */
171 NULL
, /* FetchTexel2Df */
172 NULL
, /* FetchTexel3Df */
173 store_texel_alpha
/* StoreTexel */
176 const struct gl_texture_format _mesa_texformat_luminance
= {
177 MESA_FORMAT_LUMINANCE
, /* MesaFormat */
178 GL_LUMINANCE
, /* BaseFormat */
179 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
184 CHAN_BITS
, /* LuminanceBits */
185 0, /* IntensityBits */
189 sizeof(GLchan
), /* TexelBytes */
190 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
191 fetch_texel_1d_luminance
, /* FetchTexel1D */
192 fetch_texel_2d_luminance
, /* FetchTexel2D */
193 fetch_texel_3d_luminance
, /* FetchTexel3D */
194 NULL
, /* FetchTexel1Df */
195 NULL
, /* FetchTexel2Df */
196 NULL
, /* FetchTexel3Df */
197 store_texel_luminance
/* StoreTexel */
200 const struct gl_texture_format _mesa_texformat_luminance_alpha
= {
201 MESA_FORMAT_LUMINANCE_ALPHA
, /* MesaFormat */
202 GL_LUMINANCE_ALPHA
, /* BaseFormat */
203 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
207 CHAN_BITS
, /* AlphaBits */
208 CHAN_BITS
, /* LuminanceBits */
209 0, /* IntensityBits */
213 2 * sizeof(GLchan
), /* TexelBytes */
214 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
215 fetch_texel_1d_luminance_alpha
, /* FetchTexel1D */
216 fetch_texel_2d_luminance_alpha
, /* FetchTexel2D */
217 fetch_texel_3d_luminance_alpha
, /* FetchTexel3D */
218 NULL
, /* FetchTexel1Df */
219 NULL
, /* FetchTexel2Df */
220 NULL
, /* FetchTexel3Df */
221 store_texel_luminance_alpha
/* StoreTexel */
224 const struct gl_texture_format _mesa_texformat_intensity
= {
225 MESA_FORMAT_INTENSITY
, /* MesaFormat */
226 GL_INTENSITY
, /* BaseFormat */
227 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
232 0, /* LuminanceBits */
233 CHAN_BITS
, /* IntensityBits */
237 sizeof(GLchan
), /* TexelBytes */
238 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
239 fetch_texel_1d_intensity
, /* FetchTexel1D */
240 fetch_texel_2d_intensity
, /* FetchTexel2D */
241 fetch_texel_3d_intensity
, /* FetchTexel3D */
242 NULL
, /* FetchTexel1Df */
243 NULL
, /* FetchTexel2Df */
244 NULL
, /* FetchTexel3Df */
245 store_texel_intensity
/* StoreTexel */
248 const struct gl_texture_format _mesa_texformat_depth_component_float32
= {
249 MESA_FORMAT_DEPTH_COMPONENT_FLOAT32
, /* MesaFormat */
250 GL_DEPTH_COMPONENT
, /* BaseFormat */
251 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
256 0, /* LuminanceBits */
257 0, /* IntensityBits */
259 sizeof(GLfloat
) * 8, /* DepthBits */
260 sizeof(GLfloat
) * 8, /* StencilBits */
261 sizeof(GLfloat
), /* TexelBytes */
262 _mesa_texstore_depth_component_float32
,/* StoreTexImageFunc */
263 NULL
, /* FetchTexel1D */
264 NULL
, /* FetchTexel1D */
265 NULL
, /* FetchTexel1D */
266 fetch_texel_1d_f_depth_component_f32
,/* FetchTexel1Df */
267 fetch_texel_2d_f_depth_component_f32
,/* FetchTexel2Df */
268 fetch_texel_3d_f_depth_component_f32
,/* FetchTexel3Df */
269 store_texel_depth_component_f32
/* StoreTexel */
272 const struct gl_texture_format _mesa_texformat_depth_component16
= {
273 MESA_FORMAT_DEPTH_COMPONENT16
, /* MesaFormat */
274 GL_DEPTH_COMPONENT
, /* BaseFormat */
275 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
280 0, /* LuminanceBits */
281 0, /* IntensityBits */
283 sizeof(GLushort
) * 8, /* DepthBits */
284 sizeof(GLushort
) * 8, /* StencilBits */
285 sizeof(GLushort
), /* TexelBytes */
286 _mesa_texstore_depth_component16
, /* StoreTexImageFunc */
287 NULL
, /* FetchTexel1D */
288 NULL
, /* FetchTexel1D */
289 NULL
, /* FetchTexel1D */
290 fetch_texel_1d_f_depth_component16
, /* FetchTexel1Df */
291 fetch_texel_2d_f_depth_component16
, /* FetchTexel2Df */
292 fetch_texel_3d_f_depth_component16
, /* FetchTexel3Df */
293 store_texel_depth_component16
/* StoreTexel */
296 const struct gl_texture_format _mesa_texformat_rgba_float32
= {
297 MESA_FORMAT_RGBA_FLOAT32
, /* MesaFormat */
298 GL_RGBA
, /* BaseFormat */
299 GL_FLOAT
, /* DataType */
300 8 * sizeof(GLfloat
), /* RedBits */
301 8 * sizeof(GLfloat
), /* GreenBits */
302 8 * sizeof(GLfloat
), /* BlueBits */
303 8 * sizeof(GLfloat
), /* AlphaBits */
304 0, /* LuminanceBits */
305 0, /* IntensityBits */
309 4 * sizeof(GLfloat
), /* TexelBytes */
310 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
311 NULL
, /* FetchTexel1D */
312 NULL
, /* FetchTexel1D */
313 NULL
, /* FetchTexel1D */
314 fetch_texel_1d_f_rgba_f32
, /* FetchTexel1Df */
315 fetch_texel_2d_f_rgba_f32
, /* FetchTexel2Df */
316 fetch_texel_3d_f_rgba_f32
, /* FetchTexel3Df */
317 store_texel_rgba_f32
/* StoreTexel */
320 const struct gl_texture_format _mesa_texformat_rgba_float16
= {
321 MESA_FORMAT_RGBA_FLOAT16
, /* MesaFormat */
322 GL_RGBA
, /* BaseFormat */
323 GL_FLOAT
, /* DataType */
324 8 * sizeof(GLhalfARB
), /* RedBits */
325 8 * sizeof(GLhalfARB
), /* GreenBits */
326 8 * sizeof(GLhalfARB
), /* BlueBits */
327 8 * sizeof(GLhalfARB
), /* AlphaBits */
328 0, /* LuminanceBits */
329 0, /* IntensityBits */
333 4 * sizeof(GLhalfARB
), /* TexelBytes */
334 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
335 NULL
, /* FetchTexel1D */
336 NULL
, /* FetchTexel1D */
337 NULL
, /* FetchTexel1D */
338 fetch_texel_1d_f_rgba_f16
, /* FetchTexel1Df */
339 fetch_texel_2d_f_rgba_f16
, /* FetchTexel2Df */
340 fetch_texel_3d_f_rgba_f16
, /* FetchTexel3Df */
341 store_texel_rgba_f16
/* StoreTexel */
344 const struct gl_texture_format _mesa_texformat_rgb_float32
= {
345 MESA_FORMAT_RGB_FLOAT32
, /* MesaFormat */
346 GL_RGB
, /* BaseFormat */
347 GL_FLOAT
, /* DataType */
348 8 * sizeof(GLfloat
), /* RedBits */
349 8 * sizeof(GLfloat
), /* GreenBits */
350 8 * sizeof(GLfloat
), /* BlueBits */
352 0, /* LuminanceBits */
353 0, /* IntensityBits */
357 3 * sizeof(GLfloat
), /* TexelBytes */
358 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
359 NULL
, /* FetchTexel1D */
360 NULL
, /* FetchTexel1D */
361 NULL
, /* FetchTexel1D */
362 fetch_texel_1d_f_rgb_f32
, /* FetchTexel1Df */
363 fetch_texel_2d_f_rgb_f32
, /* FetchTexel2Df */
364 fetch_texel_3d_f_rgb_f32
, /* FetchTexel3Df */
365 store_texel_rgb_f32
/* StoreTexel */
368 const struct gl_texture_format _mesa_texformat_rgb_float16
= {
369 MESA_FORMAT_RGB_FLOAT16
, /* MesaFormat */
370 GL_RGB
, /* BaseFormat */
371 GL_FLOAT
, /* DataType */
372 8 * sizeof(GLhalfARB
), /* RedBits */
373 8 * sizeof(GLhalfARB
), /* GreenBits */
374 8 * sizeof(GLhalfARB
), /* BlueBits */
376 0, /* LuminanceBits */
377 0, /* IntensityBits */
381 3 * sizeof(GLhalfARB
), /* TexelBytes */
382 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
383 NULL
, /* FetchTexel1D */
384 NULL
, /* FetchTexel1D */
385 NULL
, /* FetchTexel1D */
386 fetch_texel_1d_f_rgb_f16
, /* FetchTexel1Df */
387 fetch_texel_2d_f_rgb_f16
, /* FetchTexel2Df */
388 fetch_texel_3d_f_rgb_f16
, /* FetchTexel3Df */
389 store_texel_rgb_f16
/* StoreTexel */
392 const struct gl_texture_format _mesa_texformat_alpha_float32
= {
393 MESA_FORMAT_ALPHA_FLOAT32
, /* MesaFormat */
394 GL_ALPHA
, /* BaseFormat */
395 GL_FLOAT
, /* DataType */
399 8 * sizeof(GLfloat
), /* AlphaBits */
400 0, /* LuminanceBits */
401 0, /* IntensityBits */
405 1 * sizeof(GLfloat
), /* TexelBytes */
406 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
407 NULL
, /* FetchTexel1D */
408 NULL
, /* FetchTexel1D */
409 NULL
, /* FetchTexel1D */
410 fetch_texel_1d_f_alpha_f32
, /* FetchTexel1Df */
411 fetch_texel_2d_f_alpha_f32
, /* FetchTexel2Df */
412 fetch_texel_3d_f_alpha_f32
, /* FetchTexel3Df */
413 store_texel_alpha_f32
/* StoreTexel */
416 const struct gl_texture_format _mesa_texformat_alpha_float16
= {
417 MESA_FORMAT_ALPHA_FLOAT16
, /* MesaFormat */
418 GL_ALPHA
, /* BaseFormat */
419 GL_FLOAT
, /* DataType */
423 8 * sizeof(GLhalfARB
), /* AlphaBits */
424 0, /* LuminanceBits */
425 0, /* IntensityBits */
429 1 * sizeof(GLhalfARB
), /* TexelBytes */
430 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
431 NULL
, /* FetchTexel1D */
432 NULL
, /* FetchTexel1D */
433 NULL
, /* FetchTexel1D */
434 fetch_texel_1d_f_alpha_f16
, /* FetchTexel1Df */
435 fetch_texel_2d_f_alpha_f16
, /* FetchTexel2Df */
436 fetch_texel_3d_f_alpha_f16
, /* FetchTexel3Df */
437 store_texel_alpha_f16
/* StoreTexel */
440 const struct gl_texture_format _mesa_texformat_luminance_float32
= {
441 MESA_FORMAT_LUMINANCE_FLOAT32
, /* MesaFormat */
442 GL_LUMINANCE
, /* BaseFormat */
443 GL_FLOAT
, /* DataType */
448 8 * sizeof(GLfloat
), /* LuminanceBits */
449 0, /* IntensityBits */
453 1 * sizeof(GLfloat
), /* TexelBytes */
454 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
455 NULL
, /* FetchTexel1D */
456 NULL
, /* FetchTexel2D */
457 NULL
, /* FetchTexel3D */
458 fetch_texel_1d_f_luminance_f32
, /* FetchTexel1Df */
459 fetch_texel_2d_f_luminance_f32
, /* FetchTexel2Df */
460 fetch_texel_3d_f_luminance_f32
, /* FetchTexel3Df */
461 store_texel_luminance_f32
/* StoreTexel */
464 const struct gl_texture_format _mesa_texformat_luminance_float16
= {
465 MESA_FORMAT_LUMINANCE_FLOAT16
, /* MesaFormat */
466 GL_LUMINANCE
, /* BaseFormat */
467 GL_FLOAT
, /* DataType */
472 8 * sizeof(GLhalfARB
), /* LuminanceBits */
473 0, /* IntensityBits */
477 1 * sizeof(GLhalfARB
), /* TexelBytes */
478 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
479 NULL
, /* FetchTexel1D */
480 NULL
, /* FetchTexel2D */
481 NULL
, /* FetchTexel3D */
482 fetch_texel_1d_f_luminance_f16
, /* FetchTexel1Df */
483 fetch_texel_2d_f_luminance_f16
, /* FetchTexel2Df */
484 fetch_texel_3d_f_luminance_f16
, /* FetchTexel3Df */
485 store_texel_luminance_f16
/* StoreTexel */
488 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32
= {
489 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
, /* MesaFormat */
490 GL_LUMINANCE_ALPHA
, /* BaseFormat */
491 GL_FLOAT
, /* DataType */
495 8 * sizeof(GLfloat
), /* AlphaBits */
496 8 * sizeof(GLfloat
), /* LuminanceBits */
497 0, /* IntensityBits */
501 2 * sizeof(GLfloat
), /* TexelBytes */
502 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
503 NULL
, /* FetchTexel1D */
504 NULL
, /* FetchTexel2D */
505 NULL
, /* FetchTexel3D */
506 fetch_texel_1d_f_luminance_alpha_f32
,/* FetchTexel1Df */
507 fetch_texel_2d_f_luminance_alpha_f32
,/* FetchTexel2Df */
508 fetch_texel_3d_f_luminance_alpha_f32
,/* FetchTexel3Df */
509 store_texel_luminance_alpha_f32
/* StoreTexel */
512 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16
= {
513 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
, /* MesaFormat */
514 GL_LUMINANCE_ALPHA
, /* BaseFormat */
515 GL_FLOAT
, /* DataType */
519 8 * sizeof(GLhalfARB
), /* AlphaBits */
520 8 * sizeof(GLhalfARB
), /* LuminanceBits */
521 0, /* IntensityBits */
525 2 * sizeof(GLhalfARB
), /* TexelBytes */
526 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
527 NULL
, /* FetchTexel1D */
528 NULL
, /* FetchTexel2D */
529 NULL
, /* FetchTexel3D */
530 fetch_texel_1d_f_luminance_alpha_f16
,/* FetchTexel1Df */
531 fetch_texel_2d_f_luminance_alpha_f16
,/* FetchTexel2Df */
532 fetch_texel_3d_f_luminance_alpha_f16
,/* FetchTexel3Df */
533 store_texel_luminance_alpha_f16
/* StoreTexel */
536 const struct gl_texture_format _mesa_texformat_intensity_float32
= {
537 MESA_FORMAT_INTENSITY_FLOAT32
, /* MesaFormat */
538 GL_INTENSITY
, /* BaseFormat */
539 GL_FLOAT
, /* DataType */
544 0, /* LuminanceBits */
545 8 * sizeof(GLfloat
), /* IntensityBits */
549 1 * sizeof(GLfloat
), /* TexelBytes */
550 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
551 NULL
, /* FetchTexel1D */
552 NULL
, /* FetchTexel2D */
553 NULL
, /* FetchTexel3D */
554 fetch_texel_1d_f_intensity_f32
, /* FetchTexel1Df */
555 fetch_texel_2d_f_intensity_f32
, /* FetchTexel2Df */
556 fetch_texel_3d_f_intensity_f32
, /* FetchTexel3Df */
557 store_texel_intensity_f32
/* StoreTexel */
560 const struct gl_texture_format _mesa_texformat_intensity_float16
= {
561 MESA_FORMAT_INTENSITY_FLOAT16
, /* MesaFormat */
562 GL_INTENSITY
, /* BaseFormat */
563 GL_FLOAT
, /* DataType */
568 0, /* LuminanceBits */
569 8 * sizeof(GLhalfARB
), /* IntensityBits */
573 1 * sizeof(GLhalfARB
), /* TexelBytes */
574 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
575 NULL
, /* FetchTexel1D */
576 NULL
, /* FetchTexel2D */
577 NULL
, /* FetchTexel3D */
578 fetch_texel_1d_f_intensity_f16
, /* FetchTexel1Df */
579 fetch_texel_2d_f_intensity_f16
, /* FetchTexel2Df */
580 fetch_texel_3d_f_intensity_f16
, /* FetchTexel3Df */
581 store_texel_intensity_f16
/* StoreTexel */
588 /***************************************************************/
589 /** \name Hardware formats */
592 const struct gl_texture_format _mesa_texformat_rgba8888
= {
593 MESA_FORMAT_RGBA8888
, /* MesaFormat */
594 GL_RGBA
, /* BaseFormat */
595 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
600 0, /* LuminanceBits */
601 0, /* IntensityBits */
606 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
607 fetch_texel_1d_rgba8888
, /* FetchTexel1D */
608 fetch_texel_2d_rgba8888
, /* FetchTexel2D */
609 fetch_texel_3d_rgba8888
, /* FetchTexel3D */
610 NULL
, /* FetchTexel1Df */
611 NULL
, /* FetchTexel2Df */
612 NULL
, /* FetchTexel3Df */
613 store_texel_rgba8888
/* StoreTexel */
616 const struct gl_texture_format _mesa_texformat_rgba8888_rev
= {
617 MESA_FORMAT_RGBA8888_REV
, /* MesaFormat */
618 GL_RGBA
, /* BaseFormat */
619 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
624 0, /* LuminanceBits */
625 0, /* IntensityBits */
630 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
631 fetch_texel_1d_rgba8888_rev
, /* FetchTexel1D */
632 fetch_texel_2d_rgba8888_rev
, /* FetchTexel2D */
633 fetch_texel_3d_rgba8888_rev
, /* FetchTexel3D */
634 NULL
, /* FetchTexel1Df */
635 NULL
, /* FetchTexel2Df */
636 NULL
, /* FetchTexel3Df */
637 store_texel_rgba8888_rev
/* StoreTexel */
640 const struct gl_texture_format _mesa_texformat_argb8888
= {
641 MESA_FORMAT_ARGB8888
, /* MesaFormat */
642 GL_RGBA
, /* BaseFormat */
643 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
648 0, /* LuminanceBits */
649 0, /* IntensityBits */
654 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
655 fetch_texel_1d_argb8888
, /* FetchTexel1D */
656 fetch_texel_2d_argb8888
, /* FetchTexel2D */
657 fetch_texel_3d_argb8888
, /* FetchTexel3D */
658 NULL
, /* FetchTexel1Df */
659 NULL
, /* FetchTexel2Df */
660 NULL
, /* FetchTexel3Df */
661 store_texel_argb8888
/* StoreTexel */
664 const struct gl_texture_format _mesa_texformat_argb8888_rev
= {
665 MESA_FORMAT_ARGB8888_REV
, /* MesaFormat */
666 GL_RGBA
, /* BaseFormat */
667 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
672 0, /* LuminanceBits */
673 0, /* IntensityBits */
678 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
679 fetch_texel_1d_argb8888_rev
, /* FetchTexel1D */
680 fetch_texel_2d_argb8888_rev
, /* FetchTexel2D */
681 fetch_texel_3d_argb8888_rev
, /* FetchTexel3D */
682 NULL
, /* FetchTexel1Df */
683 NULL
, /* FetchTexel2Df */
684 NULL
, /* FetchTexel3Df */
685 store_texel_argb8888_rev
/* StoreTexel */
688 const struct gl_texture_format _mesa_texformat_rgb888
= {
689 MESA_FORMAT_RGB888
, /* MesaFormat */
690 GL_RGB
, /* BaseFormat */
691 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
696 0, /* LuminanceBits */
697 0, /* IntensityBits */
702 _mesa_texstore_rgb888
, /* StoreTexImageFunc */
703 fetch_texel_1d_rgb888
, /* FetchTexel1D */
704 fetch_texel_2d_rgb888
, /* FetchTexel2D */
705 fetch_texel_3d_rgb888
, /* FetchTexel3D */
706 NULL
, /* FetchTexel1Df */
707 NULL
, /* FetchTexel2Df */
708 NULL
, /* FetchTexel3Df */
709 store_texel_rgb888
/* StoreTexel */
712 const struct gl_texture_format _mesa_texformat_bgr888
= {
713 MESA_FORMAT_BGR888
, /* MesaFormat */
714 GL_RGB
, /* BaseFormat */
715 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
720 0, /* LuminanceBits */
721 0, /* IntensityBits */
726 _mesa_texstore_bgr888
, /* StoreTexImageFunc */
727 fetch_texel_1d_bgr888
, /* FetchTexel1D */
728 fetch_texel_2d_bgr888
, /* FetchTexel2D */
729 fetch_texel_3d_bgr888
, /* FetchTexel3D */
730 NULL
, /* FetchTexel1Df */
731 NULL
, /* FetchTexel2Df */
732 NULL
, /* FetchTexel3Df */
733 store_texel_bgr888
/* StoreTexel */
736 const struct gl_texture_format _mesa_texformat_rgb565
= {
737 MESA_FORMAT_RGB565
, /* MesaFormat */
738 GL_RGB
, /* BaseFormat */
739 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
744 0, /* LuminanceBits */
745 0, /* IntensityBits */
750 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
751 fetch_texel_1d_rgb565
, /* FetchTexel1D */
752 fetch_texel_2d_rgb565
, /* FetchTexel2D */
753 fetch_texel_3d_rgb565
, /* FetchTexel3D */
754 NULL
, /* FetchTexel1Df */
755 NULL
, /* FetchTexel2Df */
756 NULL
, /* FetchTexel3Df */
757 store_texel_rgb565
/* StoreTexel */
760 const struct gl_texture_format _mesa_texformat_rgb565_rev
= {
761 MESA_FORMAT_RGB565_REV
, /* MesaFormat */
762 GL_RGB
, /* BaseFormat */
763 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
768 0, /* LuminanceBits */
769 0, /* IntensityBits */
774 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
775 fetch_texel_1d_rgb565_rev
, /* FetchTexel1D */
776 fetch_texel_2d_rgb565_rev
, /* FetchTexel2D */
777 fetch_texel_3d_rgb565_rev
, /* FetchTexel3D */
778 NULL
, /* FetchTexel1Df */
779 NULL
, /* FetchTexel2Df */
780 NULL
, /* FetchTexel3Df */
781 store_texel_rgb565_rev
/* StoreTexel */
784 const struct gl_texture_format _mesa_texformat_argb4444
= {
785 MESA_FORMAT_ARGB4444
, /* MesaFormat */
786 GL_RGBA
, /* BaseFormat */
787 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
792 0, /* LuminanceBits */
793 0, /* IntensityBits */
798 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
799 fetch_texel_1d_argb4444
, /* FetchTexel1D */
800 fetch_texel_2d_argb4444
, /* FetchTexel2D */
801 fetch_texel_3d_argb4444
, /* FetchTexel3D */
802 NULL
, /* FetchTexel1Df */
803 NULL
, /* FetchTexel2Df */
804 NULL
, /* FetchTexel3Df */
805 store_texel_argb4444
/* StoreTexel */
808 const struct gl_texture_format _mesa_texformat_argb4444_rev
= {
809 MESA_FORMAT_ARGB4444_REV
, /* MesaFormat */
810 GL_RGBA
, /* BaseFormat */
811 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
816 0, /* LuminanceBits */
817 0, /* IntensityBits */
822 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
823 fetch_texel_1d_argb4444_rev
, /* FetchTexel1D */
824 fetch_texel_2d_argb4444_rev
, /* FetchTexel2D */
825 fetch_texel_3d_argb4444_rev
, /* FetchTexel3D */
826 NULL
, /* FetchTexel1Df */
827 NULL
, /* FetchTexel2Df */
828 NULL
, /* FetchTexel3Df */
829 store_texel_argb4444_rev
/* StoreTexel */
832 const struct gl_texture_format _mesa_texformat_argb1555
= {
833 MESA_FORMAT_ARGB1555
, /* MesaFormat */
834 GL_RGBA
, /* BaseFormat */
835 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
840 0, /* LuminanceBits */
841 0, /* IntensityBits */
846 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
847 fetch_texel_1d_argb1555
, /* FetchTexel1D */
848 fetch_texel_2d_argb1555
, /* FetchTexel2D */
849 fetch_texel_3d_argb1555
, /* FetchTexel3D */
850 NULL
, /* FetchTexel1Df */
851 NULL
, /* FetchTexel2Df */
852 NULL
, /* FetchTexel3Df */
853 store_texel_argb1555
/* StoreTexel */
856 const struct gl_texture_format _mesa_texformat_argb1555_rev
= {
857 MESA_FORMAT_ARGB1555_REV
, /* MesaFormat */
858 GL_RGBA
, /* BaseFormat */
859 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
864 0, /* LuminanceBits */
865 0, /* IntensityBits */
870 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
871 fetch_texel_1d_argb1555_rev
, /* FetchTexel1D */
872 fetch_texel_2d_argb1555_rev
, /* FetchTexel2D */
873 fetch_texel_3d_argb1555_rev
, /* FetchTexel3D */
874 NULL
, /* FetchTexel1Df */
875 NULL
, /* FetchTexel2Df */
876 NULL
, /* FetchTexel3Df */
877 store_texel_argb1555_rev
/* StoreTexel */
880 const struct gl_texture_format _mesa_texformat_al88
= {
881 MESA_FORMAT_AL88
, /* MesaFormat */
882 GL_LUMINANCE_ALPHA
, /* BaseFormat */
883 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
888 8, /* LuminanceBits */
889 0, /* IntensityBits */
894 _mesa_texstore_al88
, /* StoreTexImageFunc */
895 fetch_texel_1d_al88
, /* FetchTexel1D */
896 fetch_texel_2d_al88
, /* FetchTexel2D */
897 fetch_texel_3d_al88
, /* FetchTexel3D */
898 NULL
, /* FetchTexel1Df */
899 NULL
, /* FetchTexel2Df */
900 NULL
, /* FetchTexel3Df */
901 store_texel_al88
/* StoreTexel */
904 const struct gl_texture_format _mesa_texformat_al88_rev
= {
905 MESA_FORMAT_AL88_REV
, /* MesaFormat */
906 GL_LUMINANCE_ALPHA
, /* BaseFormat */
907 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
912 8, /* LuminanceBits */
913 0, /* IntensityBits */
918 _mesa_texstore_al88
, /* StoreTexImageFunc */
919 fetch_texel_1d_al88_rev
, /* FetchTexel1D */
920 fetch_texel_2d_al88_rev
, /* FetchTexel2D */
921 fetch_texel_3d_al88_rev
, /* FetchTexel3D */
922 NULL
, /* FetchTexel1Df */
923 NULL
, /* FetchTexel2Df */
924 NULL
, /* FetchTexel3Df */
925 store_texel_al88_rev
/* StoreTexel */
928 const struct gl_texture_format _mesa_texformat_rgb332
= {
929 MESA_FORMAT_RGB332
, /* MesaFormat */
930 GL_RGB
, /* BaseFormat */
931 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
936 0, /* LuminanceBits */
937 0, /* IntensityBits */
942 _mesa_texstore_rgb332
, /* StoreTexImageFunc */
943 fetch_texel_1d_rgb332
, /* FetchTexel1D */
944 fetch_texel_2d_rgb332
, /* FetchTexel2D */
945 fetch_texel_3d_rgb332
, /* FetchTexel3D */
946 NULL
, /* FetchTexel1Df */
947 NULL
, /* FetchTexel2Df */
948 NULL
, /* FetchTexel3Df */
949 store_texel_rgb332
/* StoreTexel */
952 const struct gl_texture_format _mesa_texformat_a8
= {
953 MESA_FORMAT_A8
, /* MesaFormat */
954 GL_ALPHA
, /* BaseFormat */
955 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
960 0, /* LuminanceBits */
961 0, /* IntensityBits */
966 _mesa_texstore_a8
, /* StoreTexImageFunc */
967 fetch_texel_1d_a8
, /* FetchTexel1D */
968 fetch_texel_2d_a8
, /* FetchTexel2D */
969 fetch_texel_3d_a8
, /* FetchTexel3D */
970 NULL
, /* FetchTexel1Df */
971 NULL
, /* FetchTexel2Df */
972 NULL
, /* FetchTexel3Df */
973 store_texel_a8
/* StoreTexel */
976 const struct gl_texture_format _mesa_texformat_l8
= {
977 MESA_FORMAT_L8
, /* MesaFormat */
978 GL_LUMINANCE
, /* BaseFormat */
979 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
984 8, /* LuminanceBits */
985 0, /* IntensityBits */
990 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
991 fetch_texel_1d_l8
, /* FetchTexel1D */
992 fetch_texel_2d_l8
, /* FetchTexel2D */
993 fetch_texel_3d_l8
, /* FetchTexel3D */
994 NULL
, /* FetchTexel1Df */
995 NULL
, /* FetchTexel2Df */
996 NULL
, /* FetchTexel3Df */
997 store_texel_l8
/* StoreTexel */
1000 const struct gl_texture_format _mesa_texformat_i8
= {
1001 MESA_FORMAT_I8
, /* MesaFormat */
1002 GL_INTENSITY
, /* BaseFormat */
1003 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1008 0, /* LuminanceBits */
1009 8, /* IntensityBits */
1012 0, /* StencilBits */
1014 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
1015 fetch_texel_1d_i8
, /* FetchTexel1D */
1016 fetch_texel_2d_i8
, /* FetchTexel2D */
1017 fetch_texel_3d_i8
, /* FetchTexel3D */
1018 NULL
, /* FetchTexel1Df */
1019 NULL
, /* FetchTexel2Df */
1020 NULL
, /* FetchTexel3Df */
1021 store_texel_i8
/* StoreTexel */
1024 const struct gl_texture_format _mesa_texformat_ci8
= {
1025 MESA_FORMAT_CI8
, /* MesaFormat */
1026 GL_COLOR_INDEX
, /* BaseFormat */
1027 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1032 0, /* LuminanceBits */
1033 0, /* IntensityBits */
1036 0, /* StencilBits */
1038 _mesa_texstore_ci8
, /* StoreTexImageFunc */
1039 fetch_texel_1d_ci8
, /* FetchTexel1D */
1040 fetch_texel_2d_ci8
, /* FetchTexel2D */
1041 fetch_texel_3d_ci8
, /* FetchTexel3D */
1042 NULL
, /* FetchTexel1Df */
1043 NULL
, /* FetchTexel2Df */
1044 NULL
, /* FetchTexel3Df */
1045 store_texel_ci8
/* StoreTexel */
1048 const struct gl_texture_format _mesa_texformat_ycbcr
= {
1049 MESA_FORMAT_YCBCR
, /* MesaFormat */
1050 GL_YCBCR_MESA
, /* BaseFormat */
1051 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1056 0, /* LuminanceBits */
1057 0, /* IntensityBits */
1060 0, /* StencilBits */
1062 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1063 fetch_texel_1d_ycbcr
, /* FetchTexel1D */
1064 fetch_texel_2d_ycbcr
, /* FetchTexel2D */
1065 fetch_texel_3d_ycbcr
, /* FetchTexel3D */
1066 NULL
, /* FetchTexel1Df */
1067 NULL
, /* FetchTexel2Df */
1068 NULL
, /* FetchTexel3Df */
1069 store_texel_ycbcr
/* StoreTexel */
1072 const struct gl_texture_format _mesa_texformat_ycbcr_rev
= {
1073 MESA_FORMAT_YCBCR_REV
, /* MesaFormat */
1074 GL_YCBCR_MESA
, /* BaseFormat */
1075 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1080 0, /* LuminanceBits */
1081 0, /* IntensityBits */
1084 0, /* StencilBits */
1086 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1087 fetch_texel_1d_ycbcr_rev
, /* FetchTexel1D */
1088 fetch_texel_2d_ycbcr_rev
, /* FetchTexel2D */
1089 fetch_texel_3d_ycbcr_rev
, /* FetchTexel3D */
1090 NULL
, /* FetchTexel1Df */
1091 NULL
, /* FetchTexel2Df */
1092 NULL
, /* FetchTexel3Df */
1093 store_texel_ycbcr_rev
/* StoreTexel */
1096 const struct gl_texture_format _mesa_texformat_z24_s8
= {
1097 MESA_FORMAT_Z24_S8
, /* MesaFormat */
1098 GL_DEPTH_STENCIL_EXT
, /* BaseFormat */
1099 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1104 0, /* LuminanceBits */
1105 0, /* IntensityBits */
1108 8, /* StencilBits */
1110 _mesa_texstore_z24_s8
, /* StoreTexImageFunc */
1111 NULL
, /* FetchTexel1D */
1112 NULL
, /* FetchTexel2D */
1113 NULL
, /* FetchTexel3D */
1114 fetch_texel_1d_f_z24_s8
, /* FetchTexel1Df */
1115 fetch_texel_2d_f_z24_s8
, /* FetchTexel2Df */
1116 fetch_texel_3d_f_z24_s8
, /* FetchTexel3Df */
1117 store_texel_z24_s8
/* StoreTexel */
1123 /***************************************************************/
1124 /** \name Null format (useful for proxy textures) */
1127 const struct gl_texture_format _mesa_null_texformat
= {
1128 -1, /* MesaFormat */
1130 GL_NONE
, /* DataType */
1135 0, /* LuminanceBits */
1136 0, /* IntensityBits */
1139 0, /* StencilBits */
1141 NULL
, /* StoreTexImageFunc */
1142 fetch_null_texel
, /* FetchTexel1D */
1143 fetch_null_texel
, /* FetchTexel2D */
1144 fetch_null_texel
, /* FetchTexel3D */
1145 fetch_null_texelf
, /* FetchTexel1Df */
1146 fetch_null_texelf
, /* FetchTexel2Df */
1147 fetch_null_texelf
, /* FetchTexel3Df */
1148 store_null_texel
/* StoreTexel */
1155 * Choose an appropriate texture format given the format, type and
1156 * internalFormat parameters passed to glTexImage().
1158 * \param ctx the GL context.
1159 * \param internalFormat user's prefered internal texture format.
1160 * \param format incoming image pixel format.
1161 * \param type incoming image data type.
1163 * \return a pointer to a gl_texture_format object which describes the
1164 * choosen texture format, or NULL on failure.
1166 * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
1167 * will typically override this function with a specialized version.
1169 const struct gl_texture_format
*
1170 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
1171 GLenum format
, GLenum type
)
1176 switch (internalFormat
) {
1183 return &_mesa_texformat_rgba
;
1185 return &_mesa_texformat_rgba8888
;
1187 return &_mesa_texformat_argb1555
;
1189 return &_mesa_texformat_argb4444_rev
; /* just to test another format*/
1191 return &_mesa_texformat_argb4444
;
1199 return &_mesa_texformat_rgb
;
1201 return &_mesa_texformat_rgb888
;
1203 return &_mesa_texformat_rgb332
;
1205 return &_mesa_texformat_rgb565_rev
; /* just to test another format */
1207 return &_mesa_texformat_rgb565
;
1214 return &_mesa_texformat_alpha
;
1216 return &_mesa_texformat_a8
;
1218 /* Luminance formats */
1222 case GL_LUMINANCE12
:
1223 case GL_LUMINANCE16
:
1224 return &_mesa_texformat_luminance
;
1226 return &_mesa_texformat_l8
;
1228 /* Luminance/Alpha formats */
1230 case GL_LUMINANCE_ALPHA
:
1231 case GL_LUMINANCE4_ALPHA4
:
1232 case GL_LUMINANCE6_ALPHA2
:
1233 case GL_LUMINANCE12_ALPHA4
:
1234 case GL_LUMINANCE12_ALPHA12
:
1235 case GL_LUMINANCE16_ALPHA16
:
1236 return &_mesa_texformat_luminance_alpha
;
1237 case GL_LUMINANCE8_ALPHA8
:
1238 return &_mesa_texformat_al88
;
1242 case GL_INTENSITY12
:
1243 case GL_INTENSITY16
:
1244 return &_mesa_texformat_intensity
;
1246 return &_mesa_texformat_i8
;
1248 case GL_COLOR_INDEX
:
1249 case GL_COLOR_INDEX1_EXT
:
1250 case GL_COLOR_INDEX2_EXT
:
1251 case GL_COLOR_INDEX4_EXT
:
1252 case GL_COLOR_INDEX12_EXT
:
1253 case GL_COLOR_INDEX16_EXT
:
1254 case GL_COLOR_INDEX8_EXT
:
1255 return &_mesa_texformat_ci8
;
1261 if (ctx
->Extensions
.SGIX_depth_texture
||
1262 ctx
->Extensions
.ARB_depth_texture
) {
1263 switch (internalFormat
) {
1264 case GL_DEPTH_COMPONENT
:
1265 case GL_DEPTH_COMPONENT24_SGIX
:
1266 case GL_DEPTH_COMPONENT32_SGIX
:
1267 return &_mesa_texformat_depth_component_float32
;
1268 case GL_DEPTH_COMPONENT16_SGIX
:
1269 return &_mesa_texformat_depth_component16
;
1275 if (ctx
->Extensions
.ARB_texture_compression
) {
1276 switch (internalFormat
) {
1277 case GL_COMPRESSED_ALPHA_ARB
:
1278 return &_mesa_texformat_alpha
;
1279 case GL_COMPRESSED_LUMINANCE_ARB
:
1280 return &_mesa_texformat_luminance
;
1281 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
1282 return &_mesa_texformat_luminance_alpha
;
1283 case GL_COMPRESSED_INTENSITY_ARB
:
1284 return &_mesa_texformat_intensity
;
1285 case GL_COMPRESSED_RGB_ARB
:
1286 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1287 return &_mesa_texformat_rgb_fxt1
;
1288 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1289 ctx
->Extensions
.S3_s3tc
)
1290 return &_mesa_texformat_rgb_dxt1
;
1292 return &_mesa_texformat_rgb
;
1293 case GL_COMPRESSED_RGBA_ARB
:
1294 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1295 return &_mesa_texformat_rgba_fxt1
;
1296 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1297 ctx
->Extensions
.S3_s3tc
)
1298 return &_mesa_texformat_rgba_dxt3
; /* Not rgba_dxt1, see spec */
1300 return &_mesa_texformat_rgba
;
1306 if (ctx
->Extensions
.MESA_ycbcr_texture
) {
1307 if (internalFormat
== GL_YCBCR_MESA
) {
1308 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
)
1309 return &_mesa_texformat_ycbcr
;
1311 return &_mesa_texformat_ycbcr_rev
;
1315 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
) {
1316 switch (internalFormat
) {
1317 case GL_COMPRESSED_RGB_FXT1_3DFX
:
1318 return &_mesa_texformat_rgb_fxt1
;
1319 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
1320 return &_mesa_texformat_rgba_fxt1
;
1326 if (ctx
->Extensions
.EXT_texture_compression_s3tc
) {
1327 switch (internalFormat
) {
1328 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
1329 return &_mesa_texformat_rgb_dxt1
;
1330 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
1331 return &_mesa_texformat_rgba_dxt1
;
1332 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
1333 return &_mesa_texformat_rgba_dxt3
;
1334 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
1335 return &_mesa_texformat_rgba_dxt5
;
1341 if (ctx
->Extensions
.S3_s3tc
) {
1342 switch (internalFormat
) {
1345 return &_mesa_texformat_rgb_dxt1
;
1348 return &_mesa_texformat_rgba_dxt3
;
1354 if (ctx
->Extensions
.ARB_texture_float
) {
1355 switch (internalFormat
) {
1356 case GL_ALPHA16F_ARB
:
1357 return &_mesa_texformat_alpha_float16
;
1358 case GL_ALPHA32F_ARB
:
1359 return &_mesa_texformat_alpha_float32
;
1360 case GL_LUMINANCE16F_ARB
:
1361 return &_mesa_texformat_luminance_float16
;
1362 case GL_LUMINANCE32F_ARB
:
1363 return &_mesa_texformat_luminance_float32
;
1364 case GL_LUMINANCE_ALPHA16F_ARB
:
1365 return &_mesa_texformat_luminance_alpha_float16
;
1366 case GL_LUMINANCE_ALPHA32F_ARB
:
1367 return &_mesa_texformat_luminance_alpha_float32
;
1368 case GL_INTENSITY16F_ARB
:
1369 return &_mesa_texformat_intensity_float16
;
1370 case GL_INTENSITY32F_ARB
:
1371 return &_mesa_texformat_intensity_float32
;
1373 return &_mesa_texformat_rgb_float16
;
1375 return &_mesa_texformat_rgb_float32
;
1376 case GL_RGBA16F_ARB
:
1377 return &_mesa_texformat_rgba_float16
;
1378 case GL_RGBA32F_ARB
:
1379 return &_mesa_texformat_rgba_float32
;
1385 if (ctx
->Extensions
.EXT_packed_depth_stencil
) {
1386 switch (internalFormat
) {
1387 case GL_DEPTH_STENCIL_EXT
:
1388 case GL_DEPTH24_STENCIL8_EXT
:
1389 return &_mesa_texformat_z24_s8
;
1395 _mesa_problem(ctx
, "unexpected format in _mesa_choose_tex_format()");