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

Author: Zack Rusin <[email protected]>
Date:   Tue Dec 15 09:26:51 2009 -0500

tgsi: make the tgsi assembly parser report line/column on error

---

 src/gallium/auxiliary/tgsi/tgsi_text.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 84e863b..9673686 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -197,7 +197,20 @@ struct translate_ctx
 
 static void report_error( struct translate_ctx *ctx, const char *msg )
 {
-   debug_printf( "\nError: %s", msg );
+   int line = 1;
+   int column = 1;
+   const char *itr = ctx->text;
+
+   while (itr != ctx->cur) {
+      if (*itr == '\n') {
+         column = 1;
+         ++line;
+      }
+      ++column;
+      ++itr;
+   }
+
+   debug_printf( "\nTGSI asm error: %s [%d : %d] \n", msg, line, column );
 }
 
 /* Parse shader header.

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to