mesa: make some s3tc/fxt1 functions public

This commit is contained in:
Brian Paul 2009-09-27 18:08:49 -06:00
parent 6c6896bd25
commit 7116ae857c
4 changed files with 196 additions and 70 deletions

View file

@ -37,6 +37,7 @@
#include "image.h"
#include "mipmap.h"
#include "texcompress.h"
#include "texcompress_fxt1.h"
#include "texformat.h"
#include "texstore.h"
@ -64,8 +65,8 @@ _mesa_init_texture_fxt1( GLcontext *ctx )
/**
* Called via TexFormat->StoreImage to store an RGB_FXT1 texture.
*/
static GLboolean
texstore_rgb_fxt1(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -121,8 +122,8 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS)
/**
* Called via TexFormat->StoreImage to store an RGBA_FXT1 texture.
*/
static GLboolean
texstore_rgba_fxt1(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -175,18 +176,18 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS)
}
static void
fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
void
_mesa_fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
}
static void
fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -199,9 +200,9 @@ fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
void
_mesa_fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
(void) k;
fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
@ -209,9 +210,9 @@ fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -239,12 +240,12 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgb_fxt1, /* StoreTexImageFunc */
_mesa_texstore_rgb_fxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
_mesa_fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -263,12 +264,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_fxt1, /* StoreTexImageFunc */
_mesa_texstore_rgba_fxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
_mesa_fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};

View file

@ -0,0 +1,51 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXCOMPRESS_FXT1_H
#define TEXCOMPRESS_FXT1_H
extern GLboolean
_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
extern GLboolean
_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
extern void
_mesa_fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel);
extern void
_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_rgb_fxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel);
extern void
_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
#endif /* TEXCOMPRESS_FXT1_H */

View file

@ -41,6 +41,7 @@
#include "dlopen.h"
#include "image.h"
#include "texcompress.h"
#include "texcompress_s3tc.h"
#include "texformat.h"
#include "texstore.h"
@ -155,8 +156,8 @@ _mesa_init_texture_s3tc( GLcontext *ctx )
/**
* Called via TexFormat->StoreImage to store an RGB_DXT1 texture.
*/
static GLboolean
texstore_rgb_dxt1(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -218,8 +219,8 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS)
/**
* Called via TexFormat->StoreImage to store an RGBA_DXT1 texture.
*/
static GLboolean
texstore_rgba_dxt1(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -280,8 +281,8 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS)
/**
* Called via TexFormat->StoreImage to store an RGBA_DXT3 texture.
*/
static GLboolean
texstore_rgba_dxt3(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -341,8 +342,8 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS)
/**
* Called via TexFormat->StoreImage to store an RGBA_DXT5 texture.
*/
static GLboolean
texstore_rgba_dxt5(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
{
const GLchan *pixels;
GLint srcRowStride;
@ -414,9 +415,9 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -442,9 +443,9 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -471,9 +472,9 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -499,9 +500,9 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
}
static void
fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -513,9 +514,9 @@ fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage,
}
#if FEATURE_EXT_texture_sRGB
static void
fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -526,9 +527,9 @@ fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
}
static void
fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -539,9 +540,9 @@ fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
}
static void
fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -552,9 +553,9 @@ fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
}
static void
fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
void
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLchan and convert to float here */
GLchan rgba[4];
@ -580,12 +581,12 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgb_dxt1, /* StoreTexImageFunc */
_mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -604,12 +605,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt1, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -628,12 +629,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt3, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -652,12 +653,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt5, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -677,12 +678,12 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgb_dxt1, /* StoreTexImageFunc */
_mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
NULL, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -701,12 +702,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt1, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
NULL, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -725,12 +726,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt3 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt3, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
NULL, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
@ -749,12 +750,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt5 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgba_dxt5, /* StoreTexImageFunc */
_mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
NULL, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */
_mesa_fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};

View file

@ -0,0 +1,73 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXCOMPRESS_S3TC_H
#define TEXCOMPRESS_S3TC_H
extern GLboolean
_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
extern GLboolean
_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS);
extern GLboolean
_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS);
extern GLboolean
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
extern void
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);
#endif /* TEXCOMPRESS_S3TC_H */