summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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;