From 85bbcdda34164865c8e603899a81463f1ad55ecf Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 10 Jan 2018 20:03:28 +0100 Subject: st/mesa: assume that user constant buffers are always supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Roland Scheidegger Tested-by: Dieter Nützel --- src/mesa/state_tracker/st_atom_constbuf.c | 19 +++---------------- src/mesa/state_tracker/st_context.c | 2 -- src/mesa/state_tracker/st_context.h | 1 - src/mesa/state_tracker/st_pbo.c | 18 +++--------------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 497d33fc348..0a6b23aff3b 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -101,22 +101,9 @@ void st_upload_constants(struct st_context *st, struct gl_program *prog) _mesa_shader_write_subroutine_indices(st->ctx, stage); - /* We always need to get a new buffer, to keep the drivers simple and - * avoid gratuitous rendering synchronization. - * Let's use a user buffer to avoid an unnecessary copy. - */ - if (!st->has_user_constbuf) { - cb.buffer = NULL; - cb.user_buffer = NULL; - u_upload_data(st->pipe->const_uploader, 0, paramBytes, - st->ctx->Const.UniformBufferOffsetAlignment, - params->ParameterValues, &cb.buffer_offset, &cb.buffer); - u_upload_unmap(st->pipe->const_uploader); - } else { - cb.buffer = NULL; - cb.user_buffer = params->ParameterValues; - cb.buffer_offset = 0; - } + cb.buffer = NULL; + cb.user_buffer = params->ParameterValues; + cb.buffer_offset = 0; cb.buffer_size = paramBytes; if (ST_DEBUG & DEBUG_CONSTANTS) { diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index a7b2cfc12ba..3ba48479266 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -372,8 +372,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, st->dirty = ST_ALL_STATES_MASK; - st->has_user_constbuf = - screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS); st->can_bind_const_buffer_as_vertex = screen->get_param(screen, PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 9f33eed8f36..0258bed36b1 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -110,7 +110,6 @@ struct st_context boolean has_shareable_shaders; boolean has_half_float_packing; boolean has_multi_draw_indirect; - boolean has_user_constbuf; boolean can_bind_const_buffer_as_vertex; /** diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index 303c8535b20..628e3ca64a5 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -259,21 +259,9 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr, { struct pipe_constant_buffer cb; - if (!st->has_user_constbuf) { - cb.buffer = NULL; - cb.user_buffer = NULL; - 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->pipe->const_uploader); - } else { - cb.buffer = NULL; - cb.user_buffer = &addr->constants; - cb.buffer_offset = 0; - } + cb.buffer = NULL; + cb.user_buffer = &addr->constants; + cb.buffer_offset = 0; cb.buffer_size = sizeof(addr->constants); cso_set_constant_buffer(cso, PIPE_SHADER_FRAGMENT, 0, &cb); -- cgit v1.2.3