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.
28 * Texture formats definitions.
30 * \author Gareth Hughes
42 * Mesa internal texture image formats.
43 * All texture images are stored in one of these formats.
45 * NOTE: when you add a new format, be sure to update the do_row()
46 * function in texstore.c used for auto mipmap generation.
50 * \name Hardware-friendly formats.
52 * Drivers can override the default formats and convert texture images to
53 * one of these as required. The driver's
54 * dd_function_table::ChooseTextureFormat function will choose one of these
57 * \note In the default case, some of these formats will be duplicates of
58 * the generic formats listed below. However, these formats guarantee their
59 * internal component sizes, while GLchan may vary between GLubyte, GLushort
63 /* msb <------ TEXEL BITS -----------> lsb */
64 /* ---- ---- ---- ---- ---- ---- ---- ---- */
65 MESA_FORMAT_RGBA8888
, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
66 MESA_FORMAT_RGBA8888_REV
, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
67 MESA_FORMAT_ARGB8888
, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
68 MESA_FORMAT_ARGB8888_REV
, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
69 MESA_FORMAT_RGB888
, /* RRRR RRRR GGGG GGGG BBBB BBBB */
70 MESA_FORMAT_BGR888
, /* BBBB BBBB GGGG GGGG RRRR RRRR */
71 MESA_FORMAT_RGB565
, /* RRRR RGGG GGGB BBBB */
72 MESA_FORMAT_RGB565_REV
, /* GGGB BBBB RRRR RGGG */
73 MESA_FORMAT_ARGB4444
, /* AAAA RRRR GGGG BBBB */
74 MESA_FORMAT_ARGB4444_REV
, /* GGGG BBBB AAAA RRRR */
75 MESA_FORMAT_ARGB1555
, /* ARRR RRGG GGGB BBBB */
76 MESA_FORMAT_ARGB1555_REV
, /* GGGB BBBB ARRR RRGG */
77 MESA_FORMAT_AL88
, /* AAAA AAAA LLLL LLLL */
78 MESA_FORMAT_AL88_REV
, /* LLLL LLLL AAAA AAAA */
79 MESA_FORMAT_RGB332
, /* RRRG GGBB */
80 MESA_FORMAT_A8
, /* AAAA AAAA */
81 MESA_FORMAT_L8
, /* LLLL LLLL */
82 MESA_FORMAT_I8
, /* IIII IIII */
83 MESA_FORMAT_CI8
, /* CCCC CCCC */
84 MESA_FORMAT_YCBCR
, /* YYYY YYYY UorV UorV */
85 MESA_FORMAT_YCBCR_REV
, /* UorV UorV YYYY YYYY */
89 * \name Compressed texture formats.
93 MESA_FORMAT_RGBA_FXT1
,
95 MESA_FORMAT_RGBA_DXT1
,
96 MESA_FORMAT_RGBA_DXT3
,
97 MESA_FORMAT_RGBA_DXT5
,
101 * \name Generic GLchan-based formats.
103 * Software-oriented texture formats. Texels are arrays of GLchan
104 * values so there are no byte order issues.
106 * \note Because these are based on the GLchan data type, one cannot assume
107 * 8 bits per channel with these formats. If you require GLubyte channels,
108 * use one of the hardware formats above.
114 MESA_FORMAT_LUMINANCE
,
115 MESA_FORMAT_LUMINANCE_ALPHA
,
116 MESA_FORMAT_INTENSITY
,
123 MESA_FORMAT_DEPTH_COMPONENT_FLOAT32
,
124 MESA_FORMAT_DEPTH_COMPONENT16
,
128 * \name Floating point texture formats.
131 MESA_FORMAT_RGBA_FLOAT32
,
132 MESA_FORMAT_RGBA_FLOAT16
,
133 MESA_FORMAT_RGB_FLOAT32
,
134 MESA_FORMAT_RGB_FLOAT16
,
135 MESA_FORMAT_ALPHA_FLOAT32
,
136 MESA_FORMAT_ALPHA_FLOAT16
,
137 MESA_FORMAT_LUMINANCE_FLOAT32
,
138 MESA_FORMAT_LUMINANCE_FLOAT16
,
139 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32
,
140 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16
,
141 MESA_FORMAT_INTENSITY_FLOAT32
,
142 MESA_FORMAT_INTENSITY_FLOAT16
147 /** GLchan-valued formats */
149 extern const struct gl_texture_format _mesa_texformat_rgba
;
150 extern const struct gl_texture_format _mesa_texformat_rgb
;
151 extern const struct gl_texture_format _mesa_texformat_alpha
;
152 extern const struct gl_texture_format _mesa_texformat_luminance
;
153 extern const struct gl_texture_format _mesa_texformat_luminance_alpha
;
154 extern const struct gl_texture_format _mesa_texformat_intensity
;
157 /** Depth textures */
159 extern const struct gl_texture_format _mesa_texformat_depth_component_float32
;
160 extern const struct gl_texture_format _mesa_texformat_depth_component16
;
163 /** Floating point texture formats */
165 extern const struct gl_texture_format _mesa_texformat_rgba_float32
;
166 extern const struct gl_texture_format _mesa_texformat_rgba_float16
;
167 extern const struct gl_texture_format _mesa_texformat_rgb_float32
;
168 extern const struct gl_texture_format _mesa_texformat_rgb_float16
;
169 extern const struct gl_texture_format _mesa_texformat_alpha_float32
;
170 extern const struct gl_texture_format _mesa_texformat_alpha_float16
;
171 extern const struct gl_texture_format _mesa_texformat_luminance_float32
;
172 extern const struct gl_texture_format _mesa_texformat_luminance_float16
;
173 extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32
;
174 extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16
;
175 extern const struct gl_texture_format _mesa_texformat_intensity_float32
;
176 extern const struct gl_texture_format _mesa_texformat_intensity_float16
;
179 /** \name Assorted hardware-friendly formats */
181 extern const struct gl_texture_format _mesa_texformat_rgba8888
;
182 extern const struct gl_texture_format _mesa_texformat_rgba8888_rev
;
183 extern const struct gl_texture_format _mesa_texformat_argb8888
;
184 extern const struct gl_texture_format _mesa_texformat_argb8888_rev
;
185 extern const struct gl_texture_format _mesa_texformat_rgb888
;
186 extern const struct gl_texture_format _mesa_texformat_bgr888
;
187 extern const struct gl_texture_format _mesa_texformat_rgb565
;
188 extern const struct gl_texture_format _mesa_texformat_rgb565_rev
;
189 extern const struct gl_texture_format _mesa_texformat_argb4444
;
190 extern const struct gl_texture_format _mesa_texformat_argb4444_rev
;
191 extern const struct gl_texture_format _mesa_texformat_argb1555
;
192 extern const struct gl_texture_format _mesa_texformat_argb1555_rev
;
193 extern const struct gl_texture_format _mesa_texformat_al88
;
194 extern const struct gl_texture_format _mesa_texformat_al88_rev
;
195 extern const struct gl_texture_format _mesa_texformat_rgb332
;
196 extern const struct gl_texture_format _mesa_texformat_a8
;
197 extern const struct gl_texture_format _mesa_texformat_l8
;
198 extern const struct gl_texture_format _mesa_texformat_i8
;
199 extern const struct gl_texture_format _mesa_texformat_ci8
;
203 /** \name YCbCr formats */
205 extern const struct gl_texture_format _mesa_texformat_ycbcr
;
206 extern const struct gl_texture_format _mesa_texformat_ycbcr_rev
;
209 /** \name Compressed formats */
211 extern const struct gl_texture_format _mesa_texformat_rgb_fxt1
;
212 extern const struct gl_texture_format _mesa_texformat_rgba_fxt1
;
213 extern const struct gl_texture_format _mesa_texformat_rgb_dxt1
;
214 extern const struct gl_texture_format _mesa_texformat_rgba_dxt1
;
215 extern const struct gl_texture_format _mesa_texformat_rgba_dxt3
;
216 extern const struct gl_texture_format _mesa_texformat_rgba_dxt5
;
219 /** \name The null format */
221 extern const struct gl_texture_format _mesa_null_texformat
;
225 extern const struct gl_texture_format
*
226 _mesa_choose_tex_format( GLcontext
*ctx
, GLint internalFormat
,
227 GLenum format
, GLenum type
);