Mesa (master): mesa: plug in primitive restart function

Brian Paul brianp at kemper.freedesktop.org
Fri Oct 22 01:11:17 UTC 2010


Module: Mesa
Branch: master
Commit: b3de6e703d91da4f7f402f9ca33ccbbe31e97d99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3de6e703d91da4f7f402f9ca33ccbbe31e97d99

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Oct 21 19:03:38 2010 -0600

mesa: plug in primitive restart function

---

 src/mesa/main/api_exec.c |    3 +++
 src/mesa/main/api_noop.c |   12 ++++++++++++
 src/mesa/main/vtxfmt.c   |    3 +++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index ae653e1..2274e54 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -494,6 +494,9 @@ _mesa_create_exec_table(void)
    SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
 #endif
 
+   /* 285. GL_NV_primitive_restart */
+   SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
+
    /* ???. GL_EXT_depth_bounds_test */
    SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
 
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 9a36394..08b4b4a 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -679,6 +679,16 @@ static void GLAPIENTRY _mesa_noop_End( void )
 }
 
 
+/***
+ * PrimitiveRestart called outside glBegin()/End(): raise an error
+ */
+static void GLAPIENTRY _mesa_noop_PrimitiveRestartNV( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartNV(no glBegin)");
+}
+
+
 /**
  * Execute a glRectf() function.  This is not suitable for GL_COMPILE
  * modes (as the test for outside begin/end is not compiled),
@@ -1007,6 +1017,8 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
    vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
    vfmt->End = _mesa_noop_End;
 
+   vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV;
+
    _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_);
 
    vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 13b1aa9..9236bf8 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -92,7 +92,10 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
 
    SET_Begin(tab, vfmt->Begin);
    SET_End(tab, vfmt->End);
+   SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
+
    SET_Rectf(tab, vfmt->Rectf);
+
    SET_DrawArrays(tab, vfmt->DrawArrays);
    SET_DrawElements(tab, vfmt->DrawElements);
    SET_DrawRangeElements(tab, vfmt->DrawRangeElements);




More information about the mesa-commit mailing list