u_upload_mgr: remove the return value from u_upload_data
authorMarek Olšák <marek.olsak@amd.com>
Wed, 2 Sep 2015 13:11:40 +0000 (15:11 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 3 Sep 2015 16:14:50 +0000 (18:14 +0200)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_upload_mgr.c
src/gallium/auxiliary/util/u_upload_mgr.h
src/gallium/auxiliary/util/u_vbuf.c
src/mesa/state_tracker/st_draw.c

index 78b0f5f99a0900312885808eacc44086bff6d01a..59207a1969b9b04e8a6dd973a7c1ab522fa41c29 100644 (file)
@@ -236,23 +236,20 @@ u_upload_alloc(struct u_upload_mgr *upload,
    upload->offset = offset + alloc_size;
 }
 
-enum pipe_error u_upload_data( struct u_upload_mgr *upload,
-                               unsigned min_out_offset,
-                               unsigned size,
-                               const void *data,
-                               unsigned *out_offset,
-                               struct pipe_resource **outbuf)
+void u_upload_data(struct u_upload_mgr *upload,
+                   unsigned min_out_offset,
+                   unsigned size,
+                   const void *data,
+                   unsigned *out_offset,
+                   struct pipe_resource **outbuf)
 {
    uint8_t *ptr;
 
    u_upload_alloc(upload, min_out_offset, size,
                   out_offset, outbuf,
                   (void**)&ptr);
-   if (!outbuf)
-      return PIPE_ERROR_OUT_OF_MEMORY;
-
-   memcpy(ptr, data, size);
-   return PIPE_OK;
+   if (ptr)
+      memcpy(ptr, data, size);
 }
 
 /* XXX: Remove. It's basically a CPU fallback of resource_copy_region. */
index 9744dc17c49497a03180c32a5119c2c450faabf4..67c6daa4e7f86b99cb6ffa4a738c7e9873033311 100644 (file)
@@ -92,12 +92,12 @@ void u_upload_alloc(struct u_upload_mgr *upload,
  * Same as u_upload_alloc, but in addition to that, it copies "data"
  * to the pointer returned from u_upload_alloc.
  */
-enum pipe_error u_upload_data( struct u_upload_mgr *upload,
-                               unsigned min_out_offset,
-                               unsigned size,
-                               const void *data,
-                               unsigned *out_offset,
-                               struct pipe_resource **outbuf);
+void u_upload_data(struct u_upload_mgr *upload,
+                   unsigned min_out_offset,
+                   unsigned size,
+                   const void *data,
+                   unsigned *out_offset,
+                   struct pipe_resource **outbuf);
 
 
 /**
index 791d82bb65f7a54079a69a83cb3fe75a9e6d9f05..3d2193c3bf5551fec53d97fb6070314b65260d7d 100644 (file)
@@ -976,7 +976,6 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
       unsigned start, end;
       struct pipe_vertex_buffer *real_vb;
       const uint8_t *ptr;
-      enum pipe_error err;
 
       i = u_bit_scan(&buffer_mask);
 
@@ -987,10 +986,10 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
       real_vb = &mgr->real_vertex_buffer[i];
       ptr = mgr->vertex_buffer[i].user_buffer;
 
-      err = u_upload_data(mgr->uploader, start, end - start, ptr + start,
-                          &real_vb->buffer_offset, &real_vb->buffer);
-      if (err != PIPE_OK)
-         return err;
+      u_upload_data(mgr->uploader, start, end - start, ptr + start,
+                    &real_vb->buffer_offset, &real_vb->buffer);
+      if (!real_vb->buffer)
+         return PIPE_ERROR_OUT_OF_MEMORY;
 
       real_vb->buffer_offset -= start;
    }
index 957fcfd410eaf48bda26b3bf3d39108a3e57b5d1..2ad679b1cb8e5dff3f5f357f650f75ce2a268ca1 100644 (file)
@@ -106,9 +106,10 @@ setup_index_buffer(struct st_context *st,
    }
    else if (st->indexbuf_uploader) {
       /* upload indexes from user memory into a real buffer */
-      if (u_upload_data(st->indexbuf_uploader, 0,
-                        ib->count * ibuffer->index_size, ib->ptr,
-                        &ibuffer->offset, &ibuffer->buffer) != PIPE_OK) {
+      u_upload_data(st->indexbuf_uploader, 0,
+                    ib->count * ibuffer->index_size, ib->ptr,
+                    &ibuffer->offset, &ibuffer->buffer);
+      if (!ibuffer->buffer) {
          /* out of memory */
          return FALSE;
       }