diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-08-14 20:05:33 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-08-14 20:05:51 +0100 |
commit | e3bc1fb6bcd3141df8ab9123c4f6c276f30f6649 (patch) | |
tree | 8652206d0af1dfdad99d9ca62a5b4498020f64b7 | |
parent | 10430f47a49884ec59eca5942fdaee80119684af (diff) |
gallium: Always map for READ flag when DISCARD is not set.
This prevents the driver from discarding a buffer when the whole buffer
is mapped for writing, but only a portion is effectively written.
This is a temporary fix, because WRITE shouldn't imply DISCARD.
The full fix implies using PIPE_BUFFER_USAGE_DISCARD, throughout
the code, and will go only into master.
-rw-r--r-- | src/gallium/include/pipe/p_inlines.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index cf176c9209..a5c1e8270a 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -63,6 +63,13 @@ pipe_buffer_map(struct pipe_screen *screen, if(screen->buffer_map_range) { unsigned offset = 0; unsigned length = buf->size; + + /* XXX: Actually we should be using/detecting DISCARD + * instead of assuming that WRITE implies discard */ + if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) && + !(usage & PIPE_BUFFER_USAGE_DISCARD)) + usage |= PIPE_BUFFER_USAGE_CPU_READ; + return screen->buffer_map_range(screen, buf, offset, length, usage); } else |