diff options
author | Samuel Pitoiset <[email protected]> | 2017-05-16 12:25:28 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-14 10:04:36 +0200 |
commit | 2c3a7d584095bacb129a3fbbd6ccd5eac34d1451 (patch) | |
tree | e08fdb8b4728764183471895b7ee137845271193 /src/gallium | |
parent | e1813a8635fb9775791721cf421de05803c3fcb5 (diff) |
radeonsi: track use of bindless samplers/images from tgsi_shader_info
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 <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_compute.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_compute.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 31 |
5 files changed, 46 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 0338b8a1234..79b107e96fc 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 764d708c4fb..268817b23a6 100644 --- a/src/gallium/drivers/radeonsi/si_compute.h +++ b/src/gallium/drivers/radeonsi/si_compute.h @@ -49,6 +49,8 @@ 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; }; #endif /* SI_COMPUTE_H */ diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 64be428943c..9ebc9220742 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -428,6 +428,10 @@ struct si_context { /* Resident bindless handles */ struct util_dynarray resident_tex_handles; struct util_dynarray resident_img_handles; + + /* Bindless state */ + bool uses_bindless_samplers; + bool uses_bindless_images; }; /* cik_sdma.c */ diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index ed1df2bfa7d..063747a4096 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -630,4 +630,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 diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 848c5a75ee9..668c5d9447d 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2202,6 +2202,23 @@ static void si_update_clip_regs(struct si_context *sctx, si_mark_atom_dirty(sctx, &sctx->clip_regs); } +static void si_update_common_shader_state(struct si_context *sctx) +{ + sctx->uses_bindless_samplers = + 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); + sctx->uses_bindless_images = + 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); + sctx->do_update_shaders = true; +} + static void si_bind_vs_shader(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; @@ -2214,7 +2231,8 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state) sctx->vs_shader.cso = sel; sctx->vs_shader.current = sel ? sel->first_variant : NULL; - sctx->do_update_shaders = true; + + si_update_common_shader_state(sctx); r600_update_vs_writes_viewport_index(&sctx->b, si_get_vs_info(sctx)); si_set_active_descriptors_for_shader(sctx, sel); si_update_streamout_state(sctx); @@ -2249,7 +2267,8 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state) sctx->gs_shader.cso = sel; sctx->gs_shader.current = sel ? sel->first_variant : NULL; sctx->ia_multi_vgt_param_key.u.uses_gs = sel != NULL; - sctx->do_update_shaders = true; + + si_update_common_shader_state(sctx); sctx->last_rast_prim = -1; /* reset this so that it gets updated */ if (enable_changed) { @@ -2276,7 +2295,8 @@ static void si_bind_tcs_shader(struct pipe_context *ctx, void *state) sctx->tcs_shader.cso = sel; sctx->tcs_shader.current = sel ? sel->first_variant : NULL; si_update_tess_uses_prim_id(sctx); - sctx->do_update_shaders = true; + + si_update_common_shader_state(sctx); if (enable_changed) sctx->last_tcs = NULL; /* invalidate derived tess state */ @@ -2299,7 +2319,8 @@ static void si_bind_tes_shader(struct pipe_context *ctx, void *state) sctx->tes_shader.current = sel ? sel->first_variant : NULL; sctx->ia_multi_vgt_param_key.u.uses_tess = sel != NULL; si_update_tess_uses_prim_id(sctx); - sctx->do_update_shaders = true; + + si_update_common_shader_state(sctx); sctx->last_rast_prim = -1; /* reset this so that it gets updated */ if (enable_changed) { @@ -2325,8 +2346,8 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state) sctx->ps_shader.cso = sel; sctx->ps_shader.current = sel ? sel->first_variant : NULL; - sctx->do_update_shaders = true; + si_update_common_shader_state(sctx); if (sel) { if (sctx->ia_multi_vgt_param_key.u.uses_tess) si_update_tess_uses_prim_id(sctx); |