diff options
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_describe.h | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_refcnt.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_refcnt.h | 19 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 16 |
4 files changed, 30 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index 8c32f02ee5..33587ec879 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -5,6 +5,11 @@ extern "C" { #endif +struct pipe_reference; +struct pipe_resource; +struct pipe_surface; +struct pipe_sampler_view; + /* a 256-byte buffer is necessary and sufficient */ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index 9d6fca56ab..32e09ae1ae 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -84,7 +84,7 @@ static void dump_stack(const char* symbols[STACK_LEN]) os_stream_write(stream, "\n", 1); } -void debug_reference_slowpath(const struct pipe_reference* p, void* pget_desc, int change) +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) { if(debug_refcnt_state < 0) return; @@ -107,7 +107,6 @@ void debug_reference_slowpath(const struct pipe_reference* p, void* pget_desc, i const char* symbols[STACK_LEN]; char buf[1024]; - void (*get_desc)(char*, const struct pipe_reference*) = pget_desc; unsigned i; unsigned refcnt = p->count; unsigned serial; diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index ba40999bf2..4c4a18ecf9 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -15,19 +15,26 @@ extern "C" { #endif +typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*); + #if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) + extern int debug_refcnt_state; -void debug_reference_slowpath(const struct pipe_reference* p, void* get_desc, int change); +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change); -static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, int change) +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) { - if(debug_refcnt_state >= 0) - debug_reference_slowpath(p, get_desc, change); + if (debug_refcnt_state >= 0) + debug_reference_slowpath(p, get_desc, change); } + #else -static INLINE void debug_reference(const struct pipe_reference* p, void* get_desc, const char* op) -{} + +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) +{ +} + #endif #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 90b0903e3f..78473bf35a 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -69,7 +69,9 @@ pipe_is_referenced(struct pipe_reference *reference) * \return TRUE if the object's refcount hits zero and should be destroyed. */ static INLINE boolean -pipe_reference_described(struct pipe_reference *ptr, struct pipe_reference *reference, void* get_desc) +pipe_reference_described(struct pipe_reference *ptr, + struct pipe_reference *reference, + debug_reference_descriptor get_desc) { boolean destroy = FALSE; @@ -96,7 +98,8 @@ pipe_reference_described(struct pipe_reference *ptr, struct pipe_reference *refe static INLINE boolean pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) { - return pipe_reference_described(ptr, reference, debug_describe_reference); + return pipe_reference_described(ptr, reference, + (debug_reference_descriptor)debug_describe_reference); } static INLINE void @@ -104,7 +107,8 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf) { struct pipe_surface *old_surf = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &surf->reference, debug_describe_surface)) + if (pipe_reference_described(&(*ptr)->reference, &surf->reference, + (debug_reference_descriptor)debug_describe_surface)) old_surf->texture->screen->tex_surface_destroy(old_surf); *ptr = surf; } @@ -114,7 +118,8 @@ pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex) { struct pipe_resource *old_tex = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &tex->reference, debug_describe_resource)) + if (pipe_reference_described(&(*ptr)->reference, &tex->reference, + (debug_reference_descriptor)debug_describe_resource)) old_tex->screen->resource_destroy(old_tex->screen, old_tex); *ptr = tex; } @@ -124,7 +129,8 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ { struct pipe_sampler_view *old_view = *ptr; - if (pipe_reference_described(&(*ptr)->reference, &view->reference, debug_describe_sampler_view)) + if (pipe_reference_described(&(*ptr)->reference, &view->reference, + (debug_reference_descriptor)debug_describe_sampler_view)) old_view->context->sampler_view_destroy(old_view->context, old_view); *ptr = view; } |