diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2009-09-08 17:44:22 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2009-09-13 17:38:05 +0800 |
commit | dc2ddb27d392e68aa2139b54e5d73bbdac19d5a9 (patch) | |
tree | ab8c77f4e08e78913e77846834bfc7f7bac03383 /src/mesa | |
parent | 0fc1cd5e9125dfe86b9dc31ec8084ee1f28aef47 (diff) |
mesa/swrast: Respect mfeatures.h.
FEATURE_accum, FEATURE_convolve, FEATURE_colortable, and FEATURE_drawpix
cover part of the functionalities of swrast module. Disable them when
the features are disabled.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/common/driverfuncs.c | 19 | ||||
-rw-r--r-- | src/mesa/swrast/s_accum.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_accum.h | 11 | ||||
-rw-r--r-- | src/mesa/swrast/s_bitmap.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_feedback.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_feedback.h | 45 | ||||
-rw-r--r-- | src/mesa/swrast/s_imaging.c | 12 | ||||
-rw-r--r-- | src/mesa/swrast/swrast.h | 53 | ||||
-rw-r--r-- | src/mesa/swrast/swrast_features.h | 140 |
11 files changed, 247 insertions, 59 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 4d4d6ace7a..31a027e0e4 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -24,10 +24,14 @@ #include "main/glheader.h" +#include "main/accum.h" #include "main/imports.h" #include "main/arrayobj.h" #include "main/buffers.h" +#include "main/colortab.h" #include "main/context.h" +#include "main/convolve.h" +#include "main/drawpix.h" #include "main/framebuffer.h" #include "main/mipmap.h" #include "main/queryobj.h" @@ -85,14 +89,13 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* framebuffer/image functions */ driver->Clear = _swrast_Clear; - driver->Accum = _swrast_Accum; + + _MESA_INIT_ACCUM_FUNCTIONS(driver, _swrast_); + _MESA_INIT_DRAWPIX_FUNCTIONS(driver, _swrast_); _MESA_INIT_RASTPOS_FUNCTIONS(driver, _tnl_); - driver->DrawPixels = _swrast_DrawPixels; driver->ReadPixels = _swrast_ReadPixels; - driver->CopyPixels = _swrast_CopyPixels; - driver->Bitmap = _swrast_Bitmap; /* Texture functions */ driver->ChooseTextureFormat = _mesa_choose_tex_format; @@ -132,10 +135,10 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UpdateTexturePalette = NULL; /* imaging */ - driver->CopyColorTable = _swrast_CopyColorTable; - driver->CopyColorSubTable = _swrast_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + /* swrast does not need UpdateTexturePalette */ +#define _swrast_UpdateTexturePalette NULL + _MESA_INIT_COLORTABLE_FUNCTIONS(driver, _swrast_); + _MESA_INIT_CONVOLVE_FUNCTIONS(driver, _swrast_); /* Vertex/fragment programs */ driver->BindProgram = NULL; diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index c6c7dbf5cf..c29ccf2d9b 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -73,6 +73,9 @@ #endif +#if FEATURE_accum + + /** * This is called when we fall out of optimized/unscaled accum buffer mode. * That is, we convert each unscaled accum buffer value into a scaled value @@ -597,3 +600,6 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) swrast_render_finish(ctx); } + + +#endif /* FEATURE_accum */ diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h index 42e38cf02b..730c0254b2 100644 --- a/src/mesa/swrast/s_accum.h +++ b/src/mesa/swrast/s_accum.h @@ -30,8 +30,19 @@ #include "main/mtypes.h" +#if FEATURE_accum + extern void _swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); +#else /* FEATURE_accum */ + +static INLINE void +_swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + ASSERT_NO_FEATURE(); +} #endif + +#endif /* S_ACCUM_H */ diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 3dbdf2a61a..b7a28a46e9 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -38,6 +38,8 @@ #include "s_span.h" +#if FEATURE_drawpix + /** * Render a bitmap. @@ -226,3 +228,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, swrast_render_finish(ctx); } #endif + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 5ecfb1e90a..8f2db3afbb 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -40,6 +40,8 @@ #include "s_zoom.h" +#if FEATURE_drawpix + /** * Determine if there's overlap in an image copy. @@ -930,3 +932,6 @@ _swrast_CopyPixels( GLcontext *ctx, swrast_render_finish(ctx); } + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 6970b2e9cb..6ce449b2a8 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -39,6 +39,8 @@ #include "s_zoom.h" +#if FEATURE_drawpix + /** * Try to do a fast and simple RGB(a) glDrawPixels. @@ -896,3 +898,6 @@ _swrast_DrawPixels( GLcontext *ctx, _mesa_unmap_pbo_source(ctx, unpack); } + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 47ed25ee10..0eea1d0c3b 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -34,6 +34,8 @@ #include "s_triangle.h" +#if FEATURE_feedback + static void feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv) @@ -138,3 +140,6 @@ _swrast_select_point(GLcontext *ctx, const SWvertex *v) const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); } + + +#endif /* FEATURE_feedback */ diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h index 9feab75dbb..994984f6f7 100644 --- a/src/mesa/swrast/s_feedback.h +++ b/src/mesa/swrast/s_feedback.h @@ -31,6 +31,8 @@ #include "swrast.h" +#if FEATURE_feedback + extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ); extern void _swrast_feedback_line( GLcontext *ctx, @@ -46,5 +48,48 @@ extern void _swrast_select_line( GLcontext *ctx, extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); +#else /* FEATURE_feedback */ + +static INLINE void +_swrast_feedback_point( GLcontext *ctx, const SWvertex *v ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_feedback_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_point( GLcontext *ctx, const SWvertex *v ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} #endif + +#endif /* S_FEEDBACK_H */ diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c index 3578b713f6..7cc97b7f03 100644 --- a/src/mesa/swrast/s_imaging.c +++ b/src/mesa/swrast/s_imaging.c @@ -34,6 +34,9 @@ #include "s_span.h" +#if FEATURE_colortable + + void _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, @@ -103,6 +106,12 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, } +#endif /* FEATURE_colortable */ + + +#if FEATURE_convolve + + void _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, @@ -194,3 +203,6 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, ctx->Unpack = packSave; /* restore pixel packing params */ ctx->NewState |= _NEW_PACKUNPACK; } + + +#endif /* FEATURE_convolve */ diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index c319ca62f9..a85d69bfbf 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -33,6 +33,7 @@ #define SWRAST_H #include "main/mtypes.h" +#include "swrast_features.h" /** * \struct SWvertex @@ -102,28 +103,6 @@ extern struct swrast_device_driver * _swrast_GetDeviceDriverReference( GLcontext *ctx ); extern void -_swrast_Bitmap( GLcontext *ctx, - GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap ); - -extern void -_swrast_CopyPixels( GLcontext *ctx, - GLint srcx, GLint srcy, - GLint destx, GLint desty, - GLsizei width, GLsizei height, - GLenum type ); - -extern void -_swrast_DrawPixels( GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ); - -extern void _swrast_ReadPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -139,10 +118,6 @@ _swrast_BlitFramebuffer(GLcontext *ctx, extern void _swrast_Clear(GLcontext *ctx, GLbitfield buffers); -extern void -_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); - - /* Reset the stipple counter */ @@ -208,28 +183,6 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); /* - * Imaging fallbacks (a better solution should be found, perhaps - * moving all the imaging fallback code to a new module) - */ -extern void -_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, - GLsizei height); -extern void -_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorTable( GLcontext *ctx, - GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width); - - -/* * Texture fallbacks. Could also live in a new module * with the rest of the texture store fallbacks? */ @@ -287,6 +240,4 @@ struct swrast_device_driver { void (*SpanRenderFinish)(GLcontext *ctx); }; - - -#endif +#endif /* SWRAST_H */ diff --git a/src/mesa/swrast/swrast_features.h b/src/mesa/swrast/swrast_features.h new file mode 100644 index 0000000000..7b7b76460b --- /dev/null +++ b/src/mesa/swrast/swrast_features.h @@ -0,0 +1,140 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * \file swrast/swrast_features.h + * \brief Public interface to the software rasterization functions. + * \author Keith Whitwell <keith@tungstengraphics.com> + */ + +#ifndef SWRAST_FEATURES_H +#define SWRAST_FEATURES_H + +#include "main/mtypes.h" + + +#if FEATURE_accum + +extern void +_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); + +#endif + + +/* + * Imaging fallbacks (a better solution should be found, perhaps + * moving all the imaging fallback code to a new module) + */ +#if FEATURE_convolve + +extern void +_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, + GLsizei height); + +extern void +_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width); + +#endif + + +#if FEATURE_colortable + +extern void +_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); + +extern void +_swrast_CopyColorTable( GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + +#endif + + +#if FEATURE_drawpix + +extern void +_swrast_Bitmap( GLcontext *ctx, + GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, + GLint destx, GLint desty, + GLsizei width, GLsizei height, + GLenum type ); + +extern void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +#else /* FEATURE_drawpix */ + +static INLINE void +_swrast_Bitmap( GLcontext *ctx, + GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, + GLint destx, GLint desty, + GLsizei width, GLsizei height, + GLenum type ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + ASSERT_NO_FEATURE(); +} + +#endif + + +#endif /* SWRAST_FEATURES_H */ |