[Mesa-dev] [PATCH] RFC: tgsi: Add output_type to struct tgsi_opcode_info
Jose Fonseca
jfonseca at vmware.com
Mon Jan 9 10:51:56 PST 2012
Tom,
I think this is perfectly sensible thing to do if it helps, but tgsi_output_type definition should be added to tgsi_info.h and not src/gallium/include/pipe/p_shader_tokens.h as it is not really used anywhere in the tokenized representation.
Jose
----- Original Message -----
> I've been working more on the TGSI->LLVM converter, and I've found
> that
> it would be useful to be able to look up information about how an
> opcode
> calculates its result.
>
> I'm looking for feedback on whether adding a field to struct
> tgsi_opcode_info is the right way to do this, and also if the
> enumerations in enum tgsi_output_type make sense.
> ---
> src/gallium/auxiliary/tgsi/tgsi_info.h | 1 +
> src/gallium/include/pipe/p_shader_tokens.h | 33
> ++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h
> b/src/gallium/auxiliary/tgsi/tgsi_info.h
> index 1992d11..4fc19e9 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
> @@ -43,6 +43,7 @@ struct tgsi_opcode_info
> unsigned is_branch:1;
> int pre_dedent:2;
> int post_indent:2;
> + enum tgsi_output_type output_type:3;
> const char *mnemonic;
> uint opcode;
> };
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h
> b/src/gallium/include/pipe/p_shader_tokens.h
> index 330e0ba..8a1d60c 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -216,6 +216,39 @@ struct tgsi_property_data {
> unsigned Data;
> };
>
> +/* This enum describes how an opcode calculates its result. */
> +enum tgsi_output_type {
> + /** The opcode produces no result. */
> + TGSI_OUTPUT_NONE = 0,
> +
> + /** When this opcode writes to a channel of the destination
> register,
> + * it takes as arguments values from the same channel of the
> source
> + * register(s).
> + *
> + * Example: TGSI_OPCODE_ADD
> + */
> + TGSI_OUTPUT_COMPONENTWISE = 1,
> +
> + /** This opcode writes the same value to all enabled channels of
> the
> + * destination register.
> + *
> + * Example: TGSI_OPCODE_RSQ
> + */
> + TGSI_OUTPUT_REPLICATE = 2,
> +
> + /** The operation performed by this opcode is dependent on which
> channel
> + * of the destination register is being written.
> + *
> + * Example: TGSI_OPCODE_LOG
> + */
> + TGSI_OUTPUT_CHAN_DEPENDENT = 3,
> +
> + /**
> + * Example: TGSI_OPCODE_TEX
> + */
> + TGSI_OUTPUT_OTHER = 4
> +};
> +
> /* TGSI opcodes.
> *
> * For more information on semantics of opcodes and
> --
> 1.7.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list