aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/varray.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-16 16:08:57 +0000
committermarha <marha@users.sourceforge.net>2011-01-16 16:08:57 +0000
commit367c91bebcdc1f5ba4278b68eb8715218d9640ad (patch)
tree7ddef803c402f1b84e293793c5fd3d0e95d3de0a /mesalib/src/mesa/main/varray.c
parent6feea7e6cdde235d7e3727c4155ca9f8d90df3ca (diff)
downloadvcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.tar.gz
vcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.tar.bz2
vcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.zip
mesalib git update 16/1/2011
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r--mesalib/src/mesa/main/varray.c42
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;