summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-12-18 16:46:41 -0800
committerMarge Bot <[email protected]>2020-01-16 23:29:10 +0000
commitd55573aac631af93a738944fc705967c8ae91453 (patch)
tree0841723a3b60d10c720a003818b61a04f73af8d7
parent65641e0c7a29944e19cc068457ee0d59cace8096 (diff)
nir: Fix printing of ~0 .locations.
I kept wondering what "429" meant in variable declarations, when it was just a truncated ~0 snprintf. Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3423> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3423>
-rw-r--r--src/compiler/nir/nir_print.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 5d81d3424f7..aa9ee670a70 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -562,8 +562,12 @@ print_var_decl(nir_variable *var, print_state *state)
}
if (!loc) {
- snprintf(buf, sizeof(buf), "%u", var->data.location);
- loc = buf;
+ if (var->data.location == ~0) {
+ loc = "~0";
+ } else {
+ snprintf(buf, sizeof(buf), "%u", var->data.location);
+ loc = buf;
+ }
}
/* For shader I/O vars that have been split to components or packed,