[Mesa-dev] [PATCH v3 034/104] nir: Support deref instructions in lower_alpha_test

Jason Ekstrand jason at jlekstrand.net
Tue Apr 3 18:33:01 UTC 2018


---
 src/compiler/nir/nir_lower_alpha_test.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir_lower_alpha_test.c b/src/compiler/nir/nir_lower_alpha_test.c
index 6bf9ff1..776655a 100644
--- a/src/compiler/nir/nir_lower_alpha_test.c
+++ b/src/compiler/nir/nir_lower_alpha_test.c
@@ -58,6 +58,9 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
                case nir_intrinsic_store_var:
                   out = intr->variables[0]->var;
                   break;
+               case nir_intrinsic_store_deref:
+                  out = nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0]));
+                  break;
                case nir_intrinsic_store_output:
                   /* already had i/o lowered.. lookup the matching output var: */
                   nir_foreach_variable(var, &shader->outputs) {
@@ -85,6 +88,9 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
                nir_ssa_def *alpha;
                if (alpha_to_one) {
                   alpha = nir_imm_float(&b, 1.0);
+               } else if (intr->intrinsic == nir_intrinsic_store_deref) {
+                  alpha = nir_channel(&b, nir_ssa_for_src(&b, intr->src[1], 4),
+                                      3);
                } else {
                   alpha = nir_channel(&b, nir_ssa_for_src(&b, intr->src[0], 4),
                                       3);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list