[Mesa-dev] [PATCH 1/5] st/mesa: also emit labels for TGSI_OPCODE_BGNSUB

Jose Fonseca jfonseca at vmware.com
Tue Apr 14 13:20:03 PDT 2015


On 14/04/15 17:56, Brian Paul wrote:
> Subroutines need labels so they can be identied by CAL instructions.
> ---
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 19 +++++++++++++------
>   1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 67a4da7..eb0ce07 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4771,18 +4771,25 @@ compile_tgsi_instruction(struct st_translate *t,
>      }
>
>      switch(inst->op) {
> +   case TGSI_OPCODE_BGNSUB:
>      case TGSI_OPCODE_BGNLOOP:
>      case TGSI_OPCODE_CAL:
>      case TGSI_OPCODE_ELSE:
>      case TGSI_OPCODE_ENDLOOP:
>      case TGSI_OPCODE_IF:
>      case TGSI_OPCODE_UIF:
> -      assert(num_dst == 0);
> -      ureg_label_insn(ureg,
> -                      inst->op,
> -                      src, num_src,
> -                      get_label(t,
> -                                inst->op == TGSI_OPCODE_CAL ? inst->function->sig_id : 0));
> +      {
> +         int sig_id = 0;
> +         if (inst->op == TGSI_OPCODE_CAL ||
> +             inst->op == TGSI_OPCODE_BGNSUB) {

I'm not sure about this.

One thing is the label of the instruction (ie, instrution no), the other 
is the operand label.

CAL takes an operand label (the #no of the instruction where BGNSUB starts).

But BGNSUB shouldn't need a label (what matter is the instrucion #no). 
If it does take a label, then it's probably the label of the ENDSUB, not 
where the function starts.


I thought we had removed all these pointless labels.  I suppose that's 
why the label 0 is used.  In other words, I believe the right thing here 
is to add the case statement for TGSI_OPCODE_BGNSUB, but not treat it 
like CAL.



> +            sig_id = inst->function->sig_id;
> +         }
> +         assert(num_dst == 0);
> +         ureg_label_insn(ureg,
> +                         inst->op,
> +                         src, num_src,
> +                         get_label(t, sig_id));
> +      }
>         return;
>
>      case TGSI_OPCODE_TEX:
>



Jose


More information about the mesa-dev mailing list