Mesa (master): gallium: Fix setup of pstipple frag coord var.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 23 19:13:03 UTC 2020


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 21 16:18:42 2020 -0700

gallium: Fix setup of pstipple frag coord var.

If the last input was a struct or matrix, we would have overlapped driver
locations for our new position var.

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4670>

---

 src/gallium/auxiliary/nir/nir_draw_helpers.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/nir/nir_draw_helpers.c b/src/gallium/auxiliary/nir/nir_draw_helpers.c
index 7a6936d63d7..33fdf4aee69 100644
--- a/src/gallium/auxiliary/nir/nir_draw_helpers.c
+++ b/src/gallium/auxiliary/nir/nir_draw_helpers.c
@@ -49,20 +49,16 @@ typedef struct {
 static nir_ssa_def *
 load_frag_coord(nir_builder *b)
 {
-   int max_driver_loc = -1;
    nir_foreach_variable(var, &b->shader->inputs) {
       if (var->data.location == VARYING_SLOT_POS)
          return nir_load_var(b, var);
-      if (max_driver_loc < (int)var->data.driver_location)
-         max_driver_loc = var->data.driver_location;
    }
 
    nir_variable *pos = nir_variable_create(b->shader, nir_var_shader_in,
                                            glsl_vec4_type(), NULL);
    pos->data.location = VARYING_SLOT_POS;
    pos->data.interpolation = INTERP_MODE_NOPERSPECTIVE;
-   pos->data.driver_location = max_driver_loc + 1;
-   b->shader->num_inputs++;
+   pos->data.driver_location = b->shader->num_inputs++;
    return nir_load_var(b, pos);
 }
 



More information about the mesa-commit mailing list