summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Fröhlich <Mathias.Froehlich@web.de>2011-02-26 08:20:34 +0100
committerMarek Olšák <maraeo@gmail.com>2011-03-15 15:39:31 +0100
commitbaab835a1f11d026bd757d99ff05b59971042a3e (patch)
tree87cfa287dadf8f3f45f556ded2d55d587f8091b6
parentfedc5b03db64cbb76d101945017a46c5d27f1bbb (diff)
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 <Mathias.Froehlich@web.de>
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c14
1 files 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 12528f49ff..b9b606d539 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;