summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2013-11-14 14:02:24 +0000
committerJosé Fonseca <jfonseca@vmware.com>2013-11-14 14:04:28 +0000
commita29e40a42382630c2d9d95d3a1e03a7b3db87add (patch)
treeb6101e3c368e80f6f1b1f02d2c05d33b2118c533 /src/gallium/auxiliary/tgsi
parent673d5391a2f4084525de6c5cebf322ddb0e2acf1 (diff)
downloadexternal_mesa3d-a29e40a42382630c2d9d95d3a1e03a7b3db87add.zip
external_mesa3d-a29e40a42382630c2d9d95d3a1e03a7b3db87add.tar.gz
external_mesa3d-a29e40a42382630c2d9d95d3a1e03a7b3db87add.tar.bz2
gallivm: Compile flag to debug TGSI execution through printfs.
It is similar to tgsi_exec.c's DEBUG_EXECUTION compile flag. I had prototyped this for a while while debugging an issue, but finally cleaned this up and added a few more bells and whistles. v2: Use '$' as marker; better output. Thanks to Brian, Zack and Roland reviews. Here is a sample output. CONST[0].x = 0.00625000009 0.00625000009 0.00625000009 0.00625000009 CONST[0].y = -0.00714285718 -0.00714285718 -0.00714285718 -0.00714285718 CONST[0].z = -1 -1 -1 -1 CONST[0].w = 1 1 1 1 IN[0].x = 143.5 175.5 175.5 143.5 IN[0].y = 123.5 123.5 155.5 155.5 IN[0].z = 0 0 0 0 IN[0].w = 1 1 1 1 $ 1: RCP TEMP[0].w, IN[0].wwww TEMP[0].w = 1 1 1 1 $ 2: MAD TEMP[0].xy, IN[0], CONST[0], CONST[0].zwzw TEMP[0].x = -0.103124976 0.0968750715 0.0968750715 -0.103124976 TEMP[0].y = 0.117857158 0.117857158 -0.110714316 -0.110714316 $ 3: MUL OUT[0].xy, TEMP[0], TEMP[0].wwww OUT[0].x = -0.103124976 0.0968750715 0.0968750715 -0.103124976 OUT[0].y = 0.117857158 0.117857158 -0.110714316 -0.110714316 $ 4: MUL OUT[0].z, IN[0].zzzz, TEMP[0].wwww OUT[0].z = 0 0 0 0 $ 5: MOV OUT[0].w, TEMP[0] OUT[0].w = 1 1 1 1 $ 6: END OUT[0].x = -0.103124976 0.0968750715 0.0968750715 -0.103124976 OUT[0].y = 0.117857158 0.117857158 -0.110714316 -0.110714316 OUT[0].z = 0 0 0 0 OUT[0].w = 1 1 1 1
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c23
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.h7
2 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 7f6a3d8..77bca62 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -721,3 +721,26 @@ tgsi_dump_str(
tgsi_iterate_shader( tokens, &ctx.base.iter );
}
+
+void
+tgsi_dump_instruction_str(
+ const struct tgsi_full_instruction *inst,
+ uint instno,
+ char *str,
+ size_t size)
+{
+ struct str_dump_ctx ctx;
+
+ ctx.base.instno = instno;
+ ctx.base.immno = instno;
+ ctx.base.indent = 0;
+ ctx.base.dump_printf = &str_dump_ctx_printf;
+ ctx.base.indentation = 0;
+
+ ctx.str = str;
+ ctx.str[0] = 0;
+ ctx.ptr = str;
+ ctx.left = (int)size;
+
+ iter_instruction( &ctx.base.iter, (struct tgsi_full_instruction *)inst );
+}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.h b/src/gallium/auxiliary/tgsi/tgsi_dump.h
index adaef9d..9820bb1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.h
@@ -58,6 +58,13 @@ tgsi_dump_immediate(
const struct tgsi_full_immediate *imm );
void
+tgsi_dump_instruction_str(
+ const struct tgsi_full_instruction *inst,
+ uint instno,
+ char *str,
+ size_t size);
+
+void
tgsi_dump_instruction(
const struct tgsi_full_instruction *inst,
uint instno );