OSDN Git Service

mesa: New feature FEATURE_beginend.
authorChia-I Wu <olvaffe@gmail.com>
Sat, 12 Sep 2009 10:59:13 +0000 (18:59 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sun, 13 Sep 2009 09:06:16 +0000 (17:06 +0800)
This feature corresponds to the Begin/End paradigm.  Disabling this
feature also eliminates the use of GLvertexformat completely.

src/mesa/main/api_loopback.c
src/mesa/main/api_loopback.h
src/mesa/main/api_noop.c
src/mesa/main/api_noop.h
src/mesa/main/mfeatures.h
src/mesa/main/vtxfmt.c
src/mesa/main/vtxfmt.h
src/mesa/vbo/vbo_exec.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_exec_draw.c

index 0e3f5ff..3d466ac 100644 (file)
 #define FOGCOORDF(x)                CALL_FogCoordfEXT(GET_DISPATCH(), (x))
 #define SECONDARYCOLORF(a,b,c)      CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
 
+
+#if FEATURE_beginend
+
+
 static void GLAPIENTRY
 loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue )
 {
@@ -1655,3 +1659,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
    SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB);
    SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB);
 }
+
+
+#endif /* FEATURE_beginend */
index 6f85bbc..751cba2 100644 (file)
 #ifndef API_LOOPBACK_H
 #define API_LOOPBACK_H
 
-#include "glheader.h"
+#include "main/mtypes.h"
 
+#if FEATURE_beginend
 
 struct _glapi_table;
 
 extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
 
-#endif
+#else /* FEATURE_beginend */
+
+static INLINE void
+_mesa_loopback_init_api_table( struct _glapi_table *dest )
+{
+}
+
+#endif /* FEATURE_beginend */
+
+#endif /* API_LOOPBACK_H */
index a30c47d..cd67661 100644 (file)
@@ -43,6 +43,9 @@
  */
 
 
+#if FEATURE_beginend
+
+
 static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1064,3 +1067,6 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
    vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
    vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
 }
+
+
+#endif /* FEATURE_beginend */
index 1150984..e7fd49b 100644 (file)
@@ -25,8 +25,9 @@
 #ifndef _API_NOOP_H
 #define _API_NOOP_H
 
-#include "mtypes.h"
-#include "context.h"
+#include "main/mtypes.h"
+
+#if FEATURE_beginend
 
 extern void GLAPIENTRY
 _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
@@ -54,4 +55,6 @@ _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
 extern void
 _mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
 
-#endif
+#endif /* FEATURE_beginend */
+
+#endif /* _API_NOOP_H */
index a89b760..02083ec 100644 (file)
@@ -75,7 +75,7 @@
 #define FEATURE_colortable  _HAVE_FULL_GL
 #define FEATURE_convolve  _HAVE_FULL_GL
 #define FEATURE_dispatch  _HAVE_FULL_GL
-#define FEATURE_dlist  (_HAVE_FULL_GL && FEATURE_arrayelt)
+#define FEATURE_dlist  (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend)
 #define FEATURE_draw_read_buffer  _HAVE_FULL_GL
 #define FEATURE_drawpix  _HAVE_FULL_GL
 #define FEATURE_eval  _HAVE_FULL_GL
@@ -90,6 +90,7 @@
 #define FEATURE_texture_fxt1  _HAVE_FULL_GL
 #define FEATURE_texture_s3tc  _HAVE_FULL_GL
 #define FEATURE_userclip  _HAVE_FULL_GL
+#define FEATURE_beginend  _HAVE_FULL_GL
 #define FEATURE_vertex_array_byte 0
 #define FEATURE_es2_glsl 0
 
index 8ba1af6..6e0581f 100644 (file)
@@ -38,6 +38,9 @@
 #include "dlist.h"
 
 
+#if FEATURE_beginend
+
+
 /* The neutral vertex format.  This wraps all tnl module functions,
  * verifying that the currently-installed module is valid and then
  * installing the function pointers in a lazy fashion.  It records the
@@ -198,3 +201,6 @@ void _mesa_restore_exec_vtxfmt( GLcontext *ctx )
 
    tnl->SwapCount = 0;
 }
+
+
+#endif /* FEATURE_beginend */
index 76f108e..819a6ec 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef _VTXFMT_H_
 #define _VTXFMT_H_
 
+#if FEATURE_beginend
+
 extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );
 
 extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
@@ -40,4 +42,29 @@ extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfm
 
 extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx );
 
-#endif
+#else /* FEATURE_beginend */
+
+static INLINE void
+_mesa_init_exec_vtxfmt( GLcontext *ctx )
+{
+}
+
+static INLINE void
+_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+}
+
+static INLINE void
+_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+{
+}
+
+
+static INLINE void
+_mesa_restore_exec_vtxfmt( GLcontext *ctx )
+{
+}
+
+#endif /* FEATURE_beginend */
+
+#endif /* _VTXFMT_H_ */
index e0f4489..516be09 100644 (file)
@@ -161,8 +161,26 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec );
 
 void vbo_exec_vtx_init( struct vbo_exec_context *exec );
 void vbo_exec_vtx_destroy( struct vbo_exec_context *exec );
+
+#if FEATURE_beginend
+
 void vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap );
 void vbo_exec_vtx_map( struct vbo_exec_context *exec );
+
+#else /* FEATURE_beginend */
+
+static INLINE void
+vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
+{
+}
+
+static INLINE void
+vbo_exec_vtx_map( struct vbo_exec_context *exec )
+{
+}
+
+#endif /* FEATURE_beginend */
+
 void vbo_exec_vtx_wrap( struct vbo_exec_context *exec );
 
 void vbo_exec_eval_update( struct vbo_exec_context *exec );
index a81bd39..d105183 100644 (file)
@@ -348,7 +348,7 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx,
 }
 
 
-
+#if FEATURE_beginend
 
 /* 
  */
@@ -634,6 +634,98 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
 }
 
 
+#else /* FEATURE_beginend */
+
+
+#define ATTR( A, N, V0, V1, V2, V3 )                           \
+do {                                                           \
+   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;    \
+                                                               \
+   /* FLUSH_UPDATE_CURRENT needs to be set manually */         \
+   exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                \
+                                                               \
+   if (exec->vtx.active_sz[A] != N)                            \
+      vbo_exec_fixup_vertex(ctx, A, N);                                \
+                                                               \
+   {                                                           \
+      GLfloat *dest = exec->vtx.attrptr[A];                    \
+      if (N>0) dest[0] = V0;                                   \
+      if (N>1) dest[1] = V1;                                   \
+      if (N>2) dest[2] = V2;                                   \
+      if (N>3) dest[3] = V3;                                   \
+   }                                                           \
+} while (0)
+
+#define ERROR() _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ )
+#define TAG(x) vbo_##x
+
+#include "vbo_attrib_tmp.h"
+
+static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
+{
+   /* silence warnings */
+   (void) vbo_Color3f;
+   (void) vbo_Color3fv;
+   (void) vbo_Color4f;
+   (void) vbo_Color4fv;
+   (void) vbo_FogCoordfEXT;
+   (void) vbo_FogCoordfvEXT;
+   (void) vbo_MultiTexCoord1f;
+   (void) vbo_MultiTexCoord1fv;
+   (void) vbo_MultiTexCoord2f;
+   (void) vbo_MultiTexCoord2fv;
+   (void) vbo_MultiTexCoord3f;
+   (void) vbo_MultiTexCoord3fv;
+   (void) vbo_MultiTexCoord4f;
+   (void) vbo_MultiTexCoord4fv;
+   (void) vbo_Normal3f;
+   (void) vbo_Normal3fv;
+   (void) vbo_SecondaryColor3fEXT;
+   (void) vbo_SecondaryColor3fvEXT;
+   (void) vbo_TexCoord1f;
+   (void) vbo_TexCoord1fv;
+   (void) vbo_TexCoord2f;
+   (void) vbo_TexCoord2fv;
+   (void) vbo_TexCoord3f;
+   (void) vbo_TexCoord3fv;
+   (void) vbo_TexCoord4f;
+   (void) vbo_TexCoord4fv;
+   (void) vbo_Vertex2f;
+   (void) vbo_Vertex2fv;
+   (void) vbo_Vertex3f;
+   (void) vbo_Vertex3fv;
+   (void) vbo_Vertex4f;
+   (void) vbo_Vertex4fv;
+
+   (void) vbo_VertexAttrib1fARB;
+   (void) vbo_VertexAttrib1fvARB;
+   (void) vbo_VertexAttrib2fARB;
+   (void) vbo_VertexAttrib2fvARB;
+   (void) vbo_VertexAttrib3fARB;
+   (void) vbo_VertexAttrib3fvARB;
+   (void) vbo_VertexAttrib4fARB;
+   (void) vbo_VertexAttrib4fvARB;
+
+   (void) vbo_VertexAttrib1fNV;
+   (void) vbo_VertexAttrib1fvNV;
+   (void) vbo_VertexAttrib2fNV;
+   (void) vbo_VertexAttrib2fvNV;
+   (void) vbo_VertexAttrib3fNV;
+   (void) vbo_VertexAttrib3fvNV;
+   (void) vbo_VertexAttrib4fNV;
+   (void) vbo_VertexAttrib4fvNV;
+
+   (void) vbo_Materialfv;
+
+   (void) vbo_EdgeFlag;
+   (void) vbo_Indexf;
+   (void) vbo_Indexfv;
+}
+
+
+#endif /* FEATURE_beginend */
+
+
 /**
  * Tell the VBO module to use a real OpenGL vertex buffer object to
  * store accumulated immediate-mode vertex data.
index 0c258c5..ee148df 100644 (file)
@@ -35,6 +35,9 @@
 #include "vbo_context.h"
 
 
+#if FEATURE_beginend
+
+
 static void
 vbo_exec_debug_verts( struct vbo_exec_context *exec )
 {
@@ -411,3 +414,6 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
    exec->vtx.prim_count = 0;
    exec->vtx.vert_count = 0;
 }
+
+
+#endif /* FEATURE_beginend */