1 /* $Id: texformat.h,v 1.7 2001/06/15 14:18:46 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * Gareth Hughes <gareth@valinux.com>
36 /* The Mesa internal texture image types. These will be set to their
37 * default value, but may be changed by drivers as required.
40 /* Hardware-friendly formats. Drivers can override the default
41 * formats and convert texture images to one of these as required.
42 * These formats are all little endian, as shown below. They will be
43 * most useful for x86-based PC graphics card drivers.
45 * NOTE: In the default case, some of these formats will be
46 * duplicates of the default formats listed above. However, these
47 * formats guarantee their internal component sizes, while GLchan may
48 * vary betwen GLubyte, GLushort and GLfloat.
50 /* msb <------ TEXEL BITS -----------> lsb */
51 /* ---- ---- ---- ---- ---- ---- ---- ---- */
52 MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
53 MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
54 MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
55 MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
56 MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
57 MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
58 MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
59 MESA_FORMAT_RGB332, /* RRRG GGBB */
60 MESA_FORMAT_A8, /* AAAA AAAA */
61 MESA_FORMAT_L8, /* LLLL LLLL */
62 MESA_FORMAT_I8, /* IIII IIII */
63 MESA_FORMAT_CI8, /* CCCC CCCC */
65 /* Generic GLchan-based formats. These are the default formats used
66 * by the software rasterizer and, unless the driver overrides the
67 * texture image functions, incoming images will be converted to one
68 * of these formats. Components are arrays of GLchan values, so
69 * there will be no big/little endian issues.
71 * NOTE: Because these are based on the GLchan datatype, one cannot
72 * assume 8 bits per channel with these formats. If you require
73 * GLubyte per channel, use one of the hardware formats below.
78 MESA_FORMAT_LUMINANCE,
79 MESA_FORMAT_LUMINANCE_ALPHA,
80 MESA_FORMAT_INTENSITY,
81 MESA_FORMAT_COLOR_INDEX,
82 MESA_FORMAT_DEPTH_COMPONENT
87 _mesa_is_hardware_tex_format( const struct gl_texture_format *format );
89 extern const struct gl_texture_format *
90 _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
91 GLenum format, GLenum type );
94 _mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
97 _mesa_compressed_texture_size(GLcontext *ctx,
98 const struct gl_texture_image *texImage);
101 /* The default formats, GLchan per component:
103 extern const struct gl_texture_format _mesa_texformat_rgba;
104 extern const struct gl_texture_format _mesa_texformat_rgb;
105 extern const struct gl_texture_format _mesa_texformat_alpha;
106 extern const struct gl_texture_format _mesa_texformat_luminance;
107 extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
108 extern const struct gl_texture_format _mesa_texformat_intensity;
109 extern const struct gl_texture_format _mesa_texformat_color_index;
110 extern const struct gl_texture_format _mesa_texformat_depth_component;
112 /* The hardware-friendly formats:
114 extern const struct gl_texture_format _mesa_texformat_rgba8888;
115 extern const struct gl_texture_format _mesa_texformat_argb8888;
116 extern const struct gl_texture_format _mesa_texformat_rgb888;
117 extern const struct gl_texture_format _mesa_texformat_rgb565;
118 extern const struct gl_texture_format _mesa_texformat_argb4444;
119 extern const struct gl_texture_format _mesa_texformat_argb1555;
120 extern const struct gl_texture_format _mesa_texformat_al88;
121 extern const struct gl_texture_format _mesa_texformat_rgb332;
122 extern const struct gl_texture_format _mesa_texformat_a8;
123 extern const struct gl_texture_format _mesa_texformat_l8;
124 extern const struct gl_texture_format _mesa_texformat_i8;
125 extern const struct gl_texture_format _mesa_texformat_ci8;
129 extern const struct gl_texture_format _mesa_null_texformat;