[Mesa-dev] [PATCH 08/14] mesa_to_tgsi: drop support for instructions that can't occur here

Ian Romanick idr at freedesktop.org
Mon Oct 17 18:43:15 UTC 2016


I am in favor of these.  One of these days I'm planning to remove these
instructions from Mesa IR altogether... unless someone beats me to it.

Patches 8 and 9 are

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 10/17/2016 06:39 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/mesa/state_tracker/st_mesa_to_tgsi.c | 72 --------------------------------
>  1 file changed, 72 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> index b989257..c8ed26c 100644
> --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
> +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> @@ -498,116 +498,78 @@ static void emit_swz( struct st_translate *t,
>  static unsigned
>  translate_opcode( unsigned op )
>  {
>     switch( op ) {
>     case OPCODE_ARL:
>        return TGSI_OPCODE_ARL;
>     case OPCODE_ABS:
>        return TGSI_OPCODE_ABS;
>     case OPCODE_ADD:
>        return TGSI_OPCODE_ADD;
> -   case OPCODE_BGNLOOP:
> -      return TGSI_OPCODE_BGNLOOP;
> -   case OPCODE_BGNSUB:
> -      return TGSI_OPCODE_BGNSUB;
> -   case OPCODE_BRK:
> -      return TGSI_OPCODE_BRK;
> -   case OPCODE_CAL:
> -      return TGSI_OPCODE_CAL;
>     case OPCODE_CMP:
>        return TGSI_OPCODE_CMP;
> -   case OPCODE_CONT:
> -      return TGSI_OPCODE_CONT;
>     case OPCODE_COS:
>        return TGSI_OPCODE_COS;
> -   case OPCODE_DDX:
> -      return TGSI_OPCODE_DDX;
> -   case OPCODE_DDY:
> -      return TGSI_OPCODE_DDY;
> -   case OPCODE_DP2:
> -      return TGSI_OPCODE_DP2;
>     case OPCODE_DP3:
>        return TGSI_OPCODE_DP3;
>     case OPCODE_DP4:
>        return TGSI_OPCODE_DP4;
>     case OPCODE_DPH:
>        return TGSI_OPCODE_DPH;
>     case OPCODE_DST:
>        return TGSI_OPCODE_DST;
> -   case OPCODE_ELSE:
> -      return TGSI_OPCODE_ELSE;
> -   case OPCODE_ENDIF:
> -      return TGSI_OPCODE_ENDIF;
> -   case OPCODE_ENDLOOP:
> -      return TGSI_OPCODE_ENDLOOP;
> -   case OPCODE_ENDSUB:
> -      return TGSI_OPCODE_ENDSUB;
>     case OPCODE_EX2:
>        return TGSI_OPCODE_EX2;
>     case OPCODE_EXP:
>        return TGSI_OPCODE_EXP;
>     case OPCODE_FLR:
>        return TGSI_OPCODE_FLR;
>     case OPCODE_FRC:
>        return TGSI_OPCODE_FRC;
> -   case OPCODE_IF:
> -      return TGSI_OPCODE_IF;
> -   case OPCODE_TRUNC:
> -      return TGSI_OPCODE_TRUNC;
>     case OPCODE_KIL:
>        return TGSI_OPCODE_KILL_IF;
>     case OPCODE_LG2:
>        return TGSI_OPCODE_LG2;
>     case OPCODE_LOG:
>        return TGSI_OPCODE_LOG;
>     case OPCODE_LIT:
>        return TGSI_OPCODE_LIT;
>     case OPCODE_LRP:
>        return TGSI_OPCODE_LRP;
>     case OPCODE_MAD:
>        return TGSI_OPCODE_MAD;
>     case OPCODE_MAX:
>        return TGSI_OPCODE_MAX;
>     case OPCODE_MIN:
>        return TGSI_OPCODE_MIN;
>     case OPCODE_MOV:
>        return TGSI_OPCODE_MOV;
>     case OPCODE_MUL:
>        return TGSI_OPCODE_MUL;
> -   case OPCODE_NOP:
> -      return TGSI_OPCODE_NOP;
>     case OPCODE_POW:
>        return TGSI_OPCODE_POW;
>     case OPCODE_RCP:
>        return TGSI_OPCODE_RCP;
> -   case OPCODE_RET:
> -      return TGSI_OPCODE_RET;
>     case OPCODE_SCS:
>        return TGSI_OPCODE_SCS;
>     case OPCODE_SGE:
>        return TGSI_OPCODE_SGE;
>     case OPCODE_SIN:
>        return TGSI_OPCODE_SIN;
>     case OPCODE_SLT:
>        return TGSI_OPCODE_SLT;
> -   case OPCODE_SSG:
> -      return TGSI_OPCODE_SSG;
>     case OPCODE_SUB:
>        return TGSI_OPCODE_SUB;
>     case OPCODE_TEX:
>        return TGSI_OPCODE_TEX;
>     case OPCODE_TXB:
>        return TGSI_OPCODE_TXB;
> -   case OPCODE_TXD:
> -      return TGSI_OPCODE_TXD;
> -   case OPCODE_TXL:
> -      return TGSI_OPCODE_TXL;
>     case OPCODE_TXP:
>        return TGSI_OPCODE_TXP;
>     case OPCODE_XPD:
>        return TGSI_OPCODE_XPD;
>     case OPCODE_END:
>        return TGSI_OPCODE_END;
>     default:
>        debug_assert( 0 );
>        return TGSI_OPCODE_NOP;
>     }
> @@ -636,43 +598,22 @@ compile_instruction(
>                                inst->Saturate);
>  
>     for (i = 0; i < num_src; i++) 
>        src[i] = translate_src( t, &inst->SrcReg[i] );
>  
>     switch( inst->Opcode ) {
>     case OPCODE_SWZ:
>        emit_swz( t, dst[0], &inst->SrcReg[0] );
>        return;
>  
> -   case OPCODE_BGNLOOP:
> -   case OPCODE_CAL:
> -   case OPCODE_ELSE:
> -   case OPCODE_ENDLOOP:
> -      debug_assert(num_dst == 0);
> -      ureg_label_insn( ureg,
> -                       translate_opcode( inst->Opcode ),
> -                       src, num_src,
> -                       get_label( t, inst->BranchTarget ));
> -      return;
> -
> -   case OPCODE_IF:
> -      debug_assert(num_dst == 0);
> -      ureg_label_insn( ureg,
> -                       ctx->Const.NativeIntegers ? TGSI_OPCODE_UIF : TGSI_OPCODE_IF,
> -                       src, num_src,
> -                       get_label( t, inst->BranchTarget ));
> -      return;
> -
>     case OPCODE_TEX:
>     case OPCODE_TXB:
> -   case OPCODE_TXD:
> -   case OPCODE_TXL:
>     case OPCODE_TXP:
>        src[num_src++] = t->samplers[inst->TexSrcUnit];
>        ureg_tex_insn( ureg,
>                       translate_opcode( inst->Opcode ),
>                       dst, num_dst, 
>                       st_translate_texture_target( inst->TexSrcTarget,
>                                                 inst->TexShadow ),
>                       NULL, 0,
>                       src, num_src );
>        return;
> @@ -686,33 +627,20 @@ compile_instruction(
>        break;
>  
>     case OPCODE_XPD:
>        dst[0] = ureg_writemask(dst[0], TGSI_WRITEMASK_XYZ );
>        ureg_insn( ureg, 
>                   translate_opcode( inst->Opcode ), 
>                   dst, num_dst, 
>                   src, num_src );
>        break;
>  
> -   case OPCODE_NOISE1:
> -   case OPCODE_NOISE2:
> -   case OPCODE_NOISE3:
> -   case OPCODE_NOISE4:
> -      /* At some point, a motivated person could add a better
> -       * implementation of noise.  Currently not even the nvidia
> -       * binary drivers do anything more than this.  In any case, the
> -       * place to do this is in the GL state tracker, not the poor
> -       * driver.
> -       */
> -      ureg_MOV( ureg, dst[0], ureg_imm1f(ureg, 0.5) );
> -      break;
> -
>     case OPCODE_RSQ:
>        ureg_RSQ( ureg, dst[0], ureg_abs(src[0]) );
>        break;
>  
>     default:
>        ureg_insn( ureg, 
>                   translate_opcode( inst->Opcode ), 
>                   dst, num_dst, 
>                   src, num_src );
>        break;
> 



More information about the mesa-dev mailing list