Michal,

This looks fine.  Longer term I'd like to see the generic "extended
token" notion go away in TGSI and be replaced with a set of specific
flags for each optional token in the instruction/register/etc.  This
works for me as a first step towards that. 

Keith

On Mon, 2009-11-23 at 02:21 -0800, michal wrote:
> From f74a81fa4400c2b556cdc56ad34511faf8a89628 Mon Sep 17 00:00:00 2001
> From: Michal Krol <[email protected]>
> Date: Fri, 20 Nov 2009 13:59:49 +0100
> Subject: [PATCH] gallium: Refactor the instruction predicate TGSI token.
> 
> Rename it to tgsi_instruction_predicate -- it's no longer an extended
> token. Its presence is indicated by a new flag in tgsi_instruction that
> indicates whether an instruction is predicated.
> 
> Also, change predicate index representation to match the other
> tokens that specify register indices.
> ---
>  src/gallium/include/pipe/p_shader_tokens.h |   17 +++++++----------
>  1 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
> b/src/gallium/include/pipe/p_shader_tokens.h
> index d4c8aad..54c173b 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -293,6 +293,8 @@ union tgsi_immediate_data
>   * respectively. For a given operation code, those numbers are fixed 
> and are
>   * present here only for convenience.
>   *
> + * If Predicate is TRUE, tgsi_instruction_predicate token immediately 
> follows.
> + *
>   * If Extended is TRUE, it is now executed.
>   *
>   * Saturate controls how are final results in destination registers 
> modified.
> @@ -306,7 +308,8 @@ struct tgsi_instruction
>     unsigned Saturate   : 2;  /* TGSI_SAT_ */
>     unsigned NumDstRegs : 2;  /* UINT */
>     unsigned NumSrcRegs : 4;  /* UINT */
> -   unsigned Padding    : 3;
> +   unsigned Predicate  : 1;  /* BOOL */
> +   unsigned Padding    : 2;
>     unsigned Extended   : 1;  /* BOOL */
>  };
>  
> @@ -323,7 +326,6 @@ struct tgsi_instruction
>  
>  #define TGSI_INSTRUCTION_EXT_TYPE_LABEL     1
>  #define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE   2
> -#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
>  
>  struct tgsi_instruction_ext
>  {
> @@ -339,9 +341,6 @@ struct tgsi_instruction_ext
>   * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
>   * should be cast to tgsi_instruction_ext_texture.
>   *
> - * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
> - * should be cast to tgsi_instruction_ext_predicate.
> - *
>   * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
>   * follows.
>   */
> @@ -382,17 +381,15 @@ struct tgsi_instruction_ext_texture
>   * For SM3, the following constraint applies.
>   *   - Swizzle is either set to identity or replicate.
>   */
> -struct tgsi_instruction_ext_predicate
> +struct tgsi_instruction_predicate
>  {
> -   unsigned Type     : 4;  /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
> +   int      Index    : 16; /* SINT */
>     unsigned SwizzleX : 2;  /* TGSI_SWIZZLE_x */
>     unsigned SwizzleY : 2;  /* TGSI_SWIZZLE_x */
>     unsigned SwizzleZ : 2;  /* TGSI_SWIZZLE_x */
>     unsigned SwizzleW : 2;  /* TGSI_SWIZZLE_x */
>     unsigned Negate   : 1;  /* BOOL */
> -   unsigned SrcIndex : 8;  /* UINT */
> -   unsigned Padding  : 10;
> -   unsigned Extended : 1;  /* BOOL */
> +   unsigned Padding  : 7;
>  };
>  
>  /**


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to