* avoid gratuitous rendering synchronization.
* Let's use a user buffer to avoid an unnecessary copy.
*/
- if (st->constbuf_uploader) {
+ if (!st->has_user_constbuf) {
cb.buffer = NULL;
cb.user_buffer = NULL;
- u_upload_data(st->constbuf_uploader, 0, paramBytes,
+ u_upload_data(st->pipe->const_uploader, 0, paramBytes,
st->ctx->Const.UniformBufferOffsetAlignment,
params->ParameterValues, &cb.buffer_offset, &cb.buffer);
- u_upload_unmap(st->constbuf_uploader);
+ u_upload_unmap(st->pipe->const_uploader);
} else {
cb.buffer = NULL;
cb.user_buffer = params->ParameterValues;
vb.stride = sizeof(struct st_util_vertex);
- u_upload_alloc(st->uploader, 0, num_vert_bytes, 4,
+ u_upload_alloc(pipe->stream_uploader, 0, num_vert_bytes, 4,
&vb.buffer_offset, &vb.buffer, (void **) &verts);
/* build quads vertex data */
ctx->Current.RasterPos[1] += ymove;
}
- u_upload_unmap(st->uploader);
+ u_upload_unmap(pipe->stream_uploader);
cso_set_vertex_buffers(st->cso_context,
cso_get_aux_vertex_buffer_slot(st->cso_context),
GLfloat *vbuf = NULL;
GLuint tex_attr;
- u_upload_alloc(st->uploader, 0,
+ u_upload_alloc(pipe->stream_uploader, 0,
numAttribs * 4 * 4 * sizeof(GLfloat), 4,
&offset, &vbuffer, (void **) &vbuf);
if (!vbuffer) {
}
}
- u_upload_unmap(st->uploader);
+ u_upload_unmap(pipe->stream_uploader);
#undef SET_ATTRIB
}
}
}
- u_upload_destroy(st->uploader);
- if (st->indexbuf_uploader) {
- u_upload_destroy(st->indexbuf_uploader);
- }
- if (st->constbuf_uploader) {
- u_upload_destroy(st->constbuf_uploader);
- }
-
/* free glDrawPixels cache data */
free(st->drawpix_cache.image);
pipe_resource_reference(&st->drawpix_cache.texture, NULL);
st->dirty = ST_ALL_STATES_MASK;
- /* Create upload manager for vertex data for glBitmap, glDrawPixels,
- * glClear, etc.
- */
- st->uploader = u_upload_create(pipe, 65536, PIPE_BIND_VERTEX_BUFFER,
- PIPE_USAGE_STREAM);
-
- if (!screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS)) {
- st->indexbuf_uploader = u_upload_create(pipe, 128 * 1024,
- PIPE_BIND_INDEX_BUFFER,
- PIPE_USAGE_STREAM);
- }
-
- if (!screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS))
- st->constbuf_uploader = u_upload_create(pipe, 128 * 1024,
- PIPE_BIND_CONSTANT_BUFFER,
- PIPE_USAGE_STREAM);
+ st->has_user_indexbuf =
+ screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS);
+ st->has_user_constbuf =
+ screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS);
st->cso_context = cso_create_context(pipe);
struct pipe_context *pipe;
- struct u_upload_mgr *uploader, *indexbuf_uploader, *constbuf_uploader;
-
struct draw_context *draw; /**< For selection/feedback/rastpos only */
struct draw_stage *feedback_stage; /**< For GL_FEEDBACK rendermode */
struct draw_stage *selection_stage; /**< For GL_SELECT rendermode */
boolean has_shareable_shaders;
boolean has_half_float_packing;
boolean has_multi_draw_indirect;
+ boolean has_user_constbuf;
+ boolean has_user_indexbuf;
/**
* If a shader can be created when we get its source.
ibuffer->buffer = st_buffer_object(bufobj)->buffer;
ibuffer->offset = pointer_to_offset(ib->ptr);
}
- else if (st->indexbuf_uploader) {
+ else if (!st->has_user_indexbuf) {
/* upload indexes from user memory into a real buffer */
- u_upload_data(st->indexbuf_uploader, 0,
+ u_upload_data(st->pipe->stream_uploader, 0,
ib->count * ibuffer->index_size, 4, ib->ptr,
&ibuffer->offset, &ibuffer->buffer);
if (!ibuffer->buffer) {
/* out of memory */
return FALSE;
}
- u_upload_unmap(st->indexbuf_uploader);
+ u_upload_unmap(st->pipe->stream_uploader);
}
else {
/* indices are in user space memory */
}
}
- if (ib && st->indexbuf_uploader && !_mesa_is_bufferobj(ib->obj)) {
+ if (ib && !st->has_user_indexbuf && !_mesa_is_bufferobj(ib->obj)) {
pipe_resource_reference(&ibuffer.buffer, NULL);
}
}
vb.stride = sizeof(struct st_util_vertex);
- u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4,
+ u_upload_alloc(st->pipe->stream_uploader, 0,
+ 4 * sizeof(struct st_util_vertex), 4,
&vb.buffer_offset, &vb.buffer, (void **) &verts);
if (!vb.buffer) {
return false;
verts[3].s = s0;
verts[3].t = t1;
- u_upload_unmap(st->uploader);
+ u_upload_unmap(st->pipe->stream_uploader);
/* At the time of writing, cso_get_aux_vertex_buffer_slot() always returns
* zero. If that ever changes we need to audit the calls to that function
vbo.buffer = NULL;
vbo.stride = 2 * sizeof(float);
- u_upload_alloc(st->uploader, 0, 8 * sizeof(float), 4,
+ u_upload_alloc(st->pipe->stream_uploader, 0, 8 * sizeof(float), 4,
&vbo.buffer_offset, &vbo.buffer, (void **) &verts);
if (!verts)
return false;
verts[6] = x1;
verts[7] = y1;
- u_upload_unmap(st->uploader);
+ u_upload_unmap(st->pipe->stream_uploader);
velem.src_offset = 0;
velem.instance_divisor = 0;
{
struct pipe_constant_buffer cb;
- if (st->constbuf_uploader) {
+ if (!st->has_user_constbuf) {
cb.buffer = NULL;
cb.user_buffer = NULL;
- u_upload_data(st->constbuf_uploader, 0, sizeof(addr->constants),
+ u_upload_data(st->pipe->const_uploader, 0, sizeof(addr->constants),
st->ctx->Const.UniformBufferOffsetAlignment,
&addr->constants, &cb.buffer_offset, &cb.buffer);
if (!cb.buffer)
return false;
- u_upload_unmap(st->constbuf_uploader);
+ u_upload_unmap(st->pipe->const_uploader);
} else {
cb.buffer = NULL;
cb.user_buffer = &addr->constants;