1 /* $Id: texformat.h,v 1.4 2001/03/22 06:25:23 gareth 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_init_tex_format( GLcontext
*ctx
, GLenum internalFormat
,
88 struct gl_texture_image
*texImage
);
91 /* The default formats, GLchan per component:
93 extern const struct gl_texture_format _mesa_texformat_rgba
;
94 extern const struct gl_texture_format _mesa_texformat_rgb
;
95 extern const struct gl_texture_format _mesa_texformat_alpha
;
96 extern const struct gl_texture_format _mesa_texformat_luminance
;
97 extern const struct gl_texture_format _mesa_texformat_luminance_alpha
;
98 extern const struct gl_texture_format _mesa_texformat_intensity
;
99 extern const struct gl_texture_format _mesa_texformat_color_index
;
100 extern const struct gl_texture_format _mesa_texformat_depth_component
;
102 /* The hardware-friendly formats:
104 extern const struct gl_texture_format _mesa_texformat_rgba8888
;
105 extern const struct gl_texture_format _mesa_texformat_abgr8888
;
106 extern const struct gl_texture_format _mesa_texformat_argb8888
;
107 extern const struct gl_texture_format _mesa_texformat_rgb888
;
108 extern const struct gl_texture_format _mesa_texformat_bgr888
;
109 extern const struct gl_texture_format _mesa_texformat_rgb565
;
110 extern const struct gl_texture_format _mesa_texformat_argb4444
;
111 extern const struct gl_texture_format _mesa_texformat_argb1555
;
112 extern const struct gl_texture_format _mesa_texformat_al88
;
113 extern const struct gl_texture_format _mesa_texformat_rgb332
;
114 extern const struct gl_texture_format _mesa_texformat_a8
;
115 extern const struct gl_texture_format _mesa_texformat_l8
;
116 extern const struct gl_texture_format _mesa_texformat_i8
;
117 extern const struct gl_texture_format _mesa_texformat_ci8
;
121 extern const struct gl_texture_format _mesa_null_texformat
;