diff options
Diffstat (limited to 'src/mesa')
| -rw-r--r-- | src/mesa/main/api_exec.c | 19 | ||||
| -rw-r--r-- | src/mesa/main/convolve.c | 26 | ||||
| -rw-r--r-- | src/mesa/main/convolve.h | 67 | ||||
| -rw-r--r-- | src/mesa/main/teximage.c | 20 | ||||
| -rw-r--r-- | src/mesa/main/texstore.c | 17 | 
5 files changed, 82 insertions, 67 deletions
| diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 30c142e53a..6317639075 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -56,9 +56,7 @@  #include "clip.h"  #include "colortab.h"  #include "context.h" -#if FEATURE_convolve  #include "convolve.h" -#endif  #include "depth.h"  #if FEATURE_dlist  #include "dlist.h" @@ -384,21 +382,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)     SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);     _mesa_init_colortable_dispatch(exec); - -#if FEATURE_convolve -   SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); -   SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); -   SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); -   SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); -   SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); -   SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); -   SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); -   SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); -   SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); -   SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); -   SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); -   SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); -#endif +   _mesa_init_convolve_dispatch(exec);  #if FEATURE_histogram     SET_GetHistogram(exec, _mesa_GetHistogram);     SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); @@ -406,7 +390,6 @@ _mesa_init_exec_table(struct _glapi_table *exec)     SET_GetMinmax(exec, _mesa_GetMinmax);     SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);     SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); -   SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);     SET_Histogram(exec, _mesa_Histogram);     SET_Minmax(exec, _mesa_Minmax);     SET_ResetHistogram(exec, _mesa_ResetHistogram); diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 70951112a1..4bca436095 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -40,6 +40,10 @@  #include "mtypes.h"  #include "pixel.h"  #include "state.h" +#include "glapi/dispatch.h" + + +#if FEATURE_convolve  /* @@ -1425,3 +1429,25 @@ _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,        *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);     }  } + + +void  +_mesa_init_convolve_dispatch(struct _glapi_table *disp) +{ +   SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D); +   SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D); +   SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf); +   SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv); +   SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri); +   SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv); +   SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D); +   SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D); +   SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter); +   SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv); +   SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv); +   SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D); +   SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter); +} + + +#endif /* FEATURE_convolve */ diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h index 4505cdae01..565a51ef8f 100644 --- a/src/mesa/main/convolve.h +++ b/src/mesa/main/convolve.h @@ -28,10 +28,17 @@  #define CONVOLVE_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_convolve + +#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl)                        \ +   do {                                                                    \ +      (driver)->CopyConvolutionFilter1D = impl ## CopyConvolutionFilter1D; \ +      (driver)->CopyConvolutionFilter2D = impl ## CopyConvolutionFilter2D; \ +   } while (0) +  extern void GLAPIENTRY  _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,                            GLenum format, GLenum type, const GLvoid *image); @@ -83,32 +90,66 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalformat,                          const GLvoid *row, const GLvoid *column); -  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); -#else -#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0) -#define _mesa_convolve_1d_image(c,w,s,d) ((void)0) -#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0) -#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0) -#endif +extern void +_mesa_init_convolve_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_convolve */ + +#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0) + +static INLINE void +_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, +                        const GLfloat *srcImage, GLfloat *dstImage) +{ +   *width = 0; +} + +static INLINE void +_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, +                        const GLfloat *srcImage, GLfloat *dstImage) +{ +   *width = 0; +   *height = 0; +} + + +static INLINE void +_mesa_convolve_sep_image(const GLcontext *ctx, +                         GLsizei *width, GLsizei *height, +                         const GLfloat *srcImage, GLfloat *dstImage) +{ +   *width = 0; +   *height = 0; +} + +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) +{ +} + +#endif /* FEATURE_convolve */ -#endif +#endif /* CONVOLVE_H */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8228303040..a0304c02d4 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -33,9 +33,7 @@  #include "glheader.h"  #include "bufferobj.h"  #include "context.h" -#if FEATURE_convolve  #include "convolve.h" -#endif  #include "fbobject.h"  #include "framebuffer.h"  #include "hash.h" @@ -2133,11 +2131,9 @@ _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 */ @@ -2232,12 +2228,10 @@ _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 && @@ -2458,12 +2452,10 @@ _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)) { @@ -2518,13 +2510,11 @@ _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)) { @@ -2634,11 +2624,9 @@ _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)) @@ -2699,12 +2687,10 @@ _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)) @@ -2777,11 +2763,9 @@ _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, @@ -2832,12 +2816,10 @@ _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, texImage)) @@ -2887,12 +2869,10 @@ _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, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a22db628d3..fce01b185e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -56,9 +56,7 @@  #include "bufferobj.h"  #include "colormac.h"  #include "context.h" -#if FEATURE_convolve  #include "convolve.h" -#endif  #include "image.h"  #include "macros.h"  #include "mipmap.h" @@ -272,16 +270,6 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,  } -#if !FEATURE_convolve -static void -_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims, -                                   GLsizei *srcWidth, GLsizei *srcHeight) -{ -   /* no-op */ -} -#endif - -  /**   * Make a temporary (color) texture image with GLfloat components.   * Apply all needed pixel unpacking and pixel transfer operations. @@ -385,7 +373,6 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,           convWidth = srcWidth;           convHeight = srcHeight; -#if FEATURE_convolve           /* do convolution */           {              GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); @@ -405,7 +392,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,                 }              }           } -#endif +           /* do post-convolution transfer and pack into tempImage */           {              const GLint logComponents @@ -562,7 +549,6 @@ _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)) { @@ -584,7 +570,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,        transferOps = 0;        freeSrcImage = GL_TRUE;     } -#endif     /* unpack and transfer the source image */     tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth | 
