glBindProgramARB dispatches to glBindProgramNV (remove _mesa_BindProgramARB).
[mesa.git] / src / mesa / main / texformat.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 5.1
4 *
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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.
23 *
24 * Author:
25 * Gareth Hughes
26 */
27
28 #ifndef TEXFORMAT_H
29 #define TEXFORMAT_H
30
31 #include "mtypes.h"
32
33
34 /*
35 * The Mesa internal texture image types.
36 * All texture images must be stored in one of these formats.
37 */
38 enum _format {
39 /* Hardware-friendly formats. Drivers can override the default
40 * formats and convert texture images to one of these as required.
41 * The driver's ChooseTextureFormat() function will choose one of
42 * these formats.
43 * These formats are all little endian, as shown below. They will be
44 * most useful for x86-based PC graphics card drivers.
45 *
46 * NOTE: In the default case, some of these formats will be
47 * duplicates of the generic formats listed below. However, these
48 * formats guarantee their internal component sizes, while GLchan may
49 * vary betwen GLubyte, GLushort and GLfloat.
50 */
51 /* msb <------ TEXEL BITS -----------> lsb */
52 /* ---- ---- ---- ---- ---- ---- ---- ---- */
53 MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
54 MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
55 MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */
56 MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */
57 MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */
58 MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */
59 MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */
60 MESA_FORMAT_RGB332, /* RRRG GGBB */
61 MESA_FORMAT_A8, /* AAAA AAAA */
62 MESA_FORMAT_L8, /* LLLL LLLL */
63 MESA_FORMAT_I8, /* IIII IIII */
64 MESA_FORMAT_CI8, /* CCCC CCCC */
65 MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
66 MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
67
68 MESA_FORMAT_RGB_DXT1,
69 MESA_FORMAT_RGBA_DXT1,
70 MESA_FORMAT_RGBA_DXT3,
71 MESA_FORMAT_RGBA_DXT5,
72
73 #if 0
74 /* upcoming little-endian formats: */
75
76 /* msb <------ TEXEL BITS -----------> lsb */
77 /* ---- ---- ---- ---- ---- ---- ---- ---- */
78 MESA_FORMAT_ABGR8888, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
79 MESA_FORMAT_BGRA8888, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
80 MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */
81 MESA_FORMAT_BGR565, /* BBBB BGGG GGGR RRRR */
82 MESA_FORMAT_BGRA4444, /* BBBB GGGG RRRR AAAA */
83 MESA_FORMAT_BGRA5551, /* BBBB BGGG GGRR RRRA */
84 MESA_FORMAT_LA88, /* LLLL LLLL AAAA AAAA */
85 MESA_FORMAT_BGR233, /* BBGG GRRR */
86 #endif
87
88 /* Generic GLchan-based formats. These are the default formats used
89 * by the software rasterizer and, unless the driver overrides the
90 * texture image functions, incoming images will be converted to one
91 * of these formats. Components are arrays of GLchan values, so
92 * there will be no big/little endian issues.
93 *
94 * NOTE: Because these are based on the GLchan datatype, one cannot
95 * assume 8 bits per channel with these formats. If you require
96 * GLubyte channels, use one of the hardware formats above.
97 */
98 MESA_FORMAT_RGBA,
99 MESA_FORMAT_RGB,
100 MESA_FORMAT_ALPHA,
101 MESA_FORMAT_LUMINANCE,
102 MESA_FORMAT_LUMINANCE_ALPHA,
103 MESA_FORMAT_INTENSITY,
104 MESA_FORMAT_COLOR_INDEX,
105 MESA_FORMAT_DEPTH_COMPONENT
106 };
107
108
109 extern GLboolean
110 _mesa_is_hardware_tex_format( const struct gl_texture_format *format );
111
112 extern const struct gl_texture_format *
113 _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
114 GLenum format, GLenum type );
115
116 extern GLint
117 _mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
118
119
120 /* The default formats, GLchan per component:
121 */
122 extern const struct gl_texture_format _mesa_texformat_rgba;
123 extern const struct gl_texture_format _mesa_texformat_rgb;
124 extern const struct gl_texture_format _mesa_texformat_alpha;
125 extern const struct gl_texture_format _mesa_texformat_luminance;
126 extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
127 extern const struct gl_texture_format _mesa_texformat_intensity;
128 extern const struct gl_texture_format _mesa_texformat_color_index;
129 extern const struct gl_texture_format _mesa_texformat_depth_component;
130
131 /* The hardware-friendly formats:
132 */
133 extern const struct gl_texture_format _mesa_texformat_rgba8888;
134 extern const struct gl_texture_format _mesa_texformat_argb8888;
135 extern const struct gl_texture_format _mesa_texformat_rgb888;
136 extern const struct gl_texture_format _mesa_texformat_rgb565;
137 extern const struct gl_texture_format _mesa_texformat_argb4444;
138 extern const struct gl_texture_format _mesa_texformat_argb1555;
139 extern const struct gl_texture_format _mesa_texformat_al88;
140 extern const struct gl_texture_format _mesa_texformat_rgb332;
141 extern const struct gl_texture_format _mesa_texformat_a8;
142 extern const struct gl_texture_format _mesa_texformat_l8;
143 extern const struct gl_texture_format _mesa_texformat_i8;
144 extern const struct gl_texture_format _mesa_texformat_ci8;
145 extern const struct gl_texture_format _mesa_texformat_ycbcr;
146 extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
147 extern const struct gl_texture_format _mesa_texformat_rgb_dxt1;
148 extern const struct gl_texture_format _mesa_texformat_rgba_dxt1;
149 extern const struct gl_texture_format _mesa_texformat_rgba_dxt3;
150 extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
151
152 /* The null format:
153 */
154 extern const struct gl_texture_format _mesa_null_texformat;
155
156 #endif