mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Get rid of vkd3d_atomic_decrement().
This commit is contained in:
parent
6e439045e8
commit
8ddca1ebaf
Notes:
Alexandre Julliard
2024-02-07 23:27:37 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/637
@ -154,7 +154,6 @@ VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popcount(0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_BUILTIN_ADD_OVERFLOW], [__builtin_add_overflow], [__builtin_add_overflow(0, 0, (int *)0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_and_fetch((int *)0, 0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_SYNC_SUB_AND_FETCH], [__sync_sub_and_fetch], [__sync_sub_and_fetch((int *)0, 0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_SYNC_BOOL_COMPARE_AND_SWAP], [__sync_bool_compare_and_swap], [__sync_bool_compare_and_swap((int *)0, 0, 0)])
|
||||
VKD3D_CHECK_FUNC([HAVE_ATOMIC_EXCHANGE_N], [__atomic_exchange_n], [__atomic_exchange_n((int *)0, 0, 0)])
|
||||
AC_CHECK_FUNCS([gettid])
|
||||
|
@ -1926,7 +1926,7 @@ static void d3d12_command_signature_incref(struct d3d12_command_signature *signa
|
||||
|
||||
static void d3d12_command_signature_decref(struct d3d12_command_signature *signature)
|
||||
{
|
||||
unsigned int refcount = vkd3d_atomic_decrement(&signature->internal_refcount);
|
||||
unsigned int refcount = vkd3d_atomic_decrement_u32(&signature->internal_refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
|
@ -2321,7 +2321,7 @@ static void *vkd3d_desc_object_cache_get(struct vkd3d_desc_object_cache *cache)
|
||||
{
|
||||
if ((u.object = cache->heads[i].head))
|
||||
{
|
||||
vkd3d_atomic_decrement(&cache->free_count);
|
||||
vkd3d_atomic_decrement_u32(&cache->free_count);
|
||||
cache->heads[i].head = u.header->next;
|
||||
vkd3d_atomic_exchange(&cache->heads[i].spinlock, 0);
|
||||
return u.object;
|
||||
@ -2429,7 +2429,7 @@ void vkd3d_view_decref(void *view, struct d3d12_device *device)
|
||||
{
|
||||
union d3d12_desc_object u = {view};
|
||||
|
||||
if (vkd3d_atomic_decrement(&u.header->refcount))
|
||||
if (vkd3d_atomic_decrement_u32(&u.header->refcount))
|
||||
return;
|
||||
|
||||
if (u.header->magic != VKD3D_DESCRIPTOR_MAGIC_CBV)
|
||||
|
@ -257,11 +257,6 @@ static inline void vkd3d_cond_destroy(struct vkd3d_cond *cond)
|
||||
{
|
||||
}
|
||||
|
||||
static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
||||
{
|
||||
return InterlockedDecrement((LONG volatile *)x);
|
||||
}
|
||||
|
||||
static inline bool vkd3d_atomic_compare_exchange(unsigned int volatile *x, unsigned int cmp, unsigned int xchg)
|
||||
{
|
||||
return InterlockedCompareExchange((LONG volatile *)x, xchg, cmp) == cmp;
|
||||
@ -384,15 +379,6 @@ static inline void vkd3d_cond_destroy(struct vkd3d_cond *cond)
|
||||
ERR("Could not destroy the condition variable, error %d.\n", ret);
|
||||
}
|
||||
|
||||
# if HAVE_SYNC_SUB_AND_FETCH
|
||||
static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
||||
{
|
||||
return __sync_sub_and_fetch(x, 1);
|
||||
}
|
||||
# else
|
||||
# error "vkd3d_atomic_decrement() not implemented for this platform"
|
||||
# endif /* HAVE_SYNC_SUB_AND_FETCH */
|
||||
|
||||
# if HAVE_SYNC_BOOL_COMPARE_AND_SWAP
|
||||
static inline bool vkd3d_atomic_compare_exchange(unsigned int volatile *x, unsigned int cmp, unsigned int xchg)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user