[Mesa-dev] [PATCH 4/4] i965/fs: Gen4-5: Implement alpha test in shader for MRT
Eric Anholt
eric at anholt.net
Mon Oct 28 22:48:56 CET 2013
Chris Forbes <chrisf at ijw.co.nz> writes:
> Signed-off-by: Chris Forbes <chrisf at 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?
> + /* 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;
> +}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131028/9e19226c/attachment.pgp>
More information about the mesa-dev
mailing list