summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_dump.h
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-11-05 11:18:07 +0000
committerJosé Fonseca <[email protected]>2012-11-05 11:18:07 +0000
commit3700bd115841958cc9c211475d3069298e4ff266 (patch)
treecb8769809e384c5094b2f363dbd7d4cabcf692cb /src/gallium/drivers/trace/tr_dump.h
parent99c45c5aa4b60e1fd55ff4fde6ff6d1a391987d9 (diff)
trace: Prevent segfault when passing NULL to set_vertex_buffers.
State tracker now passes NULL buffer array to unbind buffers.
Diffstat (limited to 'src/gallium/drivers/trace/tr_dump.h')
-rw-r--r--src/gallium/drivers/trace/tr_dump.h36
1 files changed, 22 insertions, 14 deletions
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) \