Chris Forbes <[email protected]> writes:

> Signed-off-by: Chris Forbes <[email protected]>

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?

> +      /* 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;
> +}

Attachment: pgpnlOXdpdS0P.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to