diff options
author | Brian Paul <[email protected]> | 2013-01-21 11:37:07 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-01-22 14:53:58 -0700 |
commit | ed643d6b2fa11082f617f24040c73d2c58ca09bf (patch) | |
tree | b968bfa9f4059b8c1145931d045fbb3956b9e22f | |
parent | 4a938ef7136a89c828ebb16effe1bc5bea08b7d7 (diff) |
draw: improve the clipper debug/printf code
Reviewed-by: José Fonseca <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_clip.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index c02d0efed9d..878d7798802 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -42,6 +42,10 @@ #include "draw_fs.h" +/** Set to 1 to enable printing of coords before/after clipping */ +#define DEBUG_CLIP 0 + + #ifndef IS_NEGATIVE #define IS_NEGATIVE(X) ((X) < 0.0) #endif @@ -237,12 +241,17 @@ static void emit_poly( struct draw_stage *stage, if (i == n - 1 && edgeflags[i]) header.flags |= edge_last; - if (0) { + if (DEBUG_CLIP) { const struct draw_vertex_shader *vs = stage->draw->vs.vertex_shader; uint j, k; debug_printf("Clipped tri: (flat-shade-first = %d)\n", stage->draw->rasterizer->flatshade_first); for (j = 0; j < 3; j++) { + debug_printf(" Vert %d: clip: %f %f %f %f\n", j, + header.v[j]->clip[0], + header.v[j]->clip[1], + header.v[j]->clip[2], + header.v[j]->clip[3]); for (k = 0; k < vs->info.num_outputs; k++) { debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k, header.v[j]->data[k][0], @@ -315,6 +324,16 @@ do_clip_tri( struct draw_stage *stage, inlist[1] = header->v[1]; inlist[2] = header->v[2]; + if (DEBUG_CLIP) { + const float *v0 = header->v[0]->clip; + const float *v1 = header->v[1]->clip; + const float *v2 = header->v[2]->clip; + debug_printf("Clip triangle:\n"); + debug_printf(" %f, %f, %f, %f\n", v0[0], v0[1], v0[2], v0[3]); + debug_printf(" %f, %f, %f, %f\n", v1[0], v1[1], v1[2], v1[3]); + debug_printf(" %f, %f, %f, %f\n", v2[0], v2[1], v2[2], v2[3]); + } + /* * Note: at this point we can't just use the per-vertex edge flags. * We have to observe the edge flag bits set in header->flags which |