Overhaul of texture image handling.

1. gl_texture_image struct's Data pointer points to images in driver's format.
2. Added FetchTexel() function pointer to struct gl_texture_image.
3. Changed Driver Tex[Sub]Image functions, return void now.
4. Texture storage/fetch code in new texstore.c file.
5. Removed texture.[ch] - functions moved to state.c

Note: FX driver updates not finished yet.
This commit is contained in:
Brian Paul
2001-02-06 21:42:48 +00:00
parent 16461f7c53
commit 8e39ad2cd6
23 changed files with 2404 additions and 2591 deletions

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.42 2001/02/03 08:41:03 gareth Exp $ # $Id: Makefile.X11,v 1.43 2001/02/06 21:42:48 brianp Exp $
# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
@@ -103,7 +103,7 @@ CORE_SOURCES = \
teximage.c \ teximage.c \
texobj.c \ texobj.c \
texstate.c \ texstate.c \
texture.c \ texstore.c \
texutil.c \ texutil.c \
varray.c \ varray.c \
vtxfmt.c \ vtxfmt.c \

View File

@@ -1108,12 +1108,11 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.TexImage2D = fxDDTexImage2D; ctx->Driver.TexImage2D = fxDDTexImage2D;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
ctx->Driver.GetTexImage = fxDDGetTexImage; ctx->Driver.TexEnv = fxDDTexEnv;
ctx->Driver.TexEnv=fxDDTexEnv; ctx->Driver.TexParameter = fxDDTexParam;
ctx->Driver.TexParameter=fxDDTexParam; ctx->Driver.BindTexture = fxDDTexBind;
ctx->Driver.BindTexture=fxDDTexBind; ctx->Driver.DeleteTexture = fxDDTexDel;
ctx->Driver.DeleteTexture=fxDDTexDel; ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
ctx->Driver.UpdateTexturePalette=fxDDTexPalette;
ctx->Driver.AlphaFunc=fxDDAlphaFunc; ctx->Driver.AlphaFunc=fxDDAlphaFunc;
ctx->Driver.BlendFunc=fxDDBlendFunc; ctx->Driver.BlendFunc=fxDDBlendFunc;

View File

@@ -836,31 +836,29 @@ static void PrintTexture(int w, int h, int c, const GLubyte *data)
} }
GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, void
GLenum format, GLenum type, const GLvoid *pixels, fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
const struct gl_pixelstore_attrib *packing, GLint internalFormat, GLint width, GLint height, GLint border,
struct gl_texture_object *texObj, GLenum format, GLenum type, const GLvoid *pixels,
struct gl_texture_image *texImage, const struct gl_pixelstore_attrib *packing,
GLboolean *retainInternalCopy) struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{ {
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
if (target != GL_TEXTURE_2D)
return GL_FALSE;
if (!texObj->DriverData) if (!texObj->DriverData)
texObj->DriverData = fxAllocTexObjData(fxMesa); texObj->DriverData = fxAllocTexObjData(fxMesa);
if (fxIsTexSupported(target, texImage->IntFormat, texImage)) { if (fxIsTexSupported(target, internalFormat, texImage)) {
GrTextureFormat_t gldformat; GrTextureFormat_t gldformat;
tfxTexInfo *ti = fxTMGetTexInfo(texObj); tfxTexInfo *ti = fxTMGetTexInfo(texObj);
tfxMipMapLevel *mml = &ti->mipmapLevel[level]; tfxMipMapLevel *mml = &ti->mipmapLevel[level];
GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride; GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride;
MesaIntTexFormat intFormat; MesaIntTexFormat intFormat;
fxTexGetFormat(texImage->IntFormat, &gldformat, NULL); fxTexGetFormat(internalFormat, &gldformat, NULL);
fxTexGetInfo(texImage->Width, texImage->Height, NULL,NULL,NULL,NULL, fxTexGetInfo(width, height, NULL,NULL,NULL,NULL,
NULL,NULL, &wScale, &hScale); NULL,NULL, &wScale, &hScale);
dstWidth = texImage->Width * wScale; dstWidth = texImage->Width * wScale;
@@ -942,7 +940,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
break; break;
default: default:
gl_problem(NULL, "tdfx driver: texbuildimagemap() bad format"); gl_problem(NULL, "tdfx driver: texbuildimagemap() bad format");
return GL_FALSE; return;
} }
_mesa_set_teximage_component_sizes(intFormat, texImage); _mesa_set_teximage_component_sizes(intFormat, texImage);
@@ -955,7 +953,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
FREE(mml->data); FREE(mml->data);
mml->data = MALLOC(dstWidth * dstHeight * texelSize); mml->data = MALLOC(dstWidth * dstHeight * texelSize);
if (!mml->data) if (!mml->data)
return GL_FALSE; return;
mml->glideFormat = gldformat; mml->glideFormat = gldformat;
mml->width = dstWidth; mml->width = dstWidth;
mml->height = dstHeight; mml->height = dstHeight;
@@ -967,9 +965,9 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
/* store the texture image */ /* store the texture image */
if (!_mesa_convert_teximage(intFormat, dstWidth, dstHeight, mml->data, if (!_mesa_convert_teximage(intFormat, dstWidth, dstHeight, mml->data,
dstStride, dstStride,
texImage->Width, texImage->Height, width, height,
format, type, pixels, packing)) { format, type, pixels, packing)) {
return GL_FALSE; return;
} }
@@ -981,24 +979,21 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
/*printf("invalidate2\n");*/ /*printf("invalidate2\n");*/
fxTexInvalidate(ctx,texObj); fxTexInvalidate(ctx,texObj);
} }
*retainInternalCopy = GL_FALSE;
return GL_TRUE;
} }
else { else {
gl_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n"); gl_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n");
return GL_FALSE;
} }
} }
GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, void
GLint xoffset, GLint yoffset, fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLsizei width, GLsizei height, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, const GLvoid *pixels, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *packing, GLenum format, GLenum type, const GLvoid *pixels,
struct gl_texture_object *texObj, const struct gl_pixelstore_attrib *packing,
struct gl_texture_image *texImage) struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{ {
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
tfxTexInfo *ti; tfxTexInfo *ti;
@@ -1006,11 +1001,10 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
tfxMipMapLevel *mml; tfxMipMapLevel *mml;
GLboolean result; GLboolean result;
if (target != GL_TEXTURE_2D) if (!texObj->DriverData) {
return GL_FALSE; gl_problem(ctx, "problem in fxDDTexSubImage2D");
return;
if (!texObj->DriverData) }
return GL_FALSE;
ti = fxTMGetTexInfo(texObj); ti = fxTMGetTexInfo(texObj);
mml = &ti->mipmapLevel[level]; mml = &ti->mipmapLevel[level];
@@ -1083,7 +1077,7 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
} }
if (!result) { if (!result) {
return GL_FALSE; return;
} }
if (ti->validated && ti->isInTM) if (ti->validated && ti->isInTM)
@@ -1091,11 +1085,10 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
else else
fxTexInvalidate(ctx, texObj); fxTexInvalidate(ctx, texObj);
return GL_TRUE;
} }
#if 000
GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level, GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj, const struct gl_texture_object *texObj,
GLenum *formatOut, GLenum *typeOut, GLenum *formatOut, GLenum *typeOut,
@@ -1174,6 +1167,8 @@ GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
return NULL; return NULL;
} }
} }
#endif
#else #else

View File

@@ -60,7 +60,6 @@
#include "macros.h" #include "macros.h"
#include "matrix.h" #include "matrix.h"
#include "mem.h" #include "mem.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "GL/fxmesa.h" #include "GL/fxmesa.h"
@@ -541,23 +540,20 @@ extern void fxUpdateDDSpanPointers(GLcontext *);
extern void fxSetupDDSpanPointers(GLcontext *); extern void fxSetupDDSpanPointers(GLcontext *);
extern void fxPrintTextureData(tfxTexInfo *ti); extern void fxPrintTextureData(tfxTexInfo *ti);
extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, extern void fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
GLenum format, GLenum type, const GLvoid *pixels, GLint internalFormat, GLint width, GLint height, GLint border,
const struct gl_pixelstore_attrib *packing, GLenum format, GLenum type, const GLvoid *pixels,
struct gl_texture_object *texObj, const struct gl_pixelstore_attrib *packing,
struct gl_texture_image *texImage, struct gl_texture_object *texObj,
GLboolean *retainInternalCopy); struct gl_texture_image *texImage);
extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
extern void fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels, GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing, const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage); struct gl_texture_image *texImage);
extern GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
GLenum *formatOut, GLenum *typeOut,
GLboolean *freeImageOut );
extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *); extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *, extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
GLenum, const GLfloat *); GLenum, const GLfloat *);

View File

@@ -1,4 +1,4 @@
/* $Id: osmesa.c,v 1.43 2001/01/29 20:56:32 keithw Exp $ */ /* $Id: osmesa.c,v 1.44 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -35,20 +35,19 @@
*/ */
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h" #include "glheader.h"
#include "GL/osmesa.h" #include "GL/osmesa.h"
#include "context.h" #include "context.h"
#include "colormac.h" #include "colormac.h"
#include "depth.h" #include "depth.h"
#include "extensions.h"
#include "macros.h" #include "macros.h"
#include "mem.h"
#include "matrix.h" #include "matrix.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "mtypes.h" #include "mtypes.h"
#include "extensions.h" #include "texstore.h"
#include "array_cache/acache.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h" #include "swrast_setup/swrast_setup.h"
#include "swrast/s_context.h" #include "swrast/s_context.h"
@@ -56,9 +55,6 @@
#include "swrast/s_lines.h" #include "swrast/s_lines.h"
#include "swrast/s_triangle.h" #include "swrast/s_triangle.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "array_cache/acache.h"
#endif
@@ -1784,6 +1780,14 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
ctx->Driver.GetBufferSize = buffer_size; ctx->Driver.GetBufferSize = buffer_size;
ctx->Driver.TexImage1D = _mesa_store_teximage1d;
ctx->Driver.TexImage2D = _mesa_store_teximage2d;
ctx->Driver.TexImage3D = _mesa_store_teximage3d;
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
ctx->Driver.PointsFunc = _swsetup_Points; ctx->Driver.PointsFunc = _swsetup_Points;
ctx->Driver.LineFunc = _swsetup_Line; ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle; ctx->Driver.TriangleFunc = _swsetup_Triangle;

View File

@@ -1,10 +1,10 @@
/* $Id: xm_dd.c,v 1.13 2001/01/29 20:56:32 keithw Exp $ */ /* $Id: xm_dd.c,v 1.14 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.5 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -27,18 +27,20 @@
#include "glxheader.h" #include "glxheader.h"
#include "context.h" #include "context.h"
#include "drawpix.h"
#include "mem.h"
#include "state.h"
#include "depth.h" #include "depth.h"
#include "macros.h" #include "drawpix.h"
#include "mtypes.h"
#include "xmesaP.h"
#include "extensions.h" #include "extensions.h"
#include "macros.h"
#include "mem.h"
#include "mtypes.h"
#include "state.h"
#include "texstore.h"
#include "xmesaP.h"
#include "array_cache/acache.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h" #include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "array_cache/acache.h"
/* /*
* Return the size (width,height of the current color buffer. * Return the size (width,height of the current color buffer.
@@ -955,7 +957,16 @@ void xmesa_init_pointers( GLcontext *ctx )
ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels; ctx->Driver.ReadPixels = _swrast_ReadPixels;
/* Software texture functions:
*/
ctx->Driver.TexImage1D = _mesa_store_teximage1d;
ctx->Driver.TexImage2D = _mesa_store_teximage2d;
ctx->Driver.TexImage3D = _mesa_store_teximage3d;
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
/* /*
*/ */
ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.SetDrawBuffer = set_draw_buffer;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.42 2001/02/03 08:41:03 gareth Exp $ # $Id: Makefile.X11,v 1.43 2001/02/06 21:42:48 brianp Exp $
# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
@@ -103,7 +103,7 @@ CORE_SOURCES = \
teximage.c \ teximage.c \
texobj.c \ texobj.c \
texstate.c \ texstate.c \
texture.c \ texstore.c \
texutil.c \ texutil.c \
varray.c \ varray.c \
vtxfmt.c \ vtxfmt.c \

View File

@@ -1,4 +1,4 @@
/* $Id: context.c,v 1.119 2001/01/24 04:56:19 brianp Exp $ */ /* $Id: context.c,v 1.120 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -51,7 +51,6 @@
#include "state.h" #include "state.h"
#include "teximage.h" #include "teximage.h"
#include "texobj.h" #include "texobj.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "varray.h" #include "varray.h"

View File

@@ -1,4 +1,4 @@
/* $Id: dd.h,v 1.50 2001/02/06 04:06:34 keithw Exp $ */ /* $Id: dd.h,v 1.51 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -447,24 +447,27 @@ struct dd_function_table {
/*** /***
*** Texture image functions: *** Texture image functions:
***/ ***/
GLboolean (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
GLenum format, GLenum type, const GLvoid *pixels, GLint internalFormat,
const struct gl_pixelstore_attrib *packing, GLint width, GLint border,
struct gl_texture_object *texObj, GLenum format, GLenum type, const GLvoid *pixels,
struct gl_texture_image *texImage, const struct gl_pixelstore_attrib *packing,
GLboolean *retainInternalCopy ); struct gl_texture_object *texObj,
GLboolean (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage );
GLenum format, GLenum type, const GLvoid *pixels, void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
const struct gl_pixelstore_attrib *packing, GLint internalFormat,
struct gl_texture_object *texObj, GLint width, GLint height, GLint border,
struct gl_texture_image *texImage, GLenum format, GLenum type, const GLvoid *pixels,
GLboolean *retainInternalCopy ); const struct gl_pixelstore_attrib *packing,
GLboolean (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj,
GLenum format, GLenum type, const GLvoid *pixels, struct gl_texture_image *texImage );
const struct gl_pixelstore_attrib *packing, void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj, GLint internalFormat,
struct gl_texture_image *texImage, GLint width, GLint height, GLint depth, GLint border,
GLboolean *retainInternalCopy ); GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/* Called by glTexImage1/2/3D. /* Called by glTexImage1/2/3D.
* Will not be called if any glPixelTransfer operations are enabled. * Will not be called if any glPixelTransfer operations are enabled.
* Arguments: * Arguments:
@@ -481,29 +484,29 @@ struct dd_function_table {
* GLubytes. It may be easier for the driver to handle then. * GLubytes. It may be easier for the driver to handle then.
*/ */
GLboolean (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width, GLint xoffset, GLsizei width,
GLenum format, GLenum type, GLenum format, GLenum type,
const GLvoid *pixels, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing, const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage ); struct gl_texture_image *texImage );
GLboolean (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLenum format, GLenum type,
const GLvoid *pixels, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing, const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage ); struct gl_texture_image *texImage );
GLboolean (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLint depth, GLsizei width, GLsizei height, GLint depth,
GLenum format, GLenum type, GLenum format, GLenum type,
const GLvoid *pixels, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing, const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage ); struct gl_texture_image *texImage );
/* Called by glTexSubImage1/2/3D. /* Called by glTexSubImage1/2/3D.
* Will not be called if any glPixelTransfer operations are enabled. * Will not be called if any glPixelTransfer operations are enabled.
* Arguments: * Arguments:
@@ -547,22 +550,6 @@ struct dd_function_table {
* should do the job. * should do the job.
*/ */
GLvoid *(*GetTexImage)( GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
GLenum *formatOut, GLenum *typeOut,
GLboolean *freeImageOut );
/* Called by glGetTexImage or by core Mesa when a texture image
* is needed for software fallback rendering.
* Return the address of the texture image or NULL if failure.
* The image must be tightly packed (i.e. row stride = image width)
* Return the image's format and type in formatOut and typeOut.
* The format and type must be values which are accepted by glTexImage.
* Set the freeImageOut flag if the returned image should be deallocated
* with FREE() when finished.
* The size of the image can be deduced from the target and level.
* Core Mesa will perform any image format/type conversions that are needed.
*/
GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
GLint level, GLint internalFormat, GLint level, GLint internalFormat,
GLenum format, GLenum type, GLenum format, GLenum type,
@@ -577,24 +564,25 @@ struct dd_function_table {
*** Compressed texture functions: *** Compressed texture functions:
***/ ***/
GLboolean (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
GLint level, GLsizei imageSize, GLint level, GLint internalFormat,
const GLvoid *data, GLsizei width, GLint border,
struct gl_texture_object *texObj, GLsizei imageSize, const GLvoid *data,
struct gl_texture_image *texImage, struct gl_texture_object *texObj,
GLboolean *retainInternalCopy); struct gl_texture_image *texImage );
GLboolean (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
GLint level, GLsizei imageSize, GLint level, GLint internalFormat,
const GLvoid *data, GLsizei width, GLsizei height, GLint border,
struct gl_texture_object *texObj, GLsizei imageSize, const GLvoid *data,
struct gl_texture_image *texImage, struct gl_texture_object *texObj,
GLboolean *retainInternalCopy); struct gl_texture_image *texImage );
GLboolean (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
GLint level, GLsizei imageSize, GLint level, GLint internalFormat,
const GLvoid *data, GLsizei width, GLsizei height, GLsizei depth,
struct gl_texture_object *texObj, GLint border,
struct gl_texture_image *texImage, GLsizei imageSize, const GLvoid *data,
GLboolean *retainInternalCopy); struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/* Called by glCompressedTexImage1/2/3D. /* Called by glCompressedTexImage1/2/3D.
* Arguments: * Arguments:
* <target>, <level>, <internalFormat>, <data> are user specified. * <target>, <level>, <internalFormat>, <data> are user specified.
@@ -607,27 +595,26 @@ struct dd_function_table {
* should do the job. * should do the job.
*/ */
GLboolean (*CompressedTexSubImage1D)( GLcontext *ctx, GLenum target, void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
GLint level, GLint xoffset, GLint xoffset, GLsizei width,
GLsizei width, GLenum format, GLenum format,
GLsizei imageSize, const GLvoid *data, GLsizei imageSize, const GLvoid *data,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage ); struct gl_texture_image *texImage);
GLboolean (*CompressedTexSubImage2D)( GLcontext *ctx, GLenum target, void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
GLint level, GLint xoffset, GLint xoffset, GLint yoffset,
GLint yoffset, GLsizei width, GLsizei width, GLint height,
GLint height, GLenum format, GLenum format,
GLsizei imageSize, const GLvoid *data, GLsizei imageSize, const GLvoid *data,
struct gl_texture_object *texObj, struct gl_texture_object *texObj,
struct gl_texture_image *texImage ); struct gl_texture_image *texImage);
GLboolean (*CompressedTexSubImage3D)( GLcontext *ctx, GLenum target, void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
GLint level, GLint xoffset, GLint xoffset, GLint yoffset, GLint zoffset,
GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth,
GLsizei width, GLint height, GLenum format,
GLint depth, GLenum format, GLsizei imageSize, const GLvoid *data,
GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj,
struct gl_texture_object *texObj, struct gl_texture_image *texImage);
struct gl_texture_image *texImage );
/* Called by glCompressedTexSubImage1/2/3D. /* Called by glCompressedTexSubImage1/2/3D.
* Arguments: * Arguments:
* <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>, * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>,
@@ -639,11 +626,30 @@ struct dd_function_table {
* should do the job. * should do the job.
*/ */
GLboolean (*IsCompressedFormat)(GLcontext *ctx, GLint internalFormat);
/* Called to tell if a format is a compressed format.
*/
void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
GLint lod, void *image,
const struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/* Called by glGetCompressedTexImageARB.
* <target>, <lod>, <image> are specified by user.
* <texObj> is the source texture object.
* <texImage> is the source texture image.
*/
GLint (*BaseCompressedTexFormat)(GLcontext *ctx, GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
GLint internalFormat); GLint internalFormat);
/* Called to compute the base format for a specific compressed /* Called to compute the base format for a specific compressed
* format. Return -1 if the internalFormat is not a specific * format. Return -1 if the internalFormat is not a specific
* compressed format that the driver recognizes. Note the * compressed format that the driver recognizes.
* Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
*/
#if 000
/* ... Note the
* return value differences between this function and * return value differences between this function and
* SpecificCompressedTexFormat below. * SpecificCompressedTexFormat below.
*/ */
@@ -668,10 +674,6 @@ struct dd_function_table {
* do the right thing with it. * do the right thing with it.
*/ */
GLboolean (*IsCompressedFormat)(GLcontext *ctx, GLint internalFormat);
/* Called to tell if a format is a compressed format.
*/
GLsizei (*CompressedImageSize)(GLcontext *ctx, GLsizei (*CompressedImageSize)(GLcontext *ctx,
GLenum internalFormat, GLenum internalFormat,
GLuint numDimensions, GLuint numDimensions,
@@ -681,16 +683,7 @@ struct dd_function_table {
/* Calculate the size of a compressed image, given the image's /* Calculate the size of a compressed image, given the image's
* format and dimensions. * format and dimensions.
*/ */
#endif
void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
GLint lod, void *image,
const struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/* Called by glGetCompressedTexImageARB.
* <target>, <lod>, <image> are specified by user.
* <texObj> is the source texture object.
* <texImage> is the source texture image.
*/
/*** /***
*** Texture object functions: *** Texture object functions:

View File

@@ -1,8 +1,8 @@
/* $Id: dlist.c,v 1.63 2001/01/24 04:56:20 brianp Exp $ */ /* $Id: dlist.c,v 1.64 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.3 * Version: 3.5
* *
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* *
@@ -1062,7 +1062,8 @@ static void save_ColorTable( GLenum target, GLenum internalFormat,
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
if (target == GL_PROXY_TEXTURE_1D || if (target == GL_PROXY_TEXTURE_1D ||
target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D ||
target == GL_PROXY_TEXTURE_3D) { target == GL_PROXY_TEXTURE_3D ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
/* execute immediately */ /* execute immediately */
(*ctx->Exec->ColorTable)( target, internalFormat, width, (*ctx->Exec->ColorTable)( target, internalFormat, width,
format, type, table ); format, type, table );

View File

@@ -1,4 +1,4 @@
/* $Id: mtypes.h,v 1.17 2001/01/29 20:47:39 keithw Exp $ */ /* $Id: mtypes.h,v 1.18 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -116,6 +116,7 @@ typedef int GLfixed;
* Some forward type declarations * Some forward type declarations
*/ */
struct _mesa_HashTable; struct _mesa_HashTable;
struct gl_texture_image;
struct gl_texture_object; struct gl_texture_object;
typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextRec GLcontext;
typedef struct __GLcontextModesRec GLvisual; typedef struct __GLcontextModesRec GLvisual;
@@ -764,12 +765,21 @@ struct gl_stencil_attrib {
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
typedef void (*FetchTexelFunc)( GLcontext *ctx,
const struct gl_texture_object *texObject,
const struct gl_texture_image *texImage,
GLint col, GLint row, GLint img,
GLchan texel[] );
/* Texture image record */ /* Texture image record */
struct gl_texture_image { struct gl_texture_image {
GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_RGB, GL_RGBA, or * GL_INTENSITY, GL_RGB, GL_RGBA, or
* GL_COLOR_INDEX only * GL_COLOR_INDEX only
*/ */
GLenum Type; /* Texel type: GL_UNSIGNED_BYTE, etc. */
GLenum IntFormat; /* Internal format as given by the user */ GLenum IntFormat; /* Internal format as given by the user */
GLubyte RedBits; /* Bits per texel component */ GLubyte RedBits; /* Bits per texel component */
GLubyte GreenBits; /* These are initialized by Mesa but */ GLubyte GreenBits; /* These are initialized by Mesa but */
@@ -789,7 +799,9 @@ struct gl_texture_image {
GLuint HeightLog2; /* = log2(Height2) */ GLuint HeightLog2; /* = log2(Height2) */
GLuint DepthLog2; /* = log2(Depth2) */ GLuint DepthLog2; /* = log2(Depth2) */
GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */
GLchan *Data; /* Image data as GLchan's */ GLvoid *Data; /* Image data, accessed via FetchTexel() */
FetchTexelFunc FetchTexel; /* texel fetch function pointer */
GLboolean IsCompressed; /* GL_ARB_texture_compression */ GLboolean IsCompressed; /* GL_ARB_texture_compression */
GLuint CompressedSize; /* GL_ARB_texture_compression */ GLuint CompressedSize; /* GL_ARB_texture_compression */

View File

@@ -1,4 +1,4 @@
/* $Id: state.c,v 1.55 2001/01/24 04:56:20 brianp Exp $ */ /* $Id: state.c,v 1.56 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -74,7 +74,6 @@
#include "teximage.h" #include "teximage.h"
#include "texobj.h" #include "texobj.h"
#include "texstate.h" #include "texstate.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "varray.h" #include "varray.h"
#include "winpos.h" #include "winpos.h"
@@ -697,6 +696,159 @@ update_image_transfer_state(GLcontext *ctx)
} }
/* Note: This routine refers to derived texture attribute values to
* compute the ENABLE_TEXMAT flags, but is only called on
* _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
* flags are updated by _mesa_update_textures(), below.
*
* If both TEXTURE and TEXTURE_MATRIX change at once, these values
* will be computed twice.
*/
static void
update_texture_matrices( GLcontext *ctx )
{
GLuint i;
ctx->_Enabled &= ~ENABLE_TEXMAT_ANY;
for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->TextureMatrix[i].flags & MAT_DIRTY) {
_math_matrix_analyse( &ctx->TextureMatrix[i] );
if (ctx->Driver.TextureMatrix)
ctx->Driver.TextureMatrix( ctx, i, &ctx->TextureMatrix[i] );
if (ctx->Texture.Unit[i]._ReallyEnabled &&
ctx->TextureMatrix[i].type != MATRIX_IDENTITY)
ctx->_Enabled |= ENABLE_TEXMAT0 << i;
}
}
}
/* Note: This routine refers to derived texture matrix values to
* compute the ENABLE_TEXMAT flags, but is only called on
* _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
* flags are updated by _mesa_update_texture_matrices, above.
*
* If both TEXTURE and TEXTURE_MATRIX change at once, these values
* will be computed twice.
*/
static void
update_texture_state( GLcontext *ctx )
{
GLuint i;
ctx->Texture._ReallyEnabled = 0;
ctx->Texture._GenFlags = 0;
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
ctx->_Enabled &= ~(ENABLE_TEXGEN_ANY |
ENABLE_TEXMAT_ANY);
/* Update texture unit state.
*/
for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
texUnit->_ReallyEnabled = 0;
texUnit->_GenFlags = 0;
if (!texUnit->Enabled)
continue;
/* Find the texture of highest dimensionality that is enabled
* and complete. We'll use it for texturing.
*/
if (texUnit->Enabled & TEXTURE0_CUBE) {
struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
texUnit->_ReallyEnabled = TEXTURE0_CUBE;
texUnit->_Current = texObj;
}
}
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_3D)) {
struct gl_texture_object *texObj = texUnit->Current3D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
texUnit->_ReallyEnabled = TEXTURE0_3D;
texUnit->_Current = texObj;
}
}
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) {
struct gl_texture_object *texObj = texUnit->Current2D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
texUnit->_ReallyEnabled = TEXTURE0_2D;
texUnit->_Current = texObj;
}
}
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_1D)) {
struct gl_texture_object *texObj = texUnit->Current1D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
texUnit->_ReallyEnabled = TEXTURE0_1D;
texUnit->_Current = texObj;
}
}
if (!texUnit->_ReallyEnabled) {
texUnit->_Current = NULL;
continue;
}
{
GLuint flag = texUnit->_ReallyEnabled << (i * 4);
ctx->Texture._ReallyEnabled |= flag;
}
if (texUnit->TexGenEnabled) {
if (texUnit->TexGenEnabled & S_BIT) {
texUnit->_GenFlags |= texUnit->_GenBitS;
}
if (texUnit->TexGenEnabled & T_BIT) {
texUnit->_GenFlags |= texUnit->_GenBitT;
}
if (texUnit->TexGenEnabled & Q_BIT) {
texUnit->_GenFlags |= texUnit->_GenBitQ;
}
if (texUnit->TexGenEnabled & R_BIT) {
texUnit->_GenFlags |= texUnit->_GenBitR;
}
ctx->_Enabled |= ENABLE_TEXGEN0 << i;
ctx->Texture._GenFlags |= texUnit->_GenFlags;
}
if (ctx->TextureMatrix[i].type != MATRIX_IDENTITY)
ctx->_Enabled |= ENABLE_TEXMAT0 << i;
}
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
ctx->_NeedNormals |= NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
}
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
}
}
/* /*
* If ctx->NewState is non-zero then this function MUST be called before * If ctx->NewState is non-zero then this function MUST be called before
* rendering any primitive. Basically, function pointers and miscellaneous * rendering any primitive. Basically, function pointers and miscellaneous
@@ -729,7 +881,7 @@ void gl_update_state( GLcontext *ctx )
update_projection( ctx ); update_projection( ctx );
if (new_state & _NEW_TEXTURE_MATRIX) if (new_state & _NEW_TEXTURE_MATRIX)
_mesa_update_texture_matrices( ctx ); update_texture_matrices( ctx );
if (new_state & _NEW_COLOR_MATRIX) if (new_state & _NEW_COLOR_MATRIX)
_math_matrix_analyse( &ctx->ColorMatrix ); _math_matrix_analyse( &ctx->ColorMatrix );
@@ -742,7 +894,7 @@ void gl_update_state( GLcontext *ctx )
/* Contributes to NeedEyeCoords, NeedNormals. /* Contributes to NeedEyeCoords, NeedNormals.
*/ */
if (new_state & _NEW_TEXTURE) if (new_state & _NEW_TEXTURE)
_mesa_update_texture_state( ctx ); update_texture_state( ctx );
if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR)) if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR))
update_drawbuffer( ctx ); update_drawbuffer( ctx );

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: teximage.h,v 1.15 2000/11/22 07:32:17 joukj Exp $ */ /* $Id: teximage.h,v 1.16 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -47,13 +47,6 @@ extern void
_mesa_free_texture_image( struct gl_texture_image *teximage ); _mesa_free_texture_image( struct gl_texture_image *teximage );
extern GLuint
_mesa_compressed_image_size(GLcontext *ctx,
GLenum internalFormat,
GLint numDimensions,
GLint width, GLint height, GLint depth);
extern struct gl_texture_object * extern struct gl_texture_object *
_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
GLenum target); GLenum target);
@@ -64,16 +57,6 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
GLenum target, GLint level); GLenum target, GLint level);
extern void
_mesa_get_teximage_from_driver(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj);
extern GLboolean
_mesa_get_teximages_from_driver(GLcontext *ctx,
struct gl_texture_object *texObj);
/*** API entry point functions ***/ /*** API entry point functions ***/

View File

@@ -1,4 +1,4 @@
/* $Id: texstate.c,v 1.29 2001/01/29 20:47:39 keithw Exp $ */ /* $Id: texstate.c,v 1.30 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -37,7 +37,6 @@
#include "texobj.h" #include "texobj.h"
#include "teximage.h" #include "teximage.h"
#include "texstate.h" #include "texstate.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "math/m_xform.h" #include "math/m_xform.h"
#include "math/m_matrix.h" #include "math/m_matrix.h"

View File

@@ -1,10 +1,10 @@
/* $Id: texstate.h,v 1.5 2000/11/22 07:32:17 joukj Exp $ */ /* $Id: texstate.h,v 1.6 2001/02/06 21:42:48 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1 * Version: 3.5
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -25,9 +25,6 @@
*/ */
#ifndef TEXSTATE_H #ifndef TEXSTATE_H
#define TEXSTATE_H #define TEXSTATE_H
@@ -114,8 +111,6 @@ _mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
extern void gl_SelectTextureTransform( GLcontext *ctx, GLenum target );
/* /*
* GL_ARB_multitexture * GL_ARB_multitexture

1068
src/mesa/main/texstore.c Normal file

File diff suppressed because it is too large Load Diff

143
src/mesa/main/texstore.h Normal file
View File

@@ -0,0 +1,143 @@
/* $Id: texstore.h,v 1.1 2001/02/06 21:42:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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.
*/
/*
* Authors:
* Brian Paul
*/
#ifndef TEXSTORE_H
#define TEXSTORE_H
#include "mtypes.h"
extern void
_mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
GLenum texFormat, GLchan *texAddr,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
GLint dstRowStride, GLint dstImageStride,
GLenum srcFormat, GLenum srcType,
const GLvoid *srcAddr,
const struct gl_pixelstore_attrib *srcPacking);
extern void
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern 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);
extern void
_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLsizei imageSize, const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
GLsizei imageSize, const GLvoid *data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern GLboolean
_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat, GLenum format, GLenum type,
GLint width, GLint height, GLint depth, GLint border);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: s_triangle.c,v 1.10 2001/01/29 18:51:25 brianp Exp $ */ /* $Id: s_triangle.c,v 1.11 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -243,14 +243,12 @@ static void simple_textured_triangle( GLcontext *ctx,
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \ GLfloat theight = (GLfloat) obj->Image[b]->Height; \
GLint twidth_log2 = obj->Image[b]->WidthLog2; \ GLint twidth_log2 = obj->Image[b]->WidthLog2; \
GLchan *texture = obj->Image[b]->Data; \ const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
GLint smask = obj->Image[b]->Width - 1; \ GLint smask = obj->Image[b]->Width - 1; \
GLint tmask = obj->Image[b]->Height - 1; \ GLint tmask = obj->Image[b]->Height - 1; \
if (!texture) { \ if (!texture) { \
if (!_mesa_get_teximages_from_driver(ctx, obj)) \ /* this shouldn't happen */ \
return; \ return; \
texture = obj->Image[b]->Data; \
ASSERT(texture); \
} }
#define INNER_LOOP( LEFT, RIGHT, Y ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
@@ -304,14 +302,12 @@ static void simple_z_textured_triangle( GLcontext *ctx,
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \ GLfloat theight = (GLfloat) obj->Image[b]->Height; \
GLint twidth_log2 = obj->Image[b]->WidthLog2; \ GLint twidth_log2 = obj->Image[b]->WidthLog2; \
GLchan *texture = obj->Image[b]->Data; \ const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
GLint smask = obj->Image[b]->Width - 1; \ GLint smask = obj->Image[b]->Width - 1; \
GLint tmask = obj->Image[b]->Height - 1; \ GLint tmask = obj->Image[b]->Height - 1; \
if (!texture) { \ if (!texture) { \
if (!_mesa_get_teximages_from_driver(ctx, obj)) \ /* this shouldn't happen */ \
return; \ return; \
texture = obj->Image[b]->Data; \
ASSERT(texture); \
} }
#define INNER_LOOP( LEFT, RIGHT, Y ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
@@ -376,7 +372,7 @@ static void affine_textured_triangle( GLcontext *ctx,
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \ GLfloat theight = (GLfloat) obj->Image[b]->Height; \
GLint twidth_log2 = obj->Image[b]->WidthLog2; \ GLint twidth_log2 = obj->Image[b]->WidthLog2; \
GLchan *texture = obj->Image[b]->Data; \ const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
GLint smask = obj->Image[b]->Width - 1; \ GLint smask = obj->Image[b]->Width - 1; \
GLint tmask = obj->Image[b]->Height - 1; \ GLint tmask = obj->Image[b]->Height - 1; \
GLint format = obj->Image[b]->Format; \ GLint format = obj->Image[b]->Format; \
@@ -386,10 +382,8 @@ static void affine_textured_triangle( GLcontext *ctx,
GLfixed er, eg, eb, ea; \ GLfixed er, eg, eb, ea; \
GLint tr, tg, tb, ta; \ GLint tr, tg, tb, ta; \
if (!texture) { \ if (!texture) { \
if (!_mesa_get_teximages_from_driver(ctx, obj)) \ /* this shouldn't happen */ \
return; \ return; \
texture = obj->Image[b]->Data; \
ASSERT(texture); \
} \ } \
if (envmode == GL_BLEND || envmode == GL_ADD) { \ if (envmode == GL_BLEND || envmode == GL_ADD) { \
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
@@ -499,7 +493,7 @@ static void affine_textured_triangle( GLcontext *ctx,
GLint s = FixedToInt(ffs) & smask; \ GLint s = FixedToInt(ffs) & smask; \
GLint t = FixedToInt(fft) & tmask; \ GLint t = FixedToInt(fft) & tmask; \
GLint pos = (t << twidth_log2) + s; \ GLint pos = (t << twidth_log2) + s; \
GLchan *tex00 = texture + COMP * pos; \ const GLchan *tex00 = texture + COMP * pos; \
zspan[i] = FixedToDepth(ffz); \ zspan[i] = FixedToDepth(ffz); \
fogspan[i] = fffog / 256; \ fogspan[i] = fffog / 256; \
DO_TEX; \ DO_TEX; \
@@ -523,10 +517,10 @@ static void affine_textured_triangle( GLcontext *ctx,
GLint si = FIXED_FRAC_MASK - sf; \ GLint si = FIXED_FRAC_MASK - sf; \
GLint ti = FIXED_FRAC_MASK - tf; \ GLint ti = FIXED_FRAC_MASK - tf; \
GLint pos = (t << twidth_log2) + s; \ GLint pos = (t << twidth_log2) + s; \
GLchan *tex00 = texture + COMP * pos; \ const GLchan *tex00 = texture + COMP * pos; \
GLchan *tex10 = tex00 + tbytesline; \ const GLchan *tex10 = tex00 + tbytesline; \
GLchan *tex01 = tex00 + COMP; \ const GLchan *tex01 = tex00 + COMP; \
GLchan *tex11 = tex10 + COMP; \ const GLchan *tex11 = tex10 + COMP; \
if (t == tmask) { \ if (t == tmask) { \
tex10 -= tsize; \ tex10 -= tsize; \
tex11 -= tsize; \ tex11 -= tsize; \
@@ -705,7 +699,7 @@ static void near_persp_textured_triangle(GLcontext *ctx,
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ const GLint twidth_log2 = obj->Image[b]->WidthLog2; \
GLchan *texture = obj->Image[b]->Data; \ const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \
const GLint smask = (obj->Image[b]->Width - 1); \ const GLint smask = (obj->Image[b]->Width - 1); \
const GLint tmask = (obj->Image[b]->Height - 1); \ const GLint tmask = (obj->Image[b]->Height - 1); \
const GLint format = obj->Image[b]->Format; \ const GLint format = obj->Image[b]->Format; \
@@ -714,10 +708,8 @@ static void near_persp_textured_triangle(GLcontext *ctx,
GLfixed er, eg, eb, ea; \ GLfixed er, eg, eb, ea; \
GLint tr, tg, tb, ta; \ GLint tr, tg, tb, ta; \
if (!texture) { \ if (!texture) { \
if (!_mesa_get_teximages_from_driver(ctx, obj)) \ /* this shouldn't happen */ \
return; \ return; \
texture = obj->Image[b]->Data; \
ASSERT(texture); \
} \ } \
if (envmode == GL_BLEND || envmode == GL_ADD) { \ if (envmode == GL_BLEND || envmode == GL_ADD) { \
er = FloatToFixed(unit->EnvColor[0]); \ er = FloatToFixed(unit->EnvColor[0]); \
@@ -1448,10 +1440,7 @@ static void lin_persp_textured_triangle( GLcontext *ctx,
GLfixed er, eg, eb, ea; \ GLfixed er, eg, eb, ea; \
GLint tr, tg, tb, ta; \ GLint tr, tg, tb, ta; \
if (!texture) { \ if (!texture) { \
if (!_mesa_get_teximages_from_driver(ctx, obj)) \ return; \
return; \
texture = obj->Image[b]->Data; \
ASSERT(texture); \
} \ } \
if (envmode == GL_BLEND || envmode == GL_ADD) { \ if (envmode == GL_BLEND || envmode == GL_ADD) { \
er = FloatToFixed(unit->EnvColor[0]); \ er = FloatToFixed(unit->EnvColor[0]); \
@@ -2304,6 +2293,7 @@ _swrast_choose_triangle( GLcontext *ctx )
&& ((image = current2Dtex->Image[current2Dtex->BaseLevel]) != 0) /* correct! */ && ((image = current2Dtex->Image[current2Dtex->BaseLevel]) != 0) /* correct! */
&& image->Border==0 && image->Border==0
&& ((format = image->Format)==GL_RGB || format==GL_RGBA) && ((format = image->Format)==GL_RGB || format==GL_RGBA)
&& image->Type == CHAN_TYPE
&& (filter = current2Dtex->MinFilter)==current2Dtex->MagFilter && (filter = current2Dtex->MinFilter)==current2Dtex->MagFilter
/* ==> current2Dtex->MinFilter != GL_XXX_MIPMAP_XXX */ /* ==> current2Dtex->MinFilter != GL_XXX_MIPMAP_XXX */
&& ctx->Light.Model.ColorControl==GL_SINGLE_COLOR && ctx->Light.Model.ColorControl==GL_SINGLE_COLOR

View File

@@ -1,4 +1,4 @@
/* $Id: s_tritemp.h,v 1.8 2001/01/29 18:51:25 brianp Exp $ */ /* $Id: s_tritemp.h,v 1.9 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -286,7 +286,7 @@
#error "Mipmapping without texturing doesn't make sense." #error "Mipmapping without texturing doesn't make sense."
#endif #endif
GLfloat lambda_nominator; GLfloat lambda_nominator;
#endif #endif /* INTERP_LAMBDA */
/* /*

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_exec.c,v 1.9 2001/01/24 00:04:59 brianp Exp $ */ /* $Id: t_imm_exec.c,v 1.10 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -37,7 +37,6 @@
#include "mmath.h" #include "mmath.h"
#include "light.h" #include "light.h"
#include "state.h" #include "state.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "math/m_matrix.h" #include "math/m_matrix.h"

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_fixup.c,v 1.4 2001/01/24 00:04:59 brianp Exp $ */ /* $Id: t_imm_fixup.c,v 1.5 2001/02/06 21:42:49 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -39,7 +39,6 @@
#include "mem.h" #include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "state.h" #include "state.h"
#include "texture.h"
#include "mtypes.h" #include "mtypes.h"
#include "math/m_matrix.h" #include "math/m_matrix.h"