2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 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
40 #include "texformat.h"
47 /* Texel fetch routines for all supported formats
50 #include "texformat_tmp.h"
53 #include "texformat_tmp.h"
56 #include "texformat_tmp.h"
59 * Null texel fetch function.
61 * Have to have this so the FetchTexel function pointer is never NULL.
63 static void fetch_null_texel( const struct gl_texture_image
*texImage
,
64 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
66 (void) texImage
; (void) i
; (void) j
; (void) k
;
71 _mesa_warning(NULL
, "fetch_null_texel() called!");
74 static void fetch_null_texelf( const struct gl_texture_image
*texImage
,
75 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
77 (void) texImage
; (void) i
; (void) j
; (void) k
;
82 _mesa_warning(NULL
, "fetch_null_texelf() called!");
86 /***************************************************************/
87 /** \name Default GLchan-based formats */
90 const struct gl_texture_format _mesa_texformat_rgba
= {
91 MESA_FORMAT_RGBA
, /* MesaFormat */
92 GL_RGBA
, /* BaseFormat */
93 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
94 CHAN_BITS
, /* RedBits */
95 CHAN_BITS
, /* GreenBits */
96 CHAN_BITS
, /* BlueBits */
97 CHAN_BITS
, /* AlphaBits */
98 0, /* LuminanceBits */
99 0, /* IntensityBits */
102 4 * sizeof(GLchan
), /* TexelBytes */
103 _mesa_texstore_rgba
, /* StoreTexImageFunc */
104 fetch_texel_1d_rgba
, /* FetchTexel1D */
105 fetch_texel_2d_rgba
, /* FetchTexel2D */
106 fetch_texel_3d_rgba
, /* FetchTexel3D */
107 fetch_texel_1d_f_rgba
, /* FetchTexel1Df */
108 fetch_texel_2d_f_rgba
, /* FetchTexel2Df */
109 fetch_texel_3d_f_rgba
, /* FetchTexel3Df */
112 const struct gl_texture_format _mesa_texformat_rgb
= {
113 MESA_FORMAT_RGB
, /* MesaFormat */
114 GL_RGB
, /* BaseFormat */
115 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
116 CHAN_BITS
, /* RedBits */
117 CHAN_BITS
, /* GreenBits */
118 CHAN_BITS
, /* BlueBits */
120 0, /* LuminanceBits */
121 0, /* IntensityBits */
124 3 * sizeof(GLchan
), /* TexelBytes */
125 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
126 fetch_texel_1d_rgb
, /* FetchTexel1D */
127 fetch_texel_2d_rgb
, /* FetchTexel2D */
128 fetch_texel_3d_rgb
, /* FetchTexel3D */
129 fetch_texel_1d_f_rgb
, /* FetchTexel1Df */
130 fetch_texel_2d_f_rgb
, /* FetchTexel2Df */
131 fetch_texel_3d_f_rgb
, /* FetchTexel3Df */
134 const struct gl_texture_format _mesa_texformat_alpha
= {
135 MESA_FORMAT_ALPHA
, /* MesaFormat */
136 GL_ALPHA
, /* BaseFormat */
137 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
141 CHAN_BITS
, /* AlphaBits */
142 0, /* LuminanceBits */
143 0, /* IntensityBits */
146 sizeof(GLchan
), /* TexelBytes */
147 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
148 fetch_texel_1d_alpha
, /* FetchTexel1D */
149 fetch_texel_2d_alpha
, /* FetchTexel2D */
150 fetch_texel_3d_alpha
, /* FetchTexel3D */
151 fetch_texel_1d_f_alpha
, /* FetchTexel1Df */
152 fetch_texel_2d_f_alpha
, /* FetchTexel2Df */
153 fetch_texel_3d_f_alpha
, /* FetchTexel3Df */
156 const struct gl_texture_format _mesa_texformat_luminance
= {
157 MESA_FORMAT_LUMINANCE
, /* MesaFormat */
158 GL_LUMINANCE
, /* BaseFormat */
159 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
164 CHAN_BITS
, /* LuminanceBits */
165 0, /* IntensityBits */
168 sizeof(GLchan
), /* TexelBytes */
169 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
170 fetch_texel_1d_luminance
, /* FetchTexel1D */
171 fetch_texel_2d_luminance
, /* FetchTexel2D */
172 fetch_texel_3d_luminance
, /* FetchTexel3D */
173 fetch_texel_1d_f_luminance
, /* FetchTexel1Df */
174 fetch_texel_2d_f_luminance
, /* FetchTexel2Df */
175 fetch_texel_3d_f_luminance
, /* FetchTexel3Df */
178 const struct gl_texture_format _mesa_texformat_luminance_alpha
= {
179 MESA_FORMAT_LUMINANCE_ALPHA
, /* MesaFormat */
180 GL_LUMINANCE_ALPHA
, /* BaseFormat */
181 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
185 CHAN_BITS
, /* AlphaBits */
186 CHAN_BITS
, /* LuminanceBits */
187 0, /* IntensityBits */
190 2 * sizeof(GLchan
), /* TexelBytes */
191 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
192 fetch_texel_1d_luminance_alpha
, /* FetchTexel1D */
193 fetch_texel_2d_luminance_alpha
, /* FetchTexel2D */
194 fetch_texel_3d_luminance_alpha
, /* FetchTexel3D */
195 fetch_texel_1d_f_luminance_alpha
, /* FetchTexel1Df */
196 fetch_texel_2d_f_luminance_alpha
, /* FetchTexel2Df */
197 fetch_texel_3d_f_luminance_alpha
, /* FetchTexel3Df */
200 const struct gl_texture_format _mesa_texformat_intensity
= {
201 MESA_FORMAT_INTENSITY
, /* MesaFormat */
202 GL_INTENSITY
, /* BaseFormat */
203 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
208 0, /* LuminanceBits */
209 CHAN_BITS
, /* IntensityBits */
212 sizeof(GLchan
), /* TexelBytes */
213 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
214 fetch_texel_1d_intensity
, /* FetchTexel1D */
215 fetch_texel_2d_intensity
, /* FetchTexel2D */
216 fetch_texel_3d_intensity
, /* FetchTexel3D */
217 fetch_texel_1d_f_intensity
, /* FetchTexel1Df */
218 fetch_texel_2d_f_intensity
, /* FetchTexel2Df */
219 fetch_texel_3d_f_intensity
, /* FetchTexel3Df */
222 const struct gl_texture_format _mesa_texformat_depth_component_float32
= {
223 MESA_FORMAT_DEPTH_COMPONENT_FLOAT32
, /* MesaFormat */
224 GL_DEPTH_COMPONENT
, /* BaseFormat */
225 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
230 0, /* LuminanceBits */
231 0, /* IntensityBits */
233 sizeof(GLfloat
) * 8, /* DepthBits */
234 sizeof(GLfloat
), /* TexelBytes */
235 _mesa_texstore_depth_component_float32
,/* StoreTexImageFunc */
236 fetch_null_texel
, /* FetchTexel1D */
237 fetch_null_texel
, /* FetchTexel1D */
238 fetch_null_texel
, /* FetchTexel1D */
239 fetch_texel_1d_f_depth_component_f32
,/* FetchTexel1Df */
240 fetch_texel_2d_f_depth_component_f32
,/* FetchTexel2Df */
241 fetch_texel_3d_f_depth_component_f32
,/* FetchTexel3Df */
244 const struct gl_texture_format _mesa_texformat_depth_component16
= {
245 MESA_FORMAT_DEPTH_COMPONENT16
, /* MesaFormat */
246 GL_DEPTH_COMPONENT
, /* BaseFormat */
247 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
252 0, /* LuminanceBits */
253 0, /* IntensityBits */
255 sizeof(GLushort
) * 8, /* DepthBits */
256 sizeof(GLushort
), /* TexelBytes */
257 _mesa_texstore_depth_component16
, /* StoreTexImageFunc */
258 fetch_null_texel
, /* FetchTexel1D */
259 fetch_null_texel
, /* FetchTexel1D */
260 fetch_null_texel
, /* FetchTexel1D */
261 fetch_texel_1d_f_depth_component16
, /* FetchTexel1Df */
262 fetch_texel_2d_f_depth_component16
, /* FetchTexel2Df */
263 fetch_texel_3d_f_depth_component16
, /* FetchTexel3Df */
266 const struct gl_texture_format _mesa_texformat_rgba_float32
= {
267 MESA_FORMAT_RGBA_FLOAT32
, /* MesaFormat */
268 GL_RGBA
, /* BaseFormat */
269 GL_FLOAT
, /* DataType */
270 8 * sizeof(GLfloat
), /* RedBits */
271 8 * sizeof(GLfloat
), /* GreenBits */
272 8 * sizeof(GLfloat
), /* BlueBits */
273 8 * sizeof(GLfloat
), /* AlphaBits */
274 0, /* LuminanceBits */
275 0, /* IntensityBits */
278 4 * sizeof(GLfloat
), /* TexelBytes */
279 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
280 fetch_texel_1d_rgba_f32
, /* FetchTexel1D */
281 fetch_texel_2d_rgba_f32
, /* FetchTexel1D */
282 fetch_texel_3d_rgba_f32
, /* FetchTexel1D */
283 fetch_texel_1d_f_rgba_f32
, /* FetchTexel1Df */
284 fetch_texel_2d_f_rgba_f32
, /* FetchTexel2Df */
285 fetch_texel_3d_f_rgba_f32
, /* FetchTexel3Df */
288 const struct gl_texture_format _mesa_texformat_rgba_float16
= {
289 MESA_FORMAT_RGBA_FLOAT16
, /* MesaFormat */
290 GL_RGBA
, /* BaseFormat */
291 GL_FLOAT
, /* DataType */
292 8 * sizeof(GLhalfARB
), /* RedBits */
293 8 * sizeof(GLhalfARB
), /* GreenBits */
294 8 * sizeof(GLhalfARB
), /* BlueBits */
295 8 * sizeof(GLhalfARB
), /* AlphaBits */
296 0, /* LuminanceBits */
297 0, /* IntensityBits */
300 4 * sizeof(GLhalfARB
), /* TexelBytes */
301 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
302 fetch_texel_1d_rgba_f16
, /* FetchTexel1D */
303 fetch_texel_2d_rgba_f16
, /* FetchTexel1D */
304 fetch_texel_3d_rgba_f16
, /* FetchTexel1D */
305 fetch_texel_1d_f_rgba_f16
, /* FetchTexel1Df */
306 fetch_texel_2d_f_rgba_f16
, /* FetchTexel2Df */
307 fetch_texel_3d_f_rgba_f16
, /* FetchTexel3Df */
310 const struct gl_texture_format _mesa_texformat_rgb_float32
= {
311 MESA_FORMAT_RGB_FLOAT32
, /* MesaFormat */
312 GL_RGB
, /* BaseFormat */
313 GL_FLOAT
, /* DataType */
314 8 * sizeof(GLfloat
), /* RedBits */
315 8 * sizeof(GLfloat
), /* GreenBits */
316 8 * sizeof(GLfloat
), /* BlueBits */
318 0, /* LuminanceBits */
319 0, /* IntensityBits */
322 3 * sizeof(GLfloat
), /* TexelBytes */
323 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
324 fetch_texel_1d_rgb_f32
, /* FetchTexel1D */
325 fetch_texel_2d_rgb_f32
, /* FetchTexel1D */
326 fetch_texel_3d_rgb_f32
, /* FetchTexel1D */
327 fetch_texel_1d_f_rgb_f32
, /* FetchTexel1Df */
328 fetch_texel_2d_f_rgb_f32
, /* FetchTexel2Df */
329 fetch_texel_3d_f_rgb_f32
, /* FetchTexel3Df */
332 const struct gl_texture_format _mesa_texformat_rgb_float16
= {
333 MESA_FORMAT_RGB_FLOAT16
, /* MesaFormat */
334 GL_RGB
, /* BaseFormat */
335 GL_FLOAT
, /* DataType */
336 8 * sizeof(GLhalfARB
), /* RedBits */
337 8 * sizeof(GLhalfARB
), /* GreenBits */
338 8 * sizeof(GLhalfARB
), /* BlueBits */
340 0, /* LuminanceBits */
341 0, /* IntensityBits */
344 3 * sizeof(GLhalfARB
), /* TexelBytes */
345 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
346 fetch_texel_1d_rgb_f16
, /* FetchTexel1D */
347 fetch_texel_2d_rgb_f16
, /* FetchTexel1D */
348 fetch_texel_3d_rgb_f16
, /* FetchTexel1D */
349 fetch_texel_1d_f_rgb_f16
, /* FetchTexel1Df */
350 fetch_texel_2d_f_rgb_f16
, /* FetchTexel2Df */
351 fetch_texel_3d_f_rgb_f16
/* FetchTexel3Df */
354 const struct gl_texture_format _mesa_texformat_alpha_float32
= {
355 MESA_FORMAT_ALPHA_FLOAT32
, /* MesaFormat */
356 GL_ALPHA
, /* BaseFormat */
357 GL_FLOAT
, /* DataType */
361 8 * sizeof(GLfloat
), /* AlphaBits */
362 0, /* LuminanceBits */
363 0, /* IntensityBits */
366 1 * sizeof(GLfloat
), /* TexelBytes */
367 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
368 fetch_texel_1d_alpha_f32
, /* FetchTexel1D */
369 fetch_texel_2d_alpha_f32
, /* FetchTexel1D */
370 fetch_texel_3d_alpha_f32
, /* FetchTexel1D */
371 fetch_texel_1d_f_alpha_f32
, /* FetchTexel1Df */
372 fetch_texel_2d_f_alpha_f32
, /* FetchTexel2Df */
373 fetch_texel_3d_f_alpha_f32
/* FetchTexel3Df */
376 const struct gl_texture_format _mesa_texformat_alpha_float16
= {
377 MESA_FORMAT_ALPHA_FLOAT16
, /* MesaFormat */
378 GL_ALPHA
, /* BaseFormat */
379 GL_FLOAT
, /* DataType */
383 8 * sizeof(GLhalfARB
), /* AlphaBits */
384 0, /* LuminanceBits */
385 0, /* IntensityBits */
388 1 * sizeof(GLhalfARB
), /* TexelBytes */
389 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
390 fetch_texel_1d_alpha_f16
, /* FetchTexel1D */
391 fetch_texel_2d_alpha_f16
, /* FetchTexel1D */
392 fetch_texel_3d_alpha_f16
, /* FetchTexel1D */
393 fetch_texel_1d_f_alpha_f16
, /* FetchTexel1Df */
394 fetch_texel_2d_f_alpha_f16
, /* FetchTexel2Df */
395 fetch_texel_3d_f_alpha_f16
/* FetchTexel3Df */
398 const struct gl_texture_format _mesa_texformat_luminance_float32
= {
399 MESA_FORMAT_LUMINANCE_FLOAT32
, /* MesaFormat */
400 GL_LUMINANCE
, /* BaseFormat */
401 GL_FLOAT
, /* DataType */
406 8 * sizeof(GLfloat
), /* LuminanceBits */
407 0, /* IntensityBits */
410 1 * sizeof(GLfloat
), /* TexelBytes */
411 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
412 fetch_texel_1d_luminance_f32
, /* FetchTexel1D */
413 fetch_texel_2d_luminance_f32
, /* FetchTexel2D */
414 fetch_texel_3d_luminance_f32
, /* FetchTexel3D */
415 fetch_texel_1d_f_luminance_f32
, /* FetchTexel1Df */
416 fetch_texel_2d_f_luminance_f32
, /* FetchTexel2Df */
417 fetch_texel_3d_f_luminance_f32
/* FetchTexel3Df */
420 const struct gl_texture_format _mesa_texformat_luminance_float16
= {
421 MESA_FORMAT_LUMINANCE_FLOAT16
, /* MesaFormat */
422 GL_LUMINANCE
, /* BaseFormat */
423 GL_FLOAT
, /* DataType */
428 8 * sizeof(GLhalfARB
), /* LuminanceBits */
429 0, /* IntensityBits */
432 1 * sizeof(GLhalfARB
), /* TexelBytes */
433 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
434 fetch_texel_1d_luminance_f16
, /* FetchTexel1D */
435 fetch_texel_2d_luminance_f16
, /* FetchTexel2D */
436 fetch_texel_3d_luminance_f16
, /* FetchTexel3D */
437 fetch_texel_1d_f_luminance_f16
, /* FetchTexel1Df */
438 fetch_texel_2d_f_luminance_f16
, /* FetchTexel2Df */
439 fetch_texel_3d_f_luminance_f16
/* FetchTexel3Df */
442 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32
= {
443 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
, /* MesaFormat */
444 GL_LUMINANCE_ALPHA
, /* BaseFormat */
445 GL_FLOAT
, /* DataType */
449 8 * sizeof(GLfloat
), /* AlphaBits */
450 8 * sizeof(GLfloat
), /* LuminanceBits */
451 0, /* IntensityBits */
454 2 * sizeof(GLfloat
), /* TexelBytes */
455 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
456 fetch_texel_1d_luminance_alpha_f32
, /* FetchTexel1D */
457 fetch_texel_2d_luminance_alpha_f32
, /* FetchTexel2D */
458 fetch_texel_3d_luminance_alpha_f32
, /* FetchTexel3D */
459 fetch_texel_1d_f_luminance_alpha_f32
,/* FetchTexel1Df */
460 fetch_texel_2d_f_luminance_alpha_f32
,/* FetchTexel2Df */
461 fetch_texel_3d_f_luminance_alpha_f32
/* FetchTexel3Df */
464 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16
= {
465 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
, /* MesaFormat */
466 GL_LUMINANCE_ALPHA
, /* BaseFormat */
467 GL_FLOAT
, /* DataType */
471 8 * sizeof(GLhalfARB
), /* AlphaBits */
472 8 * sizeof(GLhalfARB
), /* LuminanceBits */
473 0, /* IntensityBits */
476 2 * sizeof(GLhalfARB
), /* TexelBytes */
477 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
478 fetch_texel_1d_luminance_alpha_f16
, /* FetchTexel1D */
479 fetch_texel_2d_luminance_alpha_f16
, /* FetchTexel2D */
480 fetch_texel_3d_luminance_alpha_f16
, /* FetchTexel3D */
481 fetch_texel_1d_f_luminance_alpha_f16
,/* FetchTexel1Df */
482 fetch_texel_2d_f_luminance_alpha_f16
,/* FetchTexel2Df */
483 fetch_texel_3d_f_luminance_alpha_f16
/* FetchTexel3Df */
486 const struct gl_texture_format _mesa_texformat_intensity_float32
= {
487 MESA_FORMAT_INTENSITY_FLOAT32
, /* MesaFormat */
488 GL_INTENSITY
, /* BaseFormat */
489 GL_FLOAT
, /* DataType */
494 0, /* LuminanceBits */
495 8 * sizeof(GLfloat
), /* IntensityBits */
498 1 * sizeof(GLfloat
), /* TexelBytes */
499 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
500 fetch_texel_1d_intensity_f32
, /* FetchTexel1D */
501 fetch_texel_2d_intensity_f32
, /* FetchTexel2D */
502 fetch_texel_3d_intensity_f32
, /* FetchTexel3D */
503 fetch_texel_1d_f_intensity_f32
, /* FetchTexel1Df */
504 fetch_texel_2d_f_intensity_f32
, /* FetchTexel2Df */
505 fetch_texel_3d_f_intensity_f32
/* FetchTexel3Df */
508 const struct gl_texture_format _mesa_texformat_intensity_float16
= {
509 MESA_FORMAT_INTENSITY_FLOAT16
, /* MesaFormat */
510 GL_INTENSITY
, /* BaseFormat */
511 GL_FLOAT
, /* DataType */
516 0, /* LuminanceBits */
517 8 * sizeof(GLhalfARB
), /* IntensityBits */
520 1 * sizeof(GLhalfARB
), /* TexelBytes */
521 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
522 fetch_texel_1d_intensity_f16
, /* FetchTexel1D */
523 fetch_texel_2d_intensity_f16
, /* FetchTexel2D */
524 fetch_texel_3d_intensity_f16
, /* FetchTexel3D */
525 fetch_texel_1d_f_intensity_f16
, /* FetchTexel1Df */
526 fetch_texel_2d_f_intensity_f16
, /* FetchTexel2Df */
527 fetch_texel_3d_f_intensity_f16
/* FetchTexel3Df */
534 /***************************************************************/
535 /** \name Hardware formats */
538 const struct gl_texture_format _mesa_texformat_rgba8888
= {
539 MESA_FORMAT_RGBA8888
, /* MesaFormat */
540 GL_RGBA
, /* BaseFormat */
541 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
546 0, /* LuminanceBits */
547 0, /* IntensityBits */
551 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
552 fetch_texel_1d_rgba8888
, /* FetchTexel1D */
553 fetch_texel_2d_rgba8888
, /* FetchTexel2D */
554 fetch_texel_3d_rgba8888
, /* FetchTexel3D */
555 fetch_texel_1d_f_rgba8888
, /* FetchTexel1Df */
556 fetch_texel_2d_f_rgba8888
, /* FetchTexel2Df */
557 fetch_texel_3d_f_rgba8888
, /* FetchTexel3Df */
560 const struct gl_texture_format _mesa_texformat_rgba8888_rev
= {
561 MESA_FORMAT_RGBA8888_REV
, /* MesaFormat */
562 GL_RGBA
, /* BaseFormat */
563 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
568 0, /* LuminanceBits */
569 0, /* IntensityBits */
573 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
574 fetch_texel_1d_rgba8888_rev
, /* FetchTexel1D */
575 fetch_texel_2d_rgba8888_rev
, /* FetchTexel2D */
576 fetch_texel_3d_rgba8888_rev
, /* FetchTexel3D */
577 fetch_texel_1d_f_rgba8888_rev
, /* FetchTexel1Df */
578 fetch_texel_2d_f_rgba8888_rev
, /* FetchTexel2Df */
579 fetch_texel_3d_f_rgba8888_rev
, /* FetchTexel3Df */
582 const struct gl_texture_format _mesa_texformat_argb8888
= {
583 MESA_FORMAT_ARGB8888
, /* MesaFormat */
584 GL_RGBA
, /* BaseFormat */
585 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
590 0, /* LuminanceBits */
591 0, /* IntensityBits */
595 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
596 fetch_texel_1d_argb8888
, /* FetchTexel1D */
597 fetch_texel_2d_argb8888
, /* FetchTexel2D */
598 fetch_texel_3d_argb8888
, /* FetchTexel3D */
599 fetch_texel_1d_f_argb8888
, /* FetchTexel1Df */
600 fetch_texel_2d_f_argb8888
, /* FetchTexel2Df */
601 fetch_texel_3d_f_argb8888
, /* FetchTexel3Df */
604 const struct gl_texture_format _mesa_texformat_argb8888_rev
= {
605 MESA_FORMAT_ARGB8888_REV
, /* MesaFormat */
606 GL_RGBA
, /* BaseFormat */
607 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
612 0, /* LuminanceBits */
613 0, /* IntensityBits */
617 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
618 fetch_texel_1d_argb8888_rev
, /* FetchTexel1D */
619 fetch_texel_2d_argb8888_rev
, /* FetchTexel2D */
620 fetch_texel_3d_argb8888_rev
, /* FetchTexel3D */
621 fetch_texel_1d_f_argb8888_rev
, /* FetchTexel1Df */
622 fetch_texel_2d_f_argb8888_rev
, /* FetchTexel2Df */
623 fetch_texel_3d_f_argb8888_rev
, /* FetchTexel3Df */
626 const struct gl_texture_format _mesa_texformat_rgb888
= {
627 MESA_FORMAT_RGB888
, /* MesaFormat */
628 GL_RGB
, /* BaseFormat */
629 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
634 0, /* LuminanceBits */
635 0, /* IntensityBits */
639 _mesa_texstore_rgb888
, /* StoreTexImageFunc */
640 fetch_texel_1d_rgb888
, /* FetchTexel1D */
641 fetch_texel_2d_rgb888
, /* FetchTexel2D */
642 fetch_texel_3d_rgb888
, /* FetchTexel3D */
643 fetch_texel_1d_f_rgb888
, /* FetchTexel1Df */
644 fetch_texel_2d_f_rgb888
, /* FetchTexel2Df */
645 fetch_texel_3d_f_rgb888
, /* FetchTexel3Df */
648 const struct gl_texture_format _mesa_texformat_bgr888
= {
649 MESA_FORMAT_BGR888
, /* MesaFormat */
650 GL_RGB
, /* BaseFormat */
651 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
656 0, /* LuminanceBits */
657 0, /* IntensityBits */
661 _mesa_texstore_bgr888
, /* StoreTexImageFunc */
662 fetch_texel_1d_bgr888
, /* FetchTexel1D */
663 fetch_texel_2d_bgr888
, /* FetchTexel2D */
664 fetch_texel_3d_bgr888
, /* FetchTexel3D */
665 fetch_texel_1d_f_bgr888
, /* FetchTexel1Df */
666 fetch_texel_2d_f_bgr888
, /* FetchTexel2Df */
667 fetch_texel_3d_f_bgr888
, /* FetchTexel3Df */
670 const struct gl_texture_format _mesa_texformat_rgb565
= {
671 MESA_FORMAT_RGB565
, /* MesaFormat */
672 GL_RGB
, /* BaseFormat */
673 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
678 0, /* LuminanceBits */
679 0, /* IntensityBits */
683 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
684 fetch_texel_1d_rgb565
, /* FetchTexel1D */
685 fetch_texel_2d_rgb565
, /* FetchTexel2D */
686 fetch_texel_3d_rgb565
, /* FetchTexel3D */
687 fetch_texel_1d_f_rgb565
, /* FetchTexel1Df */
688 fetch_texel_2d_f_rgb565
, /* FetchTexel2Df */
689 fetch_texel_3d_f_rgb565
, /* FetchTexel3Df */
692 const struct gl_texture_format _mesa_texformat_rgb565_rev
= {
693 MESA_FORMAT_RGB565_REV
, /* MesaFormat */
694 GL_RGB
, /* BaseFormat */
695 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
700 0, /* LuminanceBits */
701 0, /* IntensityBits */
705 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
706 fetch_texel_1d_rgb565_rev
, /* FetchTexel1D */
707 fetch_texel_2d_rgb565_rev
, /* FetchTexel2D */
708 fetch_texel_3d_rgb565_rev
, /* FetchTexel3D */
709 fetch_texel_1d_f_rgb565_rev
, /* FetchTexel1Df */
710 fetch_texel_2d_f_rgb565_rev
, /* FetchTexel2Df */
711 fetch_texel_3d_f_rgb565_rev
, /* FetchTexel3Df */
714 const struct gl_texture_format _mesa_texformat_argb4444
= {
715 MESA_FORMAT_ARGB4444
, /* MesaFormat */
716 GL_RGBA
, /* BaseFormat */
717 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
722 0, /* LuminanceBits */
723 0, /* IntensityBits */
727 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
728 fetch_texel_1d_argb4444
, /* FetchTexel1D */
729 fetch_texel_2d_argb4444
, /* FetchTexel2D */
730 fetch_texel_3d_argb4444
, /* FetchTexel3D */
731 fetch_texel_1d_f_argb4444
, /* FetchTexel1Df */
732 fetch_texel_2d_f_argb4444
, /* FetchTexel2Df */
733 fetch_texel_3d_f_argb4444
, /* FetchTexel3Df */
736 const struct gl_texture_format _mesa_texformat_argb4444_rev
= {
737 MESA_FORMAT_ARGB4444_REV
, /* MesaFormat */
738 GL_RGBA
, /* BaseFormat */
739 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
744 0, /* LuminanceBits */
745 0, /* IntensityBits */
749 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
750 fetch_texel_1d_argb4444_rev
, /* FetchTexel1D */
751 fetch_texel_2d_argb4444_rev
, /* FetchTexel2D */
752 fetch_texel_3d_argb4444_rev
, /* FetchTexel3D */
753 fetch_texel_1d_f_argb4444_rev
, /* FetchTexel1Df */
754 fetch_texel_2d_f_argb4444_rev
, /* FetchTexel2Df */
755 fetch_texel_3d_f_argb4444_rev
, /* FetchTexel3Df */
758 const struct gl_texture_format _mesa_texformat_argb1555
= {
759 MESA_FORMAT_ARGB1555
, /* MesaFormat */
760 GL_RGBA
, /* BaseFormat */
761 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
766 0, /* LuminanceBits */
767 0, /* IntensityBits */
771 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
772 fetch_texel_1d_argb1555
, /* FetchTexel1D */
773 fetch_texel_2d_argb1555
, /* FetchTexel2D */
774 fetch_texel_3d_argb1555
, /* FetchTexel3D */
775 fetch_texel_1d_f_argb1555
, /* FetchTexel1Df */
776 fetch_texel_2d_f_argb1555
, /* FetchTexel2Df */
777 fetch_texel_3d_f_argb1555
, /* FetchTexel3Df */
780 const struct gl_texture_format _mesa_texformat_argb1555_rev
= {
781 MESA_FORMAT_ARGB1555_REV
, /* MesaFormat */
782 GL_RGBA
, /* BaseFormat */
783 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
788 0, /* LuminanceBits */
789 0, /* IntensityBits */
793 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
794 fetch_texel_1d_argb1555_rev
, /* FetchTexel1D */
795 fetch_texel_2d_argb1555_rev
, /* FetchTexel2D */
796 fetch_texel_3d_argb1555_rev
, /* FetchTexel3D */
797 fetch_texel_1d_f_argb1555_rev
, /* FetchTexel1Df */
798 fetch_texel_2d_f_argb1555_rev
, /* FetchTexel2Df */
799 fetch_texel_3d_f_argb1555_rev
, /* FetchTexel3Df */
802 const struct gl_texture_format _mesa_texformat_al88
= {
803 MESA_FORMAT_AL88
, /* MesaFormat */
804 GL_LUMINANCE_ALPHA
, /* BaseFormat */
805 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
810 8, /* LuminanceBits */
811 0, /* IntensityBits */
815 _mesa_texstore_al88
, /* StoreTexImageFunc */
816 fetch_texel_1d_al88
, /* FetchTexel1D */
817 fetch_texel_2d_al88
, /* FetchTexel2D */
818 fetch_texel_3d_al88
, /* FetchTexel3D */
819 fetch_texel_1d_f_al88
, /* FetchTexel1Df */
820 fetch_texel_2d_f_al88
, /* FetchTexel2Df */
821 fetch_texel_3d_f_al88
, /* FetchTexel3Df */
824 const struct gl_texture_format _mesa_texformat_al88_rev
= {
825 MESA_FORMAT_AL88_REV
, /* MesaFormat */
826 GL_LUMINANCE_ALPHA
, /* BaseFormat */
827 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
832 8, /* LuminanceBits */
833 0, /* IntensityBits */
837 _mesa_texstore_al88
, /* StoreTexImageFunc */
838 fetch_texel_1d_al88_rev
, /* FetchTexel1D */
839 fetch_texel_2d_al88_rev
, /* FetchTexel2D */
840 fetch_texel_3d_al88_rev
, /* FetchTexel3D */
841 fetch_texel_1d_f_al88_rev
, /* FetchTexel1Df */
842 fetch_texel_2d_f_al88_rev
, /* FetchTexel2Df */
843 fetch_texel_3d_f_al88_rev
, /* FetchTexel3Df */
846 const struct gl_texture_format _mesa_texformat_rgb332
= {
847 MESA_FORMAT_RGB332
, /* MesaFormat */
848 GL_RGB
, /* BaseFormat */
849 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
854 0, /* LuminanceBits */
855 0, /* IntensityBits */
859 _mesa_texstore_rgb332
, /* StoreTexImageFunc */
860 fetch_texel_1d_rgb332
, /* FetchTexel1D */
861 fetch_texel_2d_rgb332
, /* FetchTexel2D */
862 fetch_texel_3d_rgb332
, /* FetchTexel3D */
863 fetch_texel_1d_f_rgb332
, /* FetchTexel1Df */
864 fetch_texel_2d_f_rgb332
, /* FetchTexel2Df */
865 fetch_texel_3d_f_rgb332
, /* FetchTexel3Df */
868 const struct gl_texture_format _mesa_texformat_a8
= {
869 MESA_FORMAT_A8
, /* MesaFormat */
870 GL_ALPHA
, /* BaseFormat */
871 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
876 0, /* LuminanceBits */
877 0, /* IntensityBits */
881 _mesa_texstore_a8
, /* StoreTexImageFunc */
882 fetch_texel_1d_a8
, /* FetchTexel1D */
883 fetch_texel_2d_a8
, /* FetchTexel2D */
884 fetch_texel_3d_a8
, /* FetchTexel3D */
885 fetch_texel_1d_f_a8
, /* FetchTexel1Df */
886 fetch_texel_2d_f_a8
, /* FetchTexel2Df */
887 fetch_texel_3d_f_a8
, /* FetchTexel3Df */
890 const struct gl_texture_format _mesa_texformat_l8
= {
891 MESA_FORMAT_L8
, /* MesaFormat */
892 GL_LUMINANCE
, /* BaseFormat */
893 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
898 8, /* LuminanceBits */
899 0, /* IntensityBits */
903 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
904 fetch_texel_1d_l8
, /* FetchTexel1D */
905 fetch_texel_2d_l8
, /* FetchTexel2D */
906 fetch_texel_3d_l8
, /* FetchTexel3D */
907 fetch_texel_1d_f_l8
, /* FetchTexel1Df */
908 fetch_texel_2d_f_l8
, /* FetchTexel2Df */
909 fetch_texel_3d_f_l8
, /* FetchTexel3Df */
912 const struct gl_texture_format _mesa_texformat_i8
= {
913 MESA_FORMAT_I8
, /* MesaFormat */
914 GL_INTENSITY
, /* BaseFormat */
915 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
920 0, /* LuminanceBits */
921 8, /* IntensityBits */
925 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
926 fetch_texel_1d_i8
, /* FetchTexel1D */
927 fetch_texel_2d_i8
, /* FetchTexel2D */
928 fetch_texel_3d_i8
, /* FetchTexel3D */
929 fetch_texel_1d_f_i8
, /* FetchTexel1Df */
930 fetch_texel_2d_f_i8
, /* FetchTexel2Df */
931 fetch_texel_3d_f_i8
, /* FetchTexel3Df */
934 const struct gl_texture_format _mesa_texformat_ci8
= {
935 MESA_FORMAT_CI8
, /* MesaFormat */
936 GL_COLOR_INDEX
, /* BaseFormat */
937 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
942 0, /* LuminanceBits */
943 0, /* IntensityBits */
947 _mesa_texstore_ci8
, /* StoreTexImageFunc */
948 fetch_texel_1d_ci8
, /* FetchTexel1D */
949 fetch_texel_2d_ci8
, /* FetchTexel2D */
950 fetch_texel_3d_ci8
, /* FetchTexel3D */
951 fetch_texel_1d_f_ci8
, /* FetchTexel1Df */
952 fetch_texel_2d_f_ci8
, /* FetchTexel2Df */
953 fetch_texel_3d_f_ci8
, /* FetchTexel3Df */
956 const struct gl_texture_format _mesa_texformat_ycbcr
= {
957 MESA_FORMAT_YCBCR
, /* MesaFormat */
958 GL_YCBCR_MESA
, /* BaseFormat */
959 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
964 0, /* LuminanceBits */
965 0, /* IntensityBits */
969 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
970 fetch_texel_1d_ycbcr
, /* FetchTexel1D */
971 fetch_texel_2d_ycbcr
, /* FetchTexel2D */
972 fetch_texel_3d_ycbcr
, /* FetchTexel3D */
973 fetch_texel_1d_f_ycbcr
, /* FetchTexel1Df */
974 fetch_texel_2d_f_ycbcr
, /* FetchTexel2Df */
975 fetch_texel_3d_f_ycbcr
, /* FetchTexel3Df */
978 const struct gl_texture_format _mesa_texformat_ycbcr_rev
= {
979 MESA_FORMAT_YCBCR_REV
, /* MesaFormat */
980 GL_YCBCR_MESA
, /* BaseFormat */
981 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
986 0, /* LuminanceBits */
987 0, /* IntensityBits */
991 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
992 fetch_texel_1d_ycbcr_rev
, /* FetchTexel1D */
993 fetch_texel_2d_ycbcr_rev
, /* FetchTexel2D */
994 fetch_texel_3d_ycbcr_rev
, /* FetchTexel3D */
995 fetch_texel_1d_f_ycbcr_rev
, /* FetchTexel1Df */
996 fetch_texel_2d_f_ycbcr_rev
, /* FetchTexel2Df */
997 fetch_texel_3d_f_ycbcr_rev
, /* FetchTexel3Df */
1003 /***************************************************************/
1004 /** \name Null format (useful for proxy textures) */
1007 const struct gl_texture_format _mesa_null_texformat
= {
1008 -1, /* MesaFormat */
1010 GL_NONE
, /* DataType */
1015 0, /* LuminanceBits */
1016 0, /* IntensityBits */
1020 NULL
, /* StoreTexImageFunc */
1021 fetch_null_texel
, /* FetchTexel1D */
1022 fetch_null_texel
, /* FetchTexel2D */
1023 fetch_null_texel
, /* FetchTexel3D */
1024 fetch_null_texelf
, /* FetchTexel1Df */
1025 fetch_null_texelf
, /* FetchTexel2Df */
1026 fetch_null_texelf
, /* FetchTexel3Df */
1033 * Choose an appropriate texture format given the format, type and
1034 * internalFormat parameters passed to glTexImage().
1036 * \param ctx the GL context.
1037 * \param internalFormat user's prefered internal texture format.
1038 * \param format incoming image pixel format.
1039 * \param type incoming image data type.
1041 * \return a pointer to a gl_texture_format object which describes the
1042 * choosen texture format, or NULL on failure.
1044 * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
1045 * will typically override this function with a specialized version.
1047 const struct gl_texture_format
*
1048 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
1049 GLenum format
, GLenum type
)
1054 switch (internalFormat
) {
1061 return &_mesa_texformat_rgba
;
1063 return &_mesa_texformat_rgba8888
;
1065 return &_mesa_texformat_argb1555
;
1067 return &_mesa_texformat_argb4444_rev
; /* just to test another format*/
1069 return &_mesa_texformat_argb4444
;
1077 return &_mesa_texformat_rgb
;
1079 return &_mesa_texformat_rgb888
;
1081 return &_mesa_texformat_rgb332
;
1083 return &_mesa_texformat_rgb565_rev
; /* just to test another format */
1085 return &_mesa_texformat_rgb565
;
1092 return &_mesa_texformat_alpha
;
1094 return &_mesa_texformat_a8
;
1096 /* Luminance formats */
1100 case GL_LUMINANCE12
:
1101 case GL_LUMINANCE16
:
1102 return &_mesa_texformat_luminance
;
1104 return &_mesa_texformat_l8
;
1106 /* Luminance/Alpha formats */
1108 case GL_LUMINANCE_ALPHA
:
1109 case GL_LUMINANCE4_ALPHA4
:
1110 case GL_LUMINANCE6_ALPHA2
:
1111 case GL_LUMINANCE12_ALPHA4
:
1112 case GL_LUMINANCE12_ALPHA12
:
1113 case GL_LUMINANCE16_ALPHA16
:
1114 return &_mesa_texformat_luminance_alpha
;
1115 case GL_LUMINANCE8_ALPHA8
:
1116 return &_mesa_texformat_al88
;
1120 case GL_INTENSITY12
:
1121 case GL_INTENSITY16
:
1122 return &_mesa_texformat_intensity
;
1124 return &_mesa_texformat_i8
;
1126 case GL_COLOR_INDEX
:
1127 case GL_COLOR_INDEX1_EXT
:
1128 case GL_COLOR_INDEX2_EXT
:
1129 case GL_COLOR_INDEX4_EXT
:
1130 case GL_COLOR_INDEX12_EXT
:
1131 case GL_COLOR_INDEX16_EXT
:
1132 case GL_COLOR_INDEX8_EXT
:
1133 return &_mesa_texformat_ci8
;
1139 if (ctx
->Extensions
.SGIX_depth_texture
) {
1140 switch (internalFormat
) {
1141 case GL_DEPTH_COMPONENT
:
1142 case GL_DEPTH_COMPONENT24_SGIX
:
1143 case GL_DEPTH_COMPONENT32_SGIX
:
1144 return &_mesa_texformat_depth_component_float32
;
1145 case GL_DEPTH_COMPONENT16_SGIX
:
1146 return &_mesa_texformat_depth_component16
;
1152 if (ctx
->Extensions
.ARB_texture_compression
) {
1153 switch (internalFormat
) {
1154 case GL_COMPRESSED_ALPHA_ARB
:
1155 return &_mesa_texformat_alpha
;
1156 case GL_COMPRESSED_LUMINANCE_ARB
:
1157 return &_mesa_texformat_luminance
;
1158 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
1159 return &_mesa_texformat_luminance_alpha
;
1160 case GL_COMPRESSED_INTENSITY_ARB
:
1161 return &_mesa_texformat_intensity
;
1162 case GL_COMPRESSED_RGB_ARB
:
1163 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1164 return &_mesa_texformat_rgb_fxt1
;
1165 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1166 ctx
->Extensions
.S3_s3tc
)
1167 return &_mesa_texformat_rgb_dxt1
;
1169 return &_mesa_texformat_rgb
;
1170 case GL_COMPRESSED_RGBA_ARB
:
1171 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1172 return &_mesa_texformat_rgba_fxt1
;
1173 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1174 ctx
->Extensions
.S3_s3tc
)
1175 return &_mesa_texformat_rgba_dxt3
; /* Not rgba_dxt1, see spec */
1177 return &_mesa_texformat_rgba
;
1183 if (ctx
->Extensions
.MESA_ycbcr_texture
) {
1184 if (internalFormat
== GL_YCBCR_MESA
) {
1185 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
)
1186 return &_mesa_texformat_ycbcr
;
1188 return &_mesa_texformat_ycbcr_rev
;
1192 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
) {
1193 switch (internalFormat
) {
1194 case GL_COMPRESSED_RGB_FXT1_3DFX
:
1195 return &_mesa_texformat_rgb_fxt1
;
1196 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
1197 return &_mesa_texformat_rgba_fxt1
;
1203 if (ctx
->Extensions
.EXT_texture_compression_s3tc
) {
1204 switch (internalFormat
) {
1205 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
1206 return &_mesa_texformat_rgb_dxt1
;
1207 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
1208 return &_mesa_texformat_rgba_dxt1
;
1209 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
1210 return &_mesa_texformat_rgba_dxt3
;
1211 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
1212 return &_mesa_texformat_rgba_dxt5
;
1218 if (ctx
->Extensions
.S3_s3tc
) {
1219 switch (internalFormat
) {
1222 return &_mesa_texformat_rgb_dxt1
;
1225 return &_mesa_texformat_rgba_dxt3
;
1231 if (ctx
->Extensions
.ARB_texture_float
) {
1232 switch (internalFormat
) {
1233 case GL_ALPHA16F_ARB
:
1234 return &_mesa_texformat_alpha_float16
;
1235 case GL_ALPHA32F_ARB
:
1236 return &_mesa_texformat_alpha_float32
;
1237 case GL_LUMINANCE16F_ARB
:
1238 return &_mesa_texformat_luminance_float16
;
1239 case GL_LUMINANCE32F_ARB
:
1240 return &_mesa_texformat_luminance_float32
;
1241 case GL_LUMINANCE_ALPHA16F_ARB
:
1242 return &_mesa_texformat_luminance_alpha_float16
;
1243 case GL_LUMINANCE_ALPHA32F_ARB
:
1244 return &_mesa_texformat_luminance_alpha_float32
;
1245 case GL_INTENSITY16F_ARB
:
1246 return &_mesa_texformat_intensity_float16
;
1247 case GL_INTENSITY32F_ARB
:
1248 return &_mesa_texformat_intensity_float32
;
1250 return &_mesa_texformat_rgb_float16
;
1252 return &_mesa_texformat_rgb_float32
;
1253 case GL_RGBA16F_ARB
:
1254 return &_mesa_texformat_rgba_float16
;
1255 case GL_RGBA32F_ARB
:
1256 return &_mesa_texformat_rgba_float32
;
1262 _mesa_problem(ctx
, "unexpected format in _mesa_choose_tex_format()");