mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
new texture compression infrastructure
This commit is contained in:
parent
1a0bfdc8c1
commit
89fb06fcc1
30 changed files with 1420 additions and 767 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# $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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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: */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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 \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# 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 \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $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 \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $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 \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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:
|
||||
***/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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) }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $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);
|
||||
|
|
|
|||
159
src/mesa/main/texcompress.c
Normal file
159
src/mesa/main/texcompress.c
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
/* $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) {
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
stride = ((width + 3) / 4) * bytesPerTile;
|
||||
return stride;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the address of the pixel at (col, row, img) in a
|
||||
* compressed texture image.
|
||||
* \param col, row, img - image position (3D)
|
||||
* \param format - compressed image format
|
||||
* \param width - image width
|
||||
* \param image - the image address
|
||||
* \return address of pixel at (row, col)
|
||||
*/
|
||||
GLubyte *
|
||||
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
||||
GLenum format,
|
||||
GLsizei width, const GLubyte *image)
|
||||
{
|
||||
GLint bytesPerTile, stride;
|
||||
GLubyte *addr;
|
||||
|
||||
ASSERT((row & 3) == 0);
|
||||
ASSERT((col & 3) == 0);
|
||||
(void) img;
|
||||
|
||||
switch (format) {
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
stride = ((width + 3) / 4) * bytesPerTile;
|
||||
|
||||
addr = (GLubyte *) image + (row / 4) * stride + (col / 4) * bytesPerTile;
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \param srcRowStride - source stride, in pixels
|
||||
*/
|
||||
void
|
||||
_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height,
|
||||
GLenum srcFormat, const GLchan *source, GLint srcRowStride,
|
||||
GLenum dstFormat, GLubyte *dest, GLint dstRowStride )
|
||||
{
|
||||
GLuint len = 0;
|
||||
|
||||
switch (dstFormat) {
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad dstFormat in _mesa_compress_teximage()");
|
||||
return;
|
||||
}
|
||||
|
||||
/* sanity check */
|
||||
ASSERT(len == _mesa_compressed_texture_size(ctx, width, height,
|
||||
1, dstFormat));
|
||||
}
|
||||
58
src/mesa/main/texcompress.h
Normal file
58
src/mesa/main/texcompress.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* $Id: texcompress.h,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.
|
||||
*/
|
||||
|
||||
#ifndef TEXCOMPRESS_H
|
||||
#define TEXCOMPRESS_H
|
||||
|
||||
#include "mtypes.h"
|
||||
|
||||
|
||||
extern GLuint
|
||||
_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats );
|
||||
|
||||
extern GLuint
|
||||
_mesa_compressed_texture_size( GLcontext *ctx,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format );
|
||||
|
||||
extern GLint
|
||||
_mesa_compressed_row_stride(GLenum format, GLsizei width);
|
||||
|
||||
|
||||
extern GLubyte *
|
||||
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
||||
GLenum format,
|
||||
GLsizei width, const GLubyte *image);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height,
|
||||
GLenum srcFormat,
|
||||
const GLchan *source, GLint srcRowStride,
|
||||
GLenum dstformat, GLubyte *dest, GLint dstRowStride );
|
||||
|
||||
|
||||
#endif /* TEXCOMPRESS_H */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texformat.c,v 1.15 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: texformat.c,v 1.16 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -74,7 +74,6 @@ static void fetch_null_texel( const struct gl_texture_image *texImage,
|
|||
const struct gl_texture_format _mesa_texformat_rgba = {
|
||||
MESA_FORMAT_RGBA, /* MesaFormat */
|
||||
GL_RGBA, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
CHAN_BITS, /* RedBits */
|
||||
CHAN_BITS, /* GreenBits */
|
||||
CHAN_BITS, /* BlueBits */
|
||||
|
|
@ -92,7 +91,6 @@ const struct gl_texture_format _mesa_texformat_rgba = {
|
|||
const struct gl_texture_format _mesa_texformat_rgb = {
|
||||
MESA_FORMAT_RGB, /* MesaFormat */
|
||||
GL_RGB, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
CHAN_BITS, /* RedBits */
|
||||
CHAN_BITS, /* GreenBits */
|
||||
CHAN_BITS, /* BlueBits */
|
||||
|
|
@ -110,7 +108,6 @@ const struct gl_texture_format _mesa_texformat_rgb = {
|
|||
const struct gl_texture_format _mesa_texformat_alpha = {
|
||||
MESA_FORMAT_ALPHA, /* MesaFormat */
|
||||
GL_ALPHA, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -128,7 +125,6 @@ const struct gl_texture_format _mesa_texformat_alpha = {
|
|||
const struct gl_texture_format _mesa_texformat_luminance = {
|
||||
MESA_FORMAT_LUMINANCE, /* MesaFormat */
|
||||
GL_LUMINANCE, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -146,7 +142,6 @@ const struct gl_texture_format _mesa_texformat_luminance = {
|
|||
const struct gl_texture_format _mesa_texformat_luminance_alpha = {
|
||||
MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */
|
||||
GL_LUMINANCE_ALPHA, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -164,7 +159,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
|
|||
const struct gl_texture_format _mesa_texformat_intensity = {
|
||||
MESA_FORMAT_INTENSITY, /* MesaFormat */
|
||||
GL_INTENSITY, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -182,7 +176,6 @@ const struct gl_texture_format _mesa_texformat_intensity = {
|
|||
const struct gl_texture_format _mesa_texformat_color_index = {
|
||||
MESA_FORMAT_COLOR_INDEX, /* MesaFormat */
|
||||
GL_COLOR_INDEX, /* BaseFormat */
|
||||
CHAN_TYPE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -200,7 +193,6 @@ const struct gl_texture_format _mesa_texformat_color_index = {
|
|||
const struct gl_texture_format _mesa_texformat_depth_component = {
|
||||
MESA_FORMAT_DEPTH_COMPONENT, /* MesaFormat */
|
||||
GL_DEPTH_COMPONENT, /* BaseFormat */
|
||||
GL_FLOAT, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -223,7 +215,6 @@ const struct gl_texture_format _mesa_texformat_depth_component = {
|
|||
const struct gl_texture_format _mesa_texformat_rgba8888 = {
|
||||
MESA_FORMAT_RGBA8888, /* MesaFormat */
|
||||
GL_RGBA, /* BaseFormat */
|
||||
GL_UNSIGNED_INT_8_8_8_8, /* Type */
|
||||
8, /* RedBits */
|
||||
8, /* GreenBits */
|
||||
8, /* BlueBits */
|
||||
|
|
@ -241,7 +232,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
|
|||
const struct gl_texture_format _mesa_texformat_argb8888 = {
|
||||
MESA_FORMAT_ARGB8888, /* MesaFormat */
|
||||
GL_RGBA, /* BaseFormat */
|
||||
GL_UNSIGNED_INT_8_8_8_8_REV, /* Type */
|
||||
8, /* RedBits */
|
||||
8, /* GreenBits */
|
||||
8, /* BlueBits */
|
||||
|
|
@ -259,7 +249,6 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
|
|||
const struct gl_texture_format _mesa_texformat_rgb888 = {
|
||||
MESA_FORMAT_RGB888, /* MesaFormat */
|
||||
GL_RGB, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
8, /* RedBits */
|
||||
8, /* GreenBits */
|
||||
8, /* BlueBits */
|
||||
|
|
@ -277,7 +266,6 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
|
|||
const struct gl_texture_format _mesa_texformat_rgb565 = {
|
||||
MESA_FORMAT_RGB565, /* MesaFormat */
|
||||
GL_RGB, /* BaseFormat */
|
||||
GL_UNSIGNED_SHORT_5_6_5, /* Type */
|
||||
5, /* RedBits */
|
||||
6, /* GreenBits */
|
||||
5, /* BlueBits */
|
||||
|
|
@ -295,7 +283,6 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
|
|||
const struct gl_texture_format _mesa_texformat_argb4444 = {
|
||||
MESA_FORMAT_ARGB4444, /* MesaFormat */
|
||||
GL_RGBA, /* BaseFormat */
|
||||
GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
|
||||
4, /* RedBits */
|
||||
4, /* GreenBits */
|
||||
4, /* BlueBits */
|
||||
|
|
@ -313,7 +300,6 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
|
|||
const struct gl_texture_format _mesa_texformat_argb1555 = {
|
||||
MESA_FORMAT_ARGB1555, /* MesaFormat */
|
||||
GL_RGBA, /* BaseFormat */
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
|
||||
5, /* RedBits */
|
||||
5, /* GreenBits */
|
||||
5, /* BlueBits */
|
||||
|
|
@ -331,7 +317,6 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
|
|||
const struct gl_texture_format _mesa_texformat_al88 = {
|
||||
MESA_FORMAT_AL88, /* MesaFormat */
|
||||
GL_LUMINANCE_ALPHA, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -349,7 +334,6 @@ const struct gl_texture_format _mesa_texformat_al88 = {
|
|||
const struct gl_texture_format _mesa_texformat_rgb332 = {
|
||||
MESA_FORMAT_RGB332, /* MesaFormat */
|
||||
GL_RGB, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE_3_3_2, /* Type */
|
||||
3, /* RedBits */
|
||||
3, /* GreenBits */
|
||||
2, /* BlueBits */
|
||||
|
|
@ -367,7 +351,6 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
|
|||
const struct gl_texture_format _mesa_texformat_a8 = {
|
||||
MESA_FORMAT_A8, /* MesaFormat */
|
||||
GL_ALPHA, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -385,7 +368,6 @@ const struct gl_texture_format _mesa_texformat_a8 = {
|
|||
const struct gl_texture_format _mesa_texformat_l8 = {
|
||||
MESA_FORMAT_L8, /* MesaFormat */
|
||||
GL_LUMINANCE, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -403,7 +385,6 @@ const struct gl_texture_format _mesa_texformat_l8 = {
|
|||
const struct gl_texture_format _mesa_texformat_i8 = {
|
||||
MESA_FORMAT_I8, /* MesaFormat */
|
||||
GL_INTENSITY, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -421,7 +402,6 @@ const struct gl_texture_format _mesa_texformat_i8 = {
|
|||
const struct gl_texture_format _mesa_texformat_ci8 = {
|
||||
MESA_FORMAT_CI8, /* MesaFormat */
|
||||
GL_COLOR_INDEX, /* BaseFormat */
|
||||
GL_UNSIGNED_BYTE, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -436,11 +416,9 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
|
|||
fetch_3d_texel_ci8, /* FetchTexel3D */
|
||||
};
|
||||
|
||||
|
||||
const struct gl_texture_format _mesa_texformat_ycbcr = {
|
||||
MESA_FORMAT_YCBCR, /* MesaFormat */
|
||||
GL_YCBCR_MESA, /* BaseFormat */
|
||||
GL_UNSIGNED_SHORT_8_8_MESA, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -459,7 +437,6 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
|
|||
const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
|
||||
MESA_FORMAT_YCBCR_REV, /* MesaFormat */
|
||||
GL_YCBCR_MESA, /* BaseFormat */
|
||||
GL_UNSIGNED_SHORT_8_8_REV_MESA, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -623,13 +600,12 @@ const struct gl_texture_format _mesa_texformat_bgr233 = {
|
|||
#endif
|
||||
|
||||
/* =============================================================
|
||||
* Null format:
|
||||
* Null format (useful for proxy textures):
|
||||
*/
|
||||
|
||||
const struct gl_texture_format _mesa_null_texformat = {
|
||||
-1, /* MesaFormat */
|
||||
0, /* BaseFormat */
|
||||
0, /* Type */
|
||||
0, /* RedBits */
|
||||
0, /* GreenBits */
|
||||
0, /* BlueBits */
|
||||
|
|
@ -645,7 +621,6 @@ const struct gl_texture_format _mesa_null_texformat = {
|
|||
};
|
||||
|
||||
|
||||
|
||||
GLboolean
|
||||
_mesa_is_hardware_tex_format( const struct gl_texture_format *format )
|
||||
{
|
||||
|
|
@ -774,6 +749,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
|
|||
_mesa_problem(ctx, "texture compression extension not enabled");
|
||||
return &_mesa_texformat_rgba;
|
||||
|
||||
/* GL_MESA_ycrcr_texture */
|
||||
case GL_YCBCR_MESA:
|
||||
if (type == GL_UNSIGNED_SHORT_8_8_MESA)
|
||||
return &_mesa_texformat_ycbcr;
|
||||
|
|
@ -782,7 +758,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
|
|||
|
||||
default:
|
||||
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
|
||||
_mesa_debug(ctx, "intformat = %d %x\n", internalFormat, internalFormat);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -817,23 +792,3 @@ _mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat)
|
|||
return -1; /* not a recognized compressed format */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called via ctx->Driver.CompressedTextureSize().
|
||||
* This function is only used by software rasterizers.
|
||||
* Hardware drivers will have to implement a specialized function.
|
||||
*/
|
||||
GLint
|
||||
_mesa_compressed_texture_size(GLcontext *ctx,
|
||||
const struct gl_texture_image *texImage)
|
||||
{
|
||||
GLint b;
|
||||
assert(texImage);
|
||||
assert(texImage->TexFormat);
|
||||
|
||||
b = texImage->Width * texImage->Height * texImage->Depth *
|
||||
texImage->TexFormat->TexelBytes;
|
||||
assert(b > 0);
|
||||
return b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texformat.h,v 1.11 2002/09/23 16:37:14 brianp Exp $ */
|
||||
/* $Id: texformat.h,v 1.12 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -67,7 +67,6 @@ enum _format {
|
|||
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
|
||||
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
|
||||
|
||||
|
||||
#if 0
|
||||
/* upcoming little-endian formats: */
|
||||
|
||||
|
|
@ -114,10 +113,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
|
|||
extern GLint
|
||||
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
|
||||
|
||||
extern GLint
|
||||
_mesa_compressed_texture_size(GLcontext *ctx,
|
||||
const struct gl_texture_image *texImage);
|
||||
|
||||
|
||||
/* The default formats, GLchan per component:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texformat_tmp.h,v 1.8 2002/09/23 16:37:14 brianp Exp $ */
|
||||
/* $Id: texformat_tmp.h,v 1.9 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -23,10 +23,18 @@
|
|||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Brian Paul
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This template file generates texel fetch functions for 1-D, 2-D and 3-D
|
||||
* texture images.
|
||||
*/
|
||||
|
||||
|
||||
#if DIM == 1
|
||||
|
||||
#define CHAN_SRC( t, i, j, k, sz ) \
|
||||
|
|
@ -348,7 +356,6 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* big-endian */
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texstate.c,v 1.78 2002/09/08 17:29:16 brianp Exp $ */
|
||||
/* $Id: texstate.c,v 1.79 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -1461,7 +1461,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
maxLevels = 1;
|
||||
break;
|
||||
default:
|
||||
_mesa_printf(ctx, "bad target in _mesa_GetTexLevelParameter (0x%x)", target);
|
||||
_mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1557,7 +1557,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
if (ctx->Extensions.SGIX_depth_texture)
|
||||
*params = img->TexFormat->DepthBits;
|
||||
else
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)");
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
return;
|
||||
|
||||
/* GL_ARB_texture_compression */
|
||||
|
|
@ -1567,10 +1568,11 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
*params = img->CompressedSize;
|
||||
else
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
}
|
||||
else {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)");
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
}
|
||||
return;
|
||||
case GL_TEXTURE_COMPRESSED_ARB:
|
||||
|
|
@ -1578,12 +1580,14 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
*params = (GLint) img->IsCompressed;
|
||||
}
|
||||
else {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)");
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)");
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetTexLevelParameter[if]v(pname)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texstore.c,v 1.41 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: texstore.c,v 1.42 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -29,12 +29,38 @@
|
|||
* Brian Paul
|
||||
*/
|
||||
|
||||
/*
|
||||
* The GL texture image functions in teximage.c basically just do
|
||||
* error checking and data structure allocation. They in turn call
|
||||
* device driver functions which actually copy/convert/store the user's
|
||||
* texture image data.
|
||||
*
|
||||
* However, most device drivers will be able to use the fallback functions
|
||||
* in this file. That is, most drivers will have the following bit of
|
||||
* code:
|
||||
* ctx->Driver.TexImage1D = _mesa_store_teximage1d;
|
||||
* ctx->Driver.TexImage2D = _mesa_store_teximage2d;
|
||||
* ctx->Driver.TexImage3D = _mesa_store_teximage3d;
|
||||
* etc...
|
||||
*
|
||||
* Texture image processing is actually kind of complicated. We have to do:
|
||||
* Format/type conversions
|
||||
* pixel unpacking
|
||||
* pixel transfer (scale, bais, lookup, convolution!, etc)
|
||||
*
|
||||
* These functions can handle most everything, including processing full
|
||||
* images and sub-images.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "colormac.h"
|
||||
#include "context.h"
|
||||
#include "convolve.h"
|
||||
#include "image.h"
|
||||
#include "macros.h"
|
||||
#include "mem.h"
|
||||
#include "texcompress.h"
|
||||
#include "texformat.h"
|
||||
#include "teximage.h"
|
||||
#include "texstore.h"
|
||||
|
|
@ -46,9 +72,6 @@
|
|||
* corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE,
|
||||
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the
|
||||
* number of components for the format. Return -1 if invalid enum.
|
||||
*
|
||||
* GH: Do we really need this? We have the number of bytes per texel
|
||||
* in the texture format structures, so why don't we just use that?
|
||||
*/
|
||||
static GLint
|
||||
components_in_intformat( GLint format )
|
||||
|
|
@ -129,7 +152,8 @@ components_in_intformat( GLint format )
|
|||
* We also take care of all image transfer operations here, including
|
||||
* convolution, scale/bias, colortables, etc.
|
||||
*
|
||||
* The destination texel channel type is always GLchan.
|
||||
* The destination texel type is always GLchan.
|
||||
* The destination texel format is one of the 6 basic types.
|
||||
*
|
||||
* A hardware driver may use this as a helper routine to unpack and
|
||||
* apply pixel transfer ops into a temporary image buffer. Then,
|
||||
|
|
@ -137,8 +161,8 @@ components_in_intformat( GLint format )
|
|||
*
|
||||
* Input:
|
||||
* dimensions - 1, 2, or 3
|
||||
* texFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA,
|
||||
* GL_RGB or GL_RGBA
|
||||
* texDestFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA,
|
||||
* GL_RGB or GL_RGBA (the destination format)
|
||||
* texDestAddr - destination image address
|
||||
* srcWidth, srcHeight, srcDepth - size (in pixels) of src and dest images
|
||||
* dstXoffset, dstYoffset, dstZoffset - position to store the image within
|
||||
|
|
@ -164,6 +188,12 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
|
|||
|
||||
ASSERT(ctx);
|
||||
ASSERT(dimensions >= 1 && dimensions <= 3);
|
||||
ASSERT(texDestFormat == GL_LUMINANCE ||
|
||||
texDestFormat == GL_INTENSITY ||
|
||||
texDestFormat == GL_LUMINANCE_ALPHA ||
|
||||
texDestFormat == GL_ALPHA ||
|
||||
texDestFormat == GL_RGB ||
|
||||
texDestFormat == GL_RGBA);
|
||||
ASSERT(texDestAddr);
|
||||
ASSERT(srcWidth >= 1);
|
||||
ASSERT(srcHeight >= 1);
|
||||
|
|
@ -445,6 +475,12 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
|
|||
GLint postConvWidth = srcWidth, postConvHeight = srcHeight;
|
||||
|
||||
assert(baseInternalFormat > 0);
|
||||
ASSERT(baseInternalFormat == GL_LUMINANCE ||
|
||||
baseInternalFormat == GL_INTENSITY ||
|
||||
baseInternalFormat == GL_LUMINANCE_ALPHA ||
|
||||
baseInternalFormat == GL_ALPHA ||
|
||||
baseInternalFormat == GL_RGB ||
|
||||
baseInternalFormat == GL_RGBA);
|
||||
|
||||
if (transferOps & IMAGE_CONVOLUTION_BIT) {
|
||||
_mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth,
|
||||
|
|
@ -627,12 +663,83 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a user's uncompressed texture image, this function takes care of
|
||||
* pixel unpacking, pixel transfer, format conversion and compression.
|
||||
*/
|
||||
static void
|
||||
transfer_compressed_teximage(GLcontext *ctx, GLuint dimensions,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum srcFormat, GLenum srcType,
|
||||
const struct gl_pixelstore_attrib *unpacking,
|
||||
const GLvoid *source,
|
||||
GLenum dstFormat, GLubyte *dest,
|
||||
GLint dstRowStride)
|
||||
{
|
||||
GLchan *tempImage = NULL;
|
||||
GLint srcRowStride;
|
||||
GLenum baseFormat;
|
||||
|
||||
ASSERT(dimensions == 2);
|
||||
|
||||
baseFormat = _mesa_base_tex_format(ctx, dstFormat);
|
||||
|
||||
if (srcFormat != baseFormat || srcType != CHAN_TYPE ||
|
||||
ctx->_ImageTransferState != 0 || unpacking->SwapBytes) {
|
||||
/* need to convert user's image to texImage->Format, GLchan */
|
||||
GLint comps = components_in_intformat(baseFormat);
|
||||
GLint postConvWidth = width, postConvHeight = height;
|
||||
|
||||
/* XXX convolution untested */
|
||||
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
|
||||
_mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth,
|
||||
&postConvHeight);
|
||||
}
|
||||
|
||||
tempImage = (GLchan*) MALLOC(width * height * comps * sizeof(GLchan));
|
||||
if (!tempImage) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
return;
|
||||
}
|
||||
transfer_teximage(ctx, dimensions,
|
||||
baseFormat, /* dest format */
|
||||
tempImage, /* dst address */
|
||||
width, height, depth, /* src size */
|
||||
0, 0, 0, /* x/y/zoffset */
|
||||
comps * width, /* dst row stride */
|
||||
comps * width * height, /* dst image stride */
|
||||
srcFormat, srcType, /* src format, type */
|
||||
source, unpacking, /* src and src packing */
|
||||
ctx->_ImageTransferState);
|
||||
source = tempImage;
|
||||
width = postConvWidth;
|
||||
height = postConvHeight;
|
||||
srcRowStride = width;
|
||||
}
|
||||
else {
|
||||
if (unpacking->RowLength)
|
||||
srcRowStride = unpacking->RowLength;
|
||||
else
|
||||
srcRowStride = width;
|
||||
}
|
||||
|
||||
_mesa_compress_teximage(ctx, width, height, baseFormat,
|
||||
(const GLchan *) source, srcRowStride,
|
||||
dstFormat, dest, dstRowStride);
|
||||
if (tempImage) {
|
||||
FREE(tempImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexImage1D().
|
||||
* This is the software fallback for Driver.TexImage1D()
|
||||
* and Driver.CopyTexImage2D().
|
||||
* The texture image type will be GLchan.
|
||||
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY,
|
||||
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA.
|
||||
*
|
||||
*/
|
||||
void
|
||||
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
|
||||
|
|
@ -659,52 +766,55 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
texelBytes = texImage->TexFormat->TexelBytes;
|
||||
|
||||
/* Compute image size, in bytes */
|
||||
if (texImage->IsCompressed) {
|
||||
assert(ctx->Driver.CompressedTextureSize);
|
||||
sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage);
|
||||
assert(sizeInBytes > 0);
|
||||
texImage->CompressedSize = sizeInBytes;
|
||||
}
|
||||
else {
|
||||
sizeInBytes = postConvWidth * texelBytes;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
if (texImage->IsCompressed)
|
||||
sizeInBytes = texImage->CompressedSize;
|
||||
else
|
||||
sizeInBytes = postConvWidth * texelBytes;
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixels) {
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (!pixels)
|
||||
return;
|
||||
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
width);
|
||||
transfer_compressed_teximage(ctx, 1, width, 1, 1,
|
||||
format, type, packing,
|
||||
pixels, texImage->IntFormat,
|
||||
(GLubyte *) texImage->Data, dstRowStride);
|
||||
}
|
||||
else {
|
||||
_mesa_transfer_teximage(ctx, 1,
|
||||
_mesa_base_tex_format(ctx, internalFormat),
|
||||
texImage->Format, /* base format */
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, 1, 1, 0, 0, 0,
|
||||
width, 1, 1, /* src size */
|
||||
0, 0, 0, /* dstX/Y/Zoffset */
|
||||
0, /* dstRowStride */
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexImage2D().
|
||||
* This is the software fallback for Driver.TexImage2D()
|
||||
* and Driver.CopyTexImage2D().
|
||||
* The texture image type will be GLchan.
|
||||
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY,
|
||||
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA.
|
||||
*
|
||||
* NOTE: if real texture compression is supported, this whole function
|
||||
* will need to be overridden.
|
||||
*/
|
||||
void
|
||||
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
|
||||
|
|
@ -732,51 +842,56 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
texelBytes = texImage->TexFormat->TexelBytes;
|
||||
|
||||
/* Compute image size, in bytes */
|
||||
if (texImage->IsCompressed) {
|
||||
assert(ctx->Driver.CompressedTextureSize);
|
||||
sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage);
|
||||
assert(sizeInBytes > 0);
|
||||
texImage->CompressedSize = sizeInBytes;
|
||||
}
|
||||
else {
|
||||
sizeInBytes = postConvWidth * postConvHeight * texelBytes;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
if (texImage->IsCompressed)
|
||||
sizeInBytes = texImage->CompressedSize;
|
||||
else
|
||||
sizeInBytes = postConvWidth * postConvHeight * texelBytes;
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixels) {
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (!pixels)
|
||||
return;
|
||||
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
width);
|
||||
transfer_compressed_teximage(ctx, 2, width, height, 1,
|
||||
format, type, packing,
|
||||
pixels, texImage->IntFormat,
|
||||
(GLubyte *) texImage->Data, dstRowStride);
|
||||
}
|
||||
else {
|
||||
_mesa_transfer_teximage(ctx, 2,
|
||||
_mesa_base_tex_format(ctx, internalFormat),
|
||||
texImage->Format,
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, height, 1, 0, 0, 0,
|
||||
texImage->Width * texelBytes,
|
||||
width, height, 1, /* src size */
|
||||
0, 0, 0, /* dstX/Y/Zoffset */
|
||||
texImage->Width * texelBytes, /* dstRowStride */
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexImage3D().
|
||||
* This is the software fallback for Driver.TexImage3D()
|
||||
* and Driver.CopyTexImage3D().
|
||||
* The texture image type will be GLchan.
|
||||
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY,
|
||||
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA.
|
||||
*
|
||||
*/
|
||||
void
|
||||
_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
|
||||
|
|
@ -798,65 +913,39 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
texelBytes = texImage->TexFormat->TexelBytes;
|
||||
|
||||
/* Compute image size, in bytes */
|
||||
if (texImage->IsCompressed) {
|
||||
assert(ctx->Driver.CompressedTextureSize);
|
||||
sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage);
|
||||
assert(sizeInBytes > 0);
|
||||
texImage->CompressedSize = sizeInBytes;
|
||||
}
|
||||
else {
|
||||
sizeInBytes = width * height * depth * texelBytes;
|
||||
}
|
||||
|
||||
/* allocate memory */
|
||||
if (texImage->IsCompressed)
|
||||
sizeInBytes = texImage->CompressedSize;
|
||||
else
|
||||
sizeInBytes = width * height * depth * texelBytes;
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixels) {
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (!pixels)
|
||||
return;
|
||||
|
||||
/* unpack image, apply transfer ops and store in texImage->Data */
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
width);
|
||||
transfer_compressed_teximage(ctx, 3, width, height, depth,
|
||||
format, type, packing,
|
||||
pixels, texImage->IntFormat,
|
||||
(GLubyte *) texImage->Data, dstRowStride);
|
||||
}
|
||||
else {
|
||||
_mesa_transfer_teximage(ctx, 3,
|
||||
_mesa_base_tex_format(ctx, internalFormat),
|
||||
texImage->Format,
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, height, depth, 0, 0, 0,
|
||||
texImage->Width * texelBytes,
|
||||
width, height, depth, /* src size */
|
||||
0, 0, 0, /* dstX/Y/Zoffset */
|
||||
texImage->Width * texelBytes, /* dstRowStride */
|
||||
texImage->Width * texImage->Height * texelBytes,
|
||||
format, type, pixels, packing);
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexSubImage1D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint width,
|
||||
GLenum format, GLenum type, const void *pixels,
|
||||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
_mesa_transfer_teximage(ctx, 1,
|
||||
_mesa_base_tex_format(ctx, texImage->IntFormat),
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, 1, 1, /* src size */
|
||||
xoffset, 0, 0, /* dest offsets */
|
||||
0, /* dstRowStride */
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
|
|
@ -867,8 +956,59 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexSubImage2D().
|
||||
* This is the software fallback for Driver.TexSubImage1D()
|
||||
* and Driver.CopyTexSubImage1D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint width,
|
||||
GLenum format, GLenum type, const void *pixels,
|
||||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
texImage->Width);
|
||||
GLubyte *dest = _mesa_compressed_image_address(xoffset, 0, 0,
|
||||
texImage->IntFormat,
|
||||
texImage->Width,
|
||||
texImage->Data);
|
||||
transfer_compressed_teximage(ctx, 1, /* dimensions */
|
||||
width, 1, 1, /* size to replace */
|
||||
format, type, /* source format/type */
|
||||
packing, /* source packing */
|
||||
pixels, /* source data */
|
||||
texImage->IntFormat,/* dest format */
|
||||
dest, dstRowStride);
|
||||
}
|
||||
else {
|
||||
_mesa_transfer_teximage(ctx, 1,
|
||||
texImage->Format,
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, 1, 1, /* src size */
|
||||
xoffset, 0, 0, /* dest offsets */
|
||||
0, /* dstRowStride */
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
&ctx->Texture.Unit[ctx->Texture.CurrentUnit],
|
||||
texObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexSubImage2D()
|
||||
* and Driver.CopyTexSubImage2D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
|
||||
|
|
@ -879,14 +1019,31 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
_mesa_transfer_teximage(ctx, 2,
|
||||
_mesa_base_tex_format(ctx, texImage->IntFormat),
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, height, 1, /* src size */
|
||||
xoffset, yoffset, 0, /* dest offsets */
|
||||
texImage->Width * texImage->TexFormat->TexelBytes,
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
texImage->Width);
|
||||
GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
|
||||
texImage->IntFormat,
|
||||
texImage->Width,
|
||||
texImage->Data);
|
||||
transfer_compressed_teximage(ctx, 2, /* dimensions */
|
||||
width, height, 1, /* size to replace */
|
||||
format, type, /* source format/type */
|
||||
packing, /* source packing */
|
||||
pixels, /* source data */
|
||||
texImage->IntFormat,/* dest format */
|
||||
dest, dstRowStride);
|
||||
}
|
||||
else {
|
||||
_mesa_transfer_teximage(ctx, 2,
|
||||
texImage->Format,
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, height, 1, /* src size */
|
||||
xoffset, yoffset, 0, /* dest offsets */
|
||||
texImage->Width *texImage->TexFormat->TexelBytes,
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
|
|
@ -899,6 +1056,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
/*
|
||||
* This is the software fallback for Driver.TexSubImage3D().
|
||||
* and Driver.CopyTexSubImage3D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
|
||||
|
|
@ -909,15 +1067,33 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
const GLint texelBytes = texImage->TexFormat->TexelBytes;
|
||||
_mesa_transfer_teximage(ctx, 3,
|
||||
_mesa_base_tex_format(ctx, texImage->IntFormat),
|
||||
if (texImage->IsCompressed) {
|
||||
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
texImage->Width);
|
||||
GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, zoffset,
|
||||
texImage->IntFormat,
|
||||
texImage->Width,
|
||||
texImage->Data);
|
||||
transfer_compressed_teximage(ctx, 3, /* dimensions */
|
||||
width, height, depth,/* size to replace */
|
||||
format, type, /* source format/type */
|
||||
packing, /* source packing */
|
||||
pixels, /* source data */
|
||||
texImage->IntFormat,/* dest format */
|
||||
dest, dstRowStride);
|
||||
}
|
||||
else {
|
||||
const GLint texelBytes = texImage->TexFormat->TexelBytes;
|
||||
_mesa_transfer_teximage(ctx, 3,
|
||||
texImage->Format,
|
||||
texImage->TexFormat, texImage->Data,
|
||||
width, height, depth, /* src size */
|
||||
xoffset, yoffset, xoffset, /* dest offsets */
|
||||
texImage->Width * texelBytes,
|
||||
texImage->Width * texelBytes, /* dst row stride */
|
||||
texImage->Width * texImage->Height * texelBytes,
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
_mesa_generate_mipmap(ctx, target,
|
||||
|
|
@ -940,9 +1116,7 @@ _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
/* Nothing here.
|
||||
* The device driver has to do it all.
|
||||
*/
|
||||
/* this space intentionally left blank */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -958,9 +1132,33 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
/* Nothing here.
|
||||
* The device driver has to do it all.
|
||||
/* This is pretty simple, basically just do a memcpy without worrying
|
||||
* about the usual image unpacking or image transfer operations.
|
||||
*/
|
||||
ASSERT(texObj);
|
||||
ASSERT(texImage);
|
||||
ASSERT(texImage->Width > 0);
|
||||
ASSERT(texImage->Height > 0);
|
||||
ASSERT(texImage->Depth == 1);
|
||||
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */
|
||||
|
||||
/* choose the texture format */
|
||||
assert(ctx->Driver.ChooseTextureFormat);
|
||||
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
|
||||
internalFormat, 0, 0);
|
||||
assert(texImage->TexFormat);
|
||||
texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
|
||||
|
||||
/* allocate storage */
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(imageSize);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy the data */
|
||||
ASSERT(texImage->CompressedSize == imageSize);
|
||||
MEMCPY(texImage->Data, data, imageSize);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -977,31 +1175,90 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
/* Nothing here.
|
||||
* The device driver has to do it all.
|
||||
*/
|
||||
/* this space intentionally left blank */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Fallback for Driver.GetCompressedTexImage3D()
|
||||
* This will probably work find for hardware drivers. That is, hardware
|
||||
* drivers won't have to override this function, unless the compressed
|
||||
* texture must first be fetched from the TRAM.
|
||||
/**
|
||||
* Fallback for Driver.CompressedTexSubImage1D()
|
||||
*/
|
||||
void
|
||||
_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target,
|
||||
GLint level, void *image,
|
||||
const struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLsizei width,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
assert(texImage->IsCompressed);
|
||||
assert(texImage->CompressedSize > 0);
|
||||
MEMCPY(image, texImage->Data, texImage->CompressedSize);
|
||||
/* this space intentionally left blank */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for Driver.CompressedTexSubImage2D()
|
||||
*/
|
||||
void
|
||||
_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
GLint bytesPerRow, destRowStride, srcRowStride;
|
||||
GLint i, rows;
|
||||
GLubyte *dest;
|
||||
const GLubyte *src;
|
||||
|
||||
/* these should have been caught sooner */
|
||||
ASSERT((width & 3) == 0 || width == 2 || width == 1);
|
||||
ASSERT((height & 3) == 0 || height == 2 || height == 1);
|
||||
ASSERT((xoffset & 3) == 0);
|
||||
ASSERT((yoffset & 3) == 0);
|
||||
|
||||
srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width);
|
||||
src = (const GLubyte *) data;
|
||||
|
||||
destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
|
||||
texImage->Width);
|
||||
dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
|
||||
texImage->IntFormat,
|
||||
texImage->Width, texImage->Data);
|
||||
|
||||
bytesPerRow = srcRowStride;
|
||||
rows = height / 4;
|
||||
|
||||
for (i = 0; i < rows; i++) {
|
||||
MEMCPY(dest, src, bytesPerRow);
|
||||
dest += destRowStride;
|
||||
src += srcRowStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for Driver.CompressedTexSubImage3D()
|
||||
*/
|
||||
void
|
||||
_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
/* this space intentionally left blank */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the fallback for Driver.TestProxyTexImage().
|
||||
|
|
@ -1633,6 +1890,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
const struct gl_texture_unit *texUnit,
|
||||
struct gl_texture_object *texObj)
|
||||
{
|
||||
const GLubyte *srcData;
|
||||
GLubyte *dstData;
|
||||
GLint level;
|
||||
GLint maxLevels = 0;
|
||||
|
||||
|
|
@ -1661,6 +1920,29 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
return;
|
||||
}
|
||||
|
||||
/* setup for compressed textures */
|
||||
{
|
||||
const struct gl_texture_image *srcImage;
|
||||
srcImage = texObj->Image[texObj->BaseLevel];
|
||||
if (srcImage->IsCompressed) {
|
||||
/* allocate storage for uncompressed images */
|
||||
GLint size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE)
|
||||
* srcImage->Width * srcImage->Height * srcImage->Depth;
|
||||
srcData = MALLOC(size);
|
||||
if (!srcData) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
|
||||
return;
|
||||
}
|
||||
dstData = MALLOC(size / 2); /* 1/4 would probably be OK */
|
||||
if (!dstData) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
|
||||
FREE((void *) srcData);
|
||||
return;
|
||||
}
|
||||
/* XXX decompress base image here */
|
||||
}
|
||||
}
|
||||
|
||||
for (level = texObj->BaseLevel; level < texObj->MaxLevel
|
||||
&& level < maxLevels - 1; level++) {
|
||||
/* generate image[level+1] from image[level] */
|
||||
|
|
@ -1670,13 +1952,13 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
GLint dstWidth, dstHeight, dstDepth;
|
||||
GLint border, bytesPerTexel;
|
||||
|
||||
/* get src image parameters */
|
||||
srcImage = texObj->Image[level];
|
||||
ASSERT(srcImage);
|
||||
srcWidth = srcImage->Width;
|
||||
srcHeight = srcImage->Height;
|
||||
srcDepth = srcImage->Depth;
|
||||
border = srcImage->Border;
|
||||
bytesPerTexel = srcImage->TexFormat->TexelBytes;
|
||||
|
||||
/* compute next (level+1) image size */
|
||||
if (srcWidth - 2 * border > 1) {
|
||||
|
|
@ -1702,6 +1984,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
dstHeight == srcHeight &&
|
||||
dstDepth == srcDepth) {
|
||||
/* all done */
|
||||
if (srcImage->IsCompressed) {
|
||||
FREE((void *) srcData);
|
||||
FREE(dstData);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1722,56 +2008,82 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
|
||||
/* initialize new image */
|
||||
_mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
|
||||
dstDepth, border, srcImage->Format);
|
||||
dstDepth, border, srcImage->IntFormat);
|
||||
dstImage->DriverData = NULL;
|
||||
dstImage->TexFormat = srcImage->TexFormat;
|
||||
dstImage->FetchTexel = srcImage->FetchTexel;
|
||||
ASSERT(dstImage->TexFormat);
|
||||
ASSERT(dstImage->FetchTexel);
|
||||
|
||||
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
|
||||
|
||||
/* alloc new image buffer */
|
||||
dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
|
||||
* bytesPerTexel);
|
||||
if (!dstImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
|
||||
return;
|
||||
/* Alloc new teximage data buffer.
|
||||
* Setup src and dest data pointers.
|
||||
*/
|
||||
if (dstImage->IsCompressed) {
|
||||
ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/
|
||||
dstImage->Data = MESA_PBUFFER_ALLOC(dstImage->CompressedSize);
|
||||
if (!dstImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
|
||||
return;
|
||||
}
|
||||
/* srcData and dstData are all set */
|
||||
ASSERT(srcData);
|
||||
ASSERT(dstData);
|
||||
}
|
||||
else {
|
||||
bytesPerTexel = srcImage->TexFormat->TexelBytes;
|
||||
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
|
||||
dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
|
||||
* bytesPerTexel);
|
||||
if (!dstImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
|
||||
return;
|
||||
}
|
||||
srcData = (const GLubyte *) srcImage->Data;
|
||||
dstData = (GLubyte *) dstImage->Data;
|
||||
}
|
||||
|
||||
/*
|
||||
* We use simple 2x2 averaging to compute the next mipmap level.
|
||||
*/
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
make_1d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, (const GLubyte *) srcImage->Data,
|
||||
dstWidth, (GLubyte *) dstImage->Data);
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
|
||||
make_2d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, srcHeight, (const GLubyte *) srcImage->Data,
|
||||
dstWidth, dstHeight, (GLubyte *) dstImage->Data);
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
make_3d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, srcHeight, srcDepth,
|
||||
(const GLubyte *) srcImage->Data,
|
||||
dstWidth, dstHeight, dstDepth,
|
||||
(GLubyte *) dstImage->Data);
|
||||
break;
|
||||
case GL_TEXTURE_RECTANGLE_NV:
|
||||
/* no mipmaps, do nothing */
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
|
||||
return;
|
||||
case GL_TEXTURE_1D:
|
||||
make_1d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, srcData,
|
||||
dstWidth, dstData);
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
|
||||
make_2d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, srcHeight, srcData,
|
||||
dstWidth, dstHeight, dstData);
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
make_3d_mipmap(srcImage->TexFormat, border,
|
||||
srcWidth, srcHeight, srcDepth, srcData,
|
||||
dstWidth, dstHeight, dstDepth, dstData);
|
||||
break;
|
||||
case GL_TEXTURE_RECTANGLE_NV:
|
||||
/* no mipmaps, do nothing */
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dstImage->IsCompressed) {
|
||||
GLubyte *temp;
|
||||
/* XXX compress from dstData into dstImage->Data */
|
||||
|
||||
/* swap src and dest pointers */
|
||||
temp = (GLubyte *) srcData;
|
||||
srcData = dstData;
|
||||
dstData = temp;
|
||||
}
|
||||
|
||||
} /* loop over mipmap levels */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texstore.h,v 1.10 2002/09/16 17:57:14 brianp Exp $ */
|
||||
/* $Id: texstore.h,v 1.11 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -136,10 +136,33 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
|
||||
extern void
|
||||
_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target,
|
||||
GLint level, void *image,
|
||||
const struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLsizei width,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
|
||||
extern void
|
||||
_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
|
||||
extern void
|
||||
_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
|
||||
|
||||
extern GLboolean
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* $Id: texutil.c,v 1.31 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: texutil.c,v 1.32 2002/09/27 02:45:38 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0.3
|
||||
* Version: 4.1
|
||||
*
|
||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_texstore.c,v 1.7 2002/09/16 17:57:14 brianp Exp $ */
|
||||
/* $Id: s_texstore.c,v 1.8 2002/09/27 02:45:39 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -144,8 +144,8 @@ is_depth_format(GLenum format)
|
|||
*/
|
||||
void
|
||||
_swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLint border )
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLint border )
|
||||
{
|
||||
struct gl_texture_unit *texUnit;
|
||||
struct gl_texture_object *texObj;
|
||||
|
|
@ -202,9 +202,9 @@ _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level,
|
|||
*/
|
||||
void
|
||||
_swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border )
|
||||
GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border )
|
||||
{
|
||||
struct gl_texture_unit *texUnit;
|
||||
struct gl_texture_object *texObj;
|
||||
|
|
@ -260,8 +260,8 @@ _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level,
|
|||
* Fallback for Driver.CopyTexSubImage1D().
|
||||
*/
|
||||
void
|
||||
_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint x, GLint y, GLsizei width)
|
||||
_swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint x, GLint y, GLsizei width )
|
||||
{
|
||||
struct gl_texture_unit *texUnit;
|
||||
struct gl_texture_object *texObj;
|
||||
|
|
@ -275,38 +275,7 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
|
||||
ASSERT(ctx->Driver.TexImage1D);
|
||||
|
||||
if (texImage->Format != GL_DEPTH_COMPONENT) {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, 1);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX this is a bit of a hack. We need to be sure that the alpha
|
||||
* channel is 1.0 if the internal texture format is not supposed to
|
||||
* have an alpha channel. This is because some drivers may store
|
||||
* RGB textures as RGBA and the texutil.c code isn't smart enough
|
||||
* to set the alpha channel to 1.0 in this situation.
|
||||
*/
|
||||
if (texImage->Format == GL_LUMINANCE ||
|
||||
texImage->Format == GL_RGB) {
|
||||
const GLuint n = width * 4;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i += 4) {
|
||||
image[i + 3] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* now call glTexSubImage1D to do the real work */
|
||||
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
if (texImage->Format == GL_DEPTH_COMPONENT) {
|
||||
/* read depth image from framebuffer */
|
||||
GLfloat *image = read_depth_image(ctx, x, y, width, 1);
|
||||
if (!image) {
|
||||
|
|
@ -320,6 +289,20 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, 1);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* now call glTexSubImage1D to do the real work */
|
||||
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
|
|
@ -333,9 +316,9 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||
*/
|
||||
void
|
||||
_swrast_copy_texsubimage2d( GLcontext *ctx,
|
||||
GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
{
|
||||
struct gl_texture_unit *texUnit;
|
||||
struct gl_texture_object *texObj;
|
||||
|
|
@ -349,39 +332,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
|
|||
|
||||
ASSERT(ctx->Driver.TexImage2D);
|
||||
|
||||
if (texImage->Format != GL_DEPTH_COMPONENT) {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX this is a bit of a hack. We need to be sure that the alpha
|
||||
* channel is 1.0 if the internal texture format is not supposed to
|
||||
* have an alpha channel. This is because some drivers may store
|
||||
* RGB textures as RGBA and the texutil.c code isn't smart enough
|
||||
* to set the alpha channel to 1.0 in this situation.
|
||||
*/
|
||||
if (texImage->Format == GL_LUMINANCE ||
|
||||
texImage->Format == GL_RGB) {
|
||||
const GLuint n = width * height * 4;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i += 4) {
|
||||
image[i + 3] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* now call glTexSubImage2D to do the real work */
|
||||
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
if (texImage->Format == GL_DEPTH_COMPONENT) {
|
||||
/* read depth image from framebuffer */
|
||||
GLfloat *image = read_depth_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
|
|
@ -396,6 +347,21 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
|
|||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* now call glTexSubImage2D to do the real work */
|
||||
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
|
|
@ -409,9 +375,9 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
|
|||
*/
|
||||
void
|
||||
_swrast_copy_texsubimage3d( GLcontext *ctx,
|
||||
GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
{
|
||||
struct gl_texture_unit *texUnit;
|
||||
struct gl_texture_object *texObj;
|
||||
|
|
@ -425,38 +391,7 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
|
|||
|
||||
ASSERT(ctx->Driver.TexImage3D);
|
||||
|
||||
if (texImage->Format != GL_DEPTH_COMPONENT) {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
* XXX this is a bit of a hack. We need to be sure that the alpha
|
||||
* channel is 1.0 if the internal texture format is not supposed to
|
||||
* have an alpha channel. This is because some drivers may store
|
||||
* RGB textures as RGBA and the texutil.c code isn't smart enough
|
||||
* to set the alpha channel to 1.0 in this situation.
|
||||
*/
|
||||
if (texImage->Format == GL_LUMINANCE ||
|
||||
texImage->Format == GL_RGB) {
|
||||
const GLuint n = width * height * 4;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i += 4) {
|
||||
image[i + 3] = CHAN_MAX;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* now call glTexSubImage3D to do the real work */
|
||||
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
|
||||
xoffset, yoffset, zoffset, width, height, 1,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
if (texImage->Format == GL_DEPTH_COMPONENT) {
|
||||
/* read depth image from framebuffer */
|
||||
GLfloat *image = read_depth_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
|
|
@ -471,6 +406,21 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
|
|||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
else {
|
||||
/* read RGBA image from framebuffer */
|
||||
GLchan *image = read_color_image(ctx, x, y, width, height);
|
||||
if (!image) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* now call glTexSubImage3D to do the real work */
|
||||
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
|
||||
xoffset, yoffset, zoffset, width, height, 1,
|
||||
GL_RGBA, CHAN_TYPE, image,
|
||||
&_mesa_native_packing, texObj, texImage);
|
||||
FREE(image);
|
||||
}
|
||||
|
||||
/* GL_SGIS_generate_mipmap */
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue