mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
nvk: Zero unused descriptors
When a descriptor gets freed because a buffer/image veiw or sampler is deleted, zero out the descriptor memory. This prevents the descriptor from being used later and faulting on possibly non-existant memory. While we're here, clean up the function a bit. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
67a45d1c5f
commit
c36ee41fdb
1 changed files with 7 additions and 0 deletions
|
|
@ -173,9 +173,16 @@ nvk_descriptor_table_remove(struct nvk_device *dev,
|
|||
uint32_t index)
|
||||
{
|
||||
simple_mtx_lock(&table->mutex);
|
||||
|
||||
void *map = (char *)table->map + (index * table->desc_size);
|
||||
memset(map, 0, table->desc_size);
|
||||
|
||||
/* Sanity check for double-free */
|
||||
assert(table->free_count < table->alloc);
|
||||
for (uint32_t i = 0; i < table->free_count; i++)
|
||||
assert(table->free_table[i] != index);
|
||||
|
||||
table->free_table[table->free_count++] = index;
|
||||
|
||||
simple_mtx_unlock(&table->mutex);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue