Henri Verbeet : wined3d: Use ARB_map_buffer_range in wined3d_surface_map() when available.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 11 07:55:45 CST 2016


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Mar  9 16:21:57 2016 +0100

wined3d: Use ARB_map_buffer_range in wined3d_surface_map() when available.

Like in wined3d_volume_map().

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

---

 dlls/wined3d/surface.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 13aae6d..f15d62a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2207,7 +2207,20 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
         case WINED3D_LOCATION_BUFFER:
             GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
                     texture->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object));
-            base_memory = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE));
+
+            if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
+            {
+                GLbitfield map_flags = wined3d_resource_gl_map_flags(flags);
+                map_flags &= ~GL_MAP_FLUSH_EXPLICIT_BIT;
+                base_memory = GL_EXTCALL(glMapBufferRange(GL_PIXEL_UNPACK_BUFFER,
+                        0, surface->resource.size, map_flags));
+            }
+            else
+            {
+                GLenum access = wined3d_resource_gl_legacy_map_flags(flags);
+                base_memory = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, access));
+            }
+
             GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
             checkGLcall("map PBO");
             break;




More information about the wine-cvs mailing list