Revert "vc4: do not report alpha-test as supported"
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 23 Oct 2019 11:02:55 +0000 (13:02 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 23 Oct 2019 11:03:59 +0000 (13:03 +0200)
This reverts commit a79b93269cf340ce4d23b5b34100039bcaafc841.

Reviewed-by: Jose Maria Casanova <jmcasanova@igalia.com>
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_screen.c

index 8ec181bc8fa0b493c9e02cf097df7ebdaaf673c3..6ea1667ca281e95f201c61fa103f52ffc73235ba 100644 (file)
@@ -1806,6 +1806,11 @@ ntq_emit_intrinsic(struct vc4_compile *c, nir_intrinsic_instr *instr)
                                            0));
                 break;
 
+        case nir_intrinsic_load_alpha_ref_float:
+                ntq_store_dest(c, &instr->dest, 0,
+                               qir_uniform(c, QUNIFORM_ALPHA_REF, 0));
+                break;
+
         case nir_intrinsic_load_sample_mask_in:
                 ntq_store_dest(c, &instr->dest, 0,
                                qir_uniform(c, QUNIFORM_SAMPLE_MASK, 0));
@@ -2248,8 +2253,16 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
 
         c->s = nir_shader_clone(c, key->shader_state->base.ir.nir);
 
-        if (stage == QSTAGE_FRAG)
+        if (stage == QSTAGE_FRAG) {
+                if (c->fs_key->alpha_test_func != COMPARE_FUNC_ALWAYS) {
+                        NIR_PASS_V(c->s, nir_lower_alpha_test,
+                                   c->fs_key->alpha_test_func,
+                                   c->fs_key->sample_alpha_to_one &&
+                                   c->fs_key->msaa,
+                                   NULL);
+                }
                 NIR_PASS_V(c->s, vc4_nir_lower_blend, c);
+        }
 
         struct nir_lower_tex_options tex_options = {
                 /* We would need to implement txs, but we don't want the
index d762512a4e7f9c069a337a15534bd04030fcd377..be20dc90406df116b8862717ac126baa4d2f3b84 100644 (file)
@@ -198,9 +198,6 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_UMA:
                 return 1;
 
-        case PIPE_CAP_ALPHA_TEST:
-                return 0;
-
         default:
                 return u_pipe_screen_get_param_defaults(pscreen, param);
         }