summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c6
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c4
-rw-r--r--src/mesa/state_tracker/st_cb_drawtex.c4
-rw-r--r--src/mesa/state_tracker/st_context.c28
-rw-r--r--src/mesa/state_tracker/st_context.h4
-rw-r--r--src/mesa/state_tracker/st_draw.c13
-rw-r--r--src/mesa/state_tracker/st_pbo.c10
7 files changed, 25 insertions, 44 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 6ab4ca99be6..d16f92e2acc 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -100,13 +100,13 @@ void st_upload_constants( struct st_context *st,
* 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;
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 457c41632ca..b2e2608bc5b 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -717,7 +717,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
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 */
@@ -789,7 +789,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
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),
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index 85f9a5390a5..01c5757a734 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -156,7 +156,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
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) {
@@ -228,7 +228,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
}
}
- u_upload_unmap(st->uploader);
+ u_upload_unmap(pipe->stream_uploader);
#undef SET_ATTRIB
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 55237345fc1..3d0455f9326 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -298,14 +298,6 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
}
}
- 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);
@@ -345,22 +337,10 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
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);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index b3478ea26eb..942fdd7bf1f 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -68,8 +68,6 @@ struct st_context
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 */
@@ -86,6 +84,8 @@ struct st_context
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.
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index c1a1d2d1419..8d54732eb55 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -105,16 +105,16 @@ setup_index_buffer(struct st_context *st,
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 */
@@ -277,7 +277,7 @@ st_draw_vbo(struct gl_context *ctx,
}
}
- 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);
}
}
@@ -418,7 +418,8 @@ st_draw_quad(struct st_context *st,
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;
@@ -468,7 +469,7 @@ st_draw_quad(struct st_context *st,
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
diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
index a9ea6eae594..2c63c092ed5 100644
--- a/src/mesa/state_tracker/st_pbo.c
+++ b/src/mesa/state_tracker/st_pbo.c
@@ -229,7 +229,7 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
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;
@@ -243,7 +243,7 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
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;
@@ -261,16 +261,16 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
{
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;