mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Get rid of vkd3d_atomic_increment().
This commit is contained in:
committed by
Alexandre Julliard
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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user