Mesa (master): vbo: Walk the VAO in print_draw_arrays.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Sun Jul 31 19:54:47 UTC 2016


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

Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date:   Fri Jun 17 08:09:05 2016 +0200

vbo: Walk the VAO in print_draw_arrays.

Only a debugging function, but move away from
gl_client_array and use the first order information
from the VAO. Also make use of gl_vert_attrib_name.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/vbo/vbo_exec_array.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 2d5b0dc..48182ab 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -230,37 +230,37 @@ static void
 print_draw_arrays(struct gl_context *ctx,
                   GLenum mode, GLint start, GLsizei count)
 {
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   struct gl_vertex_array_object *vao = ctx->Array.VAO;
-   int i;
+   const struct gl_vertex_array_object *vao = ctx->Array.VAO;
 
    printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
 	  mode, start, count);
 
-   for (i = 0; i < 32; i++) {
-      struct gl_buffer_object *bufObj = exec->array.inputs[i]->BufferObj;
-      GLuint bufName = bufObj->Name;
-      GLint stride = exec->array.inputs[i]->Stride;
-      printf("attr %2d: size %d stride %d  enabled %d  "
+   unsigned i;
+   for (i = 0; i < VERT_ATTRIB_MAX; ++i) {
+      const struct gl_vertex_attrib_array *array = &vao->VertexAttrib[i];
+      if (!array->Enabled)
+         continue;
+
+      const struct gl_vertex_buffer_binding *binding =
+         &vao->VertexBinding[array->VertexBinding];
+      struct gl_buffer_object *bufObj = binding->BufferObj;
+
+      printf("attr %s: size %d stride %d  enabled %d  "
 	     "ptr %p  Bufobj %u\n",
-	     i,
-	     exec->array.inputs[i]->Size,
-	     stride,
-	     /*exec->array.inputs[i]->Enabled,*/
-	     vao->_VertexAttrib[VERT_ATTRIB_FF(i)].Enabled,
-	     exec->array.inputs[i]->Ptr,
-	     bufName);
-
-      if (bufName) {
+             gl_vert_attrib_name((gl_vert_attrib)i),
+	     array->Size, binding->Stride, array->Enabled,
+             array->Ptr, bufObj->Name);
+
+      if (_mesa_is_bufferobj(bufObj)) {
          GLubyte *p = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size,
 						 GL_MAP_READ_BIT, bufObj,
                                                  MAP_INTERNAL);
-         int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
+         int offset = (int) (GLintptr)
+            _mesa_vertex_attrib_address(array, binding);
          float *f = (float *) (p + offset);
          int *k = (int *) f;
          int i;
-         int n = (count * stride) / 4;
+         int n = (count * binding->Stride) / 4;
          if (n > 32)
             n = 32;
          printf("  Data at offset %d:\n", offset);




More information about the mesa-commit mailing list