diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index 8f4c8fbe2e5..91042af8acd 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -844,10 +844,12 @@ void si_nir_scan_shader(struct si_screen *sscreen, const struct nir_shader *nir, /* For the ESGS ring in LDS, add 1 dword to reduce LDS bank * conflicts, i.e. each vertex will start on a different bank. */ - if (sscreen->info.gfx_level >= GFX9) - info->esgs_vertex_stride += 4; - else + if (sscreen->info.gfx_level >= GFX9) { + if (info->esgs_vertex_stride) + info->esgs_vertex_stride += 4; + } else { assert(((info->esgs_vertex_stride / 4) & C_028AAC_ITEMSIZE) == 0); + } info->tcs_vgpr_only_inputs = ~info->base.tess.tcs_cross_invocation_inputs_read & ~info->base.inputs_read_indirectly & diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index 59cd8bdf6ed..f31f856905e 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -925,8 +925,8 @@ void gfx9_get_gs_info(struct si_shader_selector *es, struct si_shader_selector * static void gfx9_set_gs_sgpr_num_es_outputs(struct si_context *sctx, unsigned esgs_vertex_stride) { /* The stride must always be odd (e.g. a multiple of 4 + 1) to reduce LDS bank conflicts. */ - assert(esgs_vertex_stride % 4 == 1); - unsigned num_es_outputs = (esgs_vertex_stride - 1) / 4; + assert(!esgs_vertex_stride || esgs_vertex_stride % 4 == 1); + unsigned num_es_outputs = esgs_vertex_stride / 4; /* If there are no ES outputs, GS doesn't use this SGPR field, so only set it if the number * is non-zero.