Module: Mesa
Branch: master
Commit: a6860f0913d5d4be0c73da963e84e97fc926225f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6860f0913d5d4be0c73da963e84e97fc926225f

Author: Brian Paul <bri...@vmware.com>
Date:   Sat Jan 15 17:35:08 2011 -0700

st/mesa: GL_ARB_instanced_arrays support

---

 src/mesa/state_tracker/st_draw.c       |   17 ++++++++++++++---
 src/mesa/state_tracker/st_extensions.c |    1 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b3256a3..8e1263f 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -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,
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index df4f5cf..6798675 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -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;
    }
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to