diff options
author | Mathias Fröhlich <[email protected]> | 2011-02-26 08:20:34 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-03-15 15:39:31 +0100 |
commit | baab835a1f11d026bd757d99ff05b59971042a3e (patch) | |
tree | 87cfa287dadf8f3f45f556ded2d55d587f8091b6 /src/mesa | |
parent | fedc5b03db64cbb76d101945017a46c5d27f1bbb (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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 14 |
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 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; |