libs/vkd3d: Add UAV counter support for compute pipelines.

UAV counter descriptors are stored in a separate VkDescriptorSet.
A VkPipelineLayout created for compute pipeline is compatible for all
other descriptor sets with the VkPipelineLayout created for the root
signature. This ensures that only UAV counter bindings in the last
descriptor set may be disturbed when switching between pipelines with
compatible root signatures.

The implementation of vkd3d_popcount() is based on
https://graphics.stanford.edu/~seander/bithacks.html
This commit is contained in:
Józef Kucia
2017-09-08 15:04:30 +02:00
parent 37f4c9d2a3
commit 0d28036d2a
3 changed files with 170 additions and 14 deletions

View File

@@ -37,6 +37,13 @@ static inline size_t align(size_t addr, size_t alignment)
# define VKD3D_UNUSED
#endif /* __GNUC__ */
static inline unsigned int vkd3d_popcount(unsigned int v)
{
v -= (v >> 1) & 0x55555555;
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
return (((v + (v >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24;
}
#ifndef _WIN32
# if HAVE_SYNC_ADD_AND_FETCH
static inline LONG InterlockedIncrement(LONG volatile *x)