#include "main/texcompress_fxt1.h"
#include "main/texcompress_s3tc.h"
#include "main/texcompress_rgtc.h"
+#include "main/texcompress_etc.h"
#include "main/teximage.h"
#include "s_context.h"
#include "s_texfetch.h"
*/
static struct {
gl_format Name;
- FetchTexelFuncF Fetch1D;
- FetchTexelFuncF Fetch2D;
- FetchTexelFuncF Fetch3D;
+ FetchTexelFunc Fetch1D;
+ FetchTexelFunc Fetch2D;
+ FetchTexelFunc Fetch3D;
StoreTexelFunc StoreTexel;
}
texfetch_funcs[MESA_FORMAT_COUNT] =
fetch_texel_3d_f_argb8888_rev,
store_texel_argb8888_rev
},
+ {
+ MESA_FORMAT_RGBX8888,
+ fetch_texel_1d_f_rgbx8888,
+ fetch_texel_2d_f_rgbx8888,
+ fetch_texel_3d_f_rgbx8888,
+ store_texel_rgbx8888
+ },
+ {
+ MESA_FORMAT_RGBX8888_REV,
+ fetch_texel_1d_f_rgbx8888_rev,
+ fetch_texel_2d_f_rgbx8888_rev,
+ fetch_texel_3d_f_rgbx8888_rev,
+ store_texel_rgbx8888_rev,
+ },
{
MESA_FORMAT_XRGB8888,
fetch_texel_1d_f_xrgb8888,
fetch_texel_3d_f_r8,
store_texel_r8,
},
+ {
+ MESA_FORMAT_GR88,
+ fetch_texel_1d_f_gr88,
+ fetch_texel_2d_f_gr88,
+ fetch_texel_3d_f_gr88,
+ store_texel_gr88,
+ },
{
MESA_FORMAT_RG88,
fetch_texel_1d_f_rg88,
fetch_texel_3d_f_rg88,
store_texel_rg88,
},
- {
- MESA_FORMAT_RG88_REV,
- fetch_texel_1d_f_rg88_rev,
- fetch_texel_2d_f_rg88_rev,
- fetch_texel_3d_f_rg88_rev,
- store_texel_rg88_rev,
- },
{
MESA_FORMAT_R16,
fetch_texel_1d_f_r16,
NULL,
NULL
},
+ {
+ MESA_FORMAT_ETC1_RGB8,
+ NULL,
+ _mesa_fetch_texel_2d_f_etc1_rgb8,
+ NULL,
+ NULL
+ },
{
MESA_FORMAT_SIGNED_A8,
fetch_texel_1d_signed_a8,
fetch_texel_2d_z32f_x24s8,
fetch_texel_3d_z32f_x24s8,
store_texel_z32f_x24s8
+ },
+ {
+ MESA_FORMAT_ARGB2101010_UINT,
+ NULL,
+ NULL,
+ NULL,
+ NULL
}
};
-FetchTexelFuncF
+FetchTexelFunc
_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
{
#ifdef DEBUG
}
#endif
- assert(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+ STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+
assert(format < MESA_FORMAT_COUNT);
switch (dims) {
/**
- * Adaptor for fetching a GLchan texel from a float-valued texture.
- */
-static void
-fetch_texel_float_to_chan(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texelOut)
-{
- GLfloat temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->Base.TexFormat);
-
- ASSERT(texImage->FetchTexelf);
- texImage->FetchTexelf(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- }
- else {
- /* four channels */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
- }
-}
-
-
-#if 0
-/**
- * Adaptor for fetching a float texel from a GLchan-valued texture.
- */
-static void
-fetch_texel_chan_to_float(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texelOut)
-{
- GLchan temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-
- ASSERT(texImage->FetchTexelc);
- texImage->FetchTexelc(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- }
- else {
- /* four channels */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- texelOut[1] = CHAN_TO_FLOAT(temp[1]);
- texelOut[2] = CHAN_TO_FLOAT(temp[2]);
- texelOut[3] = CHAN_TO_FLOAT(temp[3]);
- }
-}
-#endif
-
-
-/**
- * Initialize the texture image's FetchTexelc and FetchTexelf methods.
+ * Initialize the texture image's FetchTexel methods.
*/
static void
set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
format = _mesa_get_srgb_format_linear(format);
}
- texImage->FetchTexelf = _mesa_get_texel_fetch_func(format, dims);
-
- texImage->FetchTexelc = fetch_texel_float_to_chan;
-
- ASSERT(texImage->FetchTexelc);
- ASSERT(texImage->FetchTexelf);
+ texImage->FetchTexel = _mesa_get_texel_fetch_func(format, dims);
+ ASSERT(texImage->FetchTexel);
}
void