mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 01:30:08 +01:00
draw: added array element debug / bounds checking code (disabled)
This commit is contained in:
parent
2f6d47a7c8
commit
959a458ea0
1 changed files with 24 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue