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@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7475>
This commit is contained in:
Mike Blumenkrantz 2020-11-06 10:48:46 -05:00 committed by Marge Bot
parent cb034ae44f
commit 9cef302aa0
2 changed files with 4 additions and 1 deletions

View file

@ -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;

View file

@ -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;