From: Eric Anholt Date: Thu, 19 Dec 2019 00:46:41 +0000 (-0800) Subject: nir: Fix printing of ~0 .locations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d55573aac631af93a738944fc705967c8ae91453;p=mesa.git 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 Reviewed-by: Alyssa Rosenzweig Tested-by: Marge Bot Part-of: --- 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,