[Mesa-dev] [PATCH 07/10] mesa: remove GLvertexformat::Rectf()

Brian Paul brianp at vmware.com
Sun Apr 28 14:42:28 PDT 2013


As with the glDraw* functions, this doesn't have to be in GLvertexformat.
---
 src/mesa/main/dd.h            |    2 --
 src/mesa/main/dlist.c         |    5 ++---
 src/mesa/main/vtxfmt.c        |    2 --
 src/mesa/vbo/vbo_exec_api.c   |   23 -----------------------
 src/mesa/vbo/vbo_exec_array.c |   21 +++++++++++++++++++++
 src/mesa/vbo/vbo_noop.c       |    8 --------
 src/mesa/vbo/vbo_save_api.c   |   19 +------------------
 7 files changed, 24 insertions(+), 56 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 3c29e1e..05966c7 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1020,8 +1020,6 @@ typedef struct {
 
    /*@}*/
 
-   void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
-
    /**
     * \name Eval
     *
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 18c05f0..ae2a552 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -5703,7 +5703,7 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   SAVE_FLUSH_VERTICES(ctx);
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = alloc_instruction(ctx, OPCODE_RECTF, 4);
    if (n) {
       n[1].f = a;
@@ -8935,6 +8935,7 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_RasterPos4s(table, save_RasterPos4s);
    SET_RasterPos4sv(table, save_RasterPos4sv);
    SET_ReadBuffer(table, save_ReadBuffer);
+   SET_Rectf(table, save_Rectf);
    SET_Rotated(table, save_Rotated);
    SET_Rotatef(table, save_Rotatef);
    SET_Scaled(table, save_Scaled);
@@ -9633,8 +9634,6 @@ save_vtxfmt_init(GLvertexformat * vfmt)
    vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
    vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
    vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
-
-   vfmt->Rectf = save_Rectf;
 }
 
 
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index db389a5..3a0e7d3 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -112,8 +112,6 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_Begin(tab, vfmt->Begin);
       SET_End(tab, vfmt->End);
       SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
-
-      SET_Rectf(tab, vfmt->Rectf);
    }
 
    /* Originally for GL_NV_vertex_program, this is also used by dlist.c */
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 5fac363..93fa8d7 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -760,27 +760,6 @@ vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
 
 
 /**
- * Execute a glRectf() function.  This is not suitable for GL_COMPILE
- * modes (as the test for outside begin/end is not compiled),
- * but may be useful for drivers in circumstances which exclude
- * display list interactions.
- *
- * (None of the functions in this file are suitable for GL_COMPILE
- * modes).
- */
-static void GLAPIENTRY
-vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
-   CALL_Begin(GET_DISPATCH(), (GL_QUADS));
-   CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
-   CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
-   CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
-   CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
-   CALL_End(GET_DISPATCH(), ());
-}
-
-
-/**
  * Called via glBegin.
  */
 static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
@@ -928,8 +907,6 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
    vfmt->EvalMesh1 = vbo_exec_EvalMesh1;
    vfmt->EvalMesh2 = vbo_exec_EvalMesh2;
 
-   vfmt->Rectf = vbo_exec_Rectf;
-
    /* from attrib_tmp.h:
     */
    vfmt->Color3f = vbo_Color3f;
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 6d237a4..fdda6ab 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -628,6 +628,23 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
 }
 
 
+/**
+ * Execute a glRectf() function.
+ */
+static void GLAPIENTRY
+vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   CALL_Begin(GET_DISPATCH(), (GL_QUADS));
+   CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
+   CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
+   CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
+   CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
+   CALL_End(GET_DISPATCH(), ());
+}
+
 
 /**
  * Called from glDrawArrays when in immediate mode (not display list mode).
@@ -1377,6 +1394,10 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx,
 
    SET_MultiDrawElementsEXT(exec, vbo_exec_MultiDrawElements);
 
+   if (ctx->API == API_OPENGL_COMPAT) {
+      SET_Rectf(exec, vbo_exec_Rectf);
+   }
+
    if (_mesa_is_desktop_gl(ctx)) {
       SET_DrawElementsBaseVertex(exec, vbo_exec_DrawElementsBaseVertex);
       SET_DrawRangeElementsBaseVertex(exec, vbo_exec_DrawRangeElementsBaseVertex);
diff --git a/src/mesa/vbo/vbo_noop.c b/src/mesa/vbo/vbo_noop.c
index 41046e5..cff26bf 100644
--- a/src/mesa/vbo/vbo_noop.c
+++ b/src/mesa/vbo/vbo_noop.c
@@ -348,12 +348,6 @@ _mesa_noop_PrimitiveRestartNV(void)
 
 
 static void GLAPIENTRY
-_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
-}
-
-
-static void GLAPIENTRY
 _mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2)
 {
 }
@@ -444,8 +438,6 @@ _mesa_noop_vtxfmt_init(GLvertexformat * vfmt)
    vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
    vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
    vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
-
-   vfmt->Rectf = _mesa_noop_Rectf;
 }
 
 
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index a174ded..4d9a636 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -994,18 +994,6 @@ _save_End(void)
 
 
 static void GLAPIENTRY
-_save_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   (void) x1;
-   (void) y1;
-   (void) x2;
-   (void) y2;
-   _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glRectf");
-}
-
-
-static void GLAPIENTRY
 _save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1378,7 +1366,6 @@ _save_vtxfmt_init(struct gl_context *ctx)
     * only used when we're inside a glBegin/End pair.
     */
    vfmt->Begin = _save_Begin;
-   vfmt->Rectf = _save_Rectf;
 }
 
 
@@ -1395,6 +1382,7 @@ vbo_initialize_save_dispatch(const struct gl_context *ctx,
    SET_DrawRangeElements(exec, _save_OBE_DrawRangeElements);
    SET_MultiDrawElementsEXT(exec, _save_OBE_MultiDrawElements);
    SET_MultiDrawElementsBaseVertex(exec, _save_OBE_MultiDrawElementsBaseVertex);
+   SET_Rectf(exec, _save_OBE_Rectf);
    /* Note: other glDraw functins aren't compiled into display lists */
 }
 
@@ -1589,9 +1577,4 @@ vbo_save_api_init(struct vbo_save_context *save)
    /* These will actually get set again when binding/drawing */
    for (i = 0; i < VBO_ATTRIB_MAX; i++)
       save->inputs[i] = &save->arrays[i];
-
-   /* Hook our array functions into the outside-begin-end vtxfmt in 
-    * ctx->ListState.
-    */
-   ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf;
 }
-- 
1.7.3.4



More information about the mesa-dev mailing list