summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index b7e0da7d44e..d856bd8bd3d 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -344,10 +344,10 @@ vcache_check_run( struct draw_pt_front_end *frontend,
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
struct draw_context *draw = vcache->draw;
- unsigned min_index = draw->pt.user.min_index;
- unsigned max_index = draw->pt.user.max_index;
- unsigned index_size = draw->pt.user.eltSize;
- unsigned fetch_count = max_index + 1 - min_index;
+ const unsigned min_index = draw->pt.user.min_index;
+ const unsigned max_index = draw->pt.user.max_index;
+ const unsigned index_size = draw->pt.user.eltSize;
+ const unsigned fetch_count = max_index + 1 - min_index;
const ushort *transformed_elts;
ushort *storage = NULL;
boolean ok = FALSE;
@@ -357,6 +357,26 @@ vcache_check_run( struct draw_pt_front_end *frontend,
vcache->fetch_max,
draw_count);
+ /* debug: verify indexes are in range [min_index, max_index] */
+ if (0) {
+ unsigned i;
+ for (i = 0; i < draw_count; i++) {
+ if (index_size == 1) {
+ assert( ((const ubyte *) elts)[i] >= min_index);
+ assert( ((const ubyte *) elts)[i] <= max_index);
+ }
+ else if (index_size == 2) {
+ assert( ((const ushort *) elts)[i] >= min_index);
+ assert( ((const ushort *) elts)[i] <= max_index);
+ }
+ else {
+ assert(index_size == 4);
+ assert( ((const uint *) elts)[i] >= min_index);
+ assert( ((const uint *) elts)[i] <= max_index);
+ }
+ }
+ }
+
if (elt_bias + max_index >= DRAW_PIPE_MAX_VERTICES ||
fetch_count >= UNDEFINED_VERTEX_ID ||
fetch_count > draw_count) {