[Mesa-dev] [PATCH] mesa: Don't install glEvalMesh in the beginend dispatch table

Ian Romanick idr at freedesktop.org
Tue Feb 19 15:24:59 PST 2013


From: Ian Romanick <ian.d.romanick at intel.com>

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59740
Cc: Eric Anholt <eric at anholt.net>
---
 src/mesa/main/eval.c   | 11 ++++++++---
 src/mesa/main/eval.h   |  4 +++-
 src/mesa/main/vtxfmt.c | 10 +++++-----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c
index 44b5792..b3c2841 100644
--- a/src/mesa/main/eval.c
+++ b/src/mesa/main/eval.c
@@ -824,7 +824,8 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
 
 void
 _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
-                          const GLvertexformat *vfmt)
+                          const GLvertexformat *vfmt,
+                          bool beginend)
 {
    SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
    SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
@@ -833,8 +834,12 @@ _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
    SET_EvalPoint1(disp, vfmt->EvalPoint1);
    SET_EvalPoint2(disp, vfmt->EvalPoint2);
 
-   SET_EvalMesh1(disp, vfmt->EvalMesh1);
-   SET_EvalMesh2(disp, vfmt->EvalMesh2);
+   /* glEvalMesh1 and glEvalMesh2 are not allowed between glBegin and glEnd.
+    */
+   if (!beginend) {
+      SET_EvalMesh1(disp, vfmt->EvalMesh1);
+      SET_EvalMesh2(disp, vfmt->EvalMesh2);
+   }
 }
 
 
diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h
index 1b6c704..cfde53f 100644
--- a/src/mesa/main/eval.h
+++ b/src/mesa/main/eval.h
@@ -39,6 +39,7 @@
 
 #include "main/mfeatures.h"
 #include "main/mtypes.h"
+#include <stdbool.h>
 
 
 #define _MESA_INIT_EVAL_VTXFMT(vfmt, impl)         \
@@ -76,7 +77,8 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target,
 
 extern void
 _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
-                          const GLvertexformat *vfmt);
+                          const GLvertexformat *vfmt,
+                          bool beginend);
 
 extern void _mesa_init_eval( struct gl_context *ctx );
 extern void _mesa_free_eval_data( struct gl_context *ctx );
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 347d07d..8669c40 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -45,7 +45,7 @@
  */
 static void
 install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
-               const GLvertexformat *vfmt)
+               const GLvertexformat *vfmt, bool beginend)
 {
    assert(ctx->Version > 0);
 
@@ -62,7 +62,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
    }
 
    if (ctx->API == API_OPENGL_COMPAT) {
-      _mesa_install_eval_vtxfmt(tab, vfmt);
+      _mesa_install_eval_vtxfmt(tab, vfmt, beginend);
    }
 
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
@@ -251,9 +251,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
 void
 _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
 {
-   install_vtxfmt( ctx, ctx->Exec, vfmt );
+   install_vtxfmt(ctx, ctx->Exec, vfmt, false);
    if (ctx->BeginEnd)
-      install_vtxfmt( ctx, ctx->BeginEnd, vfmt );
+      install_vtxfmt(ctx, ctx->BeginEnd, vfmt, true);
 }
 
 
@@ -265,7 +265,7 @@ void
 _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
 {
    if (_mesa_is_desktop_gl(ctx))
-      install_vtxfmt( ctx, ctx->Save, vfmt );
+      install_vtxfmt(ctx, ctx->Save, vfmt, false);
 }
 
 
-- 
1.7.11.7



More information about the mesa-dev mailing list