Path: blob/21.2-virgl/src/gallium/auxiliary/util/u_debug_refcnt.h
4561 views
/**************************************************************************1*2* Copyright 2010 Luca Barbieri3*4* Permission is hereby granted, free of charge, to any person obtaining5* a copy of this software and associated documentation files (the6* "Software"), to deal in the Software without restriction, including7* without limitation the rights to use, copy, modify, merge, publish,8* distribute, sublicense, and/or sell copies of the Software, and to9* permit persons to whom the Software is furnished to do so, subject to10* the following conditions:11*12* The above copyright notice and this permission notice (including the13* next paragraph) shall be included in all copies or substantial14* portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,17* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF18* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.19* IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE20* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION21* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION22* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.23*24**************************************************************************/2526#ifndef U_DEBUG_REFCNT_H_27#define U_DEBUG_REFCNT_H_2829#include "pipe/p_config.h"30#include "pipe/p_state.h"3132#ifdef __cplusplus33extern "C" {34#endif3536typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*);3738#if defined(DEBUG)3940extern int debug_refcnt_state;4142void43debug_reference_slowpath(const struct pipe_reference* p,44debug_reference_descriptor get_desc, int change);4546static inline void47debug_reference(const struct pipe_reference* p,48debug_reference_descriptor get_desc, int change)49{50if (debug_refcnt_state >= 0)51debug_reference_slowpath(p, get_desc, change);52}5354#else5556static inline void57debug_reference(UNUSED const struct pipe_reference* p,58UNUSED debug_reference_descriptor get_desc, UNUSED int change)59{60}6162#endif6364#ifdef __cplusplus65}66#endif6768#endif /* U_DEBUG_REFCNT_H_ */697071