[Mesa-dev] [PATCH 1/4] st/mesa: remove dead code depending on EmitCondCodes

Marek Olšák maraeo at gmail.com
Fri Feb 1 09:46:51 PST 2013


On Fri, Feb 1, 2013 at 6:25 PM, Brian Paul <brianp at vmware.com> wrote:
> On 01/31/2013 04:21 PM, Marek Olšák wrote:
>>
>> EmitCondCodes is always false.
>> ---
>>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   24
>> ++----------------------
>>   1 file changed, 2 insertions(+), 22 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> index c6ac634..bc29f8a 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> @@ -2925,32 +2925,12 @@ glsl_to_tgsi_visitor::visit(ir_discard *ir)
>>   void
>>   glsl_to_tgsi_visitor::visit(ir_if *ir)
>>   {
>> -   glsl_to_tgsi_instruction *cond_inst, *if_inst;
>> -   glsl_to_tgsi_instruction *prev_inst;
>> -
>> -   prev_inst = (glsl_to_tgsi_instruction *)this->instructions.get_tail();
>> +   glsl_to_tgsi_instruction *if_inst;
>>
>>      ir->condition->accept(this);
>>      assert(this->result.file != PROGRAM_UNDEFINED);
>>
>> -   if (this->options->EmitCondCodes) {
>> -      cond_inst = (glsl_to_tgsi_instruction
>> *)this->instructions.get_tail();
>> -
>> -      /* See if we actually generated any instruction for generating
>> -       * the condition.  If not, then cook up a move to a temp so we
>> -       * have something to set cond_update on.
>> -       */
>> -      if (cond_inst == prev_inst) {
>> -         st_src_reg temp = get_temp(glsl_type::bool_type);
>> -         cond_inst = emit(ir->condition, TGSI_OPCODE_MOV,
>> st_dst_reg(temp), result);
>> -      }
>> -      cond_inst->cond_update = GL_TRUE;
>> -
>> -      if_inst = emit(ir->condition, TGSI_OPCODE_IF);
>> -      if_inst->dst.cond_mask = COND_NE;
>> -   } else {
>> -      if_inst = emit(ir->condition, TGSI_OPCODE_IF, undef_dst,
>> this->result);
>> -   }
>> +   if_inst = emit(ir->condition, TGSI_OPCODE_IF, undef_dst,
>> this->result);
>>
>>      this->instructions.push_tail(if_inst);
>>
>
> The series looks OK to me, but I'm wondering what the reason is for
> ARB_shading_language_packing.  Does someone need it or is it just low
> hanging fruit?

It's just a low-hanging fruit and easy to implement. Intel implemented
it, so why not turn it on. If needed, we can translate most of the
opcodes to equivalent TGSI opcodes, i.e. PK2H, UP2H, PK2UB, etc. Right
now I think no hardware driver implements them.

Marek


More information about the mesa-dev mailing list