From: Mathias Fröhlich Date: Sat, 26 Feb 2011 07:20:34 +0000 (+0100) Subject: st/mesa: Make use of the new PIPE_TRANSFER_DISCARD_* for buffer object. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=baab835a1f11d026bd757d99ff05b59971042a3e;p=mesa.git st/mesa: Make use of the new PIPE_TRANSFER_DISCARD_* for buffer object. 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 --- 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;