summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_context.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-02-15 10:42:32 -0700
committerBrian Paul <[email protected]>2013-02-15 11:11:34 -0700
commit2ef530cf68f7b837db6750e7a4b1ba9e71aad062 (patch)
treeebb021cefd1833f4ddf632b20a49a8bece819cff /src/gallium/drivers/trace/tr_context.c
parent82d62cf04f3c585ba324fcef16417fbee4a3d220 (diff)
trace: add context pointer sanity checking
To help catch mixed up context pointer bugs in the future, add a trace_context_check() function and some new assertions. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/trace/tr_context.c')
-rw-r--r--src/gallium/drivers/trace/tr_context.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index b88f37999e9..538ff4afc9e 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -852,6 +852,8 @@ trace_context_sampler_view_destroy(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_sampler_view *view = tr_view->sampler_view;
+ assert(_view->context == _pipe);
+
trace_dump_call_begin("pipe_context", "sampler_view_destroy");
trace_dump_arg(ptr, pipe);
@@ -1610,3 +1612,16 @@ trace_context_create(struct trace_screen *tr_scr,
error1:
return pipe;
}
+
+
+/**
+ * Sanity checker: check that the given context really is a
+ * trace context (and not the wrapped driver's context).
+ */
+void
+trace_context_check(const struct pipe_context *pipe)
+{
+ struct trace_context *tr_ctx = (struct trace_context *) pipe;
+ assert(tr_ctx->base.destroy == trace_context_destroy);
+}
+