nir: Improve printing of load_input/store_output variable names.
authorEric Anholt <eric@anholt.net>
Sun, 24 Feb 2019 00:17:02 +0000 (16:17 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 5 Mar 2019 18:59:40 +0000 (10:59 -0800)
We were printing only when the channel was exactly the start channel, so
scalarized loads/stores would be missing the name on the rest.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir_print.c

index 80bc25fde9a26f01f9c202d78d9e5d0a4a2f12ee..6b270394f9deca3cd8a9e0a69090e957d9a56725 100644 (file)
@@ -850,8 +850,10 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
    nir_foreach_variable(var, var_list) {
       if ((var->data.driver_location == nir_intrinsic_base(instr)) &&
           (instr->intrinsic == nir_intrinsic_load_uniform ||
-           var->data.location_frac == nir_intrinsic_component(instr)) &&
-          var->name) {
+           (nir_intrinsic_component(instr) >= var->data.location_frac  &&
+            nir_intrinsic_component(instr) <
+            (var->data.location_frac + glsl_get_components(var->type)))) &&
+           var->name) {
          fprintf(fp, "\t/* %s */", var->name);
          break;
       }