From 6f3716d677981bc2ac8f9842f302e9c125203bc1 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 9 Nov 2020 21:31:59 +0100 Subject: [PATCH] d3d12: avoid searching twice for bos Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/d3d12/d3d12_batch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/d3d12/d3d12_batch.cpp b/src/gallium/drivers/d3d12/d3d12_batch.cpp index a1b5aa0ff4c..b7757b92f94 100644 --- a/src/gallium/drivers/d3d12/d3d12_batch.cpp +++ b/src/gallium/drivers/d3d12/d3d12_batch.cpp @@ -220,10 +220,10 @@ void d3d12_batch_reference_resource(struct d3d12_batch *batch, struct d3d12_resource *res) { - if (!d3d12_batch_has_references(batch, res->bo)) { - _mesa_set_add(batch->bos, res->bo); + bool found = false; + _mesa_set_search_and_add(batch->bos, res->bo, &found); + if (!found) d3d12_bo_reference(res->bo); - } } void