From a232f5e07c8045fda9ace2b9f57e5dd31f910944 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 29 Jul 2019 17:44:52 -0400 Subject: [PATCH] radeonsi/gfx10: fix input VGPRs for legacy VS Reviewed-by: Samuel Pitoiset Acked-by: Pierre-Eric Pelloux-Prayer --- src/gallium/drivers/radeonsi/si_shader.c | 5 ++--- src/gallium/drivers/radeonsi/si_state_shaders.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 7702d96391e..8d3763c15bf 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -4594,10 +4594,9 @@ static void declare_vs_input_vgprs(struct si_shader_context *ctx, add_arg_assign(fninfo, ARG_VGPR, ctx->i32, &ctx->abi.instance_id); add_arg(fninfo, ARG_VGPR, ctx->i32); /* unused */ } - } else if (ctx->screen->info.chip_class == GFX10 && - !shader->is_gs_copy_shader) { - add_arg(fninfo, ARG_VGPR, ctx->i32); /* user vgpr */ + } else if (ctx->screen->info.chip_class >= GFX10) { add_arg(fninfo, ARG_VGPR, ctx->i32); /* user vgpr */ + ctx->param_vs_prim_id = add_arg(fninfo, ARG_VGPR, ctx->i32); /* user vgpr or PrimID (legacy) */ add_arg_assign(fninfo, ARG_VGPR, ctx->i32, &ctx->abi.instance_id); } else { add_arg_assign(fninfo, ARG_VGPR, ctx->i32, &ctx->abi.instance_id); diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 5371ac81039..cb5f78ba23f 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1354,11 +1354,15 @@ static void si_shader_vs(struct si_screen *sscreen, struct si_shader *shader, vgpr_comp_cnt = 0; /* only VertexID is needed for GS-COPY. */ num_user_sgprs = SI_GSCOPY_NUM_USER_SGPR; } else if (shader->selector->type == PIPE_SHADER_VERTEX) { - /* VGPR0-3: (VertexID, InstanceID / StepRate0, PrimID, InstanceID) - * If PrimID is disabled. InstanceID / StepRate1 is loaded instead. - * StepRate0 is set to 1. so that VGPR3 doesn't have to be loaded. - */ - vgpr_comp_cnt = enable_prim_id ? 2 : (shader->info.uses_instanceid ? 1 : 0); + if (sscreen->info.chip_class >= GFX10) { + vgpr_comp_cnt = shader->info.uses_instanceid ? 3 : (enable_prim_id ? 2 : 0); + } else { + /* VGPR0-3: (VertexID, InstanceID / StepRate0, PrimID, InstanceID) + * If PrimID is disabled. InstanceID / StepRate1 is loaded instead. + * StepRate0 is set to 1. so that VGPR3 doesn't have to be loaded. + */ + vgpr_comp_cnt = enable_prim_id ? 2 : (shader->info.uses_instanceid ? 1 : 0); + } if (info->properties[TGSI_PROPERTY_VS_BLIT_SGPRS]) { num_user_sgprs = SI_SGPR_VS_BLIT_DATA + -- 2.30.2