Mesa (master): i965/vs: Fix debug dumping of VS push constants.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Oct 25 21:54:54 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Oct 21 20:58:18 2012 -0700

i965/vs: Fix debug dumping of VS push constants.

While copying the values into the batch space, we advance the param
pointer.  The debug code then tries to iterate over all the uploaded
values, starting at param...which is now the end of the uploaded data,
rather than the start.

This patch saves a pointer to the start of push constant space before
it gets altered and switches the debug code to use that.

Tested by uncommenting the code and examining the output of
glsl-vs-clamp-1.shader_test.  Previously all values appeared to be zero.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/gen6_vs_state.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index b15bc3d..0e80c27 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -63,6 +63,8 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
 			      4 * sizeof(float),
 			      32, &brw->vs.push_const_offset);
 
+      float *save_param = param;
+
       if (brw->vs.prog_data->uses_new_param_layout) {
 	 for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
 	    *param = *brw->vs.prog_data->param[i];
@@ -102,7 +104,7 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
       if (0) {
 	 printf("VS constant buffer:\n");
 	 for (i = 0; i < params_uploaded; i++) {
-	    float *buf = param + i * 4;
+	    float *buf = save_param + i * 4;
 	    printf("%d: %f %f %f %f\n",
 		   i, buf[0], buf[1], buf[2], buf[3]);
 	 }




More information about the mesa-commit mailing list