Mesa (gallium-resources): util: fix up several uses of pipe_map_buffer_range
Keith Whitwell
keithw at kemper.freedesktop.org
Thu Apr 8 13:51:45 UTC 2010
Module: Mesa
Branch: gallium-resources
Commit: 20bf14be8ac6438cb1afa38212e306fc06a5ed40
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=20bf14be8ac6438cb1afa38212e306fc06a5ed40
Author: Keith Whitwell <keithw at vmware.com>
Date: Thu Apr 8 14:39:13 2010 +0100
util: fix up several uses of pipe_map_buffer_range
This function used to return a pointer to where the start of the
actual buffer would have been, even though only the requested range is
being mapped.
In the resources change, the function was modified to use a transfer
internally, and started returning the pointer to the beginning of the
transfer, ie the mapped range.
Some users of the function were changed to reflect this new behaviour,
some were not. Since then the function has reverted to its original
behaviour, matching master.
This change restores some of the users of the map_buffer_range helper
to expect the old/original behaviour.
---
src/gallium/auxiliary/util/u_inlines.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 66a8bf3..b1f2285 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -179,8 +179,10 @@ pipe_buffer_map_range(struct pipe_context *pipe,
return NULL;
map = pipe->transfer_map( pipe, *transfer );
- if (map == NULL)
+ if (map == NULL) {
+ pipe->transfer_destroy( pipe, *transfer );
return NULL;
+ }
/* Match old screen->buffer_map_range() behaviour, return pointer
* to where the beginning of the buffer would be:
@@ -298,7 +300,7 @@ pipe_buffer_read(struct pipe_context *pipe,
&src_transfer);
if (map)
- memcpy(data, map, size);
+ memcpy(data, map + offset, size);
pipe_buffer_unmap(pipe, buf, src_transfer);
}
More information about the mesa-commit
mailing list