diff options
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 2d4a6b54b..39855cbb0 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -534,11 +534,19 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, if (ctx->Extensions.EXT_gpu_shader4) {
return array->Integer;
}
- /* fall-through */
+ goto error;
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
+ if (ctx->Extensions.ARB_instanced_arrays) {
+ return array->InstanceDivisor;
+ }
+ goto error;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname);
- return 0;
+ ; /* fall-through */
}
+
+error:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname);
+ return 0;
}
@@ -1066,6 +1074,33 @@ _mesa_PrimitiveRestartIndex(GLuint index) /**
+ * See GL_ARB_instanced_arrays.
+ * Note that the instance divisor only applies to generic arrays, not
+ * the legacy vertex arrays.
+ */
+void GLAPIENTRY
+_mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (!ctx->Extensions.ARB_instanced_arrays) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
+ return;
+ }
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glVertexAttribDivisor(index = %u)",
+ index);
+ return;
+ }
+
+ ctx->Array.ArrayObj->VertexAttrib[index].InstanceDivisor = divisor;
+}
+
+
+
+/**
* Copy one client vertex array to another.
*/
void
@@ -1082,6 +1117,7 @@ _mesa_copy_client_array(struct gl_context *ctx, dst->Enabled = src->Enabled;
dst->Normalized = src->Normalized;
dst->Integer = src->Integer;
+ dst->InstanceDivisor = src->InstanceDivisor;
dst->_ElementSize = src->_ElementSize;
_mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
dst->_MaxElement = src->_MaxElement;
|