st/mesa: assume that user constant buffers are always supported
authorMarek Olšák <marek.olsak@amd.com>
Wed, 10 Jan 2018 19:03:28 +0000 (20:03 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 17 Jan 2018 19:17:59 +0000 (20:17 +0100)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_pbo.c

index 497d33fc348683d8fd0b65c570ba931947080200..0a6b23aff3b09eae1ba66c3b40f3e4ed1afa80a0 100644 (file)
@@ -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) {
index a7b2cfc12bac28bb1e8cdedc618c684ecd39e872..3ba484792662079320f13265aae7bbe8e41d9db1 100644 (file)
@@ -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);
 
index 9f33eed8f3614cd9d6f1917fb15347f8f2bd160c..0258bed36b1cf7ec553027949d53e0462d3c3a9d 100644 (file)
@@ -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;
 
    /**
index 303c8535b20d4d558d9ee76e93739dd9d1d0a271..628e3ca64a5835e80facbba8d2b61dc9ddc31533 100644 (file)
@@ -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);