[Mesa-dev] [PATCH 6/6] svga: minor code movement in svga_tgsi_insn.c

Jose Fonseca jfonseca at vmware.com
Thu Jan 23 04:07:46 PST 2014


Only skimmed through but series looks good to me.

Jose

----- Original Message -----
> ---
>  src/gallium/drivers/svga/svga_tgsi_insn.c |   94
>  ++++++++++++++---------------
>  1 file changed, 47 insertions(+), 47 deletions(-)
> 
> diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c
> b/src/gallium/drivers/svga/svga_tgsi_insn.c
> index 88c96c0..4d78e96 100644
> --- a/src/gallium/drivers/svga/svga_tgsi_insn.c
> +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
> @@ -729,45 +729,6 @@ alias_src_dst(struct src_register src,
>  
>  
>  /**
> - * Translate/emit a LRP (linear interpolation) instruction.
> - */
> -static boolean
> -submit_lrp(struct svga_shader_emitter *emit,
> -           SVGA3dShaderDestToken dst,
> -           struct src_register src0,
> -           struct src_register src1,
> -           struct src_register src2)
> -{
> -   SVGA3dShaderDestToken tmp;
> -   boolean need_dst_tmp = FALSE;
> -
> -   /* The dst reg must be a temporary, and not be the same as src0 or src2
> */
> -   if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
> -       alias_src_dst(src0, dst) ||
> -       alias_src_dst(src2, dst))
> -      need_dst_tmp = TRUE;
> -
> -   if (need_dst_tmp) {
> -      tmp = get_temp( emit );
> -      tmp.mask = dst.mask;
> -   }
> -   else {
> -      tmp = dst;
> -   }
> -
> -   if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
> -      return FALSE;
> -
> -   if (need_dst_tmp) {
> -      if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
> -         return FALSE;
> -   }
> -
> -   return TRUE;
> -}
> -
> -
> -/**
>   * Helper for emitting SVGA immediate values using the SVGA3DOP_DEF[I]
>   * instructions.
>   */
> @@ -1092,20 +1053,20 @@ emit_if(struct svga_shader_emitter *emit,
>  
>  
>  static boolean
> -emit_endif(struct svga_shader_emitter *emit,
> -           const struct tgsi_full_instruction *insn)
> +emit_else(struct svga_shader_emitter *emit,
> +          const struct tgsi_full_instruction *insn)
>  {
> -   emit->dynamic_branching_level--;
> -
> -   return emit_instruction(emit, inst_token(SVGA3DOP_ENDIF));
> +   return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
>  }
>  
>  
>  static boolean
> -emit_else(struct svga_shader_emitter *emit,
> -          const struct tgsi_full_instruction *insn)
> +emit_endif(struct svga_shader_emitter *emit,
> +           const struct tgsi_full_instruction *insn)
>  {
> -   return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
> +   emit->dynamic_branching_level--;
> +
> +   return emit_instruction(emit, inst_token(SVGA3DOP_ENDIF));
>  }
>  
>  
> @@ -2335,6 +2296,45 @@ emit_xpd(struct svga_shader_emitter *emit,
>  
>  
>  /**
> + * Emit a LRP (linear interpolation) instruction.
> + */
> +static boolean
> +submit_lrp(struct svga_shader_emitter *emit,
> +           SVGA3dShaderDestToken dst,
> +           struct src_register src0,
> +           struct src_register src1,
> +           struct src_register src2)
> +{
> +   SVGA3dShaderDestToken tmp;
> +   boolean need_dst_tmp = FALSE;
> +
> +   /* The dst reg must be a temporary, and not be the same as src0 or src2
> */
> +   if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
> +       alias_src_dst(src0, dst) ||
> +       alias_src_dst(src2, dst))
> +      need_dst_tmp = TRUE;
> +
> +   if (need_dst_tmp) {
> +      tmp = get_temp( emit );
> +      tmp.mask = dst.mask;
> +   }
> +   else {
> +      tmp = dst;
> +   }
> +
> +   if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
> +      return FALSE;
> +
> +   if (need_dst_tmp) {
> +      if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
> +         return FALSE;
> +   }
> +
> +   return TRUE;
> +}
> +
> +
> +/**
>   * Translate/emit LRP (Linear Interpolation) instruction.
>   */
>  static boolean
> --
> 1.7.10.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=T%2FDo9%2BriC%2B%2Fu2VbfJrlm8HgIS2YdNyx9mlFRhL20jAU%3D%0A&s=326fa9b30013a1dfea15fe8ff701140cf1ab0248a8a52d3a70e9669cebed2d2f
> 


More information about the mesa-dev mailing list