diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-25 18:38:28 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-25 18:40:48 -0700 |
commit | 795492247369199d5e79f2503c40920ff8a9b686 (patch) | |
tree | cde3980718e75bc632ac774ba1606a64a4928f1e /ir_print_visitor.cpp | |
parent | d14642739e488c8cb15726de5a63cb01c6ce835c (diff) |
IR print visitor: Finish printing constants
Diffstat (limited to 'ir_print_visitor.cpp')
-rw-r--r-- | ir_print_visitor.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index 2c9debc7d7..ca9f759252 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -163,13 +163,30 @@ void ir_print_visitor::visit(ir_assignment *ir) void ir_print_visitor::visit(ir_constant *ir) { - (void) ir; + const glsl_type *const base_type = ir->type->get_base_type(); printf("(constant ("); - print_type(ir->type); - printf(") "); - printf("(FINISHME: value goes here)"); + print_type(base_type); printf(") "); + + const unsigned num_values = 1 + * ((ir->type->vector_elements > 0) ? ir->type->vector_elements : 1) + * ((ir->type->matrix_columns > 0) ? ir->type->matrix_columns : 1); + + printf("(%d) (", num_values); + for (unsigned i = 0; i < num_values; 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(")) "); } |