diff options
-rw-r--r-- | src/gallium/drivers/trace/tr_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump.h | 36 |
2 files changed, 23 insertions, 15 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ba1882ea652..fed95c62a5c 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1077,7 +1077,7 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe, trace_dump_struct_array(vertex_buffer, buffers, num_buffers); trace_dump_arg_end(); - if (num_buffers) { + if (buffers) { struct pipe_vertex_buffer *_buffers = MALLOC(num_buffers * sizeof(*_buffers)); memcpy(_buffers, buffers, num_buffers * sizeof(*_buffers)); for (i = 0; i < num_buffers; i++) diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 5739e8694a0..ef0129281c1 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -137,26 +137,34 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer); #define trace_dump_array(_type, _obj, _size) \ do { \ - size_t idx; \ - trace_dump_array_begin(); \ - for(idx = 0; idx < (_size); ++idx) { \ - trace_dump_elem_begin(); \ - trace_dump_##_type((_obj)[idx]); \ - trace_dump_elem_end(); \ + if (_obj) { \ + size_t idx; \ + trace_dump_array_begin(); \ + for(idx = 0; idx < (_size); ++idx) { \ + trace_dump_elem_begin(); \ + trace_dump_##_type((_obj)[idx]); \ + trace_dump_elem_end(); \ + } \ + trace_dump_array_end(); \ + } else { \ + trace_dump_null(); \ } \ - trace_dump_array_end(); \ } while(0) #define trace_dump_struct_array(_type, _obj, _size) \ do { \ - size_t idx; \ - trace_dump_array_begin(); \ - for(idx = 0; idx < (_size); ++idx) { \ - trace_dump_elem_begin(); \ - trace_dump_##_type(&(_obj)[idx]); \ - trace_dump_elem_end(); \ + if (_obj) { \ + size_t idx; \ + trace_dump_array_begin(); \ + for(idx = 0; idx < (_size); ++idx) { \ + trace_dump_elem_begin(); \ + trace_dump_##_type(&(_obj)[idx]); \ + trace_dump_elem_end(); \ + } \ + trace_dump_array_end(); \ + } else { \ + trace_dump_null(); \ } \ - trace_dump_array_end(); \ } while(0) #define trace_dump_member(_type, _obj, _member) \ |