summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/enable.c23
-rw-r--r--src/mesa/main/get.c16
-rw-r--r--src/mesa/main/varray.c7
3 files changed, 40 insertions, 6 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5a5b199df32..af16c010b94 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -124,6 +124,14 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
#endif /* FEATURE_NV_vertex_program */
+ /* GL_NV_primitive_restart */
+ case GL_PRIMITIVE_RESTART_NV:
+ if (!ctx->Extensions.NV_primitive_restart) {
+ goto invalid_enum_error;
+ }
+ var = &ctx->Array.PrimitiveRestart;
+ break;
+
default:
goto invalid_enum_error;
}
@@ -945,9 +953,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
#endif
- /* GL 3.1 primitive restart */
+ /* GL 3.1 primitive restart. Note: this enum is different from
+ * GL_PRIMITIVE_RESTART_NV (which is client state).
+ */
case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
goto invalid_enum_error;
}
if (ctx->Array.PrimitiveRestart != state) {
@@ -1454,9 +1464,16 @@ _mesa_IsEnabled( GLenum cap )
return ctx->TransformFeedback.RasterDiscard;
#endif
+ /* GL_NV_primitive_restart */
+ case GL_PRIMITIVE_RESTART_NV:
+ if (!ctx->Extensions.NV_primitive_restart) {
+ goto invalid_enum_error;
+ }
+ return ctx->Array.PrimitiveRestart;
+
/* GL 3.1 primitive restart */
case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 8224c15627c..29a21deebc8 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -320,6 +320,12 @@ extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_progra
EXTRA_END
};
+static const int
+extra_NV_primitive_restart[] = {
+ EXT(NV_primitive_restart),
+ EXTRA_END
+};
+
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
@@ -1019,6 +1025,12 @@ static const struct value_desc values[] = {
{ GL_MAX_SPOT_EXPONENT_NV, CONTEXT_FLOAT(Const.MaxSpotExponent),
extra_NV_light_max_exponent },
+ /* GL_NV_primitive_restart */
+ { GL_PRIMITIVE_RESTART_NV, CONTEXT_BOOL(Array.PrimitiveRestart),
+ extra_NV_primitive_restart },
+ { GL_PRIMITIVE_RESTART_INDEX_NV, CONTEXT_INT(Array.RestartIndex),
+ extra_NV_primitive_restart },
+
/* GL_ARB_vertex_buffer_object */
{ GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
offsetof(struct gl_array_object, Index.BufferObj), NO_EXTRA },
@@ -1182,11 +1194,15 @@ static const struct value_desc values[] = {
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
/* GL 3.1 */
+ /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
+ * vs. GL_PRIMITIVE_RESTART!
+ */
{ GL_PRIMITIVE_RESTART, CONTEXT_BOOL(Array.PrimitiveRestart),
extra_version_31 },
{ GL_PRIMITIVE_RESTART_INDEX, CONTEXT_INT(Array.RestartIndex),
extra_version_31 },
+
/* GL 3.2 */
{ GL_CONTEXT_PROFILE_MASK, CONTEXT_INT(Const.ProfileMask),
extra_version_32 },
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index acab9e0e924..56749355cdf 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1315,15 +1315,16 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
/**
- * GL 3.1 glPrimitiveRestartIndex().
+ * GL_NV_primitive_restart and GL 3.1
*/
void GLAPIENTRY
_mesa_PrimitiveRestartIndex(GLuint index)
{
GET_CURRENT_CONTEXT(ctx);
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndex()");
+ if (!ctx->Extensions.NV_primitive_restart &&
+ ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
return;
}