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. */
* 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);
/**
unsigned start, end;
struct pipe_vertex_buffer *real_vb;
const uint8_t *ptr;
- enum pipe_error err;
i = u_bit_scan(&buffer_mask);
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;
}
}
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;
}