From e446ef50eb8bbc2e3505c4d52e971d24c37785d6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:46:56 -0600 Subject: vbo: new debug/dump code (disabled) --- src/mesa/vbo/vbo_split_copy.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/mesa/vbo/vbo_split_copy.c') diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 2f6a1998ea..dcb14c868b 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -133,6 +133,41 @@ check_flush( struct copy_context *copy ) } +/** + * Dump the parameters/info for a vbo->draw() call. + */ +static void +dump_draw_info(GLcontext *ctx, + const struct gl_client_array **arrays, + const struct _mesa_prim *prims, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index) +{ + GLuint i, j; + + _mesa_printf("VBO Draw:\n"); + for (i = 0; i < nr_prims; i++) { + _mesa_printf("Prim %u of %u\n", i, nr_prims); + _mesa_printf(" Prim mode 0x%x\n", prims[i].mode); + _mesa_printf(" IB: %p\n", (void*) ib); + for (j = 0; j < VERT_ATTRIB_MAX; j++) { + _mesa_printf(" array %d at %p:\n", j, (void*) arrays[j]); + _mesa_printf(" enabled %d, ptr %p, size %d, type 0x%x, stride %d\n", + arrays[j]->Enabled, arrays[j]->Ptr, + arrays[j]->Size, arrays[j]->Type, arrays[j]->StrideB); + if (0) { + GLint k = prims[i].start + prims[i].count - 1; + GLfloat *last = (GLfloat *) (arrays[j]->Ptr + arrays[j]->Stride * k); + _mesa_printf(" last: %f %f %f\n", + last[0], last[1], last[2]); + } + } + } +} + + static void flush( struct copy_context *copy ) { @@ -142,6 +177,18 @@ flush( struct copy_context *copy ) */ copy->dstib.count = copy->dstelt_nr; +#if 0 + dump_draw_info(copy->ctx, + copy->dstarray_ptr, + copy->dstprim, + copy->dstprim_nr, + ©->dstib, + 0, + copy->dstbuf_nr); +#else + (void) dump_draw_info; +#endif + copy->draw( copy->ctx, copy->dstarray_ptr, copy->dstprim, @@ -207,6 +254,17 @@ elt(struct copy_context *copy, GLuint elt_idx) memcpy(csr, srcptr, copy->varying[i].size); csr += copy->varying[i].size; +#ifdef NAN_CHECK + if (srcarray->Type == GL_FLOAT) { + GLuint k; + GLfloat *f = (GLfloat *) srcptr; + for (k = 0; k < srcarray->Size; k++) { + assert(!IS_INF_OR_NAN(f[k])); + assert(f[k] <= 1.0e20 && f[k] >= -1.0e20); + } + } +#endif + if (0) { const GLuint *f = (const GLuint *)srcptr; -- cgit v1.2.3