Mesa (master): Revert "nir: drop support for using load_alpha_ref_float"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 23 11:39:18 UTC 2019


Module: Mesa
Branch: master
Commit: acf1bf47cc34f2e1d3fb9160651d4a33ce3c6a05
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=acf1bf47cc34f2e1d3fb9160651d4a33ce3c6a05

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon Oct 21 10:48:09 2019 +0200

Revert "nir: drop support for using load_alpha_ref_float"

This reverts commit 5af272b47469398762e984e27f65fc4ecc293d28.

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Jose Maria Casanova <jmcasanova at igalia.com>

---

 src/compiler/nir/nir_lower_alpha_test.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/compiler/nir/nir_lower_alpha_test.c b/src/compiler/nir/nir_lower_alpha_test.c
index a13de554445..b652fb796be 100644
--- a/src/compiler/nir/nir_lower_alpha_test.c
+++ b/src/compiler/nir/nir_lower_alpha_test.c
@@ -40,7 +40,6 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
                      bool alpha_to_one,
                      const gl_state_index16 *alpha_ref_state_tokens)
 {
-   assert(alpha_ref_state_tokens);
    assert(shader->info.stage == MESA_SHADER_FRAGMENT);
 
    nir_foreach_function(function, shader) {
@@ -95,16 +94,20 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
                                       3);
                }
 
-               nir_variable *var = nir_variable_create(shader,
-                                                       nir_var_uniform,
-                                                       glsl_float_type(),
-                                                       "gl_AlphaRefMESA");
-               var->num_state_slots = 1;
-               var->state_slots = ralloc_array(var, nir_state_slot, 1);
-               memcpy(var->state_slots[0].tokens,
-                      alpha_ref_state_tokens,
-                      sizeof(var->state_slots[0].tokens));
-               nir_ssa_def *alpha_ref = nir_load_var(&b, var);
+               nir_ssa_def *alpha_ref;
+               if (alpha_ref_state_tokens) {
+                  nir_variable *var = nir_variable_create(shader,
+                                                          nir_var_uniform,
+                                                          glsl_float_type(),
+                                                          "gl_AlphaRefMESA");
+                  var->num_state_slots = 1;
+                  var->state_slots = ralloc_array(var, nir_state_slot, 1);
+                  memcpy(var->state_slots[0].tokens,
+                         alpha_ref_state_tokens,
+                         sizeof(var->state_slots[0].tokens));
+                  alpha_ref = nir_load_var(&b, var);
+               } else
+                  alpha_ref = nir_load_alpha_ref_float(&b);
 
                nir_ssa_def *condition =
                   nir_compare_func(&b, func, alpha, alpha_ref);




More information about the mesa-commit mailing list