2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **********************************************************************/
29 * Keith Whitwell <keith@tungstengraphics.com>
36 #include "simple_list.h"
40 #include "texformat.h"
43 #include "intel_ioctl.h"
44 #include "brw_context.h"
45 #include "brw_defines.h"
50 static const struct gl_texture_format
*
51 brwChooseTextureFormat( GLcontext
*ctx
, GLint internalFormat
,
52 GLenum format
, GLenum type
)
54 switch ( internalFormat
) {
57 case GL_COMPRESSED_RGBA
:
65 return &_mesa_texformat_argb8888
;
66 /* return &_mesa_texformat_rgba8888_rev; */
70 case GL_COMPRESSED_RGB
:
78 /* return &_mesa_texformat_rgb888; */
79 return &_mesa_texformat_argb8888
;
86 case GL_COMPRESSED_ALPHA
:
87 return &_mesa_texformat_a8
;
95 case GL_COMPRESSED_LUMINANCE
:
96 return &_mesa_texformat_l8
;
99 case GL_LUMINANCE_ALPHA
:
100 case GL_LUMINANCE4_ALPHA4
:
101 case GL_LUMINANCE6_ALPHA2
:
102 case GL_LUMINANCE8_ALPHA8
:
103 case GL_LUMINANCE12_ALPHA4
:
104 case GL_LUMINANCE12_ALPHA12
:
105 case GL_LUMINANCE16_ALPHA16
:
106 case GL_COMPRESSED_LUMINANCE_ALPHA
:
107 return &_mesa_texformat_al88
;
114 case GL_COMPRESSED_INTENSITY
:
115 return &_mesa_texformat_i8
;
118 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
||
119 type
== GL_UNSIGNED_BYTE
)
120 return &_mesa_texformat_ycbcr
;
122 return &_mesa_texformat_ycbcr_rev
;
124 case GL_COMPRESSED_RGB_FXT1_3DFX
:
125 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
126 return &_mesa_texformat_rgb_fxt1
;
132 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
133 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
134 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
135 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
136 return &_mesa_texformat_rgb_dxt1
; /* there is no rgba support? */
138 case GL_DEPTH_COMPONENT
:
139 case GL_DEPTH_COMPONENT16
:
140 case GL_DEPTH_COMPONENT24
:
141 case GL_DEPTH_COMPONENT32
:
142 return &_mesa_texformat_z16
;
145 fprintf(stderr
, "unexpected texture format %s in %s\n",
146 _mesa_lookup_enum_by_nr(internalFormat
),
151 return NULL
; /* never get here */
155 void brwInitTextureFuncs( struct dd_function_table
*functions
)
157 functions
->ChooseTextureFormat
= brwChooseTextureFormat
;