2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
27 * \file texcompress_fxt1.c
28 * GL_EXT_texture_compression_fxt1 support.
38 #include "texcompress.h"
39 #include "texformat.h"
44 _mesa_init_texture_fxt1( GLcontext
*ctx
)
46 /* called during context initialization */
51 texstore_rgb_fxt1(STORE_PARAMS
)
59 texstore_rgba_fxt1(STORE_PARAMS
)
68 fetch_texel_2d_rgba_fxt1( const struct gl_texture_image
*texImage
,
69 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
76 fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image
*texImage
,
77 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
79 /* just sample as GLchan and convert to float here */
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
]);
90 fetch_texel_2d_rgb_fxt1( const struct gl_texture_image
*texImage
,
91 GLint i
, GLint j
, GLint k
, GLchan
*texel
)
98 fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image
*texImage
,
99 GLint i
, GLint j
, GLint k
, GLfloat
*texel
)
101 /* just sample as GLchan and convert to float here */
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
]);
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 */
120 0, /* LuminanceBits */
121 0, /* IntensityBits */
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 */
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 */
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 */