Mesa (glsl2): glsl2: Add option to stand-alone GLSL compiler to dump IR before optimizations

Ian Romanick idr at kemper.freedesktop.org
Mon Jun 28 10:09:04 PDT 2010


Module: Mesa
Branch: glsl2
Commit: 22c23dedad4e7f362ffbd990f1c2d5caf4cae75a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=22c23dedad4e7f362ffbd990f1c2d5caf4cae75a

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Jun 25 15:27:47 2010 -0700

glsl2: Add option to stand-alone GLSL compiler to dump IR before optimizations

---

 src/glsl/main.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index b32e2ad..16b2cf8 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -89,11 +89,13 @@ usage_fail(const char *name)
 
 
 int dump_ast = 0;
+int dump_hir = 0;
 int dump_lir = 0;
 int do_link = 0;
 
 const struct option compiler_opts[] = {
    { "dump-ast", 0, &dump_ast, 1 },
+   { "dump-hir", 0, &dump_hir, 1 },
    { "dump-lir", 0, &dump_lir, 1 },
    { "link",     0, &do_link,  1 },
    { NULL, 0, NULL, 0 }
@@ -147,6 +149,11 @@ compile_shader(struct glsl_shader *shader)
 
    validate_ir_tree(&shader->ir);
 
+   /* Print out the unoptimized IR. */
+   if (!state->error && dump_hir) {
+      _mesa_print_ir(&shader->ir, state);
+   }
+
    /* Optimization passes */
    if (!state->error && !shader->ir.is_empty()) {
       bool progress;



More information about the mesa-commit mailing list