From 9930d18c2aefad12152d12bc251d02ae1c1593bc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:28:09 -0700 Subject: [PATCH] ir_print_visitor: Print out constant arrays. --- src/glsl/ir_print_visitor.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 05ac3029922..1eb073ff6a0 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -270,16 +270,20 @@ void ir_print_visitor::visit(ir_constant *ir) print_type(ir->type); printf(" ("); - for (unsigned i = 0; i < ir->type->components(); i++) { - if (i != 0) - printf(" "); - - switch (base_type->base_type) { - case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; - case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; - case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; - case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; - default: assert(0); + if (ir->type->is_array()) { + for (unsigned i = 0; i < ir->type->length; i++) + ir->get_array_element(i)->accept(this); + } else { + for (unsigned i = 0; i < ir->type->components(); i++) { + if (i != 0) + printf(" "); + switch (base_type->base_type) { + case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; + case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; + case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; + case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; + default: assert(0); + } } } printf(")) "); -- 2.30.2