mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
radeonsi: calculate lds size for merged shaders
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24204>
This commit is contained in:
parent
339ea9e344
commit
1b53708a62
1 changed files with 19 additions and 8 deletions
|
|
@ -936,16 +936,27 @@ static bool upload_binary_elf(struct si_screen *sscreen, struct si_shader *shade
|
|||
|
||||
static void calculate_needed_lds_size(struct si_screen *sscreen, struct si_shader *shader)
|
||||
{
|
||||
if ((shader->selector->stage == MESA_SHADER_VERTEX && !shader->key.ge.as_ls) ||
|
||||
shader->selector->stage == MESA_SHADER_TESS_EVAL) {
|
||||
unsigned size_in_dw = 0;
|
||||
if (shader->key.ge.as_es || shader->key.ge.as_ngg)
|
||||
size_in_dw += shader->gs_info.esgs_ring_size;
|
||||
if (shader->key.ge.as_ngg)
|
||||
size_in_dw += gfx10_ngg_get_scratch_dw_size(shader);
|
||||
gl_shader_stage stage =
|
||||
shader->is_gs_copy_shader ? MESA_SHADER_VERTEX : shader->selector->stage;
|
||||
|
||||
if (sscreen->info.gfx_level >= GFX9 && stage <= MESA_SHADER_GEOMETRY &&
|
||||
(stage == MESA_SHADER_GEOMETRY || shader->key.ge.as_ngg)) {
|
||||
unsigned size_in_dw = shader->gs_info.esgs_ring_size;
|
||||
|
||||
if (stage == MESA_SHADER_GEOMETRY && shader->key.ge.as_ngg)
|
||||
size_in_dw += shader->ngg.ngg_emit_size;
|
||||
|
||||
if (shader->key.ge.as_ngg) {
|
||||
unsigned scratch_dw_size = gfx10_ngg_get_scratch_dw_size(shader);
|
||||
if (scratch_dw_size) {
|
||||
/* scratch base address needs to be 8 byte aligned */
|
||||
size_in_dw = ALIGN(size_in_dw, 2);
|
||||
size_in_dw += scratch_dw_size;
|
||||
}
|
||||
}
|
||||
|
||||
shader->config.lds_size =
|
||||
DIV_ROUND_UP(size_in_dw * 4, get_lds_granularity(sscreen, shader->selector->stage));
|
||||
DIV_ROUND_UP(size_in_dw * 4, get_lds_granularity(sscreen, stage));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue