Commit 89fb06fc authored by Brian Paul's avatar Brian Paul
Browse files

new texture compression infrastructure

parent 1a0bfdc8
# $Id: Makefile.X11,v 1.68 2002/06/13 04:28:29 brianp Exp $
# $Id: Makefile.X11,v 1.69 2002/09/27 02:45:37 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
......@@ -63,6 +63,7 @@ CORE_SOURCES = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
......@@ -649,16 +649,19 @@ void dmesa_init_pointers (GLcontext *ctx)
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
/* Swrast hooks for imaging extensions:
*/
ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
......
......@@ -241,16 +241,19 @@ static void gl_ggiSetupPointers(GLcontext *ctx)
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
/* Imaging extensions */
ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
......
/* $Id: fxdd.c,v 1.90 2002/08/21 02:59:31 brianp Exp $ */
/* $Id: fxdd.c,v 1.91 2002/09/27 02:45:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -1014,6 +1014,12 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
......
/* $Id: osmesa.c,v 1.87 2002/08/07 00:45:07 brianp Exp $ */
/* $Id: osmesa.c,v 1.88 2002/09/27 02:45:39 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -2092,6 +2092,13 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
......@@ -2102,10 +2109,6 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
swdd->SetBuffer = set_buffer;
/* RGB(A) span/pixel functions */
......
/* $Id: wmesa.c,v 1.35 2002/09/12 17:05:55 kschultz Exp $ */
/* $Id: wmesa.c,v 1.36 2002/09/27 02:45:39 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
......@@ -1045,6 +1045,13 @@ static void SetFunctionPointers(GLcontext *ctx)
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
......@@ -1054,15 +1061,9 @@ static void SetFunctionPointers(GLcontext *ctx)
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
swdd->SetBuffer = set_buffer;
/* Pixel/span writing functions: */
swdd->WriteRGBASpan = write_rgba_span;
swdd->WriteRGBSpan = write_rgb_span;
......@@ -1123,6 +1124,13 @@ static void wmesa_update_state( GLcontext *ctx, GLuint new_state )
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
......@@ -1133,10 +1141,6 @@ static void wmesa_update_state( GLcontext *ctx, GLuint new_state )
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
swdd->SetBuffer = set_buffer;
/* Pixel/span writing functions: */
......
/* $Id: xm_dd.c,v 1.35 2002/09/23 17:21:53 brianp Exp $ */
/* $Id: xm_dd.c,v 1.36 2002/09/27 02:45:39 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -953,9 +953,12 @@ void xmesa_init_pointers( GLcontext *ctx )
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
/* Swrast hooks for imaging extensions:
*/
......
......@@ -98,6 +98,7 @@ MESA_CORE_SRCS = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
# Mesa 3-D graphics library
# Version: 4.0
# Version: 4.1
#
# Copyright (C) 1999 Brian Paul All Rights Reserved.
# Copyright (C) 1999-2002 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"),
......@@ -129,6 +129,7 @@ CORE_SOURCES = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
# $Id: Makefile.OSMesa16,v 1.7 2002/06/13 04:28:29 brianp Exp $
# $Id: Makefile.OSMesa16,v 1.8 2002/09/27 02:45:37 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
......@@ -63,6 +63,7 @@ CORE_SOURCES = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
# $Id: Makefile.X11,v 1.68 2002/06/13 04:28:29 brianp Exp $
# $Id: Makefile.X11,v 1.69 2002/09/27 02:45:37 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
......@@ -63,6 +63,7 @@ CORE_SOURCES = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
......@@ -93,6 +93,7 @@ GL_SOURCES = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
texformat.c \
teximage.c \
texobj.c \
......
......@@ -80,6 +80,7 @@ CORE_SRCS = \
rastpos.c \
state.c \
stencil.c \
texcompress.c \
teximage.c \
texformat.c \
texobj.c \
......
/* $Id: context.c,v 1.176 2002/09/06 02:56:08 brianp Exp $ */
/* $Id: context.c,v 1.177 2002/09/27 02:45:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -930,7 +930,6 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE;
ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
ctx->Const.NumCompressedTextureFormats = 0;
ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
ctx->Const.MaxLights = MAX_LIGHTS;
......
/* $Id: dd.h,v 1.71 2002/09/06 02:56:08 brianp Exp $ */
/* $Id: dd.h,v 1.72 2002/09/27 02:45:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -341,55 +341,6 @@ struct dd_function_table {
* should do the job.
*/
void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
GLint level, void *image,
const struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/* Called by glGetCompressedTexImageARB.
* <target>, <level>, <image> are specified by user.
* <texObj> is the source texture object.
* <texImage> is the source texture image.
*/
GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
GLint internalFormat);
/* Called to compute the base format for a specific compressed
* format. Return -1 if the internalFormat is not a specific
* compressed format that the driver recognizes.
* Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
*/
GLint (*CompressedTextureSize)(GLcontext *ctx,
const struct gl_texture_image *texImage);
#if 000
/* ... Note the
* return value differences between this function and
* SpecificCompressedTexFormat below.
*/
GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
GLint internalFormat,
GLint numDimensions,
GLint *levelp,
GLsizei *widthp,
GLsizei *heightp,
GLsizei *depthp,
GLint *borderp,
GLenum *formatp,
GLenum *typep);
/* Called to turn a generic texture format into a specific
* texture format. For example, if a driver implements
* GL_3DFX_texture_compression_FXT1, this would map
* GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
*
* If the driver does not know how to handle the compressed
* format, then just return the generic format, and Mesa will
* do the right thing with it.
*/
#endif
/***
*** Texture object functions:
***/
......
/* $Id: extensions.c,v 1.80 2002/09/21 17:34:56 brianp Exp $ */
/* $Id: extensions.c,v 1.81 2002/09/27 02:45:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -132,9 +132,8 @@ static struct {
{ OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
{ OFF, "GL_SGIX_shadow", F(SGIX_shadow) },
{ OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) },
{ OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) },
{ OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) },
{ OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) }
};
......
/* $Id: get.c,v 1.91 2002/09/21 17:34:56 brianp Exp $ */
/* $Id: get.c,v 1.92 2002/09/27 02:45:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -38,7 +38,7 @@
#include "macros.h"
#include "mmath.h"
#include "mtypes.h"
#include "texcompress.h"
#include "math/m_matrix.h"
#endif
......@@ -1034,14 +1034,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_B(ARB_texture_compression, pname);
*params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats);
*params = INT_TO_BOOL(_mesa_get_compressed_formats(ctx, NULL));
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_B(ARB_texture_compression, pname);
{
GLuint i;
for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++)
params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]);
GLint formats[100];
GLuint i, n;
n = _mesa_get_compressed_formats(ctx, formats);
for (i = 0; i < n; i++)
params[i] = INT_TO_BOOL(formats[i]);
}
break;
......@@ -2393,14 +2395,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_D(ARB_texture_compression, pname);
*params = (GLdouble) ctx->Const.NumCompressedTextureFormats;
*params = (GLdouble) _mesa_get_compressed_formats(ctx, NULL);
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_D(ARB_texture_compression, pname);
{
GLuint i;
for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++)
params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i];
GLint formats[100];
GLuint i, n;
n = _mesa_get_compressed_formats(ctx, formats);
for (i = 0; i < n; i++)
params[i] = (GLdouble) formats[i];
}
break;
......@@ -3754,14 +3758,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_F(ARB_texture_compression, pname);
*params = (GLfloat) ctx->Const.NumCompressedTextureFormats;
*params = (GLfloat) _mesa_get_compressed_formats(ctx, NULL);
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_F(ARB_texture_compression, pname);
{
GLuint i;
for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++)
params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i];
GLint formats[100];
GLuint i, n;
n = _mesa_get_compressed_formats(ctx, formats);
for (i = 0; i < n; i++)
params[i] = (GLfloat) formats[i];
}
break;
......@@ -5088,15 +5094,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_I(ARB_texture_compression, pname);
*params = (GLint) ctx->Const.NumCompressedTextureFormats;
*params = (GLint) _mesa_get_compressed_formats(ctx, NULL);
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
CHECK_EXTENSION_I(ARB_texture_compression, pname);
{
GLuint i;
for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++)
params[i] = (GLint) ctx->Const.CompressedTextureFormats[i];
}
(void) _mesa_get_compressed_formats(ctx, params);
break;
/* GL_EXT_compiled_vertex_array */
......
/* $Id: mtypes.h,v 1.88 2002/09/23 16:37:13 brianp Exp $ */
/* $Id: mtypes.h,v 1.89 2002/09/27 02:45:37 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -809,18 +809,16 @@ struct gl_texture_format {
* GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
*/
GLenum Type; /* Internal type as GL enum value - UNUSED?? */
GLubyte RedBits; /* Bits per texel component */
GLubyte GreenBits;
GLubyte BlueBits;
GLubyte GreenBits; /* These are just rough approximations for */
GLubyte BlueBits; /* compressed texture formats. */
GLubyte AlphaBits;
GLubyte LuminanceBits;
GLubyte IntensityBits;
GLubyte IndexBits;
GLubyte DepthBits;
GLint TexelBytes;
GLint TexelBytes; /* Bytes per texel (0 for compressed formats */
FetchTexelFunc FetchTexel1D; /* Texel fetch function pointers */
FetchTexelFunc FetchTexel2D;
......@@ -833,6 +831,7 @@ struct gl_texture_image {
GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
* Used for choosing TexEnv arithmetic.
*/
GLint IntFormat; /* Internal format as given by the user */
GLuint Border; /* 0 or 1 */
......@@ -1373,8 +1372,6 @@ struct gl_constants {
GLuint MaxColorTableSize;
GLuint MaxConvolutionWidth;
GLuint MaxConvolutionHeight;
GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */
GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS];
GLuint MaxClipPlanes;
GLuint MaxLights;
};
......@@ -1455,7 +1452,7 @@ struct gl_extensions {
GLboolean SGIX_pixel_texture;
GLboolean SGIX_shadow;
GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
GLboolean _3DFX_texture_compression_FXT1;
GLboolean TDFX_texture_compression_FXT1;
GLboolean APPLE_client_storage;
};
......
/* $Id: state.c,v 1.91 2002/09/06 03:20:21 brianp Exp $ */
/* $Id: state.c,v 1.92 2002/09/27 02:45:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -1041,9 +1041,6 @@ void _mesa_update_state( GLcontext *ctx )
ASSERT(ctx->Driver.CopyTexSubImage2D);
ASSERT(ctx->Driver.CopyTexSubImage3D);
if (ctx->Extensions.ARB_texture_compression) {
ASSERT(ctx->Driver.BaseCompressedTexFormat);
ASSERT(ctx->Driver.CompressedTextureSize);
ASSERT(ctx->Driver.GetCompressedTexImage);
#if 0 /* HW drivers need these, but not SW rasterizers */
ASSERT(ctx->Driver.CompressedTexImage1D);
ASSERT(ctx->Driver.CompressedTexImage2D);
......
/* $Id: texcompress.c,v 1.1 2002/09/27 02:45:38 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 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.
*/
#include "glheader.h"
#include "context.h"
#include "image.h"
#include "mem.h"
#include "texcompress.h"
#include "texformat.h"
/**
* Get the list of supported internal compression formats.
* \param formats - the results list (may be NULL)
* \return number of formats.
*/
GLuint
_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats )
{
GLuint n = 0;
if (ctx->Extensions.ARB_texture_compression) {
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
if (formats) {
formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
}
else {
n += 4;
}
}
}
return n;
}
/**
* Return bytes of storage needed for the given texture size and compressed
* format.
* \param width, height, depth - texture size in texels
* \param texFormat - one of the compressed format enums
* \return size in bytes, or zero if bad texFormat
*/
GLuint
_mesa_compressed_texture_size( GLcontext *ctx,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format )
{
GLuint size;
switch (format) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
case GL_COMPRESSED_RGBA_FXT1_3DFX:
/* round up to multiple of 4 */
size = ((width + 7) / 8) * ((height + 3) / 4) * 16;
return size;
default:
_mesa_problem(ctx, "bad texformat in compressed_texture_size");
return 0;
}
}
/*
* Compute the bytes per row in a compressed texture image.
*/
GLint
_mesa_compressed_row_stride(GLenum format, GLsizei width)
{
GLint bytesPerTile, stride;
switch (format) {