summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2009-09-23 16:56:20 +0800
committerBrian Paul <[email protected]>2009-09-24 21:48:39 -0600
commit5a1e25afac8eac5df1c0c9d3165b9812f54909a6 (patch)
tree76939ba9652acb5dbd465f8d3ac7cbc975b563ec
parentcb4f24e51d0f4f4b867b2c01ed26d2a5ce73aeab (diff)
mesa/main: Make FEATURE_convolve follow feature conventions.
As shown in mfeatures.h, this allows users of convolve.h to work without knowing if the feature is available.
-rw-r--r--src/mesa/main/api_exec.c19
-rw-r--r--src/mesa/main/convolve.c48
-rw-r--r--src/mesa/main/convolve.h118
-rw-r--r--src/mesa/main/teximage.c2
-rw-r--r--src/mesa/main/texstore.c2
5 files changed, 103 insertions, 86 deletions
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 30c142e53ac..63176390751 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 bf6f6619d4f..8db3e79d384 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
/*
@@ -256,7 +260,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
{
GET_CURRENT_CONTEXT(ctx);
@@ -299,7 +303,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
@@ -351,7 +355,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
{
GET_CURRENT_CONTEXT(ctx);
@@ -394,7 +398,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
@@ -459,7 +463,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
{
GLint baseFormat;
@@ -491,7 +495,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
{
GLint baseFormat;
@@ -527,7 +531,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
GLvoid *image)
{
@@ -586,7 +590,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
@@ -647,7 +651,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
@@ -717,7 +721,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span)
{
@@ -784,7 +788,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
}
-void GLAPIENTRY
+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;
@@ -1433,3 +1437,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 4505cdae01e..59492bc7c54 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);
@@ -41,74 +48,79 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
GLsizei height, GLenum format, GLenum type,
const GLvoid *image);
-extern void GLAPIENTRY
-_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameterfv(GLenum target, GLenum pname,
- const GLfloat *params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params);
-
-extern void GLAPIENTRY
-_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
-
-extern void GLAPIENTRY
-_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width);
+extern void
+_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
+ const GLfloat *srcImage, GLfloat *dstImage);
-extern void GLAPIENTRY
-_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width, GLsizei height);
+extern void
+_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage);
-extern void GLAPIENTRY
-_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *image);
+extern void
+_mesa_convolve_sep_image(const GLcontext *ctx,
+ GLsizei *width, GLsizei *height,
+ const GLfloat *srcImage, GLfloat *dstImage);
-extern void GLAPIENTRY
-_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
+extern void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+ GLsizei *width, GLsizei *height);
-extern void GLAPIENTRY
-_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
+extern void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp);
-extern void GLAPIENTRY
-_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *row, GLvoid *column, GLvoid *span);
+#else /* FEATURE_convolve */
-extern void GLAPIENTRY
-_mesa_SeparableFilter2D(GLenum target, GLenum internalformat,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *row, const GLvoid *column);
+#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0)
+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();
+}
-extern void
+static INLINE void
_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
- const GLfloat *srcImage, GLfloat *dstImage);
-
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ ASSERT_NO_FEATURE();
+}
-extern void
+static INLINE void
_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage);
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ ASSERT_NO_FEATURE();
+}
-extern void
+static INLINE void
_mesa_convolve_sep_image(const GLcontext *ctx,
GLsizei *width, GLsizei *height,
- const GLfloat *srcImage, GLfloat *dstImage);
-
+ const GLfloat *srcImage, GLfloat *dstImage)
+{
+ ASSERT_NO_FEATURE();
+}
-extern void
+static INLINE void
_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
- GLsizei *width, GLsizei *height);
+ GLsizei *width, GLsizei *height)
+{
+}
+
+static INLINE void
+_mesa_init_convolve_dispatch(struct _glapi_table *disp)
+{
+}
-#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
+#endif /* FEATURE_convolve */
-#endif
+#endif /* CONVOLVE_H */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b555624d882..465da6b0469 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 "enums.h"
#include "fbobject.h"
#include "framebuffer.h"
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index ab9973b8101..f553a898f9e 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"