diff options
author | Gareth Hughes <[email protected]> | 2001-03-18 13:31:52 +0000 |
---|---|---|
committer | Gareth Hughes <[email protected]> | 2001-03-18 13:31:52 +0000 |
commit | 6b406bf09dc18f4d84ccb636d043c990a30da4e1 (patch) | |
tree | 057b15d6ae4560a2c8e1d4dea2c3b7135ba33e59 /src | |
parent | 2f9757f344a05fa0ecb758f8b6a8ee1d631b0478 (diff) |
Remove old code, fix a few comments.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/texformat.c | 11 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 407 |
2 files changed, 10 insertions, 408 deletions
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index d7b8024161f..57e653af216 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1,4 +1,4 @@ -/* $Id: texformat.c,v 1.2 2001/03/18 08:53:49 gareth Exp $ */ +/* $Id: texformat.c,v 1.3 2001/03/18 13:31:52 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -420,11 +420,10 @@ const struct gl_texture_format _mesa_null_texformat = { -/* - * Given an internal texture format enum or 1, 2, 3, 4 return the - * corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, - * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. - * Return -1 if invalid enum. +/* Given an internal texture format or 1, 2, 3, 4 initialize the texture + * image structure's default format and type information. Drivers will + * initialize these fields accordingly if they override the default + * storage format. */ void _mesa_init_tex_format( GLcontext *ctx, GLenum internalFormat, struct gl_texture_image *texImage ) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 8fa9deb2218..9bccb207917 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,4 +1,4 @@ -/* $Id: texstore.c,v 1.12 2001/03/18 08:53:50 gareth Exp $ */ +/* $Id: texstore.c,v 1.13 2001/03/18 13:31:52 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -50,412 +50,14 @@ #include "swrast/s_span.h" -#if 0 -/* - * Default 1-D texture texel fetch function. This will typically be - * overridden by hardware drivers which store their texture images in - * special ways. - */ -static void -fetch_1d_texel(const struct gl_texture_image *img, - GLint i, GLint j, GLint k, GLvoid *texel) -{ - switch (img->Format) { - case GL_RGBA: - { - const GLchan *src = (GLchan *) img->Data + i * 4; - GLchan *rgba = (GLchan *) texel; - COPY_CHAN4(rgba, src); - return; - } - case GL_RGB: - { - const GLchan *src = (GLchan *) img->Data + i * 3; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[2]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_ALPHA: - { - const GLchan *src = (GLchan *) img->Data + i; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = 0; - rgba[GCOMP] = 0; - rgba[BCOMP] = 0; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE: - { - const GLchan *src = (GLchan *) img->Data + i; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_INTENSITY: - { - const GLchan *src = (GLchan *) img->Data + i; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE_ALPHA: - { - const GLchan *src = (GLchan *) img->Data + i * 2; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[1]; - return; - } - case GL_COLOR_INDEX: - { - const GLchan *src = (GLchan *) img->Data + i; - GLchan *index = (GLchan *) texel; - *index = *src; - return; - } - case GL_DEPTH_COMPONENT: - { - const GLfloat *src = (GLfloat *) img->Data + i; - GLfloat *depth = (GLfloat *) texel; - *depth = *src; - return; - } - default: - _mesa_problem(NULL, "Bad format in fetch_1d_texel"); - } -} - - -/* - * Default 2-D texture texel fetch function. - */ -static void -fetch_2d_texel(const struct gl_texture_image *img, - GLint i, GLint j, GLint k, GLvoid *texel) -{ - switch (img->Format) { - case GL_RGBA: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 4; - GLchan *rgba = (GLchan *) texel; - COPY_CHAN4(rgba, src); - return; - } - case GL_RGB: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 3; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[2]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_ALPHA: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = 0; - rgba[GCOMP] = 0; - rgba[BCOMP] = 0; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_INTENSITY: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE_ALPHA: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 2; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[1]; - return; - } - case GL_COLOR_INDEX: - { - const GLchan *src = (GLchan *) img->Data + (img->Width * j + i); - GLchan *index = (GLchan *) texel; - *index = *src; - return; - } - case GL_DEPTH_COMPONENT: - { - const GLfloat *src = (GLfloat *) img->Data + (img->Width * j + i); - GLfloat *depth = (GLfloat *) texel; - *depth = *src; - return; - } - default: - _mesa_problem(NULL, "Bad format in fetch_2d_texel"); - } -} - - -/* - * Default 2-D texture texel fetch function. - */ -static void -fetch_3d_texel(const struct gl_texture_image *img, - GLint i, GLint j, GLint k, GLvoid *texel) -{ - const GLint width = img->Width; - const GLint rectArea = width * img->Height; - - switch (img->Format) { - case GL_RGBA: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i) * 4; - GLchan *rgba = (GLchan *) texel; - COPY_CHAN4(rgba, src); - return; - } - case GL_RGB: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i) * 3; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[1]; - rgba[BCOMP] = src[2]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_ALPHA: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = 0; - rgba[GCOMP] = 0; - rgba[BCOMP] = 0; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = CHAN_MAX; - return; - } - case GL_INTENSITY: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i); - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[0]; - return; - } - case GL_LUMINANCE_ALPHA: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i) * 2; - GLchan *rgba = (GLchan *) texel; - rgba[RCOMP] = src[0]; - rgba[GCOMP] = src[0]; - rgba[BCOMP] = src[0]; - rgba[ACOMP] = src[1]; - return; - } - case GL_COLOR_INDEX: - { - const GLchan *src = (GLchan *) img->Data - + (rectArea * k + width * j + i); - GLchan *index = (GLchan *) texel; - *index = *src; - return; - } - case GL_DEPTH_COMPONENT: - { - const GLfloat *src = (GLfloat *) img->Data - + (rectArea * k + width * j + i); - GLfloat *depth = (GLfloat *) texel; - *depth = *src; - return; - } - default: - _mesa_problem(NULL, "Bad format in fetch_3d_texel"); - } -} - - - -/* - * Examine the texImage->Format field and set the Red, Green, Blue, etc - * texel component sizes to default values. - * These fields are set only here by core Mesa but device drivers may - * overwritting these fields to indicate true texel resolution. - */ -static void -set_teximage_component_sizes( struct gl_texture_image *texImage ) -{ - switch (texImage->Format) { - case GL_ALPHA: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 8 * sizeof(GLchan); - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_LUMINANCE: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 8 * sizeof(GLchan); - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_LUMINANCE_ALPHA: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 8 * sizeof(GLchan); - texImage->IntensityBits = 0; - texImage->LuminanceBits = 8 * sizeof(GLchan); - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_INTENSITY: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 8 * sizeof(GLchan); - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_RED: - texImage->RedBits = 8 * sizeof(GLchan); - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_GREEN: - texImage->RedBits = 0; - texImage->GreenBits = 8 * sizeof(GLchan); - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_BLUE: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 8 * sizeof(GLchan); - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_RGB: - case GL_BGR: - texImage->RedBits = 8 * sizeof(GLchan); - texImage->GreenBits = 8 * sizeof(GLchan); - texImage->BlueBits = 8 * sizeof(GLchan); - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_RGBA: - case GL_BGRA: - case GL_ABGR_EXT: - texImage->RedBits = 8 * sizeof(GLchan); - texImage->GreenBits = 8 * sizeof(GLchan); - texImage->BlueBits = 8 * sizeof(GLchan); - texImage->AlphaBits = 8 * sizeof(GLchan); - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 0; - break; - case GL_COLOR_INDEX: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 8 * sizeof(GLchan); - texImage->DepthBits = 0; - break; - case GL_DEPTH_COMPONENT: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - texImage->DepthBits = 8 * sizeof(GLfloat); - break; - default: - _mesa_problem(NULL, "unexpected format in set_teximage_component_sizes"); - } -} -#endif - - - /* * Given an internal texture format enum or 1, 2, 3, 4 return the * 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 ) @@ -526,6 +128,7 @@ components_in_intformat( GLint format ) return -1; /* error */ } } +#endif /* |