tBot = (GLfloat) height;
}
- u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), vbuf_offset, vbuf,
- (void**)&vertices);
- if (!vbuf) {
+ if (u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]),
+ vbuf_offset, vbuf, (void **) &vertices) != PIPE_OK) {
return;
}
GLuint i, offset;
float (*vertices)[2][4]; /**< vertex pos + color */
- u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), &offset, &vbuf,
- (void**)&vertices);
- if (!vbuf) {
+ if (u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]),
+ &offset, &vbuf, (void **) &vertices) != PIPE_OK) {
return;
}
struct pipe_resource *buf = NULL;
unsigned offset;
- u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), &offset, &buf,
- (void**)&verts);
- if (!buf) {
+ if (u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), &offset,
+ &buf, (void **) &verts) != PIPE_OK) {
return;
}
GLfloat *vbuf = NULL;
GLuint attr;
- u_upload_alloc(st->uploader, 0,
- numAttribs * 4 * 4 * sizeof(GLfloat),
- &offset, &vbuffer, (void**)&vbuf);
- if (!vbuffer) {
+ if (u_upload_alloc(st->uploader, 0,
+ numAttribs * 4 * 4 * sizeof(GLfloat),
+ &offset, &vbuffer, (void **) &vbuf) != PIPE_OK) {
return;
}
}
-static void
+/**
+ * Basically, translate Mesa's index buffer information into
+ * a pipe_index_buffer object.
+ * \return TRUE or FALSE for success/failure
+ */
+static boolean
setup_index_buffer(struct st_context *st,
const struct _mesa_index_buffer *ib,
struct pipe_index_buffer *ibuffer)
ibuffer->offset = pointer_to_offset(ib->ptr);
}
else if (st->indexbuf_uploader) {
- u_upload_data(st->indexbuf_uploader, 0, ib->count * ibuffer->index_size,
- ib->ptr, &ibuffer->offset, &ibuffer->buffer);
+ if (u_upload_data(st->indexbuf_uploader, 0,
+ ib->count * ibuffer->index_size, ib->ptr,
+ &ibuffer->offset, &ibuffer->buffer) != PIPE_OK) {
+ /* out of memory */
+ return FALSE;
+ }
u_upload_unmap(st->indexbuf_uploader);
}
else {
}
cso_set_index_buffer(st->cso_context, ibuffer);
+ return TRUE;
}
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
nr_prims);
- setup_index_buffer(st, ib, &ibuffer);
+ if (!setup_index_buffer(st, ib, &ibuffer)) {
+ /* out of memory */
+ return;
+ }
info.indexed = TRUE;
if (min_index != ~0 && max_index != ~0) {