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!");
85 static void store_null_texel(struct gl_texture_image
*texImage
,
86 GLint i
, GLint j
, GLint k
, const void *texel
)
93 /***************************************************************/
94 /** \name Default GLchan-based formats */
97 const struct gl_texture_format _mesa_texformat_rgba
= {
98 MESA_FORMAT_RGBA
, /* MesaFormat */
99 GL_RGBA
, /* BaseFormat */
100 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
101 CHAN_BITS
, /* RedBits */
102 CHAN_BITS
, /* GreenBits */
103 CHAN_BITS
, /* BlueBits */
104 CHAN_BITS
, /* AlphaBits */
105 0, /* LuminanceBits */
106 0, /* IntensityBits */
109 4 * sizeof(GLchan
), /* TexelBytes */
110 _mesa_texstore_rgba
, /* StoreTexImageFunc */
111 fetch_texel_1d_rgba
, /* FetchTexel1D */
112 fetch_texel_2d_rgba
, /* FetchTexel2D */
113 fetch_texel_3d_rgba
, /* FetchTexel3D */
114 fetch_texel_1d_f_rgba
, /* FetchTexel1Df */
115 fetch_texel_2d_f_rgba
, /* FetchTexel2Df */
116 fetch_texel_3d_f_rgba
, /* FetchTexel3Df */
117 store_texel_rgba
/* StoreTexel */
120 const struct gl_texture_format _mesa_texformat_rgb
= {
121 MESA_FORMAT_RGB
, /* MesaFormat */
122 GL_RGB
, /* BaseFormat */
123 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
124 CHAN_BITS
, /* RedBits */
125 CHAN_BITS
, /* GreenBits */
126 CHAN_BITS
, /* BlueBits */
128 0, /* LuminanceBits */
129 0, /* IntensityBits */
132 3 * sizeof(GLchan
), /* TexelBytes */
133 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
134 fetch_texel_1d_rgb
, /* FetchTexel1D */
135 fetch_texel_2d_rgb
, /* FetchTexel2D */
136 fetch_texel_3d_rgb
, /* FetchTexel3D */
137 fetch_texel_1d_f_rgb
, /* FetchTexel1Df */
138 fetch_texel_2d_f_rgb
, /* FetchTexel2Df */
139 fetch_texel_3d_f_rgb
, /* FetchTexel3Df */
140 store_texel_rgb
/* StoreTexel */
143 const struct gl_texture_format _mesa_texformat_alpha
= {
144 MESA_FORMAT_ALPHA
, /* MesaFormat */
145 GL_ALPHA
, /* BaseFormat */
146 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
150 CHAN_BITS
, /* AlphaBits */
151 0, /* LuminanceBits */
152 0, /* IntensityBits */
155 sizeof(GLchan
), /* TexelBytes */
156 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
157 fetch_texel_1d_alpha
, /* FetchTexel1D */
158 fetch_texel_2d_alpha
, /* FetchTexel2D */
159 fetch_texel_3d_alpha
, /* FetchTexel3D */
160 fetch_texel_1d_f_alpha
, /* FetchTexel1Df */
161 fetch_texel_2d_f_alpha
, /* FetchTexel2Df */
162 fetch_texel_3d_f_alpha
, /* FetchTexel3Df */
163 store_texel_alpha
/* StoreTexel */
166 const struct gl_texture_format _mesa_texformat_luminance
= {
167 MESA_FORMAT_LUMINANCE
, /* MesaFormat */
168 GL_LUMINANCE
, /* BaseFormat */
169 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
174 CHAN_BITS
, /* LuminanceBits */
175 0, /* IntensityBits */
178 sizeof(GLchan
), /* TexelBytes */
179 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
180 fetch_texel_1d_luminance
, /* FetchTexel1D */
181 fetch_texel_2d_luminance
, /* FetchTexel2D */
182 fetch_texel_3d_luminance
, /* FetchTexel3D */
183 fetch_texel_1d_f_luminance
, /* FetchTexel1Df */
184 fetch_texel_2d_f_luminance
, /* FetchTexel2Df */
185 fetch_texel_3d_f_luminance
, /* FetchTexel3Df */
186 store_texel_luminance
/* StoreTexel */
189 const struct gl_texture_format _mesa_texformat_luminance_alpha
= {
190 MESA_FORMAT_LUMINANCE_ALPHA
, /* MesaFormat */
191 GL_LUMINANCE_ALPHA
, /* BaseFormat */
192 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
196 CHAN_BITS
, /* AlphaBits */
197 CHAN_BITS
, /* LuminanceBits */
198 0, /* IntensityBits */
201 2 * sizeof(GLchan
), /* TexelBytes */
202 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
203 fetch_texel_1d_luminance_alpha
, /* FetchTexel1D */
204 fetch_texel_2d_luminance_alpha
, /* FetchTexel2D */
205 fetch_texel_3d_luminance_alpha
, /* FetchTexel3D */
206 fetch_texel_1d_f_luminance_alpha
, /* FetchTexel1Df */
207 fetch_texel_2d_f_luminance_alpha
, /* FetchTexel2Df */
208 fetch_texel_3d_f_luminance_alpha
, /* FetchTexel3Df */
209 store_texel_luminance_alpha
/* StoreTexel */
212 const struct gl_texture_format _mesa_texformat_intensity
= {
213 MESA_FORMAT_INTENSITY
, /* MesaFormat */
214 GL_INTENSITY
, /* BaseFormat */
215 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
220 0, /* LuminanceBits */
221 CHAN_BITS
, /* IntensityBits */
224 sizeof(GLchan
), /* TexelBytes */
225 _mesa_texstore_rgba
,/*yes*/ /* StoreTexImageFunc */
226 fetch_texel_1d_intensity
, /* FetchTexel1D */
227 fetch_texel_2d_intensity
, /* FetchTexel2D */
228 fetch_texel_3d_intensity
, /* FetchTexel3D */
229 fetch_texel_1d_f_intensity
, /* FetchTexel1Df */
230 fetch_texel_2d_f_intensity
, /* FetchTexel2Df */
231 fetch_texel_3d_f_intensity
, /* FetchTexel3Df */
232 store_texel_intensity
/* StoreTexel */
235 const struct gl_texture_format _mesa_texformat_depth_component_float32
= {
236 MESA_FORMAT_DEPTH_COMPONENT_FLOAT32
, /* MesaFormat */
237 GL_DEPTH_COMPONENT
, /* BaseFormat */
238 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
243 0, /* LuminanceBits */
244 0, /* IntensityBits */
246 sizeof(GLfloat
) * 8, /* DepthBits */
247 sizeof(GLfloat
), /* TexelBytes */
248 _mesa_texstore_depth_component_float32
,/* StoreTexImageFunc */
249 fetch_null_texel
, /* FetchTexel1D */
250 fetch_null_texel
, /* FetchTexel1D */
251 fetch_null_texel
, /* FetchTexel1D */
252 fetch_texel_1d_f_depth_component_f32
,/* FetchTexel1Df */
253 fetch_texel_2d_f_depth_component_f32
,/* FetchTexel2Df */
254 fetch_texel_3d_f_depth_component_f32
,/* FetchTexel3Df */
255 store_texel_depth_component_f32
/* StoreTexel */
258 const struct gl_texture_format _mesa_texformat_depth_component16
= {
259 MESA_FORMAT_DEPTH_COMPONENT16
, /* MesaFormat */
260 GL_DEPTH_COMPONENT
, /* BaseFormat */
261 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
266 0, /* LuminanceBits */
267 0, /* IntensityBits */
269 sizeof(GLushort
) * 8, /* DepthBits */
270 sizeof(GLushort
), /* TexelBytes */
271 _mesa_texstore_depth_component16
, /* StoreTexImageFunc */
272 fetch_null_texel
, /* FetchTexel1D */
273 fetch_null_texel
, /* FetchTexel1D */
274 fetch_null_texel
, /* FetchTexel1D */
275 fetch_texel_1d_f_depth_component16
, /* FetchTexel1Df */
276 fetch_texel_2d_f_depth_component16
, /* FetchTexel2Df */
277 fetch_texel_3d_f_depth_component16
, /* FetchTexel3Df */
278 store_texel_depth_component16
/* StoreTexel */
281 const struct gl_texture_format _mesa_texformat_rgba_float32
= {
282 MESA_FORMAT_RGBA_FLOAT32
, /* MesaFormat */
283 GL_RGBA
, /* BaseFormat */
284 GL_FLOAT
, /* DataType */
285 8 * sizeof(GLfloat
), /* RedBits */
286 8 * sizeof(GLfloat
), /* GreenBits */
287 8 * sizeof(GLfloat
), /* BlueBits */
288 8 * sizeof(GLfloat
), /* AlphaBits */
289 0, /* LuminanceBits */
290 0, /* IntensityBits */
293 4 * sizeof(GLfloat
), /* TexelBytes */
294 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
295 fetch_texel_1d_rgba_f32
, /* FetchTexel1D */
296 fetch_texel_2d_rgba_f32
, /* FetchTexel1D */
297 fetch_texel_3d_rgba_f32
, /* FetchTexel1D */
298 fetch_texel_1d_f_rgba_f32
, /* FetchTexel1Df */
299 fetch_texel_2d_f_rgba_f32
, /* FetchTexel2Df */
300 fetch_texel_3d_f_rgba_f32
, /* FetchTexel3Df */
301 store_texel_rgba_f32
/* StoreTexel */
304 const struct gl_texture_format _mesa_texformat_rgba_float16
= {
305 MESA_FORMAT_RGBA_FLOAT16
, /* MesaFormat */
306 GL_RGBA
, /* BaseFormat */
307 GL_FLOAT
, /* DataType */
308 8 * sizeof(GLhalfARB
), /* RedBits */
309 8 * sizeof(GLhalfARB
), /* GreenBits */
310 8 * sizeof(GLhalfARB
), /* BlueBits */
311 8 * sizeof(GLhalfARB
), /* AlphaBits */
312 0, /* LuminanceBits */
313 0, /* IntensityBits */
316 4 * sizeof(GLhalfARB
), /* TexelBytes */
317 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
318 fetch_texel_1d_rgba_f16
, /* FetchTexel1D */
319 fetch_texel_2d_rgba_f16
, /* FetchTexel1D */
320 fetch_texel_3d_rgba_f16
, /* FetchTexel1D */
321 fetch_texel_1d_f_rgba_f16
, /* FetchTexel1Df */
322 fetch_texel_2d_f_rgba_f16
, /* FetchTexel2Df */
323 fetch_texel_3d_f_rgba_f16
, /* FetchTexel3Df */
324 store_texel_rgba_f16
/* StoreTexel */
327 const struct gl_texture_format _mesa_texformat_rgb_float32
= {
328 MESA_FORMAT_RGB_FLOAT32
, /* MesaFormat */
329 GL_RGB
, /* BaseFormat */
330 GL_FLOAT
, /* DataType */
331 8 * sizeof(GLfloat
), /* RedBits */
332 8 * sizeof(GLfloat
), /* GreenBits */
333 8 * sizeof(GLfloat
), /* BlueBits */
335 0, /* LuminanceBits */
336 0, /* IntensityBits */
339 3 * sizeof(GLfloat
), /* TexelBytes */
340 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
341 fetch_texel_1d_rgb_f32
, /* FetchTexel1D */
342 fetch_texel_2d_rgb_f32
, /* FetchTexel1D */
343 fetch_texel_3d_rgb_f32
, /* FetchTexel1D */
344 fetch_texel_1d_f_rgb_f32
, /* FetchTexel1Df */
345 fetch_texel_2d_f_rgb_f32
, /* FetchTexel2Df */
346 fetch_texel_3d_f_rgb_f32
, /* FetchTexel3Df */
347 store_texel_rgb_f32
/* StoreTexel */
350 const struct gl_texture_format _mesa_texformat_rgb_float16
= {
351 MESA_FORMAT_RGB_FLOAT16
, /* MesaFormat */
352 GL_RGB
, /* BaseFormat */
353 GL_FLOAT
, /* DataType */
354 8 * sizeof(GLhalfARB
), /* RedBits */
355 8 * sizeof(GLhalfARB
), /* GreenBits */
356 8 * sizeof(GLhalfARB
), /* BlueBits */
358 0, /* LuminanceBits */
359 0, /* IntensityBits */
362 3 * sizeof(GLhalfARB
), /* TexelBytes */
363 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
364 fetch_texel_1d_rgb_f16
, /* FetchTexel1D */
365 fetch_texel_2d_rgb_f16
, /* FetchTexel1D */
366 fetch_texel_3d_rgb_f16
, /* FetchTexel1D */
367 fetch_texel_1d_f_rgb_f16
, /* FetchTexel1Df */
368 fetch_texel_2d_f_rgb_f16
, /* FetchTexel2Df */
369 fetch_texel_3d_f_rgb_f16
, /* FetchTexel3Df */
370 store_texel_rgb_f16
/* StoreTexel */
373 const struct gl_texture_format _mesa_texformat_alpha_float32
= {
374 MESA_FORMAT_ALPHA_FLOAT32
, /* MesaFormat */
375 GL_ALPHA
, /* BaseFormat */
376 GL_FLOAT
, /* DataType */
380 8 * sizeof(GLfloat
), /* AlphaBits */
381 0, /* LuminanceBits */
382 0, /* IntensityBits */
385 1 * sizeof(GLfloat
), /* TexelBytes */
386 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
387 fetch_texel_1d_alpha_f32
, /* FetchTexel1D */
388 fetch_texel_2d_alpha_f32
, /* FetchTexel1D */
389 fetch_texel_3d_alpha_f32
, /* FetchTexel1D */
390 fetch_texel_1d_f_alpha_f32
, /* FetchTexel1Df */
391 fetch_texel_2d_f_alpha_f32
, /* FetchTexel2Df */
392 fetch_texel_3d_f_alpha_f32
, /* FetchTexel3Df */
393 store_texel_alpha_f32
/* StoreTexel */
396 const struct gl_texture_format _mesa_texformat_alpha_float16
= {
397 MESA_FORMAT_ALPHA_FLOAT16
, /* MesaFormat */
398 GL_ALPHA
, /* BaseFormat */
399 GL_FLOAT
, /* DataType */
403 8 * sizeof(GLhalfARB
), /* AlphaBits */
404 0, /* LuminanceBits */
405 0, /* IntensityBits */
408 1 * sizeof(GLhalfARB
), /* TexelBytes */
409 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
410 fetch_texel_1d_alpha_f16
, /* FetchTexel1D */
411 fetch_texel_2d_alpha_f16
, /* FetchTexel1D */
412 fetch_texel_3d_alpha_f16
, /* FetchTexel1D */
413 fetch_texel_1d_f_alpha_f16
, /* FetchTexel1Df */
414 fetch_texel_2d_f_alpha_f16
, /* FetchTexel2Df */
415 fetch_texel_3d_f_alpha_f16
, /* FetchTexel3Df */
416 store_texel_alpha_f16
/* StoreTexel */
419 const struct gl_texture_format _mesa_texformat_luminance_float32
= {
420 MESA_FORMAT_LUMINANCE_FLOAT32
, /* MesaFormat */
421 GL_LUMINANCE
, /* BaseFormat */
422 GL_FLOAT
, /* DataType */
427 8 * sizeof(GLfloat
), /* LuminanceBits */
428 0, /* IntensityBits */
431 1 * sizeof(GLfloat
), /* TexelBytes */
432 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
433 fetch_texel_1d_luminance_f32
, /* FetchTexel1D */
434 fetch_texel_2d_luminance_f32
, /* FetchTexel2D */
435 fetch_texel_3d_luminance_f32
, /* FetchTexel3D */
436 fetch_texel_1d_f_luminance_f32
, /* FetchTexel1Df */
437 fetch_texel_2d_f_luminance_f32
, /* FetchTexel2Df */
438 fetch_texel_3d_f_luminance_f32
, /* FetchTexel3Df */
439 store_texel_luminance_f32
/* StoreTexel */
442 const struct gl_texture_format _mesa_texformat_luminance_float16
= {
443 MESA_FORMAT_LUMINANCE_FLOAT16
, /* MesaFormat */
444 GL_LUMINANCE
, /* BaseFormat */
445 GL_FLOAT
, /* DataType */
450 8 * sizeof(GLhalfARB
), /* LuminanceBits */
451 0, /* IntensityBits */
454 1 * sizeof(GLhalfARB
), /* TexelBytes */
455 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
456 fetch_texel_1d_luminance_f16
, /* FetchTexel1D */
457 fetch_texel_2d_luminance_f16
, /* FetchTexel2D */
458 fetch_texel_3d_luminance_f16
, /* FetchTexel3D */
459 fetch_texel_1d_f_luminance_f16
, /* FetchTexel1Df */
460 fetch_texel_2d_f_luminance_f16
, /* FetchTexel2Df */
461 fetch_texel_3d_f_luminance_f16
, /* FetchTexel3Df */
462 store_texel_luminance_f16
/* StoreTexel */
465 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32
= {
466 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
, /* MesaFormat */
467 GL_LUMINANCE_ALPHA
, /* BaseFormat */
468 GL_FLOAT
, /* DataType */
472 8 * sizeof(GLfloat
), /* AlphaBits */
473 8 * sizeof(GLfloat
), /* LuminanceBits */
474 0, /* IntensityBits */
477 2 * sizeof(GLfloat
), /* TexelBytes */
478 _mesa_texstore_rgba_float32
, /* StoreTexImageFunc */
479 fetch_texel_1d_luminance_alpha_f32
, /* FetchTexel1D */
480 fetch_texel_2d_luminance_alpha_f32
, /* FetchTexel2D */
481 fetch_texel_3d_luminance_alpha_f32
, /* FetchTexel3D */
482 fetch_texel_1d_f_luminance_alpha_f32
,/* FetchTexel1Df */
483 fetch_texel_2d_f_luminance_alpha_f32
,/* FetchTexel2Df */
484 fetch_texel_3d_f_luminance_alpha_f32
,/* FetchTexel3Df */
485 store_texel_luminance_alpha_f32
/* StoreTexel */
488 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16
= {
489 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
, /* MesaFormat */
490 GL_LUMINANCE_ALPHA
, /* BaseFormat */
491 GL_FLOAT
, /* DataType */
495 8 * sizeof(GLhalfARB
), /* AlphaBits */
496 8 * sizeof(GLhalfARB
), /* LuminanceBits */
497 0, /* IntensityBits */
500 2 * sizeof(GLhalfARB
), /* TexelBytes */
501 _mesa_texstore_rgba_float16
, /* StoreTexImageFunc */
502 fetch_texel_1d_luminance_alpha_f16
, /* FetchTexel1D */
503 fetch_texel_2d_luminance_alpha_f16
, /* FetchTexel2D */
504 fetch_texel_3d_luminance_alpha_f16
, /* FetchTexel3D */
505 fetch_texel_1d_f_luminance_alpha_f16
,/* FetchTexel1Df */
506 fetch_texel_2d_f_luminance_alpha_f16
,/* FetchTexel2Df */
507 fetch_texel_3d_f_luminance_alpha_f16
,/* FetchTexel3Df */
508 store_texel_luminance_alpha_f16
/* StoreTexel */
511 const struct gl_texture_format _mesa_texformat_intensity_float32
= {
512 MESA_FORMAT_INTENSITY_FLOAT32
, /* MesaFormat */
513 GL_INTENSITY
, /* BaseFormat */
514 GL_FLOAT
, /* DataType */
519 0, /* LuminanceBits */
520 8 * sizeof(GLfloat
), /* IntensityBits */
523 1 * sizeof(GLfloat
), /* TexelBytes */
524 _mesa_texstore_rgba_float32
,/*yes*/ /* StoreTexImageFunc */
525 fetch_texel_1d_intensity_f32
, /* FetchTexel1D */
526 fetch_texel_2d_intensity_f32
, /* FetchTexel2D */
527 fetch_texel_3d_intensity_f32
, /* FetchTexel3D */
528 fetch_texel_1d_f_intensity_f32
, /* FetchTexel1Df */
529 fetch_texel_2d_f_intensity_f32
, /* FetchTexel2Df */
530 fetch_texel_3d_f_intensity_f32
, /* FetchTexel3Df */
531 store_texel_intensity_f32
/* StoreTexel */
534 const struct gl_texture_format _mesa_texformat_intensity_float16
= {
535 MESA_FORMAT_INTENSITY_FLOAT16
, /* MesaFormat */
536 GL_INTENSITY
, /* BaseFormat */
537 GL_FLOAT
, /* DataType */
542 0, /* LuminanceBits */
543 8 * sizeof(GLhalfARB
), /* IntensityBits */
546 1 * sizeof(GLhalfARB
), /* TexelBytes */
547 _mesa_texstore_rgba_float16
,/*yes*/ /* StoreTexImageFunc */
548 fetch_texel_1d_intensity_f16
, /* FetchTexel1D */
549 fetch_texel_2d_intensity_f16
, /* FetchTexel2D */
550 fetch_texel_3d_intensity_f16
, /* FetchTexel3D */
551 fetch_texel_1d_f_intensity_f16
, /* FetchTexel1Df */
552 fetch_texel_2d_f_intensity_f16
, /* FetchTexel2Df */
553 fetch_texel_3d_f_intensity_f16
, /* FetchTexel3Df */
554 store_texel_intensity_f16
/* StoreTexel */
561 /***************************************************************/
562 /** \name Hardware formats */
565 const struct gl_texture_format _mesa_texformat_rgba8888
= {
566 MESA_FORMAT_RGBA8888
, /* MesaFormat */
567 GL_RGBA
, /* BaseFormat */
568 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
573 0, /* LuminanceBits */
574 0, /* IntensityBits */
578 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
579 fetch_texel_1d_rgba8888
, /* FetchTexel1D */
580 fetch_texel_2d_rgba8888
, /* FetchTexel2D */
581 fetch_texel_3d_rgba8888
, /* FetchTexel3D */
582 fetch_texel_1d_f_rgba8888
, /* FetchTexel1Df */
583 fetch_texel_2d_f_rgba8888
, /* FetchTexel2Df */
584 fetch_texel_3d_f_rgba8888
, /* FetchTexel3Df */
585 store_texel_rgba8888
/* StoreTexel */
588 const struct gl_texture_format _mesa_texformat_rgba8888_rev
= {
589 MESA_FORMAT_RGBA8888_REV
, /* MesaFormat */
590 GL_RGBA
, /* BaseFormat */
591 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
596 0, /* LuminanceBits */
597 0, /* IntensityBits */
601 _mesa_texstore_rgba8888
, /* StoreTexImageFunc */
602 fetch_texel_1d_rgba8888_rev
, /* FetchTexel1D */
603 fetch_texel_2d_rgba8888_rev
, /* FetchTexel2D */
604 fetch_texel_3d_rgba8888_rev
, /* FetchTexel3D */
605 fetch_texel_1d_f_rgba8888_rev
, /* FetchTexel1Df */
606 fetch_texel_2d_f_rgba8888_rev
, /* FetchTexel2Df */
607 fetch_texel_3d_f_rgba8888_rev
, /* FetchTexel3Df */
608 store_texel_rgba8888_rev
/* StoreTexel */
611 const struct gl_texture_format _mesa_texformat_argb8888
= {
612 MESA_FORMAT_ARGB8888
, /* MesaFormat */
613 GL_RGBA
, /* BaseFormat */
614 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
619 0, /* LuminanceBits */
620 0, /* IntensityBits */
624 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
625 fetch_texel_1d_argb8888
, /* FetchTexel1D */
626 fetch_texel_2d_argb8888
, /* FetchTexel2D */
627 fetch_texel_3d_argb8888
, /* FetchTexel3D */
628 fetch_texel_1d_f_argb8888
, /* FetchTexel1Df */
629 fetch_texel_2d_f_argb8888
, /* FetchTexel2Df */
630 fetch_texel_3d_f_argb8888
, /* FetchTexel3Df */
631 store_texel_argb8888
/* StoreTexel */
634 const struct gl_texture_format _mesa_texformat_argb8888_rev
= {
635 MESA_FORMAT_ARGB8888_REV
, /* MesaFormat */
636 GL_RGBA
, /* BaseFormat */
637 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
642 0, /* LuminanceBits */
643 0, /* IntensityBits */
647 _mesa_texstore_argb8888
, /* StoreTexImageFunc */
648 fetch_texel_1d_argb8888_rev
, /* FetchTexel1D */
649 fetch_texel_2d_argb8888_rev
, /* FetchTexel2D */
650 fetch_texel_3d_argb8888_rev
, /* FetchTexel3D */
651 fetch_texel_1d_f_argb8888_rev
, /* FetchTexel1Df */
652 fetch_texel_2d_f_argb8888_rev
, /* FetchTexel2Df */
653 fetch_texel_3d_f_argb8888_rev
, /* FetchTexel3Df */
654 store_texel_argb8888_rev
/* StoreTexel */
657 const struct gl_texture_format _mesa_texformat_rgb888
= {
658 MESA_FORMAT_RGB888
, /* MesaFormat */
659 GL_RGB
, /* BaseFormat */
660 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
665 0, /* LuminanceBits */
666 0, /* IntensityBits */
670 _mesa_texstore_rgb888
, /* StoreTexImageFunc */
671 fetch_texel_1d_rgb888
, /* FetchTexel1D */
672 fetch_texel_2d_rgb888
, /* FetchTexel2D */
673 fetch_texel_3d_rgb888
, /* FetchTexel3D */
674 fetch_texel_1d_f_rgb888
, /* FetchTexel1Df */
675 fetch_texel_2d_f_rgb888
, /* FetchTexel2Df */
676 fetch_texel_3d_f_rgb888
, /* FetchTexel3Df */
677 store_texel_rgb888
/* StoreTexel */
680 const struct gl_texture_format _mesa_texformat_bgr888
= {
681 MESA_FORMAT_BGR888
, /* MesaFormat */
682 GL_RGB
, /* BaseFormat */
683 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
688 0, /* LuminanceBits */
689 0, /* IntensityBits */
693 _mesa_texstore_bgr888
, /* StoreTexImageFunc */
694 fetch_texel_1d_bgr888
, /* FetchTexel1D */
695 fetch_texel_2d_bgr888
, /* FetchTexel2D */
696 fetch_texel_3d_bgr888
, /* FetchTexel3D */
697 fetch_texel_1d_f_bgr888
, /* FetchTexel1Df */
698 fetch_texel_2d_f_bgr888
, /* FetchTexel2Df */
699 fetch_texel_3d_f_bgr888
, /* FetchTexel3Df */
700 store_texel_bgr888
/* StoreTexel */
703 const struct gl_texture_format _mesa_texformat_rgb565
= {
704 MESA_FORMAT_RGB565
, /* MesaFormat */
705 GL_RGB
, /* BaseFormat */
706 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
711 0, /* LuminanceBits */
712 0, /* IntensityBits */
716 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
717 fetch_texel_1d_rgb565
, /* FetchTexel1D */
718 fetch_texel_2d_rgb565
, /* FetchTexel2D */
719 fetch_texel_3d_rgb565
, /* FetchTexel3D */
720 fetch_texel_1d_f_rgb565
, /* FetchTexel1Df */
721 fetch_texel_2d_f_rgb565
, /* FetchTexel2Df */
722 fetch_texel_3d_f_rgb565
, /* FetchTexel3Df */
723 store_texel_rgb565
/* StoreTexel */
726 const struct gl_texture_format _mesa_texformat_rgb565_rev
= {
727 MESA_FORMAT_RGB565_REV
, /* MesaFormat */
728 GL_RGB
, /* BaseFormat */
729 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
734 0, /* LuminanceBits */
735 0, /* IntensityBits */
739 _mesa_texstore_rgb565
, /* StoreTexImageFunc */
740 fetch_texel_1d_rgb565_rev
, /* FetchTexel1D */
741 fetch_texel_2d_rgb565_rev
, /* FetchTexel2D */
742 fetch_texel_3d_rgb565_rev
, /* FetchTexel3D */
743 fetch_texel_1d_f_rgb565_rev
, /* FetchTexel1Df */
744 fetch_texel_2d_f_rgb565_rev
, /* FetchTexel2Df */
745 fetch_texel_3d_f_rgb565_rev
, /* FetchTexel3Df */
746 store_texel_rgb565_rev
/* StoreTexel */
749 const struct gl_texture_format _mesa_texformat_argb4444
= {
750 MESA_FORMAT_ARGB4444
, /* MesaFormat */
751 GL_RGBA
, /* BaseFormat */
752 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
757 0, /* LuminanceBits */
758 0, /* IntensityBits */
762 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
763 fetch_texel_1d_argb4444
, /* FetchTexel1D */
764 fetch_texel_2d_argb4444
, /* FetchTexel2D */
765 fetch_texel_3d_argb4444
, /* FetchTexel3D */
766 fetch_texel_1d_f_argb4444
, /* FetchTexel1Df */
767 fetch_texel_2d_f_argb4444
, /* FetchTexel2Df */
768 fetch_texel_3d_f_argb4444
, /* FetchTexel3Df */
769 store_texel_argb4444
/* StoreTexel */
772 const struct gl_texture_format _mesa_texformat_argb4444_rev
= {
773 MESA_FORMAT_ARGB4444_REV
, /* MesaFormat */
774 GL_RGBA
, /* BaseFormat */
775 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
780 0, /* LuminanceBits */
781 0, /* IntensityBits */
785 _mesa_texstore_argb4444
, /* StoreTexImageFunc */
786 fetch_texel_1d_argb4444_rev
, /* FetchTexel1D */
787 fetch_texel_2d_argb4444_rev
, /* FetchTexel2D */
788 fetch_texel_3d_argb4444_rev
, /* FetchTexel3D */
789 fetch_texel_1d_f_argb4444_rev
, /* FetchTexel1Df */
790 fetch_texel_2d_f_argb4444_rev
, /* FetchTexel2Df */
791 fetch_texel_3d_f_argb4444_rev
, /* FetchTexel3Df */
792 store_texel_argb4444_rev
/* StoreTexel */
795 const struct gl_texture_format _mesa_texformat_argb1555
= {
796 MESA_FORMAT_ARGB1555
, /* MesaFormat */
797 GL_RGBA
, /* BaseFormat */
798 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
803 0, /* LuminanceBits */
804 0, /* IntensityBits */
808 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
809 fetch_texel_1d_argb1555
, /* FetchTexel1D */
810 fetch_texel_2d_argb1555
, /* FetchTexel2D */
811 fetch_texel_3d_argb1555
, /* FetchTexel3D */
812 fetch_texel_1d_f_argb1555
, /* FetchTexel1Df */
813 fetch_texel_2d_f_argb1555
, /* FetchTexel2Df */
814 fetch_texel_3d_f_argb1555
, /* FetchTexel3Df */
815 store_texel_argb1555
/* StoreTexel */
818 const struct gl_texture_format _mesa_texformat_argb1555_rev
= {
819 MESA_FORMAT_ARGB1555_REV
, /* MesaFormat */
820 GL_RGBA
, /* BaseFormat */
821 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
826 0, /* LuminanceBits */
827 0, /* IntensityBits */
831 _mesa_texstore_argb1555
, /* StoreTexImageFunc */
832 fetch_texel_1d_argb1555_rev
, /* FetchTexel1D */
833 fetch_texel_2d_argb1555_rev
, /* FetchTexel2D */
834 fetch_texel_3d_argb1555_rev
, /* FetchTexel3D */
835 fetch_texel_1d_f_argb1555_rev
, /* FetchTexel1Df */
836 fetch_texel_2d_f_argb1555_rev
, /* FetchTexel2Df */
837 fetch_texel_3d_f_argb1555_rev
, /* FetchTexel3Df */
838 store_texel_argb1555_rev
/* StoreTexel */
841 const struct gl_texture_format _mesa_texformat_al88
= {
842 MESA_FORMAT_AL88
, /* MesaFormat */
843 GL_LUMINANCE_ALPHA
, /* BaseFormat */
844 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
849 8, /* LuminanceBits */
850 0, /* IntensityBits */
854 _mesa_texstore_al88
, /* StoreTexImageFunc */
855 fetch_texel_1d_al88
, /* FetchTexel1D */
856 fetch_texel_2d_al88
, /* FetchTexel2D */
857 fetch_texel_3d_al88
, /* FetchTexel3D */
858 fetch_texel_1d_f_al88
, /* FetchTexel1Df */
859 fetch_texel_2d_f_al88
, /* FetchTexel2Df */
860 fetch_texel_3d_f_al88
, /* FetchTexel3Df */
861 store_texel_al88
/* StoreTexel */
864 const struct gl_texture_format _mesa_texformat_al88_rev
= {
865 MESA_FORMAT_AL88_REV
, /* MesaFormat */
866 GL_LUMINANCE_ALPHA
, /* BaseFormat */
867 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
872 8, /* LuminanceBits */
873 0, /* IntensityBits */
877 _mesa_texstore_al88
, /* StoreTexImageFunc */
878 fetch_texel_1d_al88_rev
, /* FetchTexel1D */
879 fetch_texel_2d_al88_rev
, /* FetchTexel2D */
880 fetch_texel_3d_al88_rev
, /* FetchTexel3D */
881 fetch_texel_1d_f_al88_rev
, /* FetchTexel1Df */
882 fetch_texel_2d_f_al88_rev
, /* FetchTexel2Df */
883 fetch_texel_3d_f_al88_rev
, /* FetchTexel3Df */
884 store_texel_al88_rev
/* StoreTexel */
887 const struct gl_texture_format _mesa_texformat_rgb332
= {
888 MESA_FORMAT_RGB332
, /* MesaFormat */
889 GL_RGB
, /* BaseFormat */
890 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
895 0, /* LuminanceBits */
896 0, /* IntensityBits */
900 _mesa_texstore_rgb332
, /* StoreTexImageFunc */
901 fetch_texel_1d_rgb332
, /* FetchTexel1D */
902 fetch_texel_2d_rgb332
, /* FetchTexel2D */
903 fetch_texel_3d_rgb332
, /* FetchTexel3D */
904 fetch_texel_1d_f_rgb332
, /* FetchTexel1Df */
905 fetch_texel_2d_f_rgb332
, /* FetchTexel2Df */
906 fetch_texel_3d_f_rgb332
, /* FetchTexel3Df */
907 store_texel_rgb332
/* StoreTexel */
910 const struct gl_texture_format _mesa_texformat_a8
= {
911 MESA_FORMAT_A8
, /* MesaFormat */
912 GL_ALPHA
, /* BaseFormat */
913 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
918 0, /* LuminanceBits */
919 0, /* IntensityBits */
923 _mesa_texstore_a8
, /* StoreTexImageFunc */
924 fetch_texel_1d_a8
, /* FetchTexel1D */
925 fetch_texel_2d_a8
, /* FetchTexel2D */
926 fetch_texel_3d_a8
, /* FetchTexel3D */
927 fetch_texel_1d_f_a8
, /* FetchTexel1Df */
928 fetch_texel_2d_f_a8
, /* FetchTexel2Df */
929 fetch_texel_3d_f_a8
, /* FetchTexel3Df */
930 store_texel_a8
/* StoreTexel */
933 const struct gl_texture_format _mesa_texformat_l8
= {
934 MESA_FORMAT_L8
, /* MesaFormat */
935 GL_LUMINANCE
, /* BaseFormat */
936 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
941 8, /* LuminanceBits */
942 0, /* IntensityBits */
946 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
947 fetch_texel_1d_l8
, /* FetchTexel1D */
948 fetch_texel_2d_l8
, /* FetchTexel2D */
949 fetch_texel_3d_l8
, /* FetchTexel3D */
950 fetch_texel_1d_f_l8
, /* FetchTexel1Df */
951 fetch_texel_2d_f_l8
, /* FetchTexel2Df */
952 fetch_texel_3d_f_l8
, /* FetchTexel3Df */
953 store_texel_l8
/* StoreTexel */
956 const struct gl_texture_format _mesa_texformat_i8
= {
957 MESA_FORMAT_I8
, /* MesaFormat */
958 GL_INTENSITY
, /* BaseFormat */
959 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
964 0, /* LuminanceBits */
965 8, /* IntensityBits */
969 _mesa_texstore_a8
,/*yes*/ /* StoreTexImageFunc */
970 fetch_texel_1d_i8
, /* FetchTexel1D */
971 fetch_texel_2d_i8
, /* FetchTexel2D */
972 fetch_texel_3d_i8
, /* FetchTexel3D */
973 fetch_texel_1d_f_i8
, /* FetchTexel1Df */
974 fetch_texel_2d_f_i8
, /* FetchTexel2Df */
975 fetch_texel_3d_f_i8
, /* FetchTexel3Df */
976 store_texel_i8
/* StoreTexel */
979 const struct gl_texture_format _mesa_texformat_ci8
= {
980 MESA_FORMAT_CI8
, /* MesaFormat */
981 GL_COLOR_INDEX
, /* BaseFormat */
982 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
987 0, /* LuminanceBits */
988 0, /* IntensityBits */
992 _mesa_texstore_ci8
, /* StoreTexImageFunc */
993 fetch_texel_1d_ci8
, /* FetchTexel1D */
994 fetch_texel_2d_ci8
, /* FetchTexel2D */
995 fetch_texel_3d_ci8
, /* FetchTexel3D */
996 fetch_texel_1d_f_ci8
, /* FetchTexel1Df */
997 fetch_texel_2d_f_ci8
, /* FetchTexel2Df */
998 fetch_texel_3d_f_ci8
, /* FetchTexel3Df */
999 store_texel_ci8
/* StoreTexel */
1002 const struct gl_texture_format _mesa_texformat_ycbcr
= {
1003 MESA_FORMAT_YCBCR
, /* MesaFormat */
1004 GL_YCBCR_MESA
, /* BaseFormat */
1005 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1010 0, /* LuminanceBits */
1011 0, /* IntensityBits */
1015 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1016 fetch_texel_1d_ycbcr
, /* FetchTexel1D */
1017 fetch_texel_2d_ycbcr
, /* FetchTexel2D */
1018 fetch_texel_3d_ycbcr
, /* FetchTexel3D */
1019 fetch_texel_1d_f_ycbcr
, /* FetchTexel1Df */
1020 fetch_texel_2d_f_ycbcr
, /* FetchTexel2Df */
1021 fetch_texel_3d_f_ycbcr
, /* FetchTexel3Df */
1022 store_texel_ycbcr
/* StoreTexel */
1025 const struct gl_texture_format _mesa_texformat_ycbcr_rev
= {
1026 MESA_FORMAT_YCBCR_REV
, /* MesaFormat */
1027 GL_YCBCR_MESA
, /* BaseFormat */
1028 GL_UNSIGNED_NORMALIZED_ARB
, /* DataType */
1033 0, /* LuminanceBits */
1034 0, /* IntensityBits */
1038 _mesa_texstore_ycbcr
, /* StoreTexImageFunc */
1039 fetch_texel_1d_ycbcr_rev
, /* FetchTexel1D */
1040 fetch_texel_2d_ycbcr_rev
, /* FetchTexel2D */
1041 fetch_texel_3d_ycbcr_rev
, /* FetchTexel3D */
1042 fetch_texel_1d_f_ycbcr_rev
, /* FetchTexel1Df */
1043 fetch_texel_2d_f_ycbcr_rev
, /* FetchTexel2Df */
1044 fetch_texel_3d_f_ycbcr_rev
, /* FetchTexel3Df */
1045 store_texel_ycbcr_rev
/* StoreTexel */
1051 /***************************************************************/
1052 /** \name Null format (useful for proxy textures) */
1055 const struct gl_texture_format _mesa_null_texformat
= {
1056 -1, /* MesaFormat */
1058 GL_NONE
, /* DataType */
1063 0, /* LuminanceBits */
1064 0, /* IntensityBits */
1068 NULL
, /* StoreTexImageFunc */
1069 fetch_null_texel
, /* FetchTexel1D */
1070 fetch_null_texel
, /* FetchTexel2D */
1071 fetch_null_texel
, /* FetchTexel3D */
1072 fetch_null_texelf
, /* FetchTexel1Df */
1073 fetch_null_texelf
, /* FetchTexel2Df */
1074 fetch_null_texelf
, /* FetchTexel3Df */
1075 store_null_texel
/* StoreTexel */
1082 * Choose an appropriate texture format given the format, type and
1083 * internalFormat parameters passed to glTexImage().
1085 * \param ctx the GL context.
1086 * \param internalFormat user's prefered internal texture format.
1087 * \param format incoming image pixel format.
1088 * \param type incoming image data type.
1090 * \return a pointer to a gl_texture_format object which describes the
1091 * choosen texture format, or NULL on failure.
1093 * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
1094 * will typically override this function with a specialized version.
1096 const struct gl_texture_format
*
1097 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
1098 GLenum format
, GLenum type
)
1103 switch (internalFormat
) {
1110 return &_mesa_texformat_rgba
;
1112 return &_mesa_texformat_rgba8888
;
1114 return &_mesa_texformat_argb1555
;
1116 return &_mesa_texformat_argb4444_rev
; /* just to test another format*/
1118 return &_mesa_texformat_argb4444
;
1126 return &_mesa_texformat_rgb
;
1128 return &_mesa_texformat_rgb888
;
1130 return &_mesa_texformat_rgb332
;
1132 return &_mesa_texformat_rgb565_rev
; /* just to test another format */
1134 return &_mesa_texformat_rgb565
;
1141 return &_mesa_texformat_alpha
;
1143 return &_mesa_texformat_a8
;
1145 /* Luminance formats */
1149 case GL_LUMINANCE12
:
1150 case GL_LUMINANCE16
:
1151 return &_mesa_texformat_luminance
;
1153 return &_mesa_texformat_l8
;
1155 /* Luminance/Alpha formats */
1157 case GL_LUMINANCE_ALPHA
:
1158 case GL_LUMINANCE4_ALPHA4
:
1159 case GL_LUMINANCE6_ALPHA2
:
1160 case GL_LUMINANCE12_ALPHA4
:
1161 case GL_LUMINANCE12_ALPHA12
:
1162 case GL_LUMINANCE16_ALPHA16
:
1163 return &_mesa_texformat_luminance_alpha
;
1164 case GL_LUMINANCE8_ALPHA8
:
1165 return &_mesa_texformat_al88
;
1169 case GL_INTENSITY12
:
1170 case GL_INTENSITY16
:
1171 return &_mesa_texformat_intensity
;
1173 return &_mesa_texformat_i8
;
1175 case GL_COLOR_INDEX
:
1176 case GL_COLOR_INDEX1_EXT
:
1177 case GL_COLOR_INDEX2_EXT
:
1178 case GL_COLOR_INDEX4_EXT
:
1179 case GL_COLOR_INDEX12_EXT
:
1180 case GL_COLOR_INDEX16_EXT
:
1181 case GL_COLOR_INDEX8_EXT
:
1182 return &_mesa_texformat_ci8
;
1188 if (ctx
->Extensions
.SGIX_depth_texture
) {
1189 switch (internalFormat
) {
1190 case GL_DEPTH_COMPONENT
:
1191 case GL_DEPTH_COMPONENT24_SGIX
:
1192 case GL_DEPTH_COMPONENT32_SGIX
:
1193 return &_mesa_texformat_depth_component_float32
;
1194 case GL_DEPTH_COMPONENT16_SGIX
:
1195 return &_mesa_texformat_depth_component16
;
1201 if (ctx
->Extensions
.ARB_texture_compression
) {
1202 switch (internalFormat
) {
1203 case GL_COMPRESSED_ALPHA_ARB
:
1204 return &_mesa_texformat_alpha
;
1205 case GL_COMPRESSED_LUMINANCE_ARB
:
1206 return &_mesa_texformat_luminance
;
1207 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB
:
1208 return &_mesa_texformat_luminance_alpha
;
1209 case GL_COMPRESSED_INTENSITY_ARB
:
1210 return &_mesa_texformat_intensity
;
1211 case GL_COMPRESSED_RGB_ARB
:
1212 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1213 return &_mesa_texformat_rgb_fxt1
;
1214 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1215 ctx
->Extensions
.S3_s3tc
)
1216 return &_mesa_texformat_rgb_dxt1
;
1218 return &_mesa_texformat_rgb
;
1219 case GL_COMPRESSED_RGBA_ARB
:
1220 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
)
1221 return &_mesa_texformat_rgba_fxt1
;
1222 else if (ctx
->Extensions
.EXT_texture_compression_s3tc
||
1223 ctx
->Extensions
.S3_s3tc
)
1224 return &_mesa_texformat_rgba_dxt3
; /* Not rgba_dxt1, see spec */
1226 return &_mesa_texformat_rgba
;
1232 if (ctx
->Extensions
.MESA_ycbcr_texture
) {
1233 if (internalFormat
== GL_YCBCR_MESA
) {
1234 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
)
1235 return &_mesa_texformat_ycbcr
;
1237 return &_mesa_texformat_ycbcr_rev
;
1241 if (ctx
->Extensions
.TDFX_texture_compression_FXT1
) {
1242 switch (internalFormat
) {
1243 case GL_COMPRESSED_RGB_FXT1_3DFX
:
1244 return &_mesa_texformat_rgb_fxt1
;
1245 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
1246 return &_mesa_texformat_rgba_fxt1
;
1252 if (ctx
->Extensions
.EXT_texture_compression_s3tc
) {
1253 switch (internalFormat
) {
1254 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
1255 return &_mesa_texformat_rgb_dxt1
;
1256 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
1257 return &_mesa_texformat_rgba_dxt1
;
1258 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
1259 return &_mesa_texformat_rgba_dxt3
;
1260 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
1261 return &_mesa_texformat_rgba_dxt5
;
1267 if (ctx
->Extensions
.S3_s3tc
) {
1268 switch (internalFormat
) {
1271 return &_mesa_texformat_rgb_dxt1
;
1274 return &_mesa_texformat_rgba_dxt3
;
1280 if (ctx
->Extensions
.ARB_texture_float
) {
1281 switch (internalFormat
) {
1282 case GL_ALPHA16F_ARB
:
1283 return &_mesa_texformat_alpha_float16
;
1284 case GL_ALPHA32F_ARB
:
1285 return &_mesa_texformat_alpha_float32
;
1286 case GL_LUMINANCE16F_ARB
:
1287 return &_mesa_texformat_luminance_float16
;
1288 case GL_LUMINANCE32F_ARB
:
1289 return &_mesa_texformat_luminance_float32
;
1290 case GL_LUMINANCE_ALPHA16F_ARB
:
1291 return &_mesa_texformat_luminance_alpha_float16
;
1292 case GL_LUMINANCE_ALPHA32F_ARB
:
1293 return &_mesa_texformat_luminance_alpha_float32
;
1294 case GL_INTENSITY16F_ARB
:
1295 return &_mesa_texformat_intensity_float16
;
1296 case GL_INTENSITY32F_ARB
:
1297 return &_mesa_texformat_intensity_float32
;
1299 return &_mesa_texformat_rgb_float16
;
1301 return &_mesa_texformat_rgb_float32
;
1302 case GL_RGBA16F_ARB
:
1303 return &_mesa_texformat_rgba_float16
;
1304 case GL_RGBA32F_ARB
:
1305 return &_mesa_texformat_rgba_float32
;
1311 _mesa_problem(ctx
, "unexpected format in _mesa_choose_tex_format()");