[Mesa-dev] [PATCH 4/4] r600g: refactor and make streamout dumping more informative

Marek Olšák maraeo at gmail.com
Wed Dec 19 08:24:36 PST 2012


---
 src/gallium/drivers/r600/r600_shader.c |   33 ++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 470a345..bca62ad 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -108,6 +108,26 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
 				 struct r600_pipe_shader *pipeshader,
 				 struct r600_shader_key key);
 
+static void r600_dump_streamout(struct pipe_stream_output_info *so)
+{
+	unsigned i;
+
+	fprintf(stderr, "STREAMOUT\n");
+	for (i = 0; i < so->num_outputs; i++) {
+		unsigned mask = ((1 << so->output[i].num_components) - 1) <<
+				so->output[i].start_component;
+		fprintf(stderr, "  %i: MEM_STREAM0_BUF%i[%i..%i] <- OUT[%i].%s%s%s%s%s\n",
+			i, so->output[i].output_buffer,
+			so->output[i].dst_offset, so->output[i].dst_offset + so->output[i].num_components - 1,
+			so->output[i].register_index,
+			mask & 1 ? "x" : "",
+		        mask & 2 ? "y" : "",
+		        mask & 4 ? "z" : "",
+		        mask & 8 ? "w" : "",
+			so->output[i].dst_offset < so->output[i].start_component ? " (will lower)" : "");
+	}
+}
+
 int r600_pipe_shader_create(struct pipe_context *ctx,
 			    struct r600_pipe_shader *shader,
 			    struct r600_shader_key key)
@@ -127,18 +147,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
 		tgsi_dump(sel->tokens, 0);
 
 		if (sel->so.num_outputs) {
-			unsigned i;
-			fprintf(stderr, "STREAMOUT\n");
-			for (i = 0; i < sel->so.num_outputs; i++) {
-				unsigned mask = ((1 << sel->so.output[i].num_components) - 1) <<
-						sel->so.output[i].start_component;
-				fprintf(stderr, "  %i: MEM_STREAM0_BUF%i OUT[%i].%s%s%s%s\n", i,
-					sel->so.output[i].output_buffer, sel->so.output[i].register_index,
-				        mask & 1 ? "x" : "_",
-				        (mask >> 1) & 1 ? "y" : "_",
-				        (mask >> 2) & 1 ? "z" : "_",
-				        (mask >> 3) & 1 ? "w" : "_");
-			}
+			r600_dump_streamout(&sel->so);
 		}
 	}
 	r = r600_shader_from_tgsi(rctx->screen, shader, key);
-- 
1.7.10.4



More information about the mesa-dev mailing list