i965/gen6: Add state dumping for the VS constants.
authorEric Anholt <eric@anholt.net>
Fri, 8 Jul 2011 20:35:42 +0000 (13:35 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 11 Jul 2011 16:27:27 +0000 (09:27 -0700)
This is quite a bit of spam, but I think it's useful to have in a full
INTEL_DEBUG=batch dump.  And a lot of this spam on glxgears is just
because we're awful at handling our constants :/

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_state_dump.c
src/mesa/drivers/dri/i965/gen6_vs_state.c

index 1a918f47b268d5aefa72fea8a86afbf77ac9ab93..471015cf9d0f2c8dca7e4b5aaabea1be23f0e403 100644 (file)
@@ -211,6 +211,7 @@ enum state_struct_type {
    AUB_TRACE_NO_TYPE =                 0x100,
    AUB_TRACE_BINDING_TABLE =           0x101,
    AUB_TRACE_SURFACE_STATE =           0x102,
+   AUB_TRACE_VS_CONSTANTS =            0x103,
 };
 
 /** Subclass of Mesa vertex program */
index e78e48f9ee9e3de18a63cb4f6438d8401725d60d..0758cb51a6ad2812e7c7dfe2d41488933b5f8884 100644 (file)
@@ -367,6 +367,23 @@ dump_scissor(struct brw_context *brw, uint32_t offset)
             scissor->xmax, scissor->ymax);
 }
 
+static void
+dump_vs_constants(struct brw_context *brw, uint32_t offset, uint32_t size)
+{
+   const char *name = "VS_CONST";
+   struct intel_context *intel = &brw->intel;
+   uint32_t *as_uint = intel->batch.bo->virtual + offset;
+   float *as_float = intel->batch.bo->virtual + offset;
+   int i;
+
+   for (i = 0; i < size / 4; i += 4) {
+      batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
+               i / 4,
+               as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3],
+               as_uint[i], as_uint[i + 1], as_uint[i + 2], as_uint[i + 3]);
+   }
+}
+
 static void dump_binding_table(struct brw_context *brw, uint32_t offset,
                               uint32_t size)
 {
@@ -493,6 +510,9 @@ dump_state_batch(struct brw_context *brw)
       case AUB_TRACE_SCISSOR_STATE:
         dump_scissor(brw, offset);
         break;
+      case AUB_TRACE_VS_CONSTANTS:
+        dump_vs_constants(brw, offset, size);
+        break;
       default:
         break;
       }
index ecdf5e4f61433725fbba683998a09d45654bea4b..fb4cdbaadf97cb5ed597393bad9c2ccb4d42257b 100644 (file)
@@ -60,7 +60,7 @@ gen6_prepare_vs_push_constants(struct brw_context *brw)
       float *param;
       int i;
 
-      param = brw_state_batch(brw, AUB_TRACE_NO_TYPE,
+      param = brw_state_batch(brw, AUB_TRACE_VS_CONSTANTS,
                              (MAX_CLIP_PLANES + nr_params) *
                              4 * sizeof(float),
                              32, &brw->vs.push_const_offset);