[Mesa-dev] [PATCH v2 58/64] radeonsi: track use of bindless samplers/images from tgsi_shader_info
Marek Olšák
maraeo at gmail.com
Tue Jun 6 23:49:59 UTC 2017
On Tue, May 30, 2017 at 10:36 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> This adds some new helper functions to know if the current draw
> call (or dispatch compute) is using bindless samplers/images,
> based on TGSI analysis.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/radeonsi/si_compute.c | 2 ++
> src/gallium/drivers/radeonsi/si_compute.h | 14 ++++++++++++++
> src/gallium/drivers/radeonsi/si_pipe.h | 20 ++++++++++++++++++++
> src/gallium/drivers/radeonsi/si_shader.h | 12 ++++++++++++
> 4 files changed, 48 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
> index 4c980668d3..61fab7ddb0 100644
> --- a/src/gallium/drivers/radeonsi/si_compute.c
> +++ b/src/gallium/drivers/radeonsi/si_compute.c
> @@ -108,6 +108,8 @@ static void si_create_compute_state_async(void *job, int thread_index)
> program->shader.is_monolithic = true;
> program->uses_grid_size = sel.info.uses_grid_size;
> program->uses_block_size = sel.info.uses_block_size;
> + program->uses_bindless_samplers = sel.info.uses_bindless_samplers;
> + program->uses_bindless_images = sel.info.uses_bindless_images;
>
> if (si_shader_create(program->screen, tm, &program->shader, debug)) {
> program->shader.compilation_failed = true;
> diff --git a/src/gallium/drivers/radeonsi/si_compute.h b/src/gallium/drivers/radeonsi/si_compute.h
> index 764d708c4f..3cf1538267 100644
> --- a/src/gallium/drivers/radeonsi/si_compute.h
> +++ b/src/gallium/drivers/radeonsi/si_compute.h
> @@ -49,6 +49,20 @@ struct si_compute {
> unsigned variable_group_size : 1;
> unsigned uses_grid_size:1;
> unsigned uses_block_size:1;
> + unsigned uses_bindless_samplers:1;
> + unsigned uses_bindless_images:1;
> };
>
> +static inline bool
> +si_compute_uses_bindless_samplers(struct si_context *sctx)
> +{
> + return sctx->cs_shader_state.program->uses_bindless_samplers;
> +}
> +
> +static inline bool
> +si_compute_uses_bindless_images(struct si_context *sctx)
> +{
> + return sctx->cs_shader_state.program->uses_bindless_images;
> +}
> +
> #endif /* SI_COMPUTE_H */
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
> index 434bc0aa67..fe7cf20ec9 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.h
> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
> @@ -538,6 +538,26 @@ static inline struct tgsi_shader_info *si_get_vs_info(struct si_context *sctx)
> return NULL;
> }
>
> +static inline bool
> +si_graphics_uses_bindless_samplers(struct si_context *sctx)
> +{
> + return si_shader_uses_bindless_samplers(sctx->vs_shader.cso) ||
> + si_shader_uses_bindless_samplers(sctx->gs_shader.cso) ||
> + si_shader_uses_bindless_samplers(sctx->ps_shader.cso) ||
> + si_shader_uses_bindless_samplers(sctx->tcs_shader.cso) ||
> + si_shader_uses_bindless_samplers(sctx->tes_shader.cso);
> +}
> +
> +static inline bool
> +si_graphics_uses_bindless_images(struct si_context *sctx)
> +{
> + return si_shader_uses_bindless_images(sctx->vs_shader.cso) ||
> + si_shader_uses_bindless_images(sctx->gs_shader.cso) ||
> + si_shader_uses_bindless_images(sctx->ps_shader.cso) ||
> + si_shader_uses_bindless_images(sctx->tcs_shader.cso) ||
> + si_shader_uses_bindless_images(sctx->tes_shader.cso);
> +}
I'd like shader bind calls to set the result of these functions in a
bool flag in si_context. Then, patch 59 can use the bool flags instead
of calling the functions.
Marek
More information about the mesa-dev
mailing list