From baab835a1f11d026bd757d99ff05b59971042a3e Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Sat, 26 Feb 2011 08:20:34 +0100 Subject: st/mesa: Make use of the new PIPE_TRANSFER_DISCARD_* for buffer object. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In memory mapping buffer objects make use of PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE and PIPE_TRANSFER_DISCARD_RANGE when appropriate. Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_cb_bufferobjects.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 12528f49ff7..b9b606d539c 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -301,11 +301,15 @@ st_bufferobj_map_range(struct gl_context *ctx, GLenum target, if (access & GL_MAP_FLUSH_EXPLICIT_BIT) flags |= PIPE_TRANSFER_FLUSH_EXPLICIT; - if (access & GL_MAP_INVALIDATE_RANGE_BIT) - flags |= PIPE_TRANSFER_DISCARD; - - if (access & GL_MAP_INVALIDATE_BUFFER_BIT) - flags |= PIPE_TRANSFER_DISCARD; + if (access & GL_MAP_INVALIDATE_BUFFER_BIT) { + flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE; + } + else if (access & GL_MAP_INVALIDATE_RANGE_BIT) { + if (offset == 0 && length == obj->Size) + flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE; + else + flags |= PIPE_TRANSFER_DISCARD_RANGE; + } if (access & GL_MAP_UNSYNCHRONIZED_BIT) flags |= PIPE_TRANSFER_UNSYNCHRONIZED; -- cgit v1.2.3