From a62efdf82c20747feb11dfd7756f0579aa914b57 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Sep 2010 19:37:15 -0700 Subject: mesa: Remove EXT_convolution. More optional code. --- src/mesa/drivers/common/driverfuncs.c | 2 - src/mesa/drivers/common/meta.c | 82 --------------------------- src/mesa/drivers/dri/intel/intel_extensions.c | 2 - src/mesa/drivers/dri/intel/intel_tex_image.c | 20 ++----- src/mesa/drivers/dri/radeon/radeon_texture.c | 16 ++---- src/mesa/drivers/dri/savage/savagetex.c | 3 - src/mesa/drivers/dri/unichrome/via_tex.c | 22 +++---- 7 files changed, 17 insertions(+), 130 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f92cdc5a777..aee73b53bb3 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -122,8 +122,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* imaging */ driver->CopyColorTable = _mesa_meta_CopyColorTable; driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _mesa_meta_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _mesa_meta_CopyConvolutionFilter2D; /* Vertex/fragment programs */ driver->BindProgram = NULL; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 87d116ad9f1..16ca42f7b5e 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -40,7 +40,6 @@ #include "main/bufferobj.h" #include "main/buffers.h" #include "main/colortab.h" -#include "main/convolve.h" #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" @@ -128,9 +127,6 @@ struct save_state GLfloat AlphaBias, AlphaScale; GLfloat DepthBias, DepthScale; GLboolean MapColorFlag; - GLboolean Convolution1DEnabled; - GLboolean Convolution2DEnabled; - GLboolean Separable2DEnabled; /** META_RASTERIZATION */ GLenum FrontPolygonMode, BackPolygonMode; @@ -389,9 +385,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) save->AlphaScale = ctx->Pixel.AlphaScale; save->AlphaBias = ctx->Pixel.AlphaBias; save->MapColorFlag = ctx->Pixel.MapColorFlag; - save->Convolution1DEnabled = ctx->Pixel.Convolution1DEnabled; - save->Convolution2DEnabled = ctx->Pixel.Convolution2DEnabled; - save->Separable2DEnabled = ctx->Pixel.Separable2DEnabled; ctx->Pixel.RedScale = 1.0F; ctx->Pixel.RedBias = 0.0F; ctx->Pixel.GreenScale = 1.0F; @@ -401,9 +394,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) ctx->Pixel.AlphaScale = 1.0F; ctx->Pixel.AlphaBias = 0.0F; ctx->Pixel.MapColorFlag = GL_FALSE; - ctx->Pixel.Convolution1DEnabled = GL_FALSE; - ctx->Pixel.Convolution2DEnabled = GL_FALSE; - ctx->Pixel.Separable2DEnabled = GL_FALSE; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -638,9 +628,6 @@ _mesa_meta_end(GLcontext *ctx) ctx->Pixel.AlphaScale = save->AlphaScale; ctx->Pixel.AlphaBias = save->AlphaBias; ctx->Pixel.MapColorFlag = save->MapColorFlag; - ctx->Pixel.Convolution1DEnabled = save->Convolution1DEnabled; - ctx->Pixel.Convolution2DEnabled = save->Convolution2DEnabled; - ctx->Pixel.Separable2DEnabled = save->Separable2DEnabled; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -2579,14 +2566,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, format, type, &ctx->Pack, buf); _mesa_meta_end(ctx); - /* - * Prepare for new texture image size/data - */ - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, - &postConvWidth, &postConvHeight); - } - if (texImage->Data) { ctx->Driver.FreeTexImageData(ctx, texImage); } @@ -2804,64 +2783,3 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, free(buf); } - - -void -_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - ctx->Driver.ReadPixels(ctx, x, y, width, 1, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter1D(target, internalFormat, width, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} - - -void -_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - - ctx->Driver.ReadPixels(ctx, x, y, width, height, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter2D(target, internalFormat, width, height, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 4b6229ffe6f..2edd6d21b48 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -208,8 +208,6 @@ intelInitExtensions(GLcontext *ctx) { struct intel_context *intel = intel_context(ctx); - /* Disable imaging extension until convolution is working in teximage paths. - */ driInitExtensions(ctx, card_extensions, GL_FALSE); _mesa_map_function_array(GL_VERSION_2_1_functions); diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index b1ed7ee5e73..f8cb50797e1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -4,7 +4,6 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/bufferobj.h" -#include "main/convolve.h" #include "main/context.h" #include "main/formats.h" #include "main/texcompress.h" @@ -320,8 +319,6 @@ intelTexImage(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); struct intel_texture_image *intelImage = intel_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLint texelBytes, sizeInBytes; GLuint dstRowStride = 0, srcRowStride = texImage->RowStride; @@ -331,11 +328,6 @@ intelTexImage(GLcontext * ctx, intelImage->face = target_to_face(target); intelImage->level = level; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } @@ -343,13 +335,13 @@ intelTexImage(GLcontext * ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } if (!intelImage->mt) { - assert(texImage->RowStride == postConvWidth); + assert(texImage->RowStride == width); } } @@ -502,8 +494,8 @@ intelTexImage(GLcontext * ctx, assert(dims != 3); } else { - dstRowStride = postConvWidth * texelBytes; - sizeInBytes = depth * dstRowStride * postConvHeight; + dstRowStride = width * texelBytes; + sizeInBytes = depth * dstRowStride * height; } texImage->Data = _mesa_alloc_texmemory(sizeInBytes); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8c6a50d2f0d..bf30e0cab8b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -32,7 +32,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/context.h" -#include "main/convolve.h" #include "main/enums.h" #include "main/mipmap.h" #include "main/texcompress.h" @@ -773,8 +772,6 @@ static void radeon_teximage( radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLuint face = _mesa_tex_target_to_face(target); radeon_print(RADEON_TEXTURE, RADEON_NORMAL, @@ -795,20 +792,15 @@ static void radeon_teximage( t->validated = GL_FALSE; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - if (!_mesa_is_format_compressed(texImage->TexFormat)) { GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } if (!image->mt) { - assert(texImage->RowStride == postConvWidth); + assert(texImage->RowStride == width); } } diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 1523af4065f..89090da5c63 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -28,7 +28,6 @@ #include "main/macros.h" #include "main/texstore.h" #include "main/texobj.h" -#include "main/convolve.h" #include "main/colormac.h" #include "main/simple_list.h" #include "main/enums.h" @@ -586,7 +585,6 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr @@ -626,7 +624,6 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a64f093326f..01cb3ebbc88 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -32,7 +32,6 @@ #include "main/enums.h" #include "main/formats.h" #include "main/colortab.h" -#include "main/convolve.h" #include "main/context.h" #include "main/mipmap.h" #include "main/mm.h" @@ -664,8 +663,6 @@ static void viaTexImage(GLcontext *ctx, struct gl_texture_image *texImage) { struct via_context *vmesa = VIA_CONTEXT(ctx); - GLint postConvWidth = width; - GLint postConvHeight = height; GLint texelBytes, sizeInBytes; struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; @@ -676,11 +673,6 @@ static void viaTexImage(GLcontext *ctx, via_release_pending_textures(vmesa); } - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - /* choose the texture format */ texImage->TexFormat = viaChooseTexFormat(ctx, internalFormat, format, type); @@ -690,13 +682,13 @@ static void viaTexImage(GLcontext *ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + if (width * texelBytes < 32) { + width = 32 / texelBytes; + texImage->RowStride = width; } - assert(texImage->RowStride == postConvWidth); - viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); + assert(texImage->RowStride == width); + viaImage->pitchLog2 = logbase2(width * texelBytes); /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) @@ -705,7 +697,7 @@ static void viaTexImage(GLcontext *ctx, texImage->Height, texImage->Depth); else - sizeInBytes = postConvWidth * postConvHeight * texelBytes; + sizeInBytes = width * height * texelBytes; /* Attempt to allocate texture memory directly, otherwise use main @@ -786,7 +778,7 @@ static void viaTexImage(GLcontext *ctx, dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } else { - dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); + dstRowStride = width * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, -- cgit v1.2.3