mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-common: Introduce vkd3d_atomic_increment_u64().
This commit is contained in:
parent
c40093474e
commit
71decc927f
Notes:
Alexandre Julliard
2024-01-17 22:43:56 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/566
@ -267,16 +267,28 @@ static inline int ascii_strcasecmp(const char *a, const char *b)
|
|||||||
return c_a - c_b;
|
return c_a - c_b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint64_t vkd3d_atomic_add_fetch_u64(uint64_t volatile *x, uint64_t val)
|
||||||
|
{
|
||||||
|
#if HAVE_SYNC_ADD_AND_FETCH
|
||||||
|
return __sync_add_and_fetch(x, val);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
return InterlockedAdd64((LONG64 *)x, val);
|
||||||
|
#else
|
||||||
|
# error "vkd3d_atomic_add_fetch_u64() not implemented for this platform"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t vkd3d_atomic_increment_u64(uint64_t volatile *x)
|
||||||
|
{
|
||||||
|
return vkd3d_atomic_add_fetch_u64(x, 1);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# if HAVE_SYNC_ADD_AND_FETCH
|
# if HAVE_SYNC_ADD_AND_FETCH
|
||||||
static inline LONG InterlockedIncrement(LONG volatile *x)
|
static inline LONG InterlockedIncrement(LONG volatile *x)
|
||||||
{
|
{
|
||||||
return __sync_add_and_fetch(x, 1);
|
return __sync_add_and_fetch(x, 1);
|
||||||
}
|
}
|
||||||
static inline LONG64 InterlockedIncrement64(LONG64 volatile *x)
|
|
||||||
{
|
|
||||||
return __sync_add_and_fetch(x, 1);
|
|
||||||
}
|
|
||||||
# else
|
# else
|
||||||
# error "InterlockedIncrement() not implemented for this platform"
|
# error "InterlockedIncrement() not implemented for this platform"
|
||||||
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define VKD3D_NULL_BUFFER_SIZE 16
|
#define VKD3D_NULL_BUFFER_SIZE 16
|
||||||
#define VKD3D_NULL_VIEW_FORMAT DXGI_FORMAT_R8G8B8A8_UNORM
|
#define VKD3D_NULL_VIEW_FORMAT DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
|
|
||||||
LONG64 object_global_serial_id;
|
uint64_t object_global_serial_id;
|
||||||
|
|
||||||
static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *properties)
|
static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *properties)
|
||||||
{
|
{
|
||||||
@ -4314,7 +4314,7 @@ static HRESULT d3d12_descriptor_heap_init(struct d3d12_descriptor_heap *descript
|
|||||||
|
|
||||||
descriptor_heap->ID3D12DescriptorHeap_iface.lpVtbl = &d3d12_descriptor_heap_vtbl;
|
descriptor_heap->ID3D12DescriptorHeap_iface.lpVtbl = &d3d12_descriptor_heap_vtbl;
|
||||||
descriptor_heap->refcount = 1;
|
descriptor_heap->refcount = 1;
|
||||||
descriptor_heap->serial_id = InterlockedIncrement64(&object_global_serial_id);
|
descriptor_heap->serial_id = vkd3d_atomic_increment_u64(&object_global_serial_id);
|
||||||
|
|
||||||
descriptor_heap->desc = *desc;
|
descriptor_heap->desc = *desc;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
* this number to prevent excessive pool memory use. */
|
* this number to prevent excessive pool memory use. */
|
||||||
#define VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE (16 * 1024u)
|
#define VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE (16 * 1024u)
|
||||||
|
|
||||||
extern LONG64 object_global_serial_id;
|
extern uint64_t object_global_serial_id;
|
||||||
|
|
||||||
struct d3d12_command_list;
|
struct d3d12_command_list;
|
||||||
struct d3d12_device;
|
struct d3d12_device;
|
||||||
|
Loading…
Reference in New Issue
Block a user