Removed the old teximage code.
[mesa.git] / src / mesa / main / texcompress_fxt1.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.1
4 *
5 * Copyright (C) 1999-2004 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
25
26 /**
27 * \file texcompress_fxt1.c
28 * GL_EXT_texture_compression_fxt1 support.
29 */
30
31
32 #include "glheader.h"
33 #include "imports.h"
34 #include "colormac.h"
35 #include "context.h"
36 #include "convolve.h"
37 #include "image.h"
38 #include "texcompress.h"
39 #include "texformat.h"
40 #include "texstore.h"
41
42
43 void
44 _mesa_init_texture_fxt1( GLcontext *ctx )
45 {
46 /* called during context initialization */
47 }
48
49
50 static GLboolean
51 texstore_rgb_fxt1(STORE_PARAMS)
52 {
53 /* XXX to do */
54 return GL_FALSE;
55 }
56
57
58 static GLboolean
59 texstore_rgba_fxt1(STORE_PARAMS)
60 {
61 /* XXX to do */
62 return GL_FALSE;
63 }
64
65
66
67 static void
68 fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
69 GLint i, GLint j, GLint k, GLchan *texel )
70 {
71 /* XXX to do */
72 }
73
74
75 static void
76 fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
77 GLint i, GLint j, GLint k, GLfloat *texel )
78 {
79 /* just sample as GLchan and convert to float here */
80 GLchan rgba[4];
81 fetch_texel_2d_rgba_fxt1(texImage, i, j, k, rgba);
82 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
83 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
84 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
85 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
86 }
87
88
89 static void
90 fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
91 GLint i, GLint j, GLint k, GLchan *texel )
92 {
93 /* XXX to do */
94 }
95
96
97 static void
98 fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
99 GLint i, GLint j, GLint k, GLfloat *texel )
100 {
101 /* just sample as GLchan and convert to float here */
102 GLchan rgba[4];
103 fetch_texel_2d_rgb_fxt1(texImage, i, j, k, rgba);
104 texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
105 texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
106 texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
107 texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
108 }
109
110
111
112 const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
113 MESA_FORMAT_RGB_FXT1, /* MesaFormat */
114 GL_RGB, /* BaseFormat */
115 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
116 4, /*approx*/ /* RedBits */
117 4, /*approx*/ /* GreenBits */
118 4, /*approx*/ /* BlueBits */
119 0, /* AlphaBits */
120 0, /* LuminanceBits */
121 0, /* IntensityBits */
122 0, /* IndexBits */
123 0, /* DepthBits */
124 0, /* TexelBytes */
125 texstore_rgb_fxt1, /* StoreTexImageFunc */
126 NULL, /*impossible*/ /* FetchTexel1D */
127 fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
128 NULL, /*impossible*/ /* FetchTexel3D */
129 NULL, /*impossible*/ /* FetchTexel1Df */
130 fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
131 NULL, /*impossible*/ /* FetchTexel3Df */
132 };
133
134 const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
135 MESA_FORMAT_RGBA_FXT1, /* MesaFormat */
136 GL_RGBA, /* BaseFormat */
137 GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
138 4, /*approx*/ /* RedBits */
139 4, /*approx*/ /* GreenBits */
140 4, /*approx*/ /* BlueBits */
141 1, /*approx*/ /* AlphaBits */
142 0, /* LuminanceBits */
143 0, /* IntensityBits */
144 0, /* IndexBits */
145 0, /* DepthBits */
146 0, /* TexelBytes */
147 texstore_rgba_fxt1, /* StoreTexImageFunc */
148 NULL, /*impossible*/ /* FetchTexel1D */
149 fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
150 NULL, /*impossible*/ /* FetchTexel3D */
151 NULL, /*impossible*/ /* FetchTexel1Df */
152 fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
153 NULL, /*impossible*/ /* FetchTexel3Df */
154 };
155