mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-08 14:38:18 +02:00
r600g: use the same upload buffer for vertices, indices, and constants
This should reduce memory consumption.
This commit is contained in:
parent
8042470057
commit
467023e808
4 changed files with 10 additions and 28 deletions
|
|
@ -207,7 +207,7 @@ void r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl
|
|||
struct r600_resource_buffer *rbuffer = r600_buffer(draw->index_buffer);
|
||||
boolean flushed;
|
||||
|
||||
u_upload_data(rctx->upload_ib, 0,
|
||||
u_upload_data(rctx->vbuf_mgr->uploader, 0,
|
||||
draw->info.count * draw->index_size,
|
||||
rbuffer->r.b.user_ptr,
|
||||
&draw->index_buffer_offset,
|
||||
|
|
@ -224,7 +224,7 @@ void r600_upload_const_buffer(struct r600_pipe_context *rctx, struct r600_resour
|
|||
|
||||
*rbuffer = NULL;
|
||||
|
||||
u_upload_data(rctx->upload_const, 0, size, ptr, const_offset,
|
||||
u_upload_data(rctx->vbuf_mgr->uploader, 0, size, ptr, const_offset,
|
||||
(struct pipe_resource**)rbuffer, &flushed);
|
||||
} else {
|
||||
*const_offset = 0;
|
||||
|
|
|
|||
|
|
@ -69,12 +69,10 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags,
|
|||
#endif
|
||||
r600_context_flush(&rctx->ctx);
|
||||
|
||||
/* XXX These shouldn't be really necessary, but removing them breaks some tests.
|
||||
/* XXX This shouldn't be really necessary, but removing it breaks some tests.
|
||||
* Needless buffer reallocations may significantly increase memory consumption,
|
||||
* so getting rid of these 3 calls is important. */
|
||||
* so getting rid of this call is important. */
|
||||
u_upload_flush(rctx->vbuf_mgr->uploader);
|
||||
u_upload_flush(rctx->upload_ib);
|
||||
u_upload_flush(rctx->upload_const);
|
||||
}
|
||||
|
||||
static void r600_destroy_context(struct pipe_context *context)
|
||||
|
|
@ -91,8 +89,6 @@ static void r600_destroy_context(struct pipe_context *context)
|
|||
free(rctx->states[i]);
|
||||
}
|
||||
|
||||
u_upload_destroy(rctx->upload_ib);
|
||||
u_upload_destroy(rctx->upload_const);
|
||||
u_vbuf_mgr_destroy(rctx->vbuf_mgr);
|
||||
|
||||
FREE(rctx);
|
||||
|
|
@ -165,28 +161,16 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
|
|||
return NULL;
|
||||
}
|
||||
|
||||
rctx->vbuf_mgr = u_vbuf_mgr_create(&rctx->context, 1024 * 1024, 16,
|
||||
PIPE_BIND_VERTEX_BUFFER,
|
||||
rctx->vbuf_mgr = u_vbuf_mgr_create(&rctx->context, 1024 * 1024, 256,
|
||||
PIPE_BIND_VERTEX_BUFFER |
|
||||
PIPE_BIND_INDEX_BUFFER |
|
||||
PIPE_BIND_CONSTANT_BUFFER,
|
||||
U_VERTEX_FETCH_BYTE_ALIGNED);
|
||||
if (!rctx->vbuf_mgr) {
|
||||
r600_destroy_context(&rctx->context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rctx->upload_ib = u_upload_create(&rctx->context, 128 * 1024, 16,
|
||||
PIPE_BIND_INDEX_BUFFER);
|
||||
if (rctx->upload_ib == NULL) {
|
||||
r600_destroy_context(&rctx->context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rctx->upload_const = u_upload_create(&rctx->context, 1024 * 1024, 256,
|
||||
PIPE_BIND_CONSTANT_BUFFER);
|
||||
if (rctx->upload_const == NULL) {
|
||||
r600_destroy_context(&rctx->context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rctx->blitter = util_blitter_create(&rctx->context);
|
||||
if (rctx->blitter == NULL) {
|
||||
FREE(rctx);
|
||||
|
|
|
|||
|
|
@ -151,9 +151,7 @@ struct r600_pipe_context {
|
|||
bool flatshade;
|
||||
struct r600_textures_info ps_samplers;
|
||||
|
||||
struct u_vbuf_mgr *vbuf_mgr;
|
||||
struct u_upload_mgr *upload_ib;
|
||||
struct u_upload_mgr *upload_const;
|
||||
struct u_vbuf_mgr *vbuf_mgr;
|
||||
bool blit;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void r600_translate_index_buffer(struct r600_pipe_context *r600,
|
|||
|
||||
switch (*index_size) {
|
||||
case 1:
|
||||
u_upload_alloc(r600->upload_ib, 0, count * 2,
|
||||
u_upload_alloc(r600->vbuf_mgr->uploader, 0, count * 2,
|
||||
&out_offset, &out_buffer, &flushed, &ptr);
|
||||
|
||||
util_shorten_ubyte_elts_to_userptr(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue