diff options
Diffstat (limited to 'src/gallium/auxiliary/util/u_inlines.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 79f62c32266..790352d7800 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -149,6 +149,12 @@ pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex) *ptr = tex; } +/** + * Set *ptr to \p view with proper reference counting. + * + * The caller must guarantee that \p view and *ptr must have been created in + * the same context (if they exist), and that this must be the current context. + */ static inline void pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) { @@ -162,18 +168,16 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ /** * 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. + * NULL and pass in the current context explicitly. + * + * If *ptr is non-NULL, it may refer to a view that was created in a different + * context (however, that context must still be alive). */ 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); |