i965/vs: Fix setup of scratch space pointer on pre-gen6.
authorEric Anholt <eric@anholt.net>
Tue, 30 Aug 2011 23:58:03 +0000 (16:58 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 7 Sep 2011 01:01:54 +0000 (18:01 -0700)
We were failing to relocate, so on the first draw run our scratch
would tend to get written to 0x0.

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

index 29b3e47ab0c69e6d06fe3a5091b7745e475e0178..a01b614ffff7b331a5f33244ed7c0d78473fa6f8 100644 (file)
@@ -157,6 +157,16 @@ brw_prepare_vs_unit(struct brw_context *brw)
     */
    vs->vs6.vs_enable = 1;
 
+   /* Emit scratch space relocation */
+   if (brw->vs.prog_data->total_scratch != 0) {
+      drm_intel_bo_emit_reloc(intel->batch.bo,
+                             brw->vs.state_offset +
+                             offsetof(struct brw_vs_unit_state, thread2),
+                             brw->vs.scratch_bo,
+                             vs->thread2.per_thread_scratch_space,
+                             I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
+   }
+
    brw->state.dirty.cache |= CACHE_NEW_VS_UNIT;
 }