vkd3d: Use atomic exchange for descriptor writes.
Merge request reports
Activity
added 27 commits
-
0b0376b8...0c05f240 - 23 commits from branch
wine:master
- 6f4ee30e - vkd3d: Ensure descriptors are pointer aligned.
- de1b83e4 - vkd3d: Delay writing Vulkan descriptors until submitted to a queue.
- f2eec106 - vkd3d: Use atomic exchange for descriptor writes.
- 744d445e - vkd3d: Buffer descriptor writes.
Toggle commit list-
0b0376b8...0c05f240 - 23 commits from branch
3984 3984 return S_OK; 3985 3985 } 3986 3986 3987 STATIC_ASSERT(!(offsetof(struct d3d12_descriptor_heap, descriptors) & (sizeof(void *) - 1))); changed this line in version 3 of the diff
From patch 2/4:
+# if HAVE_SYNC_COMPARE_AND_SWAP +static inline LONG InterlockedCompareExchange(LONG volatile *x, LONG xchg, LONG cmp) +{ + return __sync_val_compare_and_swap(x, cmp, xchg); +} +# else +# error "InterlockedCompareExchange() not implemented for this platform" +# endif +# if HAVE_ATOMIC_EXCHANGE_N +static inline LONG InterlockedExchange(LONG volatile *x, LONG val) +{ + return __atomic_exchange_n(x, val, __ATOMIC_SEQ_CST); +} +# elif HAVE_SYNC_COMPARE_AND_SWAP +static inline LONG InterlockedExchange(LONG volatile *x, LONG val) +{ + LONG i; + do + { + i = *x; + } while (__sync_val_compare_and_swap(x, i, val) != i); + return i; +} +# else +# error "InterlockedExchange() not implemented for this platform" +# endif
I imagine this follows the precedent set by InterlockedIncrement() and similar functions, but I think I'd prefer the approach taken for vkd3d_mutex_lock() and related functions, and introduce something like "vkd3d_atomic_compare_exchange()" and "vkd3d_atomic_exchange()" for these. Part of that is a style preference, but it would also avoid propagating Win32 types like LONG to the calling code.
Somewhat relatedly, patch 3/4 introduces "PVOID", and I think we should just use "void *".
Those comments aside, I'm inclined to approve this. I didn't do a very careful review of the locking; that means that if this were to break something, you'll get to fix it yourself. :)
added 64 commits
-
49de4e15...b46df551 - 60 commits from branch
wine:master
- d0a0d09d - vkd3d: Ensure descriptors are pointer aligned.
- f925fc10 - vkd3d: Delay writing Vulkan descriptors until submitted to a queue.
- 205a8f44 - vkd3d: Use atomic exchange for descriptor writes.
- b79f3db3 - vkd3d: Collect multiple descriptor writes in a buffer and update in one call.
Toggle commit list-
49de4e15...b46df551 - 60 commits from branch
866 866 struct d3d12_descriptor_heap_vk_set vk_descriptor_sets[VKD3D_SET_INDEX_COUNT]; 867 867 struct vkd3d_mutex vk_sets_mutex; 868 868 869 BYTE descriptors[]; 869 BYTE DECLSPEC_ALIGN(8) descriptors[]; changed this line in version 5 of the diff
added 4 commits
Toggle commit listadded 4 commits
Toggle commit list