[Mesa-dev] [PATCH 1/5] glsl: print non-zero bindings of variables

Nicolai Hähnle nhaehnle at gmail.com
Thu Oct 13 15:13:13 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/compiler/glsl/ir_print_visitor.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
index c238c16..efb728b 100644
--- a/src/compiler/glsl/ir_print_visitor.cpp
+++ b/src/compiler/glsl/ir_print_visitor.cpp
@@ -158,20 +158,24 @@ print_type(FILE *f, const glsl_type *t)
 
 void ir_print_visitor::visit(ir_rvalue *)
 {
    fprintf(f, "error");
 }
 
 void ir_print_visitor::visit(ir_variable *ir)
 {
    fprintf(f, "(declare ");
 
+   char binding[32] = {0};
+   if (ir->data.binding)
+      snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding);
+
    char loc[32] = {0};
    if (ir->data.location != -1)
       snprintf(loc, sizeof(loc), "location=%i ", ir->data.location);
 
    char component[32] = {0};
    if (ir->data.explicit_component)
       snprintf(component, sizeof(component), "component=%i ", ir->data.location_frac);
 
    const char *const cent = (ir->data.centroid) ? "centroid " : "";
    const char *const samp = (ir->data.sample) ? "sample " : "";
@@ -180,22 +184,22 @@ void ir_print_visitor::visit(ir_variable *ir)
    const char *const prec = (ir->data.precise) ? "precise " : "";
    const char *const mode[] = { "", "uniform ", "shader_storage ",
                                 "shader_shared ", "shader_in ", "shader_out ",
                                 "in ", "out ", "inout ",
 			        "const_in ", "sys ", "temporary " };
    STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
    const char *const stream [] = {"", "stream1 ", "stream2 ", "stream3 "};
    const char *const interp[] = { "", "smooth", "flat", "noperspective" };
    STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
 
-   fprintf(f, "(%s%s%s%s%s%s%s%s%s%s) ",
-           loc, component, cent, samp, patc, inv, prec, mode[ir->data.mode],
+   fprintf(f, "(%s%s%s%s%s%s%s%s%s%s%s) ",
+           binding, loc, component, cent, samp, patc, inv, prec, mode[ir->data.mode],
            stream[ir->data.stream],
            interp[ir->data.interpolation]);
 
    print_type(f, ir->type);
    fprintf(f, " %s)", unique_name(ir));
 }
 
 
 void ir_print_visitor::visit(ir_function_signature *ir)
 {
-- 
2.7.4



More information about the mesa-dev mailing list