mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-09 20:20:33 +01:00
radv/rra: Defer destroying accel struct data
This allows us to dump acceleration structures that were destroyed before present. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20047>
This commit is contained in:
parent
ae9c65a552
commit
94ec359ae5
3 changed files with 17 additions and 6 deletions
|
|
@ -97,6 +97,18 @@ rra_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo)
|
|||
|
||||
radv_rra_handle_trace(_queue);
|
||||
|
||||
RADV_FROM_HANDLE(radv_queue, queue, _queue);
|
||||
struct hash_table *accel_structs = queue->device->rra_trace.accel_structs;
|
||||
|
||||
hash_table_foreach (accel_structs, entry) {
|
||||
struct radv_rra_accel_struct_data *data = entry->data;
|
||||
if (!data->is_dead)
|
||||
continue;
|
||||
|
||||
radv_destroy_rra_accel_struct_data(radv_device_to_handle(queue->device), data);
|
||||
_mesa_hash_table_remove(accel_structs, entry);
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -186,6 +198,7 @@ rra_CreateAccelerationStructureKHR(VkDevice _device,
|
|||
data->va = structure->va;
|
||||
data->size = structure->size;
|
||||
data->type = pCreateInfo->type;
|
||||
data->is_dead = false;
|
||||
|
||||
VkEventCreateInfo eventCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
|
||||
|
|
@ -345,11 +358,8 @@ rra_DestroyAccelerationStructureKHR(VkDevice _device, VkAccelerationStructureKHR
|
|||
|
||||
assert(entry);
|
||||
struct radv_rra_accel_struct_data *data = entry->data;
|
||||
data->is_dead = true;
|
||||
|
||||
radv_destroy_rra_accel_struct_data(_device, data);
|
||||
|
||||
_mesa_hash_table_remove(device->rra_trace.accel_structs, entry);
|
||||
_mesa_hash_table_u64_remove(device->rra_trace.accel_struct_vas, structure->va);
|
||||
simple_mtx_unlock(&device->rra_trace.data_mtx);
|
||||
|
||||
radv_DestroyAccelerationStructureKHR(_device, _structure, pAllocator);
|
||||
|
|
|
|||
|
|
@ -806,6 +806,7 @@ struct radv_rra_accel_struct_data {
|
|||
VkBuffer buffer;
|
||||
VkDeviceMemory memory;
|
||||
VkAccelerationStructureTypeKHR type;
|
||||
bool is_dead;
|
||||
};
|
||||
|
||||
void radv_destroy_rra_accel_struct_data(VkDevice device, struct radv_rra_accel_struct_data *data);
|
||||
|
|
|
|||
|
|
@ -900,8 +900,8 @@ accel_struct_entry_cmp(const void *a, const void *b)
|
|||
{
|
||||
struct hash_entry *entry_a = *(struct hash_entry *const *)a;
|
||||
struct hash_entry *entry_b = *(struct hash_entry *const *)b;
|
||||
const struct radv_acceleration_structure *s_a = entry_a->key;
|
||||
const struct radv_acceleration_structure *s_b = entry_b->key;
|
||||
const struct radv_rra_accel_struct_data *s_a = entry_a->data;
|
||||
const struct radv_rra_accel_struct_data *s_b = entry_b->data;
|
||||
|
||||
return s_a->va > s_b->va ? 1 : s_a->va < s_b->va ? -1 : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue