On Tue, Oct 29, 2013 at 10:48 AM, Eric Anholt <e...@anholt.net> wrote:
> Chris Forbes <chr...@ijw.co.nz> writes:
>
>> Signed-off-by: Chris Forbes <chr...@ijw.co.nz>
>
> This function should probably have a comment:
>
> /**
>  * Alpha test support for when we compile it into the shader instead
>  * of using the normal fixed function alpha test.
>  */
>
>> +void
>> +fs_visitor::emit_alpha_test()
>> +{
>> +   this->current_annotation = "Alpha test";
>> +
>> +   fs_inst *cmp;
>> +   if (c->key.alpha_test_func == GL_ALWAYS)
>> +      return;
>> +
>> +   if (c->key.alpha_test_func == GL_NEVER) {
>> +      /* f0.1 = 0 */
>> +      fs_reg some_reg = fs_reg(retype(brw_vec8_grf(0, 0),
>> +                                      BRW_REGISTER_TYPE_UW));
>> +      cmp = emit(CMP(reg_null_f, some_reg, some_reg,
>> +                     BRW_CONDITIONAL_NEQ));
>> +   } else {
>> +      /* RT0 alpha */
>> +      fs_reg color = outputs[0];
>> +      color.reg_offset += 3;
>> +
>> +      /* reference value */
>> +      fs_reg ref = fs_reg(this, glsl_type::float_type);
>> +      emit(MOV(ref, fs_reg(c->key.alpha_test_ref)));
>
> I don't think you need this temporary here, do you?

Turns out I don't, and it actually gets folded away. Will tidy this up.

>
>> +      /* f0.1 &= func(color, ref) */
>> +      cmp = emit(CMP(reg_null_f, color, ref,
>>                              cond_for_alpha_func(c->key.alpha_test_func)));
>
> weird indentation.
>
>> +   }
>> +   cmp->predicate = BRW_PREDICATE_NORMAL;
>> +   cmp->flag_subreg = 1;
>> +}
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to