From: Mathias Fröhlich Date: Fri, 17 Jun 2016 06:09:05 +0000 (+0200) Subject: vbo: Walk the VAO in print_draw_arrays. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99b42184f998803c57beb3eec085bdb7f388ec22;p=mesa.git 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 Reviewed-by: Eric Anholt --- diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 2d5b0dc8d72..48182ab933b 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);