radeonsi: restructure si_get_vs_vgpr_comp_cnt for readability

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11102>
This commit is contained in:
Marek Olšák
2021-05-11 00:40:39 -04:00
committed by Marge Bot
parent 06ff0ae4bb
commit 786678a017

View File

@@ -509,22 +509,30 @@ static unsigned si_get_vs_vgpr_comp_cnt(struct si_screen *sscreen, struct si_sha
assert(shader->selector->info.stage == MESA_SHADER_VERTEX ||
(shader->previous_stage_sel && shader->previous_stage_sel->info.stage == MESA_SHADER_VERTEX));
/* GFX6-9 LS (VertexID, RelAutoindex, InstanceID / StepRate0(==1), ...).
* GFX6-9 ES,VS (VertexID, InstanceID / StepRate0(==1), VSPrimID, ...)
* GFX10 LS (VertexID, RelAutoindex, UserVGPR1, InstanceID).
* GFX10 ES,VS (VertexID, UserVGPR0, UserVGPR1 or VSPrimID, UserVGPR2 or
* InstanceID)
/* GFX6-9 LS (VertexID, RelAutoIndex, InstanceID / StepRate0, InstanceID)
* GFX6-9 ES,VS (VertexID, InstanceID / StepRate0, VSPrimID, InstanceID)
* GFX10 LS (VertexID, RelAutoIndex, UserVGPR1, UserVGPR2 or InstanceID)
* GFX10 ES,VS (VertexID, UserVGPR1, UserVGPR2 or VSPrimID, UserVGPR3 or InstanceID)
*/
bool is_ls = shader->selector->info.stage == MESA_SHADER_TESS_CTRL || shader->key.as_ls;
unsigned max = 0;
if (sscreen->info.chip_class >= GFX10 && shader->info.uses_instanceid)
return 3;
else if ((is_ls && shader->info.uses_instanceid) || legacy_vs_prim_id)
return 2;
else if (is_ls || shader->info.uses_instanceid)
return 1;
else
return 0;
if (shader->info.uses_instanceid) {
if (sscreen->info.chip_class >= GFX10)
max = MAX2(max, 3);
else if (is_ls)
max = MAX2(max, 2); /* use (InstanceID / StepRate0) because StepRate0 == 1 */
else
max = MAX2(max, 1); /* use (InstanceID / StepRate0) because StepRate0 == 1 */
}
if (legacy_vs_prim_id)
max = MAX2(max, 2); /* VSPrimID */
if (is_ls)
max = MAX2(max, 1); /* RelAutoIndex */
return max;
}
static void si_shader_ls(struct si_screen *sscreen, struct si_shader *shader)