More optional code.
/* 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;
#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"
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLboolean MapColorFlag;
- GLboolean Convolution1DEnabled;
- GLboolean Convolution2DEnabled;
- GLboolean Separable2DEnabled;
/** META_RASTERIZATION */
GLenum FrontPolygonMode, BackPolygonMode;
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;
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;
}
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;
}
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);
}
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);
-}
{
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);
#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"
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;
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;
}
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);
}
}
assert(dims != 3);
}
else {
- dstRowStride = postConvWidth * texelBytes;
- sizeInBytes = depth * dstRowStride * postConvHeight;
+ dstRowStride = width * texelBytes;
+ sizeInBytes = depth * dstRowStride * height;
}
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
#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"
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,
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);
}
}
#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"
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
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
#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"
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;
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);
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))
texImage->Height,
texImage->Depth);
else
- sizeInBytes = postConvWidth * postConvHeight * texelBytes;
+ sizeInBytes = width * height * texelBytes;
/* Attempt to allocate texture memory directly, otherwise use main
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,
GLboolean Blend;
GLbitfield ClipPlanes;
GLboolean ColorMaterial;
- GLboolean Convolution1D;
- GLboolean Convolution2D;
- GLboolean Separable2D;
GLboolean CullFace;
GLboolean DepthClamp;
GLboolean DepthTest;
attr->Blend = ctx->Color.BlendEnabled;
attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
- attr->Convolution1D = ctx->Pixel.Convolution1DEnabled;
- attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
- attr->Separable2D = ctx->Pixel.Separable2DEnabled;
attr->CullFace = ctx->Polygon.CullFlag;
attr->DepthClamp = ctx->Transform.DepthClamp;
attr->DepthTest = ctx->Depth.Test;
GL_DEPTH_CLAMP);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
- TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D,
- GL_CONVOLUTION_1D);
- TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D,
- GL_CONVOLUTION_2D);
- TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D,
- GL_SEPARABLE_2D);
TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING);
TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH);
ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH;
ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY;
ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE;
- ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
- ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
ctx->Const.MaxLights = MAX_LIGHTS;
ctx->Const.MaxShininess = 128.0;
#if FEATURE_convolve
-
-/*
- * Given an internalFormat token passed to glConvolutionFilter
- * or glSeparableFilter, return the corresponding base format.
- * Return -1 if invalid token.
- */
-static GLint
-base_filter_format( GLenum format )
-{
- switch (format) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return GL_ALPHA;
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return GL_LUMINANCE_ALPHA;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return GL_INTENSITY;
- case GL_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return GL_RGB;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return GL_RGBA;
- default:
- return -1; /* error */
- }
-}
-
-
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
{
- GLint baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (target != GL_CONVOLUTION_1D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)");
- return;
- }
-
- baseFormat = base_filter_format(internalFormat);
- if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)");
- return;
- }
- if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)");
- return;
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)");
- return;
- }
-
- if (format == GL_COLOR_INDEX ||
- format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_COMPONENT ||
- format == GL_INTENSITY ||
- type == GL_BITMAP) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)");
- return;
- }
-
- ctx->Convolution1D.Format = format;
- ctx->Convolution1D.InternalFormat = internalFormat;
- ctx->Convolution1D.Width = width;
- ctx->Convolution1D.Height = 1;
-
- image = _mesa_map_validate_pbo_source(ctx,
- 1, &ctx->Unpack, width, 1, 1,
- format, type, image,
- "glConvolutionFilter1D");
- if (!image)
- return;
-
- _mesa_unpack_color_span_float(ctx, width, GL_RGBA,
- ctx->Convolution1D.Filter,
- format, type, image, &ctx->Unpack,
- 0); /* transferOps */
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
-
- _mesa_scale_and_bias_rgba(width,
- (GLfloat (*)[4]) ctx->Convolution1D.Filter,
- ctx->Pixel.ConvolutionFilterScale[0][0],
- ctx->Pixel.ConvolutionFilterScale[0][1],
- ctx->Pixel.ConvolutionFilterScale[0][2],
- ctx->Pixel.ConvolutionFilterScale[0][3],
- ctx->Pixel.ConvolutionFilterBias[0][0],
- ctx->Pixel.ConvolutionFilterBias[0][1],
- ctx->Pixel.ConvolutionFilterBias[0][2],
- ctx->Pixel.ConvolutionFilterBias[0][3]);
-
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D");
}
-
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
{
- GLint baseFormat;
- GLint i;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (target != GL_CONVOLUTION_2D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)");
- return;
- }
-
- baseFormat = base_filter_format(internalFormat);
- if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)");
- return;
- }
-
- if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)");
- return;
- }
- if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)");
- return;
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)");
- return;
- }
- if (format == GL_COLOR_INDEX ||
- format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_COMPONENT ||
- format == GL_INTENSITY ||
- type == GL_BITMAP) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)");
- return;
- }
-
- /* this should have been caught earlier */
- assert(_mesa_components_in_format(format));
-
- ctx->Convolution2D.Format = format;
- ctx->Convolution2D.InternalFormat = internalFormat;
- ctx->Convolution2D.Width = width;
- ctx->Convolution2D.Height = height;
-
- image = _mesa_map_validate_pbo_source(ctx,
- 2, &ctx->Unpack, width, height, 1,
- format, type, image,
- "glConvolutionFilter2D");
- if (!image)
- return;
-
- /* Unpack filter image. We always store filters in RGBA format. */
- for (i = 0; i < height; i++) {
- const GLvoid *src = _mesa_image_address2d(&ctx->Unpack, image, width,
- height, format, type, i, 0);
- GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4;
- _mesa_unpack_color_span_float(ctx, width, GL_RGBA, dst,
- format, type, src, &ctx->Unpack,
- 0); /* transferOps */
- }
-
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
- _mesa_scale_and_bias_rgba(width * height,
- (GLfloat (*)[4]) ctx->Convolution2D.Filter,
- ctx->Pixel.ConvolutionFilterScale[1][0],
- ctx->Pixel.ConvolutionFilterScale[1][1],
- ctx->Pixel.ConvolutionFilterScale[1][2],
- ctx->Pixel.ConvolutionFilterScale[1][3],
- ctx->Pixel.ConvolutionFilterBias[1][0],
- ctx->Pixel.ConvolutionFilterBias[1][1],
- ctx->Pixel.ConvolutionFilterBias[1][2],
- ctx->Pixel.ConvolutionFilterBias[1][3]);
-
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D");
}
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)");
- return;
- }
-
- switch (pname) {
- case GL_CONVOLUTION_BORDER_MODE:
- if (param == (GLfloat) GL_REDUCE ||
- param == (GLfloat) GL_CONSTANT_BORDER ||
- param == (GLfloat) GL_REPLICATE_BORDER) {
- ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)");
- return;
- }
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)");
- return;
- }
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf");
}
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)");
- return;
- }
-
- switch (pname) {
- case GL_CONVOLUTION_BORDER_COLOR:
- COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params);
- break;
- case GL_CONVOLUTION_BORDER_MODE:
- if (params[0] == (GLfloat) GL_REDUCE ||
- params[0] == (GLfloat) GL_CONSTANT_BORDER ||
- params[0] == (GLfloat) GL_REPLICATE_BORDER) {
- ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)");
- return;
- }
- break;
- case GL_CONVOLUTION_FILTER_SCALE:
- COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params);
- break;
- case GL_CONVOLUTION_FILTER_BIAS:
- COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)");
- return;
- }
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv");
}
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)");
- return;
- }
-
- switch (pname) {
- case GL_CONVOLUTION_BORDER_MODE:
- if (param == (GLint) GL_REDUCE ||
- param == (GLint) GL_CONSTANT_BORDER ||
- param == (GLint) GL_REPLICATE_BORDER) {
- ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)");
- return;
- }
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)");
- return;
- }
-
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri");
}
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)");
- return;
- }
-
- switch (pname) {
- case GL_CONVOLUTION_BORDER_COLOR:
- ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]);
- ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]);
- ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]);
- ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]);
- break;
- case GL_CONVOLUTION_BORDER_MODE:
- if (params[0] == (GLint) GL_REDUCE ||
- params[0] == (GLint) GL_CONSTANT_BORDER ||
- params[0] == (GLint) GL_REPLICATE_BORDER) {
- ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)");
- return;
- }
- break;
- case GL_CONVOLUTION_FILTER_SCALE:
- /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */
- /* need cast to prevent compiler warnings */
- ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0];
- ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1];
- ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2];
- ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3];
- break;
- case GL_CONVOLUTION_FILTER_BIAS:
- /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */
- /* need cast to prevent compiler warnings */
- ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0];
- ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1];
- ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2];
- ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3];
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)");
- return;
- }
- ctx->NewState |= _NEW_PIXEL;
+ _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv");
}
static void GLAPIENTRY
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
{
- GLint baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (target != GL_CONVOLUTION_1D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)");
- return;
- }
-
- baseFormat = base_filter_format(internalFormat);
- if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)");
- return;
- }
-
- if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)");
- return;
- }
-
- if (!ctx->ReadBuffer->_ColorReadBuffer) {
- return; /* no readbuffer - OK */
- }
-
- ctx->Driver.CopyConvolutionFilter1D( ctx, target,
- internalFormat, x, y, width);
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D");
}
static void GLAPIENTRY
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
{
- GLint baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (target != GL_CONVOLUTION_2D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)");
- return;
- }
- baseFormat = base_filter_format(internalFormat);
- if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)");
- return;
- }
-
- if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)");
- return;
- }
- if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)");
- return;
- }
-
- if (!ctx->ReadBuffer->_ColorReadBuffer) {
- return; /* no readbuffer - OK */
- }
-
- ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y,
- width, height );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D");
}
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
GLvoid *image)
{
- struct gl_convolution_attrib *filter;
- GLuint row;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->NewState) {
- _mesa_update_state(ctx);
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
- return;
- }
- if (format == GL_COLOR_INDEX ||
- format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_COMPONENT ||
- format == GL_INTENSITY ||
- type == GL_BITMAP) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
- return;
- }
-
- switch (target) {
- case GL_CONVOLUTION_1D:
- filter = &(ctx->Convolution1D);
- break;
- case GL_CONVOLUTION_2D:
- filter = &(ctx->Convolution2D);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)");
- return;
- }
-
- image = _mesa_map_validate_pbo_dest(ctx, 2, &ctx->Pack,
- filter->Width, filter->Height, 1,
- format, type, image,
- "glGetConvolutionFilter");
- if (!image)
- return;
-
- for (row = 0; row < filter->Height; row++) {
- GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width,
- filter->Height, format, type,
- row, 0);
- GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + row * filter->Width * 4);
- _mesa_pack_rgba_span_float(ctx, filter->Width, src,
- format, type, dst, &ctx->Pack, 0x0);
- }
-
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter");
}
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- const struct gl_convolution_attrib *conv;
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- conv = &ctx->Convolution1D;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- conv = &ctx->Convolution2D;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- conv = &ctx->Separable2D;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)");
- return;
- }
- switch (pname) {
- case GL_CONVOLUTION_BORDER_COLOR:
- COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]);
- break;
- case GL_CONVOLUTION_BORDER_MODE:
- *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c];
- break;
- case GL_CONVOLUTION_FILTER_SCALE:
- COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]);
- break;
- case GL_CONVOLUTION_FILTER_BIAS:
- COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]);
- break;
- case GL_CONVOLUTION_FORMAT:
- *params = (GLfloat) conv->Format;
- break;
- case GL_CONVOLUTION_WIDTH:
- *params = (GLfloat) conv->Width;
- break;
- case GL_CONVOLUTION_HEIGHT:
- *params = (GLfloat) conv->Height;
- break;
- case GL_MAX_CONVOLUTION_WIDTH:
- *params = (GLfloat) ctx->Const.MaxConvolutionWidth;
- break;
- case GL_MAX_CONVOLUTION_HEIGHT:
- *params = (GLfloat) ctx->Const.MaxConvolutionHeight;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)");
- return;
- }
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv");
}
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- const struct gl_convolution_attrib *conv;
- GLuint c;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- switch (target) {
- case GL_CONVOLUTION_1D:
- c = 0;
- conv = &ctx->Convolution1D;
- break;
- case GL_CONVOLUTION_2D:
- c = 1;
- conv = &ctx->Convolution2D;
- break;
- case GL_SEPARABLE_2D:
- c = 2;
- conv = &ctx->Separable2D;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)");
- return;
- }
-
- switch (pname) {
- case GL_CONVOLUTION_BORDER_COLOR:
- params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]);
- params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]);
- params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]);
- params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]);
- break;
- case GL_CONVOLUTION_BORDER_MODE:
- *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c];
- break;
- case GL_CONVOLUTION_FILTER_SCALE:
- params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0];
- params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1];
- params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2];
- params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3];
- break;
- case GL_CONVOLUTION_FILTER_BIAS:
- params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0];
- params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1];
- params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2];
- params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3];
- break;
- case GL_CONVOLUTION_FORMAT:
- *params = (GLint) conv->Format;
- break;
- case GL_CONVOLUTION_WIDTH:
- *params = (GLint) conv->Width;
- break;
- case GL_CONVOLUTION_HEIGHT:
- *params = (GLint) conv->Height;
- break;
- case GL_MAX_CONVOLUTION_WIDTH:
- *params = (GLint) ctx->Const.MaxConvolutionWidth;
- break;
- case GL_MAX_CONVOLUTION_HEIGHT:
- *params = (GLint) ctx->Const.MaxConvolutionHeight;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)");
- return;
- }
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv");
}
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span)
{
- const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
- struct gl_convolution_attrib *filter;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->NewState) {
- _mesa_update_state(ctx);
- }
-
- if (target != GL_SEPARABLE_2D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)");
- return;
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetConvolutionFilter(format or type)");
- return;
- }
- if (format == GL_COLOR_INDEX ||
- format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_COMPONENT ||
- format == GL_INTENSITY ||
- type == GL_BITMAP) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)");
- return;
- }
-
- filter = &ctx->Separable2D;
-
- /* Get row filter */
- row = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack,
- filter->Width, 1, 1,
- format, type, row,
- "glGetConvolutionFilter");
- if (row) {
- GLvoid *dst = _mesa_image_address1d(&ctx->Pack, row, filter->Width,
- format, type, 0);
- _mesa_pack_rgba_span_float(ctx, filter->Width,
- (GLfloat (*)[4]) filter->Filter,
- format, type, dst, &ctx->Pack, 0x0);
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
- }
-
- /* get column filter */
- column = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack,
- filter->Height, 1, 1,
- format, type, column,
- "glGetConvolutionFilter");
- if (column) {
- GLvoid *dst = _mesa_image_address1d(&ctx->Pack, column, filter->Height,
- format, type, 0);
- GLfloat (*src)[4] = (GLfloat (*)[4]) (filter->Filter + colStart);
- _mesa_pack_rgba_span_float(ctx, filter->Height, src,
- format, type, dst, &ctx->Pack, 0x0);
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
- }
-
- (void) span; /* unused at this time */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter");
}
static void GLAPIENTRY
_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
{
- const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
- GLint baseFormat;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (target != GL_SEPARABLE_2D) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)");
- return;
- }
-
- baseFormat = base_filter_format(internalFormat);
- if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)");
- return;
- }
-
- if (width < 0 || width > MAX_CONVOLUTION_WIDTH) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)");
- return;
- }
- if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)");
- return;
- }
-
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)");
- return;
- }
-
- if (format == GL_COLOR_INDEX ||
- format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_COMPONENT ||
- format == GL_INTENSITY ||
- type == GL_BITMAP) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)");
- return;
- }
-
- ctx->Separable2D.Format = format;
- ctx->Separable2D.InternalFormat = internalFormat;
- ctx->Separable2D.Width = width;
- ctx->Separable2D.Height = height;
-
- /* unpack row filter */
- row = _mesa_map_validate_pbo_source(ctx, 1, &ctx->Unpack,
- width, 1, 1,
- format, type, row,
- "glSeparableFilter2D");
- if (row) {
- _mesa_unpack_color_span_float(ctx, width, GL_RGBA,
- ctx->Separable2D.Filter,
- format, type, row, &ctx->Unpack,
- 0x0); /* transferOps */
- _mesa_scale_and_bias_rgba(width,
- (GLfloat (*)[4]) ctx->Separable2D.Filter,
- ctx->Pixel.ConvolutionFilterScale[2][0],
- ctx->Pixel.ConvolutionFilterScale[2][1],
- ctx->Pixel.ConvolutionFilterScale[2][2],
- ctx->Pixel.ConvolutionFilterScale[2][3],
- ctx->Pixel.ConvolutionFilterBias[2][0],
- ctx->Pixel.ConvolutionFilterBias[2][1],
- ctx->Pixel.ConvolutionFilterBias[2][2],
- ctx->Pixel.ConvolutionFilterBias[2][3]);
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
- }
-
- /* unpack column filter */
- column = _mesa_map_validate_pbo_source(ctx, 1, &ctx->Unpack,
- height, 1, 1,
- format, type, column,
- "glSeparableFilter2D");
- if (column) {
- _mesa_unpack_color_span_float(ctx, height, GL_RGBA,
- &ctx->Separable2D.Filter[colStart],
- format, type, column, &ctx->Unpack,
- 0); /* transferOps */
-
- _mesa_scale_and_bias_rgba(height,
- (GLfloat (*)[4]) (ctx->Separable2D.Filter + colStart),
- ctx->Pixel.ConvolutionFilterScale[2][0],
- ctx->Pixel.ConvolutionFilterScale[2][1],
- ctx->Pixel.ConvolutionFilterScale[2][2],
- ctx->Pixel.ConvolutionFilterScale[2][3],
- ctx->Pixel.ConvolutionFilterBias[2][0],
- ctx->Pixel.ConvolutionFilterBias[2][1],
- ctx->Pixel.ConvolutionFilterBias[2][2],
- ctx->Pixel.ConvolutionFilterBias[2][3]);
- _mesa_unmap_pbo_source(ctx, &ctx->Unpack);
- }
-
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- ctx->Unpack.BufferObj);
- }
-
- ctx->NewState |= _NEW_PIXEL;
-}
-
-
-/**********************************************************************/
-/*** image convolution functions ***/
-/**********************************************************************/
-
-static void
-convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4],
- GLint filterWidth, const GLfloat filter[][4],
- GLfloat dest[][4])
-{
- GLint dstWidth;
- GLint i, n;
-
- if (filterWidth >= 1)
- dstWidth = srcWidth - (filterWidth - 1);
- else
- dstWidth = srcWidth;
-
- if (dstWidth <= 0)
- return; /* null result */
-
- for (i = 0; i < dstWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (n = 0; n < filterWidth; n++) {
- sumR += src[i + n][RCOMP] * filter[n][RCOMP];
- sumG += src[i + n][GCOMP] * filter[n][GCOMP];
- sumB += src[i + n][BCOMP] * filter[n][BCOMP];
- sumA += src[i + n][ACOMP] * filter[n][ACOMP];
- }
- dest[i][RCOMP] = sumR;
- dest[i][GCOMP] = sumG;
- dest[i][BCOMP] = sumB;
- dest[i][ACOMP] = sumA;
- }
-}
-
-
-static void
-convolve_1d_constant(GLint srcWidth, const GLfloat src[][4],
- GLint filterWidth, const GLfloat filter[][4],
- GLfloat dest[][4],
- const GLfloat borderColor[4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- GLint i, n;
-
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (n = 0; n < filterWidth; n++) {
- if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) {
- sumR += borderColor[RCOMP] * filter[n][RCOMP];
- sumG += borderColor[GCOMP] * filter[n][GCOMP];
- sumB += borderColor[BCOMP] * filter[n][BCOMP];
- sumA += borderColor[ACOMP] * filter[n][ACOMP];
- }
- else {
- sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP];
- sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP];
- sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP];
- sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP];
- }
- }
- dest[i][RCOMP] = sumR;
- dest[i][GCOMP] = sumG;
- dest[i][BCOMP] = sumB;
- dest[i][ACOMP] = sumA;
- }
-}
-
-
-static void
-convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4],
- GLint filterWidth, const GLfloat filter[][4],
- GLfloat dest[][4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- GLint i, n;
-
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (n = 0; n < filterWidth; n++) {
- if (i + n < halfFilterWidth) {
- sumR += src[0][RCOMP] * filter[n][RCOMP];
- sumG += src[0][GCOMP] * filter[n][GCOMP];
- sumB += src[0][BCOMP] * filter[n][BCOMP];
- sumA += src[0][ACOMP] * filter[n][ACOMP];
- }
- else if (i + n - halfFilterWidth >= srcWidth) {
- sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP];
- sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP];
- sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP];
- sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP];
- }
- else {
- sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP];
- sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP];
- sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP];
- sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP];
- }
- }
- dest[i][RCOMP] = sumR;
- dest[i][GCOMP] = sumG;
- dest[i][BCOMP] = sumB;
- dest[i][ACOMP] = sumA;
- }
-}
-
-
-static void
-convolve_2d_reduce(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat filter[][4],
- GLfloat dest[][4])
-{
- GLint dstWidth, dstHeight;
- GLint i, j, n, m;
-
- if (filterWidth >= 1)
- dstWidth = srcWidth - (filterWidth - 1);
- else
- dstWidth = srcWidth;
-
- if (filterHeight >= 1)
- dstHeight = srcHeight - (filterHeight - 1);
- else
- dstHeight = srcHeight;
-
- if (dstWidth <= 0 || dstHeight <= 0)
- return;
-
- for (j = 0; j < dstHeight; j++) {
- for (i = 0; i < dstWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- const GLint k = (j + m) * srcWidth + i + n;
- const GLint f = m * filterWidth + n;
- sumR += src[k][RCOMP] * filter[f][RCOMP];
- sumG += src[k][GCOMP] * filter[f][GCOMP];
- sumB += src[k][BCOMP] * filter[f][BCOMP];
- sumA += src[k][ACOMP] * filter[f][ACOMP];
- }
- }
- dest[j * dstWidth + i][RCOMP] = sumR;
- dest[j * dstWidth + i][GCOMP] = sumG;
- dest[j * dstWidth + i][BCOMP] = sumB;
- dest[j * dstWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-static void
-convolve_2d_constant(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat filter[][4],
- GLfloat dest[][4],
- const GLfloat borderColor[4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- const GLint halfFilterHeight = filterHeight / 2;
- GLint i, j, n, m;
-
- for (j = 0; j < srcHeight; j++) {
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- const GLint f = m * filterWidth + n;
- const GLint is = i + n - halfFilterWidth;
- const GLint js = j + m - halfFilterHeight;
- if (is < 0 || is >= srcWidth ||
- js < 0 || js >= srcHeight) {
- sumR += borderColor[RCOMP] * filter[f][RCOMP];
- sumG += borderColor[GCOMP] * filter[f][GCOMP];
- sumB += borderColor[BCOMP] * filter[f][BCOMP];
- sumA += borderColor[ACOMP] * filter[f][ACOMP];
- }
- else {
- const GLint k = js * srcWidth + is;
- sumR += src[k][RCOMP] * filter[f][RCOMP];
- sumG += src[k][GCOMP] * filter[f][GCOMP];
- sumB += src[k][BCOMP] * filter[f][BCOMP];
- sumA += src[k][ACOMP] * filter[f][ACOMP];
- }
- }
- }
- dest[j * srcWidth + i][RCOMP] = sumR;
- dest[j * srcWidth + i][GCOMP] = sumG;
- dest[j * srcWidth + i][BCOMP] = sumB;
- dest[j * srcWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-static void
-convolve_2d_replicate(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat filter[][4],
- GLfloat dest[][4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- const GLint halfFilterHeight = filterHeight / 2;
- GLint i, j, n, m;
-
- for (j = 0; j < srcHeight; j++) {
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- const GLint f = m * filterWidth + n;
- GLint is = i + n - halfFilterWidth;
- GLint js = j + m - halfFilterHeight;
- GLint k;
- if (is < 0)
- is = 0;
- else if (is >= srcWidth)
- is = srcWidth - 1;
- if (js < 0)
- js = 0;
- else if (js >= srcHeight)
- js = srcHeight - 1;
- k = js * srcWidth + is;
- sumR += src[k][RCOMP] * filter[f][RCOMP];
- sumG += src[k][GCOMP] * filter[f][GCOMP];
- sumB += src[k][BCOMP] * filter[f][BCOMP];
- sumA += src[k][ACOMP] * filter[f][ACOMP];
- }
- }
- dest[j * srcWidth + i][RCOMP] = sumR;
- dest[j * srcWidth + i][GCOMP] = sumG;
- dest[j * srcWidth + i][BCOMP] = sumB;
- dest[j * srcWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-static void
-convolve_sep_reduce(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat rowFilt[][4],
- const GLfloat colFilt[][4],
- GLfloat dest[][4])
-{
- GLint dstWidth, dstHeight;
- GLint i, j, n, m;
-
- if (filterWidth >= 1)
- dstWidth = srcWidth - (filterWidth - 1);
- else
- dstWidth = srcWidth;
-
- if (filterHeight >= 1)
- dstHeight = srcHeight - (filterHeight - 1);
- else
- dstHeight = srcHeight;
- if (dstWidth <= 0 || dstHeight <= 0)
- return;
-
- for (j = 0; j < dstHeight; j++) {
- for (i = 0; i < dstWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- GLint k = (j + m) * srcWidth + i + n;
- sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
- sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
- sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
- sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
- }
- }
- dest[j * dstWidth + i][RCOMP] = sumR;
- dest[j * dstWidth + i][GCOMP] = sumG;
- dest[j * dstWidth + i][BCOMP] = sumB;
- dest[j * dstWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-static void
-convolve_sep_constant(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat rowFilt[][4],
- const GLfloat colFilt[][4],
- GLfloat dest[][4],
- const GLfloat borderColor[4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- const GLint halfFilterHeight = filterHeight / 2;
- GLint i, j, n, m;
-
- for (j = 0; j < srcHeight; j++) {
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- const GLint is = i + n - halfFilterWidth;
- const GLint js = j + m - halfFilterHeight;
- if (is < 0 || is >= srcWidth ||
- js < 0 || js >= srcHeight) {
- sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
- sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
- sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
- sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
- }
- else {
- GLint k = js * srcWidth + is;
- sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
- sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
- sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
- sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
- }
-
- }
- }
- dest[j * srcWidth + i][RCOMP] = sumR;
- dest[j * srcWidth + i][GCOMP] = sumG;
- dest[j * srcWidth + i][BCOMP] = sumB;
- dest[j * srcWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-static void
-convolve_sep_replicate(GLint srcWidth, GLint srcHeight,
- const GLfloat src[][4],
- GLint filterWidth, GLint filterHeight,
- const GLfloat rowFilt[][4],
- const GLfloat colFilt[][4],
- GLfloat dest[][4])
-{
- const GLint halfFilterWidth = filterWidth / 2;
- const GLint halfFilterHeight = filterHeight / 2;
- GLint i, j, n, m;
-
- for (j = 0; j < srcHeight; j++) {
- for (i = 0; i < srcWidth; i++) {
- GLfloat sumR = 0.0;
- GLfloat sumG = 0.0;
- GLfloat sumB = 0.0;
- GLfloat sumA = 0.0;
- for (m = 0; m < filterHeight; m++) {
- for (n = 0; n < filterWidth; n++) {
- GLint is = i + n - halfFilterWidth;
- GLint js = j + m - halfFilterHeight;
- GLint k;
- if (is < 0)
- is = 0;
- else if (is >= srcWidth)
- is = srcWidth - 1;
- if (js < 0)
- js = 0;
- else if (js >= srcHeight)
- js = srcHeight - 1;
- k = js * srcWidth + is;
- sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP];
- sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP];
- sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP];
- sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP];
- }
- }
- dest[j * srcWidth + i][RCOMP] = sumR;
- dest[j * srcWidth + i][GCOMP] = sumG;
- dest[j * srcWidth + i][BCOMP] = sumB;
- dest[j * srcWidth + i][ACOMP] = sumA;
- }
- }
-}
-
-
-
-void
-_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- switch (ctx->Pixel.ConvolutionBorderMode[0]) {
- case GL_REDUCE:
- convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage,
- ctx->Convolution1D.Width,
- (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
- (GLfloat (*)[4]) dstImage);
- *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1);
- break;
- case GL_CONSTANT_BORDER:
- convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage,
- ctx->Convolution1D.Width,
- (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
- (GLfloat (*)[4]) dstImage,
- ctx->Pixel.ConvolutionBorderColor[0]);
- break;
- case GL_REPLICATE_BORDER:
- convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage,
- ctx->Convolution1D.Width,
- (const GLfloat (*)[4]) ctx->Convolution1D.Filter,
- (GLfloat (*)[4]) dstImage);
- break;
- default:
- ;
- }
-}
-
-
-void
-_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- switch (ctx->Pixel.ConvolutionBorderMode[1]) {
- case GL_REDUCE:
- convolve_2d_reduce(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Convolution2D.Width,
- ctx->Convolution2D.Height,
- (const GLfloat (*)[4]) ctx->Convolution2D.Filter,
- (GLfloat (*)[4]) dstImage);
- *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1);
- *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1);
- break;
- case GL_CONSTANT_BORDER:
- convolve_2d_constant(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Convolution2D.Width,
- ctx->Convolution2D.Height,
- (const GLfloat (*)[4]) ctx->Convolution2D.Filter,
- (GLfloat (*)[4]) dstImage,
- ctx->Pixel.ConvolutionBorderColor[1]);
- break;
- case GL_REPLICATE_BORDER:
- convolve_2d_replicate(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Convolution2D.Width,
- ctx->Convolution2D.Height,
- (const GLfloat (*)[4])ctx->Convolution2D.Filter,
- (GLfloat (*)[4]) dstImage);
- break;
- default:
- ;
- }
-}
-
-
-void
-_mesa_convolve_sep_image(const GLcontext *ctx,
- GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- const GLfloat *rowFilter = ctx->Separable2D.Filter;
- const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH;
-
- switch (ctx->Pixel.ConvolutionBorderMode[2]) {
- case GL_REDUCE:
- convolve_sep_reduce(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Separable2D.Width,
- ctx->Separable2D.Height,
- (const GLfloat (*)[4]) rowFilter,
- (const GLfloat (*)[4]) colFilter,
- (GLfloat (*)[4]) dstImage);
- *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1);
- *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
- break;
- case GL_CONSTANT_BORDER:
- convolve_sep_constant(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Separable2D.Width,
- ctx->Separable2D.Height,
- (const GLfloat (*)[4]) rowFilter,
- (const GLfloat (*)[4]) colFilter,
- (GLfloat (*)[4]) dstImage,
- ctx->Pixel.ConvolutionBorderColor[2]);
- break;
- case GL_REPLICATE_BORDER:
- convolve_sep_replicate(*width, *height,
- (const GLfloat (*)[4]) srcImage,
- ctx->Separable2D.Width,
- ctx->Separable2D.Height,
- (const GLfloat (*)[4]) rowFilter,
- (const GLfloat (*)[4]) colFilter,
- (GLfloat (*)[4]) dstImage);
- break;
- default:
- ;
- }
+ _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D");
}
-
-
-/*
- * This function computes an image's size after convolution.
- * If the convolution border mode is GL_REDUCE, the post-convolution
- * image will be smaller than the original.
- */
-void
-_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
- GLsizei *width, GLsizei *height)
-{
- if (ctx->Pixel.Convolution1DEnabled
- && dimensions == 1
- && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) {
- *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1);
- }
- else if (ctx->Pixel.Convolution2DEnabled
- && dimensions > 1
- && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) {
- *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1);
- *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1);
- }
- else if (ctx->Pixel.Separable2DEnabled
- && dimensions > 1
- && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) {
- *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1);
- *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
- }
-}
-
-
void
_mesa_init_convolve_dispatch(struct _glapi_table *disp)
{
#if FEATURE_convolve
-extern void GLAPIENTRY
-_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
- GLenum format, GLenum type, const GLvoid *image);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
- GLsizei height, GLenum format, GLenum type,
- const GLvoid *image);
-
-extern void
-_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
- const GLfloat *srcImage, GLfloat *dstImage);
-
-extern void
-_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage);
-
-extern void
-_mesa_convolve_sep_image(const GLcontext *ctx,
- GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage);
-
-extern void
-_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
- GLsizei *width, GLsizei *height);
-
extern void
_mesa_init_convolve_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-static INLINE void GLAPIENTRY
-_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
- GLenum format, GLenum type, const GLvoid *image)
-{
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void GLAPIENTRY
-_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
- GLsizei height, GLenum format, GLenum type,
- const GLvoid *image)
-{
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void
-_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void
-_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- ASSERT_NO_FEATURE();
-}
-
-
-static INLINE void
-_mesa_convolve_sep_image(const GLcontext *ctx,
- GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage)
-{
- ASSERT_NO_FEATURE();
-}
-
-static INLINE void
-_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
- GLsizei *width, GLsizei *height)
-{
-}
-
static INLINE void
_mesa_init_convolve_dispatch(struct _glapi_table *disp)
{
void (*CopyColorSubTable)( GLcontext *ctx,
GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width );
-
- void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width );
-
- void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
/*@}*/
ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state;
break;
- /* GL_EXT_convolution */
- case GL_CONVOLUTION_1D:
- CHECK_EXTENSION(EXT_convolution, cap);
- if (ctx->Pixel.Convolution1DEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.Convolution1DEnabled = state;
- break;
- case GL_CONVOLUTION_2D:
- CHECK_EXTENSION(EXT_convolution, cap);
- if (ctx->Pixel.Convolution2DEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.Convolution2DEnabled = state;
- break;
- case GL_SEPARABLE_2D:
- CHECK_EXTENSION(EXT_convolution, cap);
- if (ctx->Pixel.Separable2DEnabled == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.Separable2DEnabled = state;
- break;
-
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
CHECK_EXTENSION(ARB_texture_cube_map, cap);
CHECK_EXTENSION(SGI_texture_color_table);
return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;
- /* GL_EXT_convolution */
- case GL_CONVOLUTION_1D:
- CHECK_EXTENSION(EXT_convolution);
- return ctx->Pixel.Convolution1DEnabled;
- case GL_CONVOLUTION_2D:
- CHECK_EXTENSION(EXT_convolution);
- return ctx->Pixel.Convolution2DEnabled;
- case GL_SEPARABLE_2D:
- CHECK_EXTENSION(EXT_convolution);
- return ctx->Pixel.Separable2DEnabled;
-
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
CHECK_EXTENSION(ARB_texture_cube_map);
{ OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
{ OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) },
{ ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
- { OFF, "GL_EXT_convolution", F(EXT_convolution) },
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
{ OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
{ OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) },
ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
- ctx->Extensions.EXT_convolution = GL_TRUE;
ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
ctx->Extensions.EXT_fog_coord = GL_TRUE;
ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
- ctx->Extensions.EXT_convolution = GL_TRUE;
}
EXTRA_EXT(NV_texture_rectangle);
EXTRA_EXT(EXT_stencil_two_side);
EXTRA_EXT(NV_light_max_exponent);
-EXTRA_EXT(EXT_convolution);
EXTRA_EXT(SGI_texture_color_table);
EXTRA_EXT(EXT_depth_bounds_test);
EXTRA_EXT(ARB_depth_clamp);
CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA },
{ GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA },
- /* GL_EXT_convolution (also in 1.2 imaging) */
- { GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled),
- extra_EXT_convolution },
- { GL_CONVOLUTION_2D_EXT, CONTEXT_BOOL(Pixel.Convolution2DEnabled),
- extra_EXT_convolution },
- { GL_SEPARABLE_2D_EXT, CONTEXT_BOOL(Pixel.Separable2DEnabled),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_RED_SCALE_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionScale[0]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_GREEN_SCALE_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionScale[1]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_BLUE_SCALE_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionScale[2]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_ALPHA_SCALE_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionScale[3]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_RED_BIAS_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionBias[0]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_GREEN_BIAS_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionBias[1]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_BLUE_BIAS_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionBias[2]),
- extra_EXT_convolution },
- { GL_POST_CONVOLUTION_ALPHA_BIAS_EXT,
- CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]),
- extra_EXT_convolution },
-
/* GL_SGI_texture_color_table */
{ GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN,
offsetof(struct gl_texture_unit, ColorTableEnabled),
if (transferOps & IMAGE_MAP_COLOR_BIT) {
_mesa_map_rgba( ctx, n, rgba );
}
- /* convolution */
- if (transferOps & IMAGE_CONVOLUTION_BIT) {
- /* this has to be done in the calling code */
- _mesa_problem(ctx, "IMAGE_CONVOLUTION_BIT set in _mesa_apply_transfer_ops");
- }
- /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
- if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
- _mesa_scale_and_bias_rgba(n, rgba,
- ctx->Pixel.PostConvolutionScale[RCOMP],
- ctx->Pixel.PostConvolutionScale[GCOMP],
- ctx->Pixel.PostConvolutionScale[BCOMP],
- ctx->Pixel.PostConvolutionScale[ACOMP],
- ctx->Pixel.PostConvolutionBias[RCOMP],
- ctx->Pixel.PostConvolutionBias[GCOMP],
- ctx->Pixel.PostConvolutionBias[BCOMP],
- ctx->Pixel.PostConvolutionBias[ACOMP]);
- }
+
/* clamping to [0,1] */
if (transferOps & IMAGE_CLAMP_BIT) {
GLuint i;
/**
* Used to pack an array [][4] of RGBA float colors as specified
- * by the dstFormat, dstType and dstPacking. Used by glReadPixels,
- * glGetConvolutionFilter(), etc.
+ * by the dstFormat, dstType and dstPacking. Used by glReadPixels.
* Note: the rgba values will be modified by this function when any pixel
* transfer ops are enabled.
*/
GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */
};
-
-/**
- * Image convolution state.
- */
-struct gl_convolution_attrib
-{
- GLenum Format;
- GLenum InternalFormat;
- GLuint Width;
- GLuint Height;
- GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4];
-};
-
-
/**
* Light state flags.
*/
GLboolean MapColorFlag;
GLboolean MapStencilFlag;
- /* Convolution (GL_EXT_convolution) */
- GLboolean Convolution1DEnabled;
- GLboolean Convolution2DEnabled;
- GLboolean Separable2DEnabled;
- GLfloat ConvolutionBorderColor[3][4]; /**< RGBA */
- GLenum ConvolutionBorderMode[3];
- GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */
- GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */
- GLfloat PostConvolutionScale[4]; /**< RGBA */
- GLfloat PostConvolutionBias[4]; /**< RGBA */
-
/*--- End Pixel Transfer State ---*/
/** glPixelZoom */
GLfloat LineWidthGranularity;
GLuint MaxColorTableSize;
- GLuint MaxConvolutionWidth;
- GLuint MaxConvolutionHeight;
GLuint MaxClipPlanes;
GLuint MaxLights;
GLboolean EXT_blend_subtract;
GLboolean EXT_clip_volume_hint;
GLboolean EXT_cull_vertex;
- GLboolean EXT_convolution;
GLboolean EXT_compiled_vertex_array;
GLboolean EXT_copy_texture;
GLboolean EXT_depth_bounds_test;
#define IMAGE_SCALE_BIAS_BIT 0x1
#define IMAGE_SHIFT_OFFSET_BIT 0x2
#define IMAGE_MAP_COLOR_BIT 0x4
-#define IMAGE_CONVOLUTION_BIT 0x10
-#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
#define IMAGE_CLAMP_BIT 0x800
-/** Pixel Transfer ops up to convolution */
-#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
- IMAGE_SHIFT_OFFSET_BIT | \
- IMAGE_MAP_COLOR_BIT)
-
-/** Pixel transfer ops after convolution */
-#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS)
-/*@}*/
-
+/** Pixel Transfer ops */
+#define IMAGE_BITS (IMAGE_SCALE_BIAS_BIT | \
+ IMAGE_SHIFT_OFFSET_BIT | \
+ IMAGE_MAP_COLOR_BIT)
/**
* \name Bits to indicate what state has changed.
/** \name Other assorted state (not pushed/popped on attribute stack) */
/*@{*/
struct gl_pixelmaps PixelMaps;
- struct gl_convolution_attrib Convolution1D;
- struct gl_convolution_attrib Convolution2D;
- struct gl_convolution_attrib Separable2D;
struct gl_evaluators EvalMap; /**< All evaluators */
struct gl_feedback Feedback; /**< Feedback */
FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.DepthBias = param;
break;
- case GL_POST_CONVOLUTION_RED_SCALE:
- if (ctx->Pixel.PostConvolutionScale[0] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionScale[0] = param;
- break;
- case GL_POST_CONVOLUTION_RED_BIAS:
- if (ctx->Pixel.PostConvolutionBias[0] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionBias[0] = param;
- break;
- case GL_POST_CONVOLUTION_GREEN_SCALE:
- if (ctx->Pixel.PostConvolutionScale[1] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionScale[1] = param;
- break;
- case GL_POST_CONVOLUTION_GREEN_BIAS:
- if (ctx->Pixel.PostConvolutionBias[1] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionBias[1] = param;
- break;
- case GL_POST_CONVOLUTION_BLUE_SCALE:
- if (ctx->Pixel.PostConvolutionScale[2] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionScale[2] = param;
- break;
- case GL_POST_CONVOLUTION_BLUE_BIAS:
- if (ctx->Pixel.PostConvolutionBias[2] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionBias[2] = param;
- break;
- case GL_POST_CONVOLUTION_ALPHA_SCALE:
- if (ctx->Pixel.PostConvolutionScale[3] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionScale[3] = param;
- break;
- case GL_POST_CONVOLUTION_ALPHA_BIAS:
- if (ctx->Pixel.PostConvolutionBias[3] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionBias[3] = param;
- break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
return;
if (ctx->Pixel.MapColorFlag)
mask |= IMAGE_MAP_COLOR_BIT;
- if (ctx->Pixel.Convolution1DEnabled ||
- ctx->Pixel.Convolution2DEnabled ||
- ctx->Pixel.Separable2DEnabled) {
- mask |= IMAGE_CONVOLUTION_BIT;
- if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
- ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
- ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
- ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
- ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
- ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
- ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
- ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
- mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
- }
- }
-
ctx->_ImageTransferState = mask;
}
void
_mesa_init_pixel( GLcontext *ctx )
{
- int i;
-
/* Pixel group */
ctx->Pixel.RedBias = 0.0;
ctx->Pixel.RedScale = 1.0;
init_pixelmap(&ctx->PixelMaps.GtoG);
init_pixelmap(&ctx->PixelMaps.BtoB);
init_pixelmap(&ctx->PixelMaps.AtoA);
- ctx->Pixel.Convolution1DEnabled = GL_FALSE;
- ctx->Pixel.Convolution2DEnabled = GL_FALSE;
- ctx->Pixel.Separable2DEnabled = GL_FALSE;
- for (i = 0; i < 3; i++) {
- ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0);
- ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE;
- ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0);
- }
- for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) {
- ctx->Convolution1D.Filter[i] = 0.0;
- ctx->Convolution2D.Filter[i] = 0.0;
- ctx->Separable2D.Filter[i] = 0.0;
- }
- ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0);
/* GL_SGI_texture_color_table */
ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
-#include "convolve.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 3 * srcWidth;
srcFormat = GL_RGB;
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
srcFormat = GL_RGBA;
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
-#include "convolve.h"
#include "dlopen.h"
#include "image.h"
#include "macros.h"
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 3 * srcWidth;
srcFormat = GL_RGB;
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
srcFormat = GL_RGBA;
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
}
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
}
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
-#include "convolve.h"
#include "enums.h"
#include "fbobject.h"
#include "framebuffer.h"
internalFormat = override_internal_format(internalFormat, width, 1);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (target == GL_TEXTURE_1D) {
/* non-proxy target */
struct gl_texture_object *texObj;
internalFormat = override_internal_format(internalFormat, width, height);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- /* XXX should test internal format */
- if (_mesa_is_color_format(format)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
postConvWidth, 1, 1, format, type)) {
return; /* error was detected */
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- /* XXX should test internal format */
- if (_mesa_is_color_format(format)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
postConvWidth, postConvHeight, 1, format, type)) {
return; /* error was detected */
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (copytexture_error_check(ctx, 1, target, level, internalFormat,
postConvWidth, 1, border))
return;
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (copytexture_error_check(ctx, 2, target, level, internalFormat,
postConvWidth, postConvHeight, border))
return;
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 1, target, level,
xoffset, 0, 0, postConvWidth, 1,
texImage)) {
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2,
- &postConvWidth, &postConvHeight);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 2, target, level,
xoffset, yoffset, 0,
postConvWidth, postConvHeight,
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2,
- &postConvWidth, &postConvHeight);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
zoffset, postConvWidth, postConvHeight,
texImage)) {
* Texture image processing is actually kind of complicated. We have to do:
* Format/type conversions
* pixel unpacking
- * pixel transfer (scale, bais, lookup, convolution!, etc)
+ * pixel transfer (scale, bais, lookup, etc)
*
* These functions can handle most everything, including processing full
* images and sub-images.
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
-#include "convolve.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
{
GLuint transferOps = ctx->_ImageTransferState;
GLfloat *tempImage;
+ const GLint components = _mesa_components_in_format(logicalBaseFormat);
+ const GLint srcStride =
+ _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
+ GLfloat *dst;
+ GLint img, row;
ASSERT(dims >= 1 && dims <= 3);
textureBaseFormat == GL_COLOR_INDEX ||
textureBaseFormat == GL_DEPTH_COMPONENT);
- /* conventional color image */
-
- if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) ||
- (dims >= 2 && ctx->Pixel.Convolution2DEnabled) ||
- (dims >= 2 && ctx->Pixel.Separable2DEnabled)) {
- /* need image convolution */
- const GLuint preConvTransferOps
- = (transferOps & IMAGE_PRE_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
- const GLuint postConvTransferOps
- = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
- GLint img, row;
- GLint convWidth = srcWidth, convHeight = srcHeight;
- GLfloat *convImage;
-
- /* pre-convolution image buffer (3D) */
- tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
- * 4 * sizeof(GLfloat));
- if (!tempImage)
- return NULL;
-
- /* post-convolution image buffer (2D) */
- convImage = (GLfloat *) malloc(srcWidth * srcHeight
- * 4 * sizeof(GLfloat));
- if (!convImage) {
- free(tempImage);
- return NULL;
- }
-
- /* loop over 3D image slices */
- for (img = 0; img < srcDepth; img++) {
- GLfloat *dst = tempImage + img * (srcWidth * srcHeight * 4);
-
- /* unpack and do transfer ops up to convolution */
- for (row = 0; row < srcHeight; row++) {
- const GLvoid *src = _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight,
- srcFormat, srcType, img, row, 0);
- _mesa_unpack_color_span_float(ctx, srcWidth, GL_RGBA, dst,
- srcFormat, srcType, src,
- srcPacking,
- preConvTransferOps);
- dst += srcWidth * 4;
- }
-
- /* size after optional convolution */
- convWidth = srcWidth;
- convHeight = srcHeight;
-
-#if FEATURE_convolve
- /* do convolution */
- {
- GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4);
- if (dims == 1) {
- ASSERT(ctx->Pixel.Convolution1DEnabled);
- _mesa_convolve_1d_image(ctx, &convWidth, src, convImage);
- }
- else {
- if (ctx->Pixel.Convolution2DEnabled) {
- _mesa_convolve_2d_image(ctx, &convWidth, &convHeight,
- src, convImage);
- }
- else {
- ASSERT(ctx->Pixel.Separable2DEnabled);
- _mesa_convolve_sep_image(ctx, &convWidth, &convHeight,
- src, convImage);
- }
- }
- }
-#endif
- /* do post-convolution transfer and pack into tempImage */
- {
- const GLint logComponents
- = _mesa_components_in_format(logicalBaseFormat);
- const GLfloat *src = convImage;
- GLfloat *dst = tempImage + img * (convWidth * convHeight * 4);
- for (row = 0; row < convHeight; row++) {
- _mesa_pack_rgba_span_float(ctx, convWidth,
- (GLfloat (*)[4]) src,
- logicalBaseFormat, GL_FLOAT,
- dst, &ctx->DefaultPacking,
- postConvTransferOps);
- src += convWidth * 4;
- dst += convWidth * logComponents;
- }
- }
- } /* loop over 3D image slices */
-
- free(convImage);
-
- /* might need these below */
- srcWidth = convWidth;
- srcHeight = convHeight;
- }
- else {
- /* no convolution */
- const GLint components = _mesa_components_in_format(logicalBaseFormat);
- const GLint srcStride =
- _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
- GLfloat *dst;
- GLint img, row;
-
- tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLfloat));
- if (!tempImage)
- return NULL;
+ tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
+ * components * sizeof(GLfloat));
+ if (!tempImage)
+ return NULL;
- dst = tempImage;
- for (img = 0; img < srcDepth; img++) {
- const GLubyte *src
- = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat,
- dst, srcFormat, srcType, src,
- srcPacking, transferOps);
- dst += srcWidth * components;
- src += srcStride;
- }
+ dst = tempImage;
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *src
+ = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat,
+ dst, srcFormat, srcType, src,
+ srcPacking, transferOps);
+ dst += srcWidth * components;
+ src += srcStride;
}
}
{
GLuint transferOps = ctx->_ImageTransferState;
const GLint components = _mesa_components_in_format(logicalBaseFormat);
- GLboolean freeSrcImage = GL_FALSE;
GLint img, row;
GLchan *tempImage, *dst;
textureBaseFormat == GL_ALPHA ||
textureBaseFormat == GL_INTENSITY);
-#if FEATURE_convolve
- if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) ||
- (dims >= 2 && ctx->Pixel.Convolution2DEnabled) ||
- (dims >= 2 && ctx->Pixel.Separable2DEnabled)) {
- /* get convolved image */
- GLfloat *convImage = make_temp_float_image(ctx, dims,
- logicalBaseFormat,
- logicalBaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
- if (!convImage)
- return NULL;
- /* the convolved image is our new source image */
- srcAddr = convImage;
- srcFormat = logicalBaseFormat;
- srcType = GL_FLOAT;
- srcPacking = &ctx->DefaultPacking;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- transferOps = 0;
- freeSrcImage = GL_TRUE;
- }
-#endif
-
/* unpack and transfer the source image */
tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLchan));
if (!tempImage) {
- if (freeSrcImage) {
- free((void *) srcAddr);
- }
return NULL;
}
}
}
- /* If we made a temporary image for convolution, free it here */
- if (freeSrcImage) {
- free((void *) srcAddr);
- }
-
if (logicalBaseFormat != textureBaseFormat) {
/* one more conversion step */
GLint texComponents = _mesa_components_in_format(textureBaseFormat);
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
-
/* Note: tempImage is always float[4] / RGBA. We convert to 1, 2,
* 3 or 4 components/pixel here.
*/
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
bytesPerRow = srcWidth * components * sizeof(GLfloat);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
GLint img, row;
if (!tempImage)
return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img] * texelBytes
* This is the software fallback for Driver.TexImage1D()
* and Driver.CopyTexImage1D().
* \sa _mesa_store_teximage2d()
- * Note that the width may not be the actual texture width since it may
- * be changed by convolution w/ GL_REDUCE. The texImage->Width field will
- * have the actual texture size.
*/
void
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
*
* This function is oriented toward storing images in main memory, rather
* than VRAM. Device driver's can easily plug in their own replacement.
- *
- * Note: width and height may be pre-convolved dimensions, but
- * texImage->Width and texImage->Height will be post-convolved dimensions.
*/
void
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
assert(ctx->ReadBuffer->Width > 0);
- /* XXX convolution not done yet */
- assert((transferOps & IMAGE_CONVOLUTION_BIT) == 0);
-
st_validate_state(st);
/* Do all needed clipping here, so that we can forget about it later */
DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target), level, width, height, depth, border);
- /* The Mesa/Gallium state tracker does not implement the imaging extensions
- * such as convolution.
- */
- assert(!ctx->Extensions.EXT_convolution);
-
/* switch to "normal" */
if (stObj->surface_based) {
_mesa_clear_texture_object(ctx, texObj);
#include "main/context.h"
#include "main/colormac.h"
#include "main/condrender.h"
-#include "main/convolve.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
/**
- * RGBA copypixels with convolution.
- */
-static void
-copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
- GLint width, GLint height, GLint destx, GLint desty)
-{
- GLint row;
- const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
- const GLbitfield transferOps = ctx->_ImageTransferState;
- GLfloat *dest, *tmpImage, *convImage;
- SWspan span;
-
- INIT_SPAN(span, GL_BITMAP);
- _swrast_span_default_attribs(ctx, &span);
- span.arrayMask = SPAN_RGBA;
- span.arrayAttribs = FRAG_BIT_COL0;
-
- /* allocate space for GLfloat image */
- tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!tmpImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
- return;
- }
- convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!convImage) {
- free(tmpImage);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
- return;
- }
-
- /* read source image as float/RGBA */
- dest = tmpImage;
- for (row = 0; row < height; row++) {
- _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, srcx, srcy + row, GL_FLOAT, dest);
- dest += 4 * width;
- }
-
- /* do the image transfer ops which preceed convolution */
- for (row = 0; row < height; row++) {
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4);
- _mesa_apply_rgba_transfer_ops(ctx,
- transferOps & IMAGE_PRE_CONVOLUTION_BITS,
- width, rgba);
- }
-
- /* do convolution */
- if (ctx->Pixel.Convolution2DEnabled) {
- _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage);
- }
- else {
- ASSERT(ctx->Pixel.Separable2DEnabled);
- _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
- }
- free(tmpImage);
-
- /* do remaining post-convolution image transfer ops */
- for (row = 0; row < height; row++) {
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) (convImage + row * width * 4);
- _mesa_apply_rgba_transfer_ops(ctx,
- transferOps & IMAGE_POST_CONVOLUTION_BITS,
- width, rgba);
- }
-
- /* write the new image */
- for (row = 0; row < height; row++) {
- const GLfloat *src = convImage + row * width * 4;
- GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
-
- /* copy convolved colors into span array */
- memcpy(rgba, src, width * 4 * sizeof(GLfloat));
-
- /* write span */
- span.x = destx;
- span.y = desty + row;
- span.end = width;
- span.array->ChanType = GL_FLOAT;
- if (zoom) {
- _swrast_write_zoomed_rgba_span(ctx, destx, desty, &span, rgba);
- }
- else {
- _swrast_write_rgba_span(ctx, &span);
- }
- }
- /* restore this */
- span.array->ChanType = CHAN_TYPE;
-
- free(convImage);
-}
-
-
-/**
* RGBA copypixels
*/
static void
return;
}
- if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
- copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty);
- return;
- }
- else if (ctx->Pixel.Convolution1DEnabled) {
- /* make sure we don't apply 1D convolution */
- transferOps &= ~(IMAGE_CONVOLUTION_BIT |
- IMAGE_POST_CONVOLUTION_SCALE_BIAS);
- }
-
if (ctx->DrawBuffer == ctx->ReadBuffer) {
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
#include "main/bufferobj.h"
#include "main/condrender.h"
#include "main/context.h"
-#include "main/convolve.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
span.arrayMask = SPAN_RGBA;
span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
- if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
- /* Convolution has to be handled specially. We'll create an
- * intermediate image, applying all pixel transfer operations
- * up to convolution. Then we'll convolve the image. Then
- * we'll proceed with the rest of the transfer operations and
- * rasterize the image.
- */
- GLint row;
- GLfloat *dest, *tmpImage;
-
- tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!tmpImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
- return;
- }
- convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!convImage) {
- free(tmpImage);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
- return;
- }
-
- /* Unpack the image and apply transfer ops up to convolution */
- dest = tmpImage;
- for (row = 0; row < height; row++) {
- const GLvoid *source = _mesa_image_address2d(unpack,
- pixels, width, height, format, type, row, 0);
- _mesa_unpack_color_span_float(ctx, width, GL_RGBA, (GLfloat *) dest,
- format, type, source, unpack,
- transferOps & IMAGE_PRE_CONVOLUTION_BITS);
- dest += width * 4;
- }
-
- /* do convolution */
- if (ctx->Pixel.Convolution2DEnabled) {
- _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage);
- }
- else {
- ASSERT(ctx->Pixel.Separable2DEnabled);
- _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
- }
- free(tmpImage);
-
- /* continue transfer ops and draw the convolved image */
- unpack = &ctx->DefaultPacking;
- pixels = convImage;
- format = GL_RGBA;
- type = GL_FLOAT;
- transferOps &= IMAGE_POST_CONVOLUTION_BITS;
- }
- else if (ctx->Pixel.Convolution1DEnabled) {
- /* we only want to apply 1D convolution to glTexImage1D */
- transferOps &= ~(IMAGE_CONVOLUTION_BIT |
- IMAGE_POST_CONVOLUTION_SCALE_BIAS);
- }
-
if (ctx->DrawBuffer->_NumColorDrawBuffers > 0 &&
ctx->DrawBuffer->_ColorDrawBuffers[0]->DataType != GL_FLOAT &&
ctx->Color.ClampFragmentColor != GL_FALSE) {
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/colormac.h"
-#include "main/convolve.h"
#include "main/feedback.h"
#include "main/formats.h"
#include "main/image.h"
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
- if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
- GLfloat *dest, *src, *tmpImage, *convImage;
- GLint row;
-
- tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!tmpImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
- return;
- }
- convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- if (!convImage) {
- free(tmpImage);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
- return;
- }
-
- /* read full RGBA, FLOAT image */
- dest = tmpImage;
- for (row = 0; row < height; row++, y++) {
- _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, dest);
- _mesa_apply_rgba_transfer_ops(ctx,
- transferOps & IMAGE_PRE_CONVOLUTION_BITS,
- width, (GLfloat (*)[4]) dest);
- dest += width * 4;
- }
-
- /* do convolution */
- if (ctx->Pixel.Convolution2DEnabled) {
- _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage);
- }
- else {
- ASSERT(ctx->Pixel.Separable2DEnabled);
- _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
- }
- free(tmpImage);
-
- /* finish transfer ops and pack the resulting image */
- src = convImage;
- for (row = 0; row < height; row++) {
- GLvoid *dest;
- dest = _mesa_image_address2d(packing, pixels, width, height,
- format, type, row, 0);
- _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) src,
- format, type, dest, packing,
- transferOps & IMAGE_POST_CONVOLUTION_BITS);
- src += width * 4;
- }
- free(convImage);
- }
- else {
- /* no convolution */
+ do {
const GLint dstStride
= _mesa_image_row_stride(packing, width, format, type);
GLfloat (*rgba)[4] = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0];
= (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
format, type, 0, 0);
- /* make sure we don't apply 1D convolution */
- transferOps &= ~(IMAGE_CONVOLUTION_BIT |
- IMAGE_POST_CONVOLUTION_SCALE_BIAS);
-
for (row = 0; row < height; row++, y++) {
/* Get float rgba pixels */
dst += dstStride;
}
- }
+ } while (0);
}