diff options
author | Marek Olšák <[email protected]> | 2013-04-25 22:12:47 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-05-11 23:45:02 +0200 |
commit | 1ba1d617bf4eff0f08df80a2805b6f25ebf038fb (patch) | |
tree | 55d249b18468953c64d13ae3ce7462de1b4a95c7 /src/mesa | |
parent | 6a2ad679e6f11f51e01001943f7d18329f077620 (diff) |
st/mesa: restore the transfer_inline_write path for BufferData
Version 2 that shouldn't crash.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index d166fe64414..c868d5e163e 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -182,6 +182,21 @@ st_bufferobj_data(struct gl_context *ctx, struct st_buffer_object *st_obj = st_buffer_object(obj); unsigned bind, pipe_usage; + if (size && data && st_obj->buffer && + st_obj->Base.Size == size && st_obj->Base.Usage == usage) { + /* Just discard the old contents and write new data. + * This should be the same as creating a new buffer, but we avoid + * a lot of validation in Mesa. + */ + struct pipe_box box; + + u_box_1d(0, size, &box); + pipe->transfer_inline_write(pipe, st_obj->buffer, 0, + PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, + &box, data, 0, 0); + return GL_TRUE; + } + st_obj->Base.Size = size; st_obj->Base.Usage = usage; |