mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Fix invalid atomic behaviour in the view cache linked list.
The list suffers from the ABA problem, where comparison with the head succeeds but the head's `next` pointer has changed. Occurs in Cyberpunk 2077, on NVIDIA at least.
This commit is contained in:
committed by
Alexandre Julliard
parent
4f2e07a45d
commit
3ca2259807
Notes:
Alexandre Julliard
2023-08-23 22:50:33 +02: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/297
@@ -2435,19 +2435,23 @@ static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
|
||||
|
||||
static void vkd3d_desc_object_cache_init(struct vkd3d_desc_object_cache *cache, size_t size)
|
||||
{
|
||||
cache->head = NULL;
|
||||
memset(cache, 0, sizeof(*cache));
|
||||
cache->size = size;
|
||||
}
|
||||
|
||||
static void vkd3d_desc_object_cache_cleanup(struct vkd3d_desc_object_cache *cache)
|
||||
{
|
||||
union d3d12_desc_object u;
|
||||
unsigned int i;
|
||||
void *next;
|
||||
|
||||
for (u.object = cache->head; u.object; u.object = next)
|
||||
for (i = 0; i < ARRAY_SIZE(cache->heads); ++i)
|
||||
{
|
||||
next = u.header->next;
|
||||
vkd3d_free(u.object);
|
||||
for (u.object = cache->heads[i].head; u.object; u.object = next)
|
||||
{
|
||||
next = u.header->next;
|
||||
vkd3d_free(u.object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user