mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Get rid of vkd3d_atomic_increment().
This commit is contained in:
parent
18f73c1c4d
commit
6e439045e8
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
@ -1921,7 +1921,7 @@ HRESULT d3d12_command_allocator_create(struct d3d12_device *device,
|
||||
|
||||
static void d3d12_command_signature_incref(struct d3d12_command_signature *signature)
|
||||
{
|
||||
vkd3d_atomic_increment(&signature->internal_refcount);
|
||||
vkd3d_atomic_increment_u32(&signature->internal_refcount);
|
||||
}
|
||||
|
||||
static void d3d12_command_signature_decref(struct d3d12_command_signature *signature)
|
||||
|
@ -2314,7 +2314,7 @@ static void *vkd3d_desc_object_cache_get(struct vkd3d_desc_object_cache *cache)
|
||||
|
||||
STATIC_ASSERT(!(ARRAY_SIZE(cache->heads) & HEAD_INDEX_MASK));
|
||||
|
||||
i = (vkd3d_atomic_increment(&cache->next_index)) & HEAD_INDEX_MASK;
|
||||
i = vkd3d_atomic_increment_u32(&cache->next_index) & HEAD_INDEX_MASK;
|
||||
for (;;)
|
||||
{
|
||||
if (vkd3d_atomic_compare_exchange(&cache->heads[i].spinlock, 0, 1))
|
||||
@ -2345,7 +2345,7 @@ static void vkd3d_desc_object_cache_push(struct vkd3d_desc_object_cache *cache,
|
||||
|
||||
/* Using the same index as above may result in a somewhat uneven distribution,
|
||||
* but the main objective is to avoid costly spinlock contention. */
|
||||
i = (vkd3d_atomic_increment(&cache->next_index)) & HEAD_INDEX_MASK;
|
||||
i = vkd3d_atomic_increment_u32(&cache->next_index) & HEAD_INDEX_MASK;
|
||||
for (;;)
|
||||
{
|
||||
if (vkd3d_atomic_compare_exchange(&cache->heads[i].spinlock, 0, 1))
|
||||
@ -2357,7 +2357,7 @@ static void vkd3d_desc_object_cache_push(struct vkd3d_desc_object_cache *cache,
|
||||
u.header->next = head;
|
||||
cache->heads[i].head = u.object;
|
||||
vkd3d_atomic_exchange(&cache->heads[i].spinlock, 0);
|
||||
vkd3d_atomic_increment(&cache->free_count);
|
||||
vkd3d_atomic_increment_u32(&cache->free_count);
|
||||
}
|
||||
|
||||
#undef HEAD_INDEX_MASK
|
||||
|
@ -257,11 +257,6 @@ static inline void vkd3d_cond_destroy(struct vkd3d_cond *cond)
|
||||
{
|
||||
}
|
||||
|
||||
static inline unsigned int vkd3d_atomic_increment(unsigned int volatile *x)
|
||||
{
|
||||
return InterlockedIncrement((LONG volatile *)x);
|
||||
}
|
||||
|
||||
static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
||||
{
|
||||
return InterlockedDecrement((LONG volatile *)x);
|
||||
@ -398,15 +393,6 @@ static inline unsigned int vkd3d_atomic_decrement(unsigned int volatile *x)
|
||||
# error "vkd3d_atomic_decrement() not implemented for this platform"
|
||||
# endif /* HAVE_SYNC_SUB_AND_FETCH */
|
||||
|
||||
# if HAVE_SYNC_ADD_AND_FETCH
|
||||
static inline unsigned int vkd3d_atomic_increment(unsigned int volatile *x)
|
||||
{
|
||||
return __sync_add_and_fetch(x, 1);
|
||||
}
|
||||
# else
|
||||
# error "vkd3d_atomic_increment() not implemented for this platform"
|
||||
# endif /* HAVE_SYNC_ADD_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