mesa: Remove EXT_convolution.

More optional code.
This commit is contained in:
Eric Anholt 2010-09-09 19:37:15 -07:00
parent 73578ba9c4
commit a62efdf82c
27 changed files with 63 additions and 2210 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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

View file

@ -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,

View file

@ -69,9 +69,6 @@ struct gl_enable_attrib
GLboolean Blend;
GLbitfield ClipPlanes;
GLboolean ColorMaterial;
GLboolean Convolution1D;
GLboolean Convolution2D;
GLboolean Separable2D;
GLboolean CullFace;
GLboolean DepthClamp;
GLboolean DepthTest;
@ -259,9 +256,6 @@ _mesa_PushAttrib(GLbitfield mask)
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;
@ -516,12 +510,6 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
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);

View file

@ -557,8 +557,6 @@ _mesa_init_constants(GLcontext *ctx)
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;

File diff suppressed because it is too large Load diff

View file

@ -33,32 +33,6 @@
#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);
@ -66,50 +40,6 @@ _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)
{

View file

@ -558,15 +558,6 @@ struct dd_function_table {
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 );
/*@}*/

View file

@ -712,29 +712,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
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);
@ -1327,17 +1304,6 @@ _mesa_IsEnabled( GLenum 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);

View file

@ -116,7 +116,6 @@ static const struct {
{ 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) },
@ -303,7 +302,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
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;
@ -393,7 +391,6 @@ _mesa_enable_imaging_extensions(GLcontext *ctx)
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;
}

View file

@ -276,7 +276,6 @@ EXTRA_EXT(NV_fragment_program);
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);
@ -880,38 +879,6 @@ static const struct value_desc values[] = {
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),

View file

@ -1866,23 +1866,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
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;
@ -1988,8 +1972,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
/**
* 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.
*/

View file

@ -800,20 +800,6 @@ struct gl_hint_attrib
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.
*/
@ -954,17 +940,6 @@ struct gl_pixel_attrib
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 */
@ -2528,8 +2503,6 @@ struct gl_constants
GLfloat LineWidthGranularity;
GLuint MaxColorTableSize;
GLuint MaxConvolutionWidth;
GLuint MaxConvolutionHeight;
GLuint MaxClipPlanes;
GLuint MaxLights;
@ -2652,7 +2625,6 @@ struct gl_extensions
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;
@ -2769,20 +2741,13 @@ struct gl_matrix_stack
#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.
@ -3135,9 +3100,6 @@ struct __GLcontextRec
/** \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 */

View file

@ -566,54 +566,6 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param )
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;
@ -654,22 +606,6 @@ update_image_transfer_state(GLcontext *ctx)
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;
}
@ -721,8 +657,6 @@ init_pixelmap(struct gl_pixelmap *map)
void
_mesa_init_pixel( GLcontext *ctx )
{
int i;
/* Pixel group */
ctx->Pixel.RedBias = 0.0;
ctx->Pixel.RedScale = 1.0;
@ -750,22 +684,6 @@ _mesa_init_pixel( GLcontext *ctx )
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);

View file

@ -32,7 +32,6 @@
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
#include "convolve.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
@ -86,7 +85,6 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
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;
@ -143,7 +141,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
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;

View file

@ -36,7 +36,6 @@
#include "glheader.h"
#include "imports.h"
#include "colormac.h"
#include "convolve.h"
#include "dlopen.h"
#include "image.h"
#include "macros.h"
@ -187,7 +186,6 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
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;
@ -250,7 +248,6 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
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;
@ -312,7 +309,6 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
}
@ -373,7 +369,6 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
srcPacking);
if (!tempImage)
return GL_FALSE; /* out of memory */
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
pixels = tempImage;
srcRowStride = 4 * srcWidth;
}

View file

@ -33,7 +33,6 @@
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
#include "convolve.h"
#include "enums.h"
#include "fbobject.h"
#include "framebuffer.h"
@ -2243,12 +2242,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
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;
@ -2354,13 +2347,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
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 &&
@ -2649,13 +2635,6 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
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 */
@ -2715,14 +2694,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
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 */
@ -2843,12 +2814,6 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
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;
@ -2918,13 +2883,6 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
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;
@ -3004,12 +2962,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
{
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)) {
@ -3064,13 +3016,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
{
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,
@ -3127,13 +3072,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
{
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)) {

View file

@ -45,7 +45,7 @@
* 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.
@ -55,7 +55,6 @@
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
#include "convolve.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
@ -310,6 +309,11 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
{
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);
@ -331,126 +335,24 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
textureBaseFormat == GL_COLOR_INDEX ||
textureBaseFormat == GL_DEPTH_COMPONENT);
/* conventional color image */
tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLfloat));
if (!tempImage)
return NULL;
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;
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;
}
}
@ -536,7 +438,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
{
GLuint transferOps = ctx->_ImageTransferState;
const GLint components = _mesa_components_in_format(logicalBaseFormat);
GLboolean freeSrcImage = GL_FALSE;
GLint img, row;
GLchan *tempImage, *dst;
@ -556,37 +457,10 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
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;
}
@ -608,11 +482,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
}
}
/* 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);
@ -1238,7 +1107,6 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
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
@ -1365,7 +1233,6 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
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
@ -1567,7 +1434,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
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
@ -1697,7 +1563,6 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
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
@ -1824,7 +1689,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
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
@ -1882,7 +1746,6 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
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
@ -1951,7 +1814,6 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
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
@ -2010,7 +1872,6 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
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
@ -2115,7 +1976,6 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
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
@ -2186,7 +2046,6 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS)
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
@ -2257,7 +2116,6 @@ _mesa_texstore_rgba_16(TEXSTORE_PARAMS)
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
@ -2327,8 +2185,6 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS)
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.
*/
@ -2390,7 +2246,6 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
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
@ -2479,7 +2334,6 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
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
@ -2710,7 +2564,6 @@ _mesa_texstore_signed_r8(TEXSTORE_PARAMS)
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
@ -2755,7 +2608,6 @@ _mesa_texstore_signed_rg88(TEXSTORE_PARAMS)
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
@ -2800,7 +2652,6 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS)
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
@ -2912,7 +2763,6 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
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
@ -3186,7 +3036,6 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
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
@ -3254,7 +3103,6 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
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
@ -3318,7 +3166,6 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS)
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
@ -3382,7 +3229,6 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS)
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
@ -3446,7 +3292,6 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS)
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
@ -3510,7 +3355,6 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS)
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
@ -3574,7 +3418,6 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS)
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
@ -3638,7 +3481,6 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS)
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
@ -4057,9 +3899,6 @@ texture_row_stride(const struct gl_texture_image *texImage)
* 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,
@ -4114,9 +3953,6 @@ _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,

View file

@ -338,9 +338,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
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 */

View file

@ -545,11 +545,6 @@ st_TexImage(GLcontext * ctx,
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);

View file

@ -27,7 +27,6 @@
#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"
@ -93,98 +92,6 @@ regions_overlap(GLint srcx, GLint srcy,
}
/**
* 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
*/
@ -204,16 +111,6 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
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);

View file

@ -27,7 +27,6 @@
#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"
@ -484,62 +483,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
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) {

View file

@ -26,7 +26,6 @@
#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"
@ -326,57 +325,7 @@ read_rgba_pixels( GLcontext *ctx,
/* 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];
@ -385,10 +334,6 @@ read_rgba_pixels( GLcontext *ctx,
= (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 */
@ -407,7 +352,7 @@ read_rgba_pixels( GLcontext *ctx,
dst += dstStride;
}
}
} while (0);
}