st/nine: Upload managed buffers only at draw using them
authorAxel Davy <davyaxel0@gmail.com>
Thu, 4 Apr 2019 21:06:44 +0000 (23:06 +0200)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 30 Apr 2019 17:18:50 +0000 (19:18 +0200)
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 <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/buffer9.h

index 1803d8d..9ccd6da 100644 (file)
@@ -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);
 }