[Mesa-dev] [PATCH 04/15] radv: gather the number of streams used by geometry shaders

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Oct 15 07:24:58 UTC 2018


On Sat, Oct 13, 2018 at 2:56 PM Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
> This will be used for splitting the GS->VS ring buffer. The
> stream ID is always 0 for now.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_shader.h      |  1 +
>  src/amd/vulkan/radv_shader_info.c | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
> index c490b69f52..f02ca1cf8d 100644
> --- a/src/amd/vulkan/radv_shader.h
> +++ b/src/amd/vulkan/radv_shader.h
> @@ -159,6 +159,7 @@ struct radv_shader_info {
>         } vs;
>         struct {
>                 uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
> +               uint8_t max_stream;

With 0 outputs, should we be able to support 0 streams? If so we might
need to change this to a count.

Otherwise,

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>         } gs;
>         struct {
>                 uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
> diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
> index 6262acb1a6..00bc2ca5db 100644
> --- a/src/amd/vulkan/radv_shader_info.c
> +++ b/src/amd/vulkan/radv_shader_info.c
> @@ -434,6 +434,17 @@ gather_info_output_decl_ps(const nir_shader *nir, const nir_variable *var,
>         }
>  }
>
> +static void
> +gather_info_output_decl_gs(const nir_shader *nir, const nir_variable *var,
> +                          struct radv_shader_info *info)
> +{
> +       unsigned stream = var->data.stream;
> +
> +       assert(stream < 4);
> +
> +       info->gs.max_stream = MAX2(info->gs.max_stream, stream);
> +}
> +
>  static void
>  gather_info_output_decl(const nir_shader *nir, const nir_variable *var,
>                         struct radv_shader_info *info,
> @@ -447,6 +458,9 @@ gather_info_output_decl(const nir_shader *nir, const nir_variable *var,
>                 if (options->key.vs.as_ls)
>                         gather_info_output_decl_ls(nir, var, info);
>                 break;
> +       case MESA_SHADER_GEOMETRY:
> +               gather_info_output_decl_gs(nir, var, info);
> +               break;
>         default:
>                 break;
>         }
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list