From: José Fonseca Date: Thu, 26 Mar 2009 10:54:48 +0000 (+0000) Subject: python: Use pipe_buffer_read/write. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca9d2044a2390267477f1e7118b16f21f2557dd3;p=mesa.git python: Use pipe_buffer_read/write. --- diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index de03f8f446c..4648af691d1 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -327,7 +327,6 @@ struct st_buffer { void read(char **STRING, int *LENGTH) { struct pipe_screen *screen = $self->st_dev->screen; - const char *map; assert(p_atomic_read(&$self->buffer->reference.count) > 0); @@ -336,18 +335,13 @@ struct st_buffer { if(!*STRING) return; - map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_READ); - if(map) { - memcpy(*STRING, map, $self->buffer->size); - pipe_buffer_unmap(screen, $self->buffer); - } + pipe_buffer_read(screen, $self->buffer, 0, $self->buffer->size, STRING); } %cstring_input_binary(const char *STRING, unsigned LENGTH); void write(const char *STRING, unsigned LENGTH, unsigned offset = 0) { struct pipe_screen *screen = $self->st_dev->screen; - char *map; assert(p_atomic_read(&$self->buffer->reference.count) > 0); @@ -361,10 +355,6 @@ struct st_buffer { return; } - map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); - if(map) { - memcpy(map + offset, STRING, LENGTH); - pipe_buffer_unmap(screen, $self->buffer); - } + pipe_buffer_write(screen, $self->buffer, offset, LENGTH, STRING); } };