[Mesa-dev] [PATCH] ac/shader: be a little smarter when scanning vertex buffers
Bas Nieuwenhuizen
basni at chromium.org
Wed Feb 14 14:21:11 UTC 2018
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
On Wed, Feb 14, 2018 at 12:03 PM, Samuel Pitoiset <samuel.pitoiset at gmail.com
> wrote:
> Although meta shaders don't use any vertex buffers, there is no
> behaviour change but I think it's better to do this. Though,
> this saves two user SGPRs for push constants inlining or
> something else.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/amd/common/ac_shader_info.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_
> info.c
> index 3b0887995d..f6cdd34703 100644
> --- a/src/amd/common/ac_shader_info.c
> +++ b/src/amd/common/ac_shader_info.c
> @@ -179,6 +179,16 @@ gather_info_block(const nir_shader *nir, const
> nir_block *block,
> }
> }
>
> +static void
> +gather_info_input_decl_vs(const nir_shader *nir, const nir_variable *var,
> + struct ac_shader_info *info)
> +{
> + int idx = var->data.location;
> +
> + if (idx >= VERT_ATTRIB_GENERIC0 && idx <= VERT_ATTRIB_GENERIC15)
> + info->vs.has_vertex_buffers = true;
> +}
> +
> static void
> gather_info_input_decl_ps(const nir_shader *nir, const nir_variable *var,
> struct ac_shader_info *info)
> @@ -197,7 +207,7 @@ gather_info_input_decl(const nir_shader *nir, const
> nir_variable *var,
> {
> switch (nir->info.stage) {
> case MESA_SHADER_VERTEX:
> - info->vs.has_vertex_buffers = true;
> + gather_info_input_decl_vs(nir, var, info);
> break;
> case MESA_SHADER_FRAGMENT:
> gather_info_input_decl_ps(nir, var, info);
> --
> 2.16.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180214/a217ff17/attachment.html>
More information about the mesa-dev
mailing list