Mesa (master): nv50/ir: make colorful ir dump output optional

Marcin Åšlusarz mslusarz at kemper.freedesktop.org
Wed Jun 27 22:06:25 UTC 2012


Module: Mesa
Branch: master
Commit: 96259b51285469a229c3740c2b467d4455ed0c8d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96259b51285469a229c3740c2b467d4455ed0c8d

Author: Marcin Slusarz <marcin.slusarz at gmail.com>
Date:   Tue Jun 26 15:02:55 2012 +0200

nv50/ir: make colorful ir dump output optional

---

 src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp |   22 +++++++++++++++----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
index 9d92b7b..daa0ec6 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
@@ -37,9 +37,8 @@ enum TextStyle
    TXT_INSN
 };
 
-static const char *colour[8] =
+static const char *_colour[8] =
 {
-#if 1
    "\x1b[00m",
    "\x1b[34m",
    "\x1b[35m",
@@ -48,11 +47,23 @@ static const char *colour[8] =
    "\x1b[33m",
    "\x1b[37m",
    "\x1b[32m"
-#else
-   "", "", "", "", "", "", "", ""
-#endif
 };
 
+static const char *_nocolour[8] =
+{
+      "", "", "", "", "", "", "", ""
+};
+
+static const char **colour;
+
+static void init_colours()
+{
+   if (getenv("NV50_PROG_DEBUG_NO_COLORS") != NULL)
+      colour = _nocolour;
+   else
+      colour = _colour;
+}
+
 static const char *OpClassStr[OPCLASS_OTHER + 1] =
 {
    "MOVE",
@@ -620,6 +631,7 @@ void
 Program::print()
 {
    PrintPass pass;
+   init_colours();
    pass.run(this, true, false);
 }
 




More information about the mesa-commit mailing list