diff options
Diffstat (limited to 'dist/Mesa/src/glsl/ir_print_visitor.cpp')
-rw-r--r-- | dist/Mesa/src/glsl/ir_print_visitor.cpp | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/dist/Mesa/src/glsl/ir_print_visitor.cpp b/dist/Mesa/src/glsl/ir_print_visitor.cpp index bd398052c..6f370b971 100644 --- a/dist/Mesa/src/glsl/ir_print_visitor.cpp +++ b/dist/Mesa/src/glsl/ir_print_visitor.cpp @@ -67,7 +67,8 @@ _mesa_print_ir(FILE *f, exec_list *instructions, } fprintf(f, "(\n"); - foreach_in_list(ir_instruction, ir, instructions) { + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir->fprint(f); if (ir->ir_type != ir_type_function) fprintf(f, "\n"); @@ -75,13 +76,6 @@ _mesa_print_ir(FILE *f, exec_list *instructions, fprintf(f, "\n)"); } -void -fprint_ir(FILE *f, const void *instruction) -{ - const ir_instruction *ir = (const ir_instruction *)instruction; - ir->fprint(f); -} - } /* extern "C" */ ir_print_visitor::ir_print_visitor(FILE *f) @@ -145,7 +139,7 @@ print_type(FILE *f, const glsl_type *t) print_type(f, t->fields.array); fprintf(f, " %u)", t->length); } else if ((t->base_type == GLSL_TYPE_STRUCT) - && !is_gl_identifier(t->name)) { + && (strncmp("gl_", t->name, 3) != 0)) { fprintf(f, "%s@%p", t->name, (void *) t); } else { fprintf(f, "%s", t->name); @@ -168,14 +162,11 @@ void ir_print_visitor::visit(ir_variable *ir) "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_QUALIFIER_COUNT); - fprintf(f, "(%s%s%s%s%s%s) ", - cent, samp, inv, mode[ir->data.mode], - stream[ir->data.stream], - interp[ir->data.interpolation]); + fprintf(f, "(%s%s%s%s%s) ", + cent, samp, inv, mode[ir->data.mode], interp[ir->data.interpolation]); print_type(f, ir->type); fprintf(f, " %s)", unique_name(ir)); @@ -195,7 +186,9 @@ void ir_print_visitor::visit(ir_function_signature *ir) fprintf(f, "(parameters\n"); indentation++; - foreach_in_list(ir_variable, inst, &ir->parameters) { + foreach_list(n, &ir->parameters) { + ir_variable *const inst = (ir_variable *) n; + indent(); inst->accept(this); fprintf(f, "\n"); @@ -210,7 +203,9 @@ void ir_print_visitor::visit(ir_function_signature *ir) fprintf(f, "(\n"); indentation++; - foreach_in_list(ir_instruction, inst, &ir->body) { + foreach_list(n, &ir->body) { + ir_instruction *const inst = (ir_instruction *) n; + indent(); inst->accept(this); fprintf(f, "\n"); @@ -227,7 +222,8 @@ void ir_print_visitor::visit(ir_function *ir) { fprintf(f, "(function %s\n", ir->name); indentation++; - foreach_in_list(ir_function_signature, sig, &ir->signatures) { + foreach_list(n, &ir->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; indent(); sig->accept(this); fprintf(f, "\n"); @@ -427,7 +423,7 @@ void ir_print_visitor::visit(ir_constant *ir) case GLSL_TYPE_FLOAT: if (ir->value.f[i] == 0.0f) /* 0.0 == -0.0, so print with %f to get the proper sign. */ - fprintf(f, "%f", ir->value.f[i]); + fprintf(f, "%.1f", ir->value.f[i]); else if (fabs(ir->value.f[i]) < 0.000001f) fprintf(f, "%a", ir->value.f[i]); else if (fabs(ir->value.f[i]) > 1000000.0f) @@ -451,7 +447,9 @@ ir_print_visitor::visit(ir_call *ir) if (ir->return_deref) ir->return_deref->accept(this); fprintf(f, " ("); - foreach_in_list(ir_rvalue, param, &ir->actual_parameters) { + foreach_list(n, &ir->actual_parameters) { + ir_rvalue *const param = (ir_rvalue *) n; + param->accept(this); } fprintf(f, "))\n"); @@ -496,7 +494,9 @@ ir_print_visitor::visit(ir_if *ir) fprintf(f, "(\n"); indentation++; - foreach_in_list(ir_instruction, inst, &ir->then_instructions) { + foreach_list(n, &ir->then_instructions) { + ir_instruction *const inst = (ir_instruction *) n; + indent(); inst->accept(this); fprintf(f, "\n"); @@ -511,7 +511,9 @@ ir_print_visitor::visit(ir_if *ir) fprintf(f, "(\n"); indentation++; - foreach_in_list(ir_instruction, inst, &ir->else_instructions) { + foreach_list(n, &ir->else_instructions) { + ir_instruction *const inst = (ir_instruction *) n; + indent(); inst->accept(this); fprintf(f, "\n"); @@ -531,7 +533,9 @@ ir_print_visitor::visit(ir_loop *ir) fprintf(f, "(loop (\n"); indentation++; - foreach_in_list(ir_instruction, inst, &ir->body_instructions) { + foreach_list(n, &ir->body_instructions) { + ir_instruction *const inst = (ir_instruction *) n; + indent(); inst->accept(this); fprintf(f, "\n"); @@ -549,18 +553,13 @@ ir_print_visitor::visit(ir_loop_jump *ir) } void -ir_print_visitor::visit(ir_emit_vertex *ir) +ir_print_visitor::visit(ir_emit_vertex *) { - fprintf(f, "(emit-vertex "); - ir->stream->accept(this); - fprintf(f, ")\n"); + fprintf(f, "(emit-vertex)"); } void -ir_print_visitor::visit(ir_end_primitive *ir) +ir_print_visitor::visit(ir_end_primitive *) { - fprintf(f, "(end-primitive "); - ir->stream->accept(this); - fprintf(f, ")\n"); - + fprintf(f, "(end-primitive)"); } |