c6b897f544598fe532d89828af9c729281b44bea
[mesa.git] / src / mesa / main / texformat.h
1 /* $Id: texformat.h,v 1.2 2001/03/18 08:53:49 gareth Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
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.
25 *
26 * Author:
27 * Gareth Hughes <gareth@valinux.com>
28 */
29
30 #ifndef TEXFORMAT_H
31 #define TEXFORMAT_H
32
33 #include "mtypes.h"
34
35
36 /* The Mesa internal texture image types. These will be set to their
37 * default value, but may be changed by drivers as required.
38 */
39 enum _format {
40 /* Generic GLchan-based formats. These are the default formats used
41 * by the software rasterizer and, unless the driver overrides the
42 * texture image functions, incoming images will be converted to one
43 * of these formats. Components are arrays of GLchan values, so
44 * there will be no big/little endian issues.
45 *
46 * NOTE: Because these are based on the GLchan datatype, one cannot
47 * assume 8 bits per channel with these formats. If you require
48 * GLubyte per channel, use one of the hardware formats below.
49 */
50 MESA_FORMAT_RGBA,
51 MESA_FORMAT_RGB,
52 MESA_FORMAT_ALPHA,
53 MESA_FORMAT_LUMINANCE,
54 MESA_FORMAT_LUMINANCE_ALPHA,
55 MESA_FORMAT_INTENSITY,
56 MESA_FORMAT_COLOR_INDEX,
57 MESA_FORMAT_DEPTH_COMPONENT,
58
59 /* Hardware-friendly formats. Drivers can override the default
60 * formats and convert texture images to one of these as required.
61 * These formats are all little endian, as shown below. They will be
62 * most useful for x86-based PC graphics card drivers.
63 *
64 * NOTE: In the default case, some of these formats will be
65 * duplicates of the default formats listed above. However, these
66 * formats guarantee their internal component sizes, while GLchan may
67 * vary betwen GLubyte, GLushort and GLfloat.
68 */
69 /* msb <------ TEXEL BITS -----------> lsb */
70 /* ---- ---- ---- ---- ---- ---- ---- ---- */
71 MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
72 MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
73 MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
74 MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
75 MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
76 MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
77 MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
78 MESA_FORMAT_RGB332, /* RRRG GGBB */
79 MESA_FORMAT_A8, /* AAAA AAAA */
80 MESA_FORMAT_L8, /* LLLL LLLL */
81 MESA_FORMAT_I8, /* IIII IIII */
82 MESA_FORMAT_CI8 /* CCCC CCCC */
83 };
84
85
86 extern void
87 _mesa_init_tex_format( GLcontext *ctx, GLenum internalFormat,
88 struct gl_texture_image *texImage );
89
90
91 /* The default formats, GLchan per component:
92 */
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;
101
102 /* The hardware-friendly formats:
103 */
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;
118
119 /* The null format:
120 */
121 extern const struct gl_texture_format _mesa_null_texformat;
122
123 #endif