Mesa (main): gallium/u_threaded: query shader resource limits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 17 11:05:31 UTC 2021
Module: Mesa
Branch: main
Commit: 88b97567d413568e956a73cce12daecc6b9cacc7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=88b97567d413568e956a73cce12daecc6b9cacc7
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Apr 21 21:35:15 2021 -0400
gallium/u_threaded: query shader resource limits
for tracking buffer busyness later
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10662>
---
src/gallium/auxiliary/util/u_threaded_context.c | 17 +++++++++++++++++
src/gallium/auxiliary/util/u_threaded_context.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 222959cace7..40f1e9896b9 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -3475,6 +3475,23 @@ threaded_context_create(struct pipe_context *pipe,
slab_create_child(&tc->pool_transfers, parent_transfer_pool);
+ /* If you have different limits in each shader stage, set the maximum. */
+ struct pipe_screen *screen = pipe->screen;;
+ tc->max_vertex_buffers =
+ screen->get_param(screen, PIPE_CAP_MAX_VERTEX_BUFFERS);
+ tc->max_const_buffers =
+ screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFERS);
+ tc->max_shader_buffers =
+ screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
+ tc->max_images =
+ screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_SHADER_IMAGES);
+ tc->max_samplers =
+ screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS);
+
tc->base.set_context_param = tc_set_context_param; /* always set this */
#define CTX_INIT(_member) \
diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
index dedfe7ecb89..72ffe7819ac 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -405,6 +405,12 @@ struct threaded_context {
bool seen_tes;
bool seen_gs;
+ unsigned max_vertex_buffers;
+ unsigned max_const_buffers;
+ unsigned max_shader_buffers;
+ unsigned max_images;
+ unsigned max_samplers;
+
unsigned last, next;
/* The list fences that the driver should signal after the next flush.
More information about the mesa-commit
mailing list