[Mesa-dev] [PATCH 1/2] tgsi/scan: add uses_derivatives
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jun 1 14:01:23 UTC 2016
On Jun 1, 2016 7:29 AM, "Nicolai Hähnle" <nhaehnle at gmail.com> wrote:
>
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Cc: 12.0 <mesa-stable at lists.freedesktop.org>
> ---
> src/gallium/auxiliary/tgsi/tgsi_scan.c | 26 ++++++++++++++++++++++++++
> src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 +
> 2 files changed, 27 insertions(+)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> index 1baf031..d202ab1 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
> @@ -68,6 +68,29 @@ is_texture_inst(unsigned opcode)
> tgsi_get_opcode_info(opcode)->is_tex);
> }
>
> +
> +/**
> + * Is the opcode an instruction which computes a derivative explicitly or
> + * implicitly?
> + */
> +static bool
> +computes_derivative(unsigned opcode)
> +{
> + if (tgsi_get_opcode_info(opcode)->is_tex) {
> + return opcode != TGSI_OPCODE_TXD &&
> + opcode != TGSI_OPCODE_TXL &&
> + opcode != TGSI_OPCODE_TXL2 &&
> + opcode != TGSI_OPCODE_TXF &&
> + opcode != TGSI_OPCODE_TXQ &&
> + opcode != TGSI_OPCODE_TXQ_LZ &&
> + opcode != TGSI_OPCODE_TXQS;
Tg4 too, I think
> + }
> +
> + return opcode == TGSI_OPCODE_DDX || opcode == TGSI_OPCODE_DDX_FINE ||
> + opcode == TGSI_OPCODE_DDY || opcode == TGSI_OPCODE_DDY_FINE;
> +}
> +
> +
> static void
> scan_instruction(struct tgsi_shader_info *info,
> const struct tgsi_full_instruction *fullinst,
> @@ -263,6 +286,9 @@ scan_instruction(struct tgsi_shader_info *info,
> if (is_mem_inst)
> info->num_memory_instructions++;
>
> + if (computes_derivative(fullinst->Instruction.Opcode))
> + info->uses_derivatives = true;
> +
> info->num_instructions++;
> }
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
> index 31adce7..f7eefa4 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
> @@ -115,6 +115,7 @@ struct tgsi_shader_info
> boolean writes_memory; /**< contains stores or atomics to buffers or
images */
> boolean is_msaa_sampler[PIPE_MAX_SAMPLERS];
> boolean uses_doubles; /**< uses any of the double instructions */
> + boolean uses_derivatives;
> unsigned clipdist_writemask;
> unsigned culldist_writemask;
> unsigned num_written_culldistance;
> --
> 2.7.4
>
> _______________________________________________
> 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/20160601/b592f1e8/attachment-0001.html>
More information about the mesa-dev
mailing list