d3d12: Fix incorrect hash table usage
I'd assumed that since insert didn't take a deleter, it was
find-or-insert, not insert-or-replace. This caused a bo reference
leak if the same bo was used more than once in a batch.
Fixes: fde36d7992
("d3d12: Don't wait for GPU reads to do CPU reads")
Reviewed By: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13819>
This commit is contained in:
parent
764760314d
commit
a818f7b686
|
@ -230,9 +230,11 @@ d3d12_batch_reference_resource(struct d3d12_batch *batch,
|
|||
struct d3d12_resource *res,
|
||||
bool write)
|
||||
{
|
||||
hash_entry *entry = _mesa_hash_table_insert(batch->bos, res->bo, NULL);
|
||||
if (entry->data == NULL)
|
||||
hash_entry *entry = _mesa_hash_table_search(batch->bos, res->bo);
|
||||
if (entry == NULL) {
|
||||
d3d12_bo_reference(res->bo);
|
||||
entry = _mesa_hash_table_insert(batch->bos, res->bo, NULL);
|
||||
}
|
||||
size_t new_data = write ? batch_bo_reference_written : batch_bo_reference_read;
|
||||
size_t old_data = (size_t)entry->data;
|
||||
entry->data = (void*)(old_data | new_data);
|
||||
|
|
Loading…
Reference in New Issue