Re: [Mesa-dev] [PATCH 1/2] radv/gfx10: fix exporting the subpass view index for GS

2019-07-11 Thread Bas Nieuwenhuizen
R-b

On Thu, Jul 11, 2019, 5:02 PM Samuel Pitoiset 
wrote:

> This fixes dEQP-VK.multiview.*geometry*.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_nir_to_llvm.c | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c
> b/src/amd/vulkan/radv_nir_to_llvm.c
> index 11498bc27aa..7da061f7f33 100644
> --- a/src/amd/vulkan/radv_nir_to_llvm.c
> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
> @@ -3583,11 +3583,12 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct
> radv_shader_context *ctx)
> ac_build_ifcc(>ac, tmp, 5145);
> {
> struct radv_vs_output_info *outinfo =
> >shader_info->vs.outinfo;
> +   bool export_view_index =
> ctx->options->key.has_multiview_view_index;
> struct radv_shader_output_values *outputs;
> unsigned noutput = 0;
>
> /* Allocate a temporary array for the output values. */
> -   unsigned num_outputs = util_bitcount64(ctx->output_mask);
> +   unsigned num_outputs = util_bitcount64(ctx->output_mask) +
> export_view_index;
> outputs = calloc(num_outputs, sizeof(outputs[0]));
>
> memset(outinfo->vs_output_param_offset,
> AC_EXP_PARAM_UNDEFINED,
> @@ -3642,6 +3643,19 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct
> radv_shader_context *ctx)
> noutput++;
> }
>
> +   /* Export ViewIndex. */
> +   if (export_view_index) {
> +   outinfo->writes_layer = true;
> +
> +   outputs[noutput].slot_name = VARYING_SLOT_LAYER;
> +   outputs[noutput].slot_index = 0;
> +   outputs[noutput].usage_mask = 0x1;
> +   outputs[noutput].values[0] = ac_to_float(>ac,
> ctx->abi.view_index);
> +   for (unsigned j = 1; j < 4; j++)
> +   outputs[noutput].values[j] = ctx->ac.f32_0;
> +   noutput++;
> +   }
> +
> radv_llvm_export_vs(ctx, outputs, noutput, outinfo, false);
> FREE(outputs);
> }
> --
> 2.22.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/2] radv/gfx10: fix exporting the subpass view index for GS

2019-07-11 Thread Samuel Pitoiset
This fixes dEQP-VK.multiview.*geometry*.

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_nir_to_llvm.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_nir_to_llvm.c 
b/src/amd/vulkan/radv_nir_to_llvm.c
index 11498bc27aa..7da061f7f33 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -3583,11 +3583,12 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct 
radv_shader_context *ctx)
ac_build_ifcc(>ac, tmp, 5145);
{
struct radv_vs_output_info *outinfo = 
>shader_info->vs.outinfo;
+   bool export_view_index = 
ctx->options->key.has_multiview_view_index;
struct radv_shader_output_values *outputs;
unsigned noutput = 0;
 
/* Allocate a temporary array for the output values. */
-   unsigned num_outputs = util_bitcount64(ctx->output_mask);
+   unsigned num_outputs = util_bitcount64(ctx->output_mask) + 
export_view_index;
outputs = calloc(num_outputs, sizeof(outputs[0]));
 
memset(outinfo->vs_output_param_offset, AC_EXP_PARAM_UNDEFINED,
@@ -3642,6 +3643,19 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct 
radv_shader_context *ctx)
noutput++;
}
 
+   /* Export ViewIndex. */
+   if (export_view_index) {
+   outinfo->writes_layer = true;
+
+   outputs[noutput].slot_name = VARYING_SLOT_LAYER;
+   outputs[noutput].slot_index = 0;
+   outputs[noutput].usage_mask = 0x1;
+   outputs[noutput].values[0] = ac_to_float(>ac, 
ctx->abi.view_index);
+   for (unsigned j = 1; j < 4; j++)
+   outputs[noutput].values[j] = ctx->ac.f32_0;
+   noutput++;
+   }
+
radv_llvm_export_vs(ctx, outputs, noutput, outinfo, false);
FREE(outputs);
}
-- 
2.22.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev