summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/enable.c18
-rw-r--r--src/mesa/main/get.c24
-rw-r--r--src/mesa/main/get_gen.py6
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/varray.c21
-rw-r--r--src/mesa/main/varray.h3
6 files changed, 76 insertions, 0 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d24564c3537..72787226dc4 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -990,6 +990,17 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
#endif
+ /* GL 3.1 primitive restart */
+ case GL_PRIMITIVE_RESTART:
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ goto invalid_enum_error;
+ }
+ if (ctx->Array.PrimitiveRestart != state) {
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Array.PrimitiveRestart = state;
+ }
+ break;
+
default:
goto invalid_enum_error;
}
@@ -1509,6 +1520,13 @@ _mesa_IsEnabled( GLenum cap )
return ctx->TransformFeedback.RasterDiscard;
#endif
+ /* GL 3.1 primitive restart */
+ case GL_PRIMITIVE_RESTART:
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ goto invalid_enum_error;
+ }
+ return ctx->Array.PrimitiveRestart;
+
default:
goto invalid_enum_error;
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index cb12737bd7a..f89a798f1b6 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1954,6 +1954,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_CONTEXT_FLAGS:
params[0] = INT_TO_BOOLEAN(ctx->Const.ContextFlags);
break;
+ case GL_PRIMITIVE_RESTART:
+ params[0] = ctx->Array.PrimitiveRestart;
+ break;
+ case GL_PRIMITIVE_RESTART_INDEX:
+ params[0] = INT_TO_BOOLEAN(ctx->Array.RestartIndex);
+ break;
case GL_CONTEXT_PROFILE_MASK:
params[0] = INT_TO_BOOLEAN(ctx->Const.ProfileMask);
break;
@@ -3856,6 +3862,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_CONTEXT_FLAGS:
params[0] = (GLfloat)(ctx->Const.ContextFlags);
break;
+ case GL_PRIMITIVE_RESTART:
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Array.PrimitiveRestart);
+ break;
+ case GL_PRIMITIVE_RESTART_INDEX:
+ params[0] = (GLfloat)(ctx->Array.RestartIndex);
+ break;
case GL_CONTEXT_PROFILE_MASK:
params[0] = (GLfloat)(ctx->Const.ProfileMask);
break;
@@ -5758,6 +5770,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_CONTEXT_FLAGS:
params[0] = ctx->Const.ContextFlags;
break;
+ case GL_PRIMITIVE_RESTART:
+ params[0] = BOOLEAN_TO_INT(ctx->Array.PrimitiveRestart);
+ break;
+ case GL_PRIMITIVE_RESTART_INDEX:
+ params[0] = ctx->Array.RestartIndex;
+ break;
case GL_CONTEXT_PROFILE_MASK:
params[0] = ctx->Const.ProfileMask;
break;
@@ -7661,6 +7679,12 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
case GL_CONTEXT_FLAGS:
params[0] = (GLint64)(ctx->Const.ContextFlags);
break;
+ case GL_PRIMITIVE_RESTART:
+ params[0] = BOOLEAN_TO_INT64(ctx->Array.PrimitiveRestart);
+ break;
+ case GL_PRIMITIVE_RESTART_INDEX:
+ params[0] = (GLint64)(ctx->Array.RestartIndex);
+ break;
case GL_CONTEXT_PROFILE_MASK:
params[0] = (GLint64)(ctx->Const.ProfileMask);
break;
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 63b64a97a93..0279ec9d1d3 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -1145,6 +1145,12 @@ StateVars = [
( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", NoState, NoExt ),
( "GL_CONTEXT_FLAGS", GLint, ["ctx->Const.ContextFlags"], "", NoState, NoExt ),
+ # GL 3.1
+ ( "GL_PRIMITIVE_RESTART", GLboolean,
+ ["ctx->Array.PrimitiveRestart"], "", NoState, NoExt ),
+ ( "GL_PRIMITIVE_RESTART_INDEX", GLint,
+ ["ctx->Array.RestartIndex"], "", NoState, NoExt ),
+
# GL 3.2
( "GL_CONTEXT_PROFILE_MASK", GLint, ["ctx->Const.ProfileMask"], "",
NoState, NoExt )
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a980405f019..349d5f51e66 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1547,6 +1547,10 @@ struct gl_array_attrib
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
+ /** GL 3.1 (slightly different from GL_NV_primitive_restart) */
+ GLboolean PrimitiveRestart;
+ GLuint RestartIndex;
+
GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */
#if FEATURE_ARB_vertex_buffer_object
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b4128f84d81..5f255b39b79 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1054,6 +1054,27 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
/**
+ * GL 3.1 glPrimitiveRestartIndex().
+ */
+void GLAPIENTRY
+_mesa_PrimitiveRestartIndex(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndex()");
+ return;
+ }
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+
+ ctx->Array.RestartIndex = index;
+}
+
+
+/**
* Copy one client vertex array to another.
*/
void
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index ef790c504ea..b7c3e11674e 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -174,6 +174,9 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
const GLvoid *indices,
GLint basevertex);
+extern void GLAPIENTRY
+_mesa_PrimitiveRestartIndex(GLuint index);
+
extern void
_mesa_copy_client_array(GLcontext *ctx,