intel/fs: Use compare_func for wm_prog_key::alpha_test_func

Because 0 is no longer a recognizable value (it's NEVER, which isn't a
good default), we add an emit_alpha_test bool to tell the back-end when
to bother alpha testing.  This lets us only touch crocus with the
change.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14157>
This commit is contained in:
Jason Ekstrand
2021-12-09 18:21:14 -06:00
committed by Marge Bot
parent 460a953df5
commit a1de102479
4 changed files with 23 additions and 37 deletions

View File

@@ -559,23 +559,23 @@ fs_visitor::emit_interpolation_setup_gfx6()
}
static enum brw_conditional_mod
cond_for_alpha_func(GLenum func)
cond_for_alpha_func(enum compare_func func)
{
switch(func) {
case GL_GREATER:
return BRW_CONDITIONAL_G;
case GL_GEQUAL:
return BRW_CONDITIONAL_GE;
case GL_LESS:
return BRW_CONDITIONAL_L;
case GL_LEQUAL:
return BRW_CONDITIONAL_LE;
case GL_EQUAL:
return BRW_CONDITIONAL_EQ;
case GL_NOTEQUAL:
return BRW_CONDITIONAL_NEQ;
default:
unreachable("Not reached");
case COMPARE_FUNC_GREATER:
return BRW_CONDITIONAL_G;
case COMPARE_FUNC_GEQUAL:
return BRW_CONDITIONAL_GE;
case COMPARE_FUNC_LESS:
return BRW_CONDITIONAL_L;
case COMPARE_FUNC_LEQUAL:
return BRW_CONDITIONAL_LE;
case COMPARE_FUNC_EQUAL:
return BRW_CONDITIONAL_EQ;
case COMPARE_FUNC_NOTEQUAL:
return BRW_CONDITIONAL_NEQ;
default:
unreachable("Not reached");
}
}
@@ -591,10 +591,10 @@ fs_visitor::emit_alpha_test()
const fs_builder abld = bld.annotate("Alpha test");
fs_inst *cmp;
if (key->alpha_test_func == GL_ALWAYS)
if (key->alpha_test_func == COMPARE_FUNC_ALWAYS)
return;
if (key->alpha_test_func == GL_NEVER) {
if (key->alpha_test_func == COMPARE_FUNC_NEVER) {
/* f0.1 = 0 */
fs_reg some_reg = fs_reg(retype(brw_vec8_grf(0, 0),
BRW_REGISTER_TYPE_UW));