[Mesa-dev] [PATCH 1/2] tgsi: add ISSG support

Brian Paul brianp at vmware.com
Mon Jan 9 06:44:43 PST 2012


On 01/09/2012 04:54 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> This adds integer version of SSG that GLSL 1.30 can produce.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/gallium/auxiliary/tgsi/tgsi_exec.c     |   14 ++++++++++++++
>   src/gallium/auxiliary/tgsi/tgsi_info.c     |    1 +
>   src/gallium/include/pipe/p_shader_tokens.h |    3 ++-
>   3 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> index 61ab58a..3f62028 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> @@ -375,6 +375,16 @@ micro_sgn(union tgsi_exec_channel *dst,
>   }
>
>   static void
> +micro_isgn(union tgsi_exec_channel *dst,
> +          const union tgsi_exec_channel *src)
> +{
> +   dst->i[0] = src->i[0]<  0 ? -1 : src->i[0]>  0 ? 1 : 0;
> +   dst->i[1] = src->i[1]<  0 ? -1 : src->i[1]>  0 ? 1 : 0;
> +   dst->i[2] = src->i[2]<  0 ? -1 : src->i[2]>  0 ? 1 : 0;
> +   dst->i[3] = src->i[3]<  0 ? -1 : src->i[3]>  0 ? 1 : 0;
> +}
> +
> +static void
>   micro_sgt(union tgsi_exec_channel *dst,
>             const union tgsi_exec_channel *src0,
>             const union tgsi_exec_channel *src1)
> @@ -4203,6 +4213,10 @@ exec_instruction(
>         exec_vector_unary(mach, inst, micro_iabs, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
>         break;
>
> +   case TGSI_OPCODE_ISSG:
> +      exec_vector_unary(mach, inst, micro_isgn, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
> +      break;
> +
>      default:
>         assert( 0 );
>      }
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
> index c9acdb9..5b26d8f 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
> @@ -193,6 +193,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
>      { 1, 1, 0, 0, 0, 0, "UARL", TGSI_OPCODE_UARL },
>      { 1, 3, 0, 0, 0, 0, "UCMP", TGSI_OPCODE_UCMP },
>      { 1, 1, 0, 0, 0, 0, "IABS", TGSI_OPCODE_IABS },
> +   { 1, 1, 0, 0, 0, 0, "ISSG", TGSI_OPCODE_ISSG },
>   };
>
>   const struct tgsi_opcode_info *
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
> index 75e17a1..c8c1cf2 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -377,8 +377,9 @@ struct tgsi_property_data {
>   #define TGSI_OPCODE_UARL                157
>   #define TGSI_OPCODE_UCMP                158
>   #define TGSI_OPCODE_IABS                159
> +#define TGSI_OPCODE_ISSG                160
>
> -#define TGSI_OPCODE_LAST                160
> +#define TGSI_OPCODE_LAST                161
>
>   #define TGSI_SAT_NONE            0  /* do not saturate */
>   #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list