diff options
author | Kenneth Graunke <[email protected]> | 2010-07-20 01:28:09 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-07-21 16:38:33 -0700 |
commit | 9930d18c2aefad12152d12bc251d02ae1c1593bc (patch) | |
tree | ad20274e589c15b05417a964edfe2c0c58e74731 /src | |
parent | 7ea977a15c05f4a638478b7a5b8ca78454cecf41 (diff) |
ir_print_visitor: Print out constant arrays.
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ir_print_visitor.cpp | 24 |
1 files 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(")) "); |