mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
libs/vkd3d: Make vkd3d debug compatible with MinGW headers.
This commit is contained in:
parent
821d978950
commit
ef80cdedc3
@ -139,7 +139,6 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
|||||||
|
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
# define DECLSPEC_SELECTANY __attribute__((weak))
|
# define DECLSPEC_SELECTANY __attribute__((weak))
|
||||||
# define DECLSPEC_HIDDEN __attribute__((visibility("hidden")))
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Macros for COM interfaces */
|
/* Macros for COM interfaces */
|
||||||
@ -190,6 +189,17 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
|
|||||||
# endif /* NONAMELESSUNION */
|
# endif /* NONAMELESSUNION */
|
||||||
#endif /* __C89_NAMELESS */
|
#endif /* __C89_NAMELESS */
|
||||||
|
|
||||||
|
/* Define DECLSPEC_HIDDEN */
|
||||||
|
#ifndef DECLSPEC_HIDDEN
|
||||||
|
# if defined(__MINGW32__)
|
||||||
|
# define DECLSPEC_HIDDEN
|
||||||
|
# elif defined(__GNUC__)
|
||||||
|
# define DECLSPEC_HIDDEN __attribute__((visibility("hidden")))
|
||||||
|
# else
|
||||||
|
# define DECLSPEC_HIDDEN
|
||||||
|
# endif
|
||||||
|
#endif /* DECLSPEC_HIDDEN */
|
||||||
|
|
||||||
/* Define min() & max() macros */
|
/* Define min() & max() macros */
|
||||||
#ifndef min
|
#ifndef min
|
||||||
# define min(a, b) (((a) <= (b)) ? (a) : (b))
|
# define min(a, b) (((a) <= (b)) ? (a) : (b))
|
||||||
|
@ -84,8 +84,8 @@ void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const ch
|
|||||||
static char *get_buffer(void)
|
static char *get_buffer(void)
|
||||||
{
|
{
|
||||||
static char buffers[64][VKD3D_DEBUG_BUFFER_SIZE];
|
static char buffers[64][VKD3D_DEBUG_BUFFER_SIZE];
|
||||||
static unsigned int buffer_index;
|
static ULONG buffer_index;
|
||||||
unsigned int current_index;
|
ULONG current_index;
|
||||||
|
|
||||||
current_index = InterlockedIncrement(&buffer_index) % ARRAY_SIZE(buffers);
|
current_index = InterlockedIncrement(&buffer_index) % ARRAY_SIZE(buffers);
|
||||||
return buffers[current_index];
|
return buffers[current_index];
|
||||||
|
@ -28,22 +28,24 @@
|
|||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||||
|
|
||||||
#if HAVE_SYNC_ADD_AND_FETCH
|
#ifndef _WIN32
|
||||||
|
# if HAVE_SYNC_ADD_AND_FETCH
|
||||||
static inline ULONG InterlockedIncrement(ULONG volatile *x)
|
static inline ULONG InterlockedIncrement(ULONG volatile *x)
|
||||||
{
|
{
|
||||||
return __sync_add_and_fetch(x, 1);
|
return __sync_add_and_fetch(x, 1);
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
# error "InterlockedIncrement not implemented for this platform"
|
# error "InterlockedIncrement not implemented for this platform"
|
||||||
#endif /* HAVE_SYNC_ADD_AND_FETCH */
|
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||||
|
|
||||||
#if HAVE_SYNC_SUB_AND_FETCH
|
# if HAVE_SYNC_SUB_AND_FETCH
|
||||||
static inline ULONG InterlockedDecrement(ULONG volatile *x)
|
static inline ULONG InterlockedDecrement(ULONG volatile *x)
|
||||||
{
|
{
|
||||||
return __sync_sub_and_fetch(x, 1);
|
return __sync_sub_and_fetch(x, 1);
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
# error "InterlockedDecrement not implemented for this platform"
|
# error "InterlockedDecrement not implemented for this platform"
|
||||||
#endif
|
# endif
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#endif /* __VKD3D_COMMON_H */
|
#endif /* __VKD3D_COMMON_H */
|
||||||
|
@ -72,10 +72,10 @@ static inline const char *debugstr_guid(const GUID *guid)
|
|||||||
if (!guid)
|
if (!guid)
|
||||||
return "(null)";
|
return "(null)";
|
||||||
|
|
||||||
return vkd3d_dbg_sprintf("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
return vkd3d_dbg_sprintf("{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||||
guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1],
|
(unsigned long)guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
|
||||||
guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5],
|
guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
|
||||||
guid->Data4[6], guid->Data4[7]);
|
guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __VKD3D_DEBUG_H */
|
#endif /* __VKD3D_DEBUG_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user