19#ifndef __VKD3D_COMMON_H
20#define __VKD3D_COMMON_H
23#define WIN32_LEAN_AND_MEAN
42# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
45#define DIV_ROUND_UP(a, b) ((a) % (b) == 0 ? (a) / (b) : (a) / (b) + 1)
47#define STATIC_ASSERT(e) extern void __VKD3D_STATIC_ASSERT__(int [(e) ? 1 : -1])
49#define VKD3D_ASSERT(cond) \
52 ERR("Failed assertion: %s\n", #cond); \
55#define MEMBER_SIZE(t, m) sizeof(((t *)0)->m)
57#define VKD3D_MAKE_TAG(ch0, ch1, ch2, ch3) \
58 ((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) \
59 | ((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24))
61#define VKD3D_EXPAND(x) x
62#define VKD3D_STRINGIFY(x) #x
63#define VKD3D_EXPAND_AND_STRINGIFY(x) VKD3D_EXPAND(VKD3D_STRINGIFY(x))
65#define vkd3d_clamp(value, lower, upper) max(min(value, upper), lower)
67#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
68#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
69#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')
70#define TAG_FX10 VKD3D_MAKE_TAG('F', 'X', '1', '0')
71#define TAG_ISG1 VKD3D_MAKE_TAG('I', 'S', 'G', '1')
72#define TAG_ISGN VKD3D_MAKE_TAG('I', 'S', 'G', 'N')
73#define TAG_OSG1 VKD3D_MAKE_TAG('O', 'S', 'G', '1')
74#define TAG_OSG5 VKD3D_MAKE_TAG('O', 'S', 'G', '5')
75#define TAG_OSGN VKD3D_MAKE_TAG('O', 'S', 'G', 'N')
76#define TAG_PCSG VKD3D_MAKE_TAG('P', 'C', 'S', 'G')
77#define TAG_PSG1 VKD3D_MAKE_TAG('P', 'S', 'G', '1')
78#define TAG_RD11 VKD3D_MAKE_TAG('R', 'D', '1', '1')
79#define TAG_RDEF VKD3D_MAKE_TAG('R', 'D', 'E', 'F')
80#define TAG_RTS0 VKD3D_MAKE_TAG('R', 'T', 'S', '0')
81#define TAG_SDBG VKD3D_MAKE_TAG('S', 'D', 'B', 'G')
82#define TAG_SFI0 VKD3D_MAKE_TAG('S', 'F', 'I', '0')
83#define TAG_SHDR VKD3D_MAKE_TAG('S', 'H', 'D', 'R')
84#define TAG_SHEX VKD3D_MAKE_TAG('S', 'H', 'E', 'X')
85#define TAG_STAT VKD3D_MAKE_TAG('S', 'T', 'A', 'T')
86#define TAG_TEXT VKD3D_MAKE_TAG('T', 'E', 'X', 'T')
87#define TAG_XNAP VKD3D_MAKE_TAG('X', 'N', 'A', 'P')
88#define TAG_XNAS VKD3D_MAKE_TAG('X', 'N', 'A', 'S')
90#define TAG_RD11_REVERSE 0x25441313
97#if defined(__GNUC__) || defined(__clang__)
98# define VKD3D_NORETURN __attribute__((noreturn))
99# ifdef __MINGW_PRINTF_FORMAT
100# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args)))
102# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args)))
104# define VKD3D_UNUSED __attribute__((unused))
105# define VKD3D_UNREACHABLE __builtin_unreachable()
106#elif defined(_MSC_VER)
107# define VKD3D_NORETURN __declspec(noreturn)
108# define VKD3D_PRINTF_FUNC(fmt, args)
110# define VKD3D_UNREACHABLE __assume(0)
111# define __alignof__(type) __alignof(type)
113# define VKD3D_NORETURN
114# define VKD3D_PRINTF_FUNC(fmt, args)
116# define VKD3D_UNREACHABLE (void)0
119#define vkd3d_unreachable() \
121 ERR("%s:%u: Unreachable code reached.\n", __FILE__, __LINE__); \
125#ifdef VKD3D_NO_TRACE_MESSAGES
126#define TRACE(args...) do { } while (0)
127#define TRACE_ON() (false)
130#ifdef VKD3D_NO_DEBUG_MESSAGES
131#define WARN(args...) do { } while (0)
132#define FIXME(args...) do { } while (0)
133#define WARN_ON() (false)
134#define FIXME_ONCE(args...) do { } while (0)
137#ifdef VKD3D_NO_ERROR_MESSAGES
138#define ERR(args...) do { } while (0)
139#define MESSAGE(args...) do { } while (0)
163#define VKD3D_DBG_LOG(level) \
165 const enum vkd3d_dbg_level vkd3d_dbg_level = VKD3D_DBG_LEVEL_##level; \
166 VKD3D_DBG_PRINTF_##level
168#define VKD3D_DBG_LOG_ONCE(first_time_level, level) \
170 static bool vkd3d_dbg_next_time; \
171 const enum vkd3d_dbg_level vkd3d_dbg_level = vkd3d_dbg_next_time \
172 ? VKD3D_DBG_LEVEL_##level : VKD3D_DBG_LEVEL_##first_time_level; \
173 vkd3d_dbg_next_time = true; \
174 VKD3D_DBG_PRINTF_##level
176#define VKD3D_DBG_PRINTF(...) \
177 vkd3d_dbg_printf(vkd3d_dbg_level, __FUNCTION__, __VA_ARGS__); } while (0)
179#define VKD3D_DBG_PRINTF_TRACE(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
180#define VKD3D_DBG_PRINTF_WARN(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
181#define VKD3D_DBG_PRINTF_FIXME(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
182#define VKD3D_DBG_PRINTF_MESSAGE(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
184#ifdef VKD3D_ABORT_ON_ERR
185#define VKD3D_DBG_PRINTF_ERR(...) \
186 vkd3d_dbg_printf(vkd3d_dbg_level, __FUNCTION__, __VA_ARGS__); \
190#define VKD3D_DBG_PRINTF_ERR(...) VKD3D_DBG_PRINTF(__VA_ARGS__)
194#ifdef VKD3D_CROSSTEST
196#define ERR(...) do { fprintf(stderr, __VA_ARGS__); abort(); } while (0)
200#define TRACE VKD3D_DBG_LOG(TRACE)
204#define WARN VKD3D_DBG_LOG(WARN)
208#define FIXME VKD3D_DBG_LOG(FIXME)
212#define ERR VKD3D_DBG_LOG(ERR)
216#define MESSAGE VKD3D_DBG_LOG(MESSAGE)
220#define TRACE_ON() (vkd3d_dbg_get_level() == VKD3D_DBG_LEVEL_TRACE)
224#define WARN_ON() (vkd3d_dbg_get_level() >= VKD3D_DBG_LEVEL_WARN)
228#define FIXME_ONCE VKD3D_DBG_LOG_ONCE(FIXME, WARN)
231#define VKD3D_DEBUG_ENV_NAME(name) const char *const vkd3d_dbg_env_name = name
248#define TO_STR(u) case u: return #u;
284#elif defined(__MINGW32__)
285 return __builtin_popcount(
v);
287 v -= (
v >> 1) & 0x55555555;
288 v = (
v & 0x33333333) + ((
v >> 2) & 0x33333333);
289 return (((
v + (
v >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24;
299 if (
mask & (1u <<
i))
316 return (
unsigned int)
result;
317#elif defined(HAVE_BUILTIN_CLZ)
318 return __builtin_clz(
x) ^ 0x1f;
320 static const unsigned int l[] =
322 ~0
u, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
323 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
324 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
325 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
326 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
327 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
328 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
329 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
330 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
331 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
332 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
333 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
334 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
335 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
336 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
337 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
341 return (
i =
x >> 16) ? (
x =
i >> 8) ?
l[
x] + 24
342 :
l[
i] + 16 : (
i =
x >> 8) ?
l[
i] + 8 :
l[
x];
346static inline void *
vkd3d_memmem(
const void *
haystack,
size_t haystack_len,
const void *needle,
size_t needle_len)
350 while (haystack_len >= needle_len)
362#ifdef HAVE_BUILTIN_ADD_OVERFLOW
383 return low | ((
uint32_t)high << 16);
388 return (
x >
y) - (
x <
y);
393 return (
x >
y) - (
x <
y);
396#define VKD3D_BITMAP_SIZE(x) (((x) + 0x1f) >> 5)
400 return map[
idx >> 5] &= ~(1u << (
idx & 0x1f));
405 return map[
idx >> 5] |= (1u << (
idx & 0x1f));
410 return map[
idx >> 5] & (1u << (
idx & 0x1f));
415 return 'A' <=
c &&
c <=
'Z';
431 if (c_a != c_b || !c_a)
445 }
while (c_a == c_b && c_a !=
'\0');
452#if HAVE_SYNC_ADD_AND_FETCH
453 return __sync_add_and_fetch(
x,
val);
457# error "vkd3d_atomic_add_fetch_u64() not implemented for this platform"
463#if HAVE_SYNC_ADD_AND_FETCH
464 return __sync_add_and_fetch(
x,
val);
468# error "vkd3d_atomic_add_fetch_u32() not implemented for this platform"
489#if HAVE_SYNC_BOOL_COMPARE_AND_SWAP
494# error "vkd3d_atomic_compare_exchange_u32() not implemented for this platform"
500#if HAVE_SYNC_BOOL_COMPARE_AND_SWAP
505# error "vkd3d_atomic_compare_exchange_ptr() not implemented for this platform"
511#if HAVE_ATOMIC_EXCHANGE_N
512 return __atomic_exchange_n(
x,
val, __ATOMIC_SEQ_CST);
529#if HAVE_ATOMIC_EXCHANGE_N
530 return __atomic_exchange_n(
x,
val, __ATOMIC_SEQ_CST);
555#define VKD3D_MUTEX_INITIALIZER {{NULL, -1, 0, 0, 0, 0}}
557#define VKD3D_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
568 ERR(
"Failed to initialise the mutex, ret %d.\n",
ret);
580 ERR(
"Failed to lock the mutex, ret %d.\n",
ret);
592 ERR(
"Failed to unlock the mutex, ret %d.\n",
ret);
604 ERR(
"Failed to destroy the mutex, ret %d.\n",
ret);
611 CONDITION_VARIABLE
cond;
625 ERR(
"Failed to initialise the condition variable, ret %d.\n",
ret);
636 if ((
ret = pthread_cond_signal(&cond->
cond)))
637 ERR(
"Failed to signal the condition variable, ret %d.\n",
ret);
648 if ((
ret = pthread_cond_broadcast(&cond->
cond)))
649 ERR(
"Failed to broadcast the condition variable, ret %d.\n",
ret);
657 ERR(
"Failed to wait on the condition variable, error %lu.\n",
GetLastError());
662 ERR(
"Failed to wait on the condition variable, ret %d.\n",
ret);
673 if ((
ret = pthread_cond_destroy(&cond->
cond)))
674 ERR(
"Failed to destroy the condition variable, ret %d.\n",
ret);
718#elif defined(HAVE_DLFCN_H)
728 return dlsym(
handle, symbol);
758 return "Not implemented for this platform.\n";
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
#define InterlockedExchange
#define GetProcAddress(x, y)
static const WCHAR version[]
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD Timeout)
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP int __cdecl atoi(const char *)
#define InterlockedExchangePointer(Target, Value)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint y
GLboolean GLboolean GLboolean b
GLenum const GLvoid * addr
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define InterlockedCompareExchangePointer
#define InterlockedCompareExchange
__INTRIN_INLINE unsigned int __popcnt(unsigned int value)
static IPrintDialogCallback callback
static const char haystack[]
static int sum(int x_, int y_)
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask)
volatile unsigned int lock
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
static void * vkd3d_atomic_exchange_ptr(void *volatile *x, void *val)
static int vkd3d_dlclose(void *handle)
static const char * debugstr_hresult(HRESULT hr)
static unsigned int vkd3d_popcount(unsigned int v)
static bool vkd3d_bound_range(size_t start, size_t count, size_t limit)
static void * vkd3d_memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
static void vkd3d_cond_init(struct vkd3d_cond *cond)
static void * vkd3d_dlsym(void *handle, const char *symbol)
static uint64_t vkd3d_atomic_increment_u64(uint64_t volatile *x)
void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const char *fmt,...) VKD3D_PRINTF_FUNC(3
const char * vkd3d_dbg_sprintf(const char *fmt,...) VKD3D_PRINTF_FUNC(1
@ VKD3D_DBG_LEVEL_MESSAGE
static unsigned int vkd3d_log2i(unsigned int x)
static void vkd3d_parse_version(const char *version, int *major, int *minor)
static void vkd3d_mutex_init(struct vkd3d_mutex *lock)
static void vkd3d_mutex_unlock(struct vkd3d_mutex *lock)
void void vkd3d_dbg_set_log_callback(PFN_vkd3d_log callback)
enum vkd3d_dbg_level vkd3d_dbg_get_level(void)
static bool bitmap_set(uint32_t *map, unsigned int idx)
static const char * vkd3d_dlerror(void)
static void vkd3d_mutex_lock(struct vkd3d_mutex *lock)
void vkd3d_set_thread_name(const char *name)
static void vkd3d_cond_broadcast(struct vkd3d_cond *cond)
#define VKD3D_PRINTF_FUNC(fmt, args)
static bool bitmap_is_set(const uint32_t *map, unsigned int idx)
static int ascii_isupper(int c)
uint64_t vkd3d_parse_debug_options(const char *string, const struct vkd3d_debug_option *options, unsigned int option_count)
static uint16_t vkd3d_make_u16(uint8_t low, uint8_t high)
static uint32_t vkd3d_atomic_exchange_u32(uint32_t volatile *x, uint32_t val)
static void vkd3d_mutex_destroy(struct vkd3d_mutex *lock)
static uint64_t vkd3d_atomic_add_fetch_u64(uint64_t volatile *x, uint64_t val)
static uint32_t vkd3d_atomic_decrement_u32(uint32_t volatile *x)
static int vkd3d_u64_compare(uint64_t x, uint64_t y)
static bool vkd3d_atomic_compare_exchange_ptr(void *volatile *x, void *expected, void *val)
static void vkd3d_cond_destroy(struct vkd3d_cond *cond)
HRESULT hresult_from_vkd3d_result(int vkd3d_result)
static bool vkd3d_atomic_compare_exchange_u32(uint32_t volatile *x, uint32_t expected, uint32_t val)
static uint32_t vkd3d_make_u32(uint16_t low, uint16_t high)
static void * vkd3d_dlopen(const char *name)
static uint64_t align(uint64_t addr, size_t alignment)
const char * debugstr_an(const char *str, size_t n)
static bool vkd3d_bitmask_is_contiguous(unsigned int mask)
bool vkd3d_debug_list_has_member(const char *string, const char *member)
static int ascii_strcasecmp(const char *a, const char *b)
const char const char * vkd3d_dbg_vsprintf(const char *fmt, va_list args)
static uint32_t vkd3d_atomic_increment_u32(uint32_t volatile *x)
static int ascii_tolower(int c)
static int ascii_strncasecmp(const char *a, const char *b, size_t n)
static int vkd3d_u32_compare(uint32_t x, uint32_t y)
unsigned int vkd3d_env_var_as_uint(const char *name, unsigned int default_value)
static bool bitmap_clear(uint32_t *map, unsigned int idx)
static uint32_t vkd3d_atomic_add_fetch_u32(uint32_t volatile *x, uint32_t val)
static void vkd3d_cond_wait(struct vkd3d_cond *cond, struct vkd3d_mutex *lock)
static void vkd3d_cond_signal(struct vkd3d_cond *cond)
static bool vkd3d_object_range_overflow(size_t start, size_t count, size_t size)
void(* PFN_vkd3d_log)(const char *format, va_list args)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define FORMAT_MESSAGE_FROM_SYSTEM
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define DXGI_ERROR_NOT_FOUND
#define DXGI_ERROR_UNSUPPORTED
#define DXGI_ERROR_MORE_DATA