Mesa (master): gallivm/nir: fix vulkan vertex inputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 3 21:46:13 UTC 2020


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Oct 30 13:48:55 2020 +1000

gallivm/nir: fix vulkan vertex inputs

the tgsi file max is used to determine the number of input slots,
the old code was pretty bogus for the lavapipe cases (it worked
by accident).

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

---

 src/gallium/auxiliary/nir/nir_to_tgsi_info.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
index 20052bae9d2..eab790876f3 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
@@ -577,10 +577,18 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
       info->num_inputs = util_bitcount64(nir->info.inputs_read);
       if (nir->info.inputs_read_indirectly)
          info->indirect_files |= 1 << TGSI_FILE_INPUT;
+      info->file_max[TGSI_FILE_INPUT] = info->num_inputs - 1;
+   } else {
+      int max = -1;
+      nir_foreach_shader_in_variable(var, nir) {
+	 int slots = glsl_count_attribute_slots(var->type, false);
+	 int tmax = var->data.driver_location + slots - 1;
+	 if (tmax > max)
+	    max = tmax;
+	 info->file_max[TGSI_FILE_INPUT] = max;
+      }
    }
 
-   info->file_max[TGSI_FILE_INPUT] = info->num_inputs - 1;
-
    i = 0;
    uint64_t processed_outputs = 0;
    unsigned num_outputs = 0;



More information about the mesa-commit mailing list