diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 609300d3..132ab228 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -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) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index c04f4870..2368473a 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -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 diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 5955e616..eb65397a 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -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) {