[Mesa-dev] [PATCH v2 58/64] radeonsi: track use of bindless samplers/images from tgsi_shader_info
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue May 30 20:36:29 UTC 2017
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);
+}
+
static inline struct si_shader* si_get_vs_state(struct si_context *sctx)
{
if (sctx->gs_shader.current)
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index aab902b4c7..87bbbf9c2a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -622,4 +622,16 @@ si_get_main_shader_part(struct si_shader_selector *sel,
return &sel->main_shader_part;
}
+static inline bool
+si_shader_uses_bindless_samplers(struct si_shader_selector *selector)
+{
+ return selector ? selector->info.uses_bindless_samplers : false;
+}
+
+static inline bool
+si_shader_uses_bindless_images(struct si_shader_selector *selector)
+{
+ return selector ? selector->info.uses_bindless_images : false;
+}
+
#endif
--
2.13.0
More information about the mesa-dev
mailing list