summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_inlines.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-03 11:09:39 -0700
committerBrian Paul <[email protected]>2012-02-23 07:49:07 -0700
commit4fdf42883f4a2361facafc196fe0210ecbb0f607 (patch)
tree51b8353732f4ed02cb168e8d36f58b03ac42d7b0 /src/gallium/auxiliary/util/u_inlines.h
parentc68334ffc0a97406eedf11a6b8f4d846b236fb45 (diff)
gallium: added pipe_sampler_view_release() function
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_inlines.h')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index c90dc57073f..2fe680ff44c 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -135,6 +135,28 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
*ptr = view;
}
+/**
+ * Similar to pipe_sampler_view_reference() but always set the pointer to
+ * NULL and pass in an explicit context. Passing an explicit context is a
+ * work-around for fixing a dangling context pointer problem when textures
+ * are shared by multiple contexts. XXX fix this someday.
+ */
+static INLINE void
+pipe_sampler_view_release(struct pipe_context *ctx,
+ struct pipe_sampler_view **ptr)
+{
+ struct pipe_sampler_view *old_view = *ptr;
+ if (*ptr && (*ptr)->context != ctx) {
+ debug_printf_once(("context mis-match in pipe_sampler_view_release()\n"));
+ }
+ if (pipe_reference_described(&(*ptr)->reference, NULL,
+ (debug_reference_descriptor)debug_describe_sampler_view)) {
+ ctx->sampler_view_destroy(ctx, old_view);
+ }
+ *ptr = NULL;
+}
+
+
static INLINE void
pipe_so_target_reference(struct pipe_stream_output_target **ptr,
struct pipe_stream_output_target *target)