[PATCH] vkd3d: Don't allow concurrent writes to descriptors.

Derek Lesho dlesho at codeweavers.com
Thu Sep 12 08:42:25 CDT 2019


On 9/11/19 11:11 PM, Conor McCarthy wrote:

> On Thu, Sep 12, 2019 at 5:18 AM Derek Lesho <dlesho at codeweavers.com 
> <mailto:dlesho at codeweavers.com>> wrote:
>
>     +    for (unsigned int i = 0; i < desc->NumDescriptors; i++)
>     +    {
>     +        struct d3d12_desc *cur_desc = (struct d3d12_desc *)
>     (object->descriptors + (i * descriptor_size));
>     +        pthread_spinlock_t *lock =
>     vkd3d_malloc(sizeof(pthread_spinlock_t));
>     +
>     +        pthread_spin_init(lock, PTHREAD_PROCESS_PRIVATE);
>     +        cur_desc->lock = lock;
>     +    }
>
>
> On Linux, pthread_spinlock_t is just a single int (not sure about the 
> Mac equivalent but probably similar). It's more efficient to declare 
> cur_desc->lock as a pthread_spinlock_t rather than a pointer to one in 
> allocated memory.
Yes, however the entire d3d12_desc structure is memset away, including 
the lock.  Another solution to this problem would involve using 
"descriptor headers" that go in between the _desc structures in 
heap->descriptors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190912/78f062ed/attachment.htm>


More information about the wine-devel mailing list