radeonsi: call si_shader_change_notify when vs bind

vs may be null when mesh shader enabled. mesh shader and
vertex shader may share the GS user sgpr, so need to call
si_shader_change_notify to mark shader pointers dirty.

Also remove some init code which will be done anyway when
vs bind first shader in si_shader_change_notify now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37932>
This commit is contained in:
Qiang Yu 2025-05-08 17:22:30 +08:00 committed by Marge Bot
parent f1bbc3d4e4
commit a44d91d065
3 changed files with 10 additions and 6 deletions

View file

@ -2051,9 +2051,15 @@ static void si_set_user_data_base(struct si_context *sctx, unsigned shader, uint
* - geometry shader
* - tessellation evaluation shader
* - NGG
* - vertex shader
*/
void si_shader_change_notify(struct si_context *sctx)
{
if (!sctx->shader.vs.cso) {
si_set_user_data_base(sctx, MESA_SHADER_VERTEX, 0);
return;
}
si_set_user_data_base(sctx, MESA_SHADER_VERTEX,
si_get_user_data_base(sctx->gfx_level,
sctx->shader.tes.cso ? TESS_ON : TESS_OFF,
@ -2954,10 +2960,7 @@ void si_init_all_descriptors(struct si_context *sctx)
sctx->atoms.s.gfx_add_all_to_bo_list.emit = si_emit_gfx_resources_add_all_to_bo_list;
sctx->atoms.s.gfx_shader_pointers.emit = si_emit_graphics_shader_pointers;
/* Set default and immutable mappings. */
si_set_user_data_base(sctx, MESA_SHADER_VERTEX,
si_get_user_data_base(sctx->gfx_level, TESS_OFF, GS_OFF,
sctx->ngg, MESA_SHADER_VERTEX));
/* Set immutable mappings. */
si_set_user_data_base(sctx, MESA_SHADER_TESS_CTRL,
si_get_user_data_base(sctx->gfx_level, TESS_OFF, GS_OFF,
NGG_OFF, MESA_SHADER_TESS_CTRL));

View file

@ -653,7 +653,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
#endif
sctx->ngg = sscreen->use_ngg;
si_shader_change_notify(sctx);
sctx->b.emit_string_marker = si_emit_string_marker;
sctx->b.set_debug_callback = si_set_debug_callback;

View file

@ -3810,6 +3810,7 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = (struct si_shader_selector*)state;
bool enable_changed = !!sctx->shader.vs.cso != !!sel;
if (sctx->shader.vs.cso == sel)
return;
@ -3831,7 +3832,8 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
sctx->vertex_buffers_dirty = new_uses_vbos;
}
if (si_update_ngg(sctx))
bool ngg_changed = si_update_ngg(sctx);
if (ngg_changed || enable_changed)
si_shader_change_notify(sctx);
si_update_common_shader_state(sctx, sel, MESA_SHADER_VERTEX);