OSDN Git Service

mesa/swrast: Respect mfeatures.h.
authorChia-I Wu <olvaffe@gmail.com>
Tue, 8 Sep 2009 09:44:22 +0000 (17:44 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sun, 13 Sep 2009 09:38:05 +0000 (17:38 +0800)
FEATURE_accum, FEATURE_convolve, FEATURE_colortable, and FEATURE_drawpix
cover part of the functionalities of swrast module.  Disable them when
the features are disabled.

src/mesa/drivers/common/driverfuncs.c
src/mesa/swrast/s_accum.c
src/mesa/swrast/s_accum.h
src/mesa/swrast/s_bitmap.c
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_feedback.c
src/mesa/swrast/s_feedback.h
src/mesa/swrast/s_imaging.c
src/mesa/swrast/swrast.h
src/mesa/swrast/swrast_features.h [new file with mode: 0644]

index 4d4d6ac..31a027e 100644 (file)
 
 
 #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;
index c6c7dbf..c29ccf2 100644 (file)
@@ -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 */
index 42e38cf..730c025 100644 (file)
 #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 */
index 3dbdf2a..b7a28a4 100644 (file)
@@ -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 */
index 5ecfb1e..8f2db3a 100644 (file)
@@ -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 */
index 6970b2e..6ce449b 100644 (file)
@@ -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 */
index 47ed25e..0eea1d0 100644 (file)
@@ -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 */
index 9feab75..994984f 100644 (file)
@@ -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 */
index 3578b71..7cc97b7 100644 (file)
@@ -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 */
index c319ca6..a85d69b 100644 (file)
@@ -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 (file)
index 0000000..7b7b764
--- /dev/null
@@ -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 */