Henri Verbeet : wined3d: Validate WINED3D_LOCATION_BUFFER on WINED3D_MAP_DISCARD buffer maps.

Alexandre Julliard julliard at winehq.org
Thu Feb 23 16:27:50 CST 2017


Module: wine
Branch: master
Commit: 4aea36184d0ae39f8c6eede0d6d13bf75841cdc2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4aea36184d0ae39f8c6eede0d6d13bf75841cdc2

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Feb 23 08:10:26 2017 +0100

wined3d: Validate WINED3D_LOCATION_BUFFER on WINED3D_MAP_DISCARD buffer maps.

Usually when doing a WINED3D_MAP_DISCARD map on a buffer with a buffer object
WINED3D_LOCATION_BUFFER will already be current. However, if the previous map
on that buffer loaded WINED3D_LOCATION_SYSMEM, that's not necessarily true.
This also brings the code further in line with the corresponding code for
textures.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/buffer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 91ab130..0c172d0 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1054,7 +1054,9 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
             context = context_acquire(device, NULL, 0);
             gl_info = context->gl_info;
 
-            if (!(flags & WINED3D_MAP_DISCARD))
+            if (flags & WINED3D_MAP_DISCARD)
+                wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
+            else
                 wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER);
 
             if (!(flags & WINED3D_MAP_READONLY))




More information about the wine-cvs mailing list