python: Use pipe_buffer_read/write.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 26 Mar 2009 10:54:48 +0000 (10:54 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 26 Mar 2009 11:16:56 +0000 (11:16 +0000)
src/gallium/state_trackers/python/p_texture.i

index de03f8f446cd8aa14f79d7f1077fa2bab2f77fe7..4648af691d14e609fa9759e8463fd021c10822d2 100644 (file)
@@ -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);
    }
 };