[Mesa-dev] [RFC 5/9] tgsi/text: parse _PRECISE modifier

Nicolai Hähnle nhaehnle at gmail.com
Mon Jun 12 10:31:45 UTC 2017


On 11.06.2017 20:42, Karol Herbst wrote:
> Signed-off-by: Karol Herbst <karolherbst at gmail.com>
> ---
>   src/gallium/auxiliary/tgsi/tgsi_text.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
> index 93a05568f4..c5fcb3283d 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
> @@ -999,6 +999,7 @@ parse_texoffset_operand(
>   static boolean
>   match_inst(const char **pcur,
>              unsigned *saturate,
> +           unsigned *precise,
>              const struct tgsi_opcode_info *info)
>   {
>      const char *cur = *pcur;
> @@ -1007,6 +1008,7 @@ match_inst(const char **pcur,
>      if (str_match_nocase_whole(&cur, info->mnemonic)) {
>         *pcur = cur;
>         *saturate = 0;
> +      *precise = 0;
>         return TRUE;
>      }
>   
> @@ -1015,8 +1017,15 @@ match_inst(const char **pcur,
>         if (str_match_nocase_whole(&cur, "_SAT")) {
>            *pcur = cur;
>            *saturate = 1;
> -         return TRUE;
>         }
> +
> +      if (str_match_nocase_whole(&cur, "_PRECISE")) {
> +         *pcur = cur;
> +         *precise = 1;
> +      }

I think this doesn't properly handle the case where both _SAT and 
_PRECISE are present, because of using str_match_nocase_whole.

Cheers,
Nicolai

> +
> +      if (*precise || *saturate)
> +         return TRUE;
>      }
>   
>      return FALSE;
> @@ -1029,6 +1038,7 @@ parse_instruction(
>   {
>      uint i;
>      uint saturate = 0;
> +   uint precise = 0;
>      const struct tgsi_opcode_info *info;
>      struct tgsi_full_instruction inst;
>      const char *cur;
> @@ -1043,7 +1053,7 @@ parse_instruction(
>         cur = ctx->cur;
>   
>         info = tgsi_get_opcode_info( i );
> -      if (match_inst(&cur, &saturate, info)) {
> +      if (match_inst(&cur, &saturate, &precise, info)) {
>            if (info->num_dst + info->num_src + info->is_tex == 0) {
>               ctx->cur = cur;
>               break;
> @@ -1064,6 +1074,7 @@ parse_instruction(
>   
>      inst.Instruction.Opcode = i;
>      inst.Instruction.Saturate = saturate;
> +   inst.Instruction.Precise = precise;
>      inst.Instruction.NumDstRegs = info->num_dst;
>      inst.Instruction.NumSrcRegs = info->num_src;
>   
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list