summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-01-01 17:12:35 +0100
committerMarek Olšák <[email protected]>2012-01-05 18:29:11 +0100
commit214b87aa0469a12ea72d624cfaee0ca46179ec5f (patch)
tree1ccbe951a20a1443b21343d36749a83eae31fbfd /src/mesa/state_tracker
parentfb0aa34fab77fe8a7fc3253d5ecf635ce37a21c7 (diff)
gallium: fix behavior of pipe_buffer_map_range
To match what transfer_map returns. Really, subtracting the offset leads to bugs if someone expects it to work exactly like transfer_map. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c4
-rw-r--r--src/mesa/state_tracker/st_draw.c11
2 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index adac92f2c34..6d95d57c1b3 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -291,10 +291,6 @@ st_bufferobj_map_range(struct gl_context *ctx,
flags,
&st_obj->transfer);
if (obj->Pointer) {
- obj->Pointer = (ubyte *) obj->Pointer + offset;
- }
-
- if (obj->Pointer) {
obj->Offset = offset;
obj->Length = length;
obj->AccessFlags = access;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index a21160c956d..6d6fc858de4 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -824,16 +824,17 @@ handle_fallback_primitive_restart(struct pipe_context *pipe,
start * ibuffer->index_size, /* start */
count * ibuffer->index_size, /* length */
PIPE_TRANSFER_READ, &transfer);
+ if (!ptr)
+ return;
+
+ ptr = (uint8_t*)ptr + (ibuffer->offset - start * ibuffer->index_size);
}
else {
ptr = ib->ptr;
+ if (!ptr)
+ return;
}
- if (!ptr)
- return;
-
- ptr = ADD_POINTERS(ptr, ibuffer->offset);
-
sub_prims = find_sub_primitives(ptr, ibuffer->index_size,
0, count, orig_info->restart_index,
&num_sub_prims);