[PATCH 2/5] wined3d: Validate WINED3D_LOCATION_BUFFER on WINED3D_MAP_DISCARD buffer maps.
Henri Verbeet
hverbeet at codeweavers.com
Thu Feb 23 01:10:26 CST 2017
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>
---
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))
--
2.1.4
More information about the wine-patches
mailing list