Mesa (master): util/threaded_context: use driver's ubo alignment for constant buffer uploads
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 18:56:55 UTC 2020
Module: Mesa
Branch: master
Commit: 9cef302aa04fb7cb23729d269ba13ecbe6b33adf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cef302aa04fb7cb23729d269ba13ecbe6b33adf
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Nov 6 10:48:46 2020 -0500
util/threaded_context: use driver's ubo alignment for constant buffer uploads
this is another case where the hardcoded value was specific to radeon drivers
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7475>
---
src/gallium/auxiliary/util/u_threaded_context.c | 4 +++-
src/gallium/auxiliary/util/u_threaded_context.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 1eaff77724e..5da9a177fa8 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -744,7 +744,7 @@ tc_set_constant_buffer(struct pipe_context *_pipe,
* set_constant_buffer to the driver if it was done afterwards.
*/
if (cb && cb->user_buffer) {
- u_upload_data(tc->base.const_uploader, 0, cb->buffer_size, 64,
+ u_upload_data(tc->base.const_uploader, 0, cb->buffer_size, tc->ubo_alignment,
cb->user_buffer, &offset, &buffer);
u_upload_unmap(tc->base.const_uploader);
}
@@ -2745,6 +2745,8 @@ threaded_context_create(struct pipe_context *pipe,
tc->create_fence = create_fence;
tc->map_buffer_alignment =
pipe->screen->get_param(pipe->screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
+ tc->ubo_alignment =
+ MAX2(pipe->screen->get_param(pipe->screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT), 64);
tc->base.priv = pipe; /* priv points to the wrapped driver context */
tc->base.screen = pipe->screen;
tc->base.destroy = tc_destroy;
diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
index 9a47a07dbc8..ac02e1079f1 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -356,6 +356,7 @@ struct threaded_context {
tc_replace_buffer_storage_func replace_buffer_storage;
tc_create_fence_func create_fence;
unsigned map_buffer_alignment;
+ unsigned ubo_alignment;
struct list_head unflushed_queries;
More information about the mesa-commit
mailing list