[v2] radv/gfx10: fix VS input VGPRs with the legacy path

Submitted by Samuel Pitoiset on July 23, 2019, 12:14 p.m.

Details

Message ID 20190723121414.21958-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "radv/gfx10: fix VS input VGPRs with the legacy path" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset July 23, 2019, 12:14 p.m.
For some reasons, InstanceID is VGPR3 although StepRate0 is set to 1.

v2: fix instanceID

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/vulkan/radv_nir_to_llvm.c | 12 +++++++++---
 src/amd/vulkan/radv_shader.c      |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 336bae28614..cf73cdc692b 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -852,9 +852,15 @@  declare_vs_input_vgprs(struct radv_shader_context *ctx, struct arg_info *args)
 			}
 		} else {
 			if (ctx->ac.chip_class >= GFX10) {
-				add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
-				add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
-				add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
+				if (ctx->options->key.vs_common_out.as_ngg) {
+					add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
+					add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
+					add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
+				} else {
+					add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* unused */
+					add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->vs_prim_id);
+					add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
+				}
 			} else {
 				add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
 				add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->vs_prim_id);
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 3adaf52e152..3d1b56e7f60 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -765,7 +765,7 @@  static void radv_postprocess_config(const struct radv_physical_device *pdevice,
 			if (info->vs.export_prim_id) {
 				vgpr_comp_cnt = 2;
 			} else if (info->info.vs.needs_instance_id) {
-				vgpr_comp_cnt = 1;
+				vgpr_comp_cnt = pdevice->rad_info.chip_class >= GFX10 ? 3 : 1;
 			} else {
 				vgpr_comp_cnt = 0;
 			}

Comments

r-b

On Tue, Jul 23, 2019 at 2:10 PM Samuel Pitoiset
<samuel.pitoiset@gmail.com> wrote:
>
> For some reasons, InstanceID is VGPR3 although StepRate0 is set to 1.
>
> v2: fix instanceID
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> ---
>  src/amd/vulkan/radv_nir_to_llvm.c | 12 +++++++++---
>  src/amd/vulkan/radv_shader.c      |  2 +-
>  2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
> index 336bae28614..cf73cdc692b 100644
> --- a/src/amd/vulkan/radv_nir_to_llvm.c
> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
> @@ -852,9 +852,15 @@ declare_vs_input_vgprs(struct radv_shader_context *ctx, struct arg_info *args)
>                         }
>                 } else {
>                         if (ctx->ac.chip_class >= GFX10) {
> -                               add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
> -                               add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
> -                               add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
> +                               if (ctx->options->key.vs_common_out.as_ngg) {
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* user vgpr */
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
> +                               } else {
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, NULL); /* unused */
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->vs_prim_id);
> +                                       add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
> +                               }
>                         } else {
>                                 add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->abi.instance_id);
>                                 add_arg(args, ARG_VGPR, ctx->ac.i32, &ctx->vs_prim_id);
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index 3adaf52e152..3d1b56e7f60 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -765,7 +765,7 @@ static void radv_postprocess_config(const struct radv_physical_device *pdevice,
>                         if (info->vs.export_prim_id) {
>                                 vgpr_comp_cnt = 2;
>                         } else if (info->info.vs.needs_instance_id) {
> -                               vgpr_comp_cnt = 1;
> +                               vgpr_comp_cnt = pdevice->rad_info.chip_class >= GFX10 ? 3 : 1;
>                         } else {
>                                 vgpr_comp_cnt = 0;
>                         }
> --
> 2.22.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev