From: Ian Romanick Date: Fri, 26 Mar 2010 01:38:28 +0000 (-0700) Subject: IR print visitor: Finish printing constants X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=795492247369199d5e79f2503c40920ff8a9b686;p=mesa.git IR print visitor: Finish printing constants --- diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index 2c9debc7d72..ca9f7592520 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(")) "); }