st/nine: Handle READONLY for buffer MANAGED pool
authorAxel Davy <axel.davy@ens.fr>
Wed, 24 Feb 2016 22:44:40 +0000 (23:44 +0100)
committerAxel Davy <axel.davy@ens.fr>
Mon, 29 Feb 2016 17:55:58 +0000 (18:55 +0100)
READONLY won't trigger an upload.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/buffer9.c

index e066fc59f457b2b6c9b91337776e34e60ecfbe9c..8efb4cefb1fb9f9bd17a5f295527b9c04a0fc9f5 100644 (file)
@@ -174,13 +174,16 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
     u_box_1d(OffsetToLock, SizeToLock, &box);
 
     if (This->base.pool == D3DPOOL_MANAGED) {
-        if (!This->managed.dirty) {
-            assert(LIST_IS_EMPTY(&This->managed.list));
-            list_add(&This->managed.list, &This->base.base.device->update_buffers);
-            This->managed.dirty = TRUE;
-            This->managed.dirty_box = box;
-        } else {
-            u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
+        /* READONLY doesn't dirty the buffer */
+        if (!(Flags & D3DLOCK_READONLY)) {
+            if (!This->managed.dirty) {
+                assert(LIST_IS_EMPTY(&This->managed.list));
+                list_add(&This->managed.list, &This->base.base.device->update_buffers);
+                This->managed.dirty = TRUE;
+                This->managed.dirty_box = box;
+            } else {
+                u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
+            }
         }
         *ppbData = (char *)This->managed.data + OffsetToLock;
         DBG("returning pointer %p\n", *ppbData);