<p dir="ltr">Thanks. R-B</p>
<div class="gmail_quote">On Apr 15, 2016 1:00 AM, "Eduardo Lima Mitev" <<a href="mailto:elima@igalia.com">elima@igalia.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">nir_variable_mode is currently a bitflag enum, while<br>
nir_print::print_var_decl() assumes is still a numbered list.<br>
---<br>
src/compiler/nir/nir_print.c | 34 +++++++++++++++++++++++++++-------<br>
1 file changed, 27 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c<br>
index 84e9269..229539d 100644<br>
--- a/src/compiler/nir/nir_print.c<br>
+++ b/src/compiler/nir/nir_print.c<br>
@@ -315,6 +315,30 @@ print_constant(nir_constant *c, const struct glsl_type *type, print_state *state<br>
}<br>
}<br>
<br>
+static const char *<br>
+get_variable_mode_str(nir_variable_mode mode)<br>
+{<br>
+ switch (mode) {<br>
+ case nir_var_shader_in:<br>
+ return "shader_in";<br>
+ case nir_var_shader_out:<br>
+ return "shader_out";<br>
+ case nir_var_uniform:<br>
+ return "uniform";<br>
+ case nir_var_shader_storage:<br>
+ return "shader_storage";<br>
+ case nir_var_system_value:<br>
+ return "system";<br>
+ case nir_var_shared:<br>
+ return "shared";<br>
+ case nir_var_param:<br>
+ case nir_var_global:<br>
+ case nir_var_local:<br>
+ default:<br>
+ return "";<br>
+ }<br>
+}<br>
+<br>
static void<br>
print_var_decl(nir_variable *var, print_state *state)<br>
{<br>
@@ -326,13 +350,9 @@ print_var_decl(nir_variable *var, print_state *state)<br>
const char *const samp = (var->data.sample) ? "sample " : "";<br>
const char *const patch = (var->data.patch) ? "patch " : "";<br>
const char *const inv = (var->data.invariant) ? "invariant " : "";<br>
- const char *const mode[] = { "shader_in ", "shader_out ", "", "",<br>
- "uniform ", "shader_storage ", "shared ",<br>
- "system "};<br>
-<br>
- fprintf(fp, "%s%s%s%s%s%s ",<br>
- cent, samp, patch, inv, mode[var->data.mode],<br>
- glsl_interp_qualifier_name(var->data.interpolation));<br>
+ fprintf(fp, "%s%s%s%s%s %s ",<br>
+ cent, samp, patch, inv, get_variable_mode_str(var->data.mode),<br>
+ glsl_interp_qualifier_name(var->data.interpolation));<br>
<br>
glsl_print_type(var->type, fp);<br>
<br>
--<br>
2.7.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>