st/mesa: GL_ARB_instanced_arrays support
authorBrian Paul <brianp@vmware.com>
Sun, 16 Jan 2011 00:35:08 +0000 (17:35 -0700)
committerBrian Paul <brianp@vmware.com>
Sun, 16 Jan 2011 00:37:41 +0000 (17:37 -0700)
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_extensions.c

index b3256a3cb08c76b371436736084c39dc4fb30517..8e1263fe84eace4068fba31fd5a3138724070a81 100644 (file)
@@ -387,9 +387,16 @@ setup_interleaved_attribs(struct gl_context *ctx,
          vbuffer->max_index = max_index;
       }
 
+      /*
+      if (arrays[mesaAttr]->InstanceDivisor)
+         vbuffer[attr].max_index = arrays[mesaAttr]->_MaxElement;
+      else
+         vbuffer[attr].max_index = max_index;
+      */
+
       velements[attr].src_offset =
          (unsigned) (arrays[mesaAttr]->Ptr - offset0);
-      velements[attr].instance_divisor = 0;
+      velements[attr].instance_divisor = arrays[mesaAttr]->InstanceDivisor;
       velements[attr].vertex_buffer_index = 0;
       velements[attr].src_format =
          st_pipe_vertex_format(arrays[mesaAttr]->Type,
@@ -481,9 +488,13 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
 
       /* common-case setup */
       vbuffer[attr].stride = stride; /* in bytes */
-      vbuffer[attr].max_index = max_index;
+      if (arrays[mesaAttr]->InstanceDivisor)
+         vbuffer[attr].max_index = arrays[mesaAttr]->_MaxElement;
+      else
+         vbuffer[attr].max_index = max_index;
+
       velements[attr].src_offset = 0;
-      velements[attr].instance_divisor = 0;
+      velements[attr].instance_divisor = arrays[mesaAttr]->InstanceDivisor;
       velements[attr].vertex_buffer_index = attr;
       velements[attr].src_format
          = st_pipe_vertex_format(arrays[mesaAttr]->Type,
index df4f5cf8b5ce89531d5c0eb5921a57833de322d7..6798675fb89925a97385ed8cecca06383cb76777 100644 (file)
@@ -464,5 +464,6 @@ void st_init_extensions(struct st_context *st)
 
    if (screen->get_param(screen, PIPE_CAP_INSTANCED_DRAWING)) {
       ctx->Extensions.ARB_draw_instanced = GL_TRUE;
+      ctx->Extensions.ARB_instanced_arrays = GL_TRUE;
    }
 }