mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Validate the base descriptor handle in d3d12_command_list_set_descriptor_table().
The availability of allocation info makes it possible to check that the descriptor belongs to a heap of the correct type. This will be more important when Vulkan-backed descriptor heaps are added. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
67ee837f2b
commit
711378ea31
@@ -2305,6 +2305,29 @@ size_t vkd3d_gpu_descriptor_allocator_range_size_from_descriptor(
|
||||
return remaining;
|
||||
}
|
||||
|
||||
struct d3d12_descriptor_heap *vkd3d_gpu_descriptor_allocator_heap_from_descriptor(
|
||||
struct vkd3d_gpu_descriptor_allocator *allocator, const struct d3d12_desc *desc)
|
||||
{
|
||||
const struct vkd3d_gpu_descriptor_allocation *allocation;
|
||||
int rc;
|
||||
|
||||
if (!allocator->allocation_count)
|
||||
return NULL;
|
||||
|
||||
if ((rc = pthread_mutex_lock(&allocator->mutex)))
|
||||
{
|
||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
allocation = vkd3d_gpu_descriptor_allocator_allocation_from_descriptor(allocator, desc);
|
||||
|
||||
pthread_mutex_unlock(&allocator->mutex);
|
||||
|
||||
return allocation ? CONTAINING_RECORD(allocation->base, struct d3d12_descriptor_heap, descriptors)
|
||||
: NULL;
|
||||
}
|
||||
|
||||
static bool vkd3d_gpu_descriptor_allocator_init(struct vkd3d_gpu_descriptor_allocator *allocator)
|
||||
{
|
||||
int rc;
|
||||
|
||||
Reference in New Issue
Block a user