From bb3b8f8e01129ed35ea47463716def7c375f0f19 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 4 Apr 2019 23:06:44 +0200 Subject: [PATCH] st/nine: Upload managed buffers only at draw using them When a draw call is emited, buffers in the device->update_buffers list are uploaded. This patch removes buffers from the list if they are not bound anymore. Behaviour found studying: https://github.com/iXit/Mesa-3D/issues/345 Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/buffer9.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/buffer9.h b/src/gallium/state_trackers/nine/buffer9.h index 1803d8d6405..9ccd6dab990 100644 --- a/src/gallium/state_trackers/nine/buffer9.h +++ b/src/gallium/state_trackers/nine/buffer9.h @@ -125,8 +125,11 @@ NineBindBufferToDevice( struct NineDevice9 *device, list_add(&buf->managed.list, &device->update_buffers); buf->bind_count++; } - if (old) + if (old) { old->bind_count--; + if (!old->bind_count && old->managed.dirty) + list_delinit(&old->managed.list); + } nine_bind(slot, buf); } -- 2.30.2