diff options
author | Eric Anholt <[email protected]> | 2011-12-29 23:26:48 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-01-06 09:17:14 -0800 |
commit | 6c0b70e7740b30ee46ae28f6b3b7fe7223621ebd (patch) | |
tree | da965313f3ffe6d2b8e7c7c2b93909b038ca17c6 /src/mesa | |
parent | 7f91c8bf2bf08afd297314c02a8869d8919f5f0e (diff) |
i965/gen7: Fix up the transform feedback buffer pointers on later batches.
Fixes piglit EXT_transform_feedback/intervening-read
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vtbl.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_sol.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sol_state.c | 13 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 873e172b88c..9f9b11313ec 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -988,6 +988,7 @@ struct brw_context struct brw_sol_state { uint32_t svbi_0_starting_index; uint32_t svbi_0_max_index; + uint32_t offset_0_batch_start; uint32_t primitives_generated; uint32_t primitives_written; } sol; diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index d34880659e2..be975d1c41b 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -177,6 +177,12 @@ static void brw_new_batch( struct intel_context *intel ) brw->state_batch_count = 0; + /* Gen7 needs to track what the real transform feedback vertex count was at + * the start of the batch, since the kernel will be resetting the offset to + * 0. + */ + brw->sol.offset_0_batch_start = brw->sol.svbi_0_starting_index; + brw->vb.nr_current_buffers = 0; brw->ib.type = -1; diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c index f7248023d12..41923b7f527 100644 --- a/src/mesa/drivers/dri/i965/gen6_sol.c +++ b/src/mesa/drivers/dri/i965/gen6_sol.c @@ -132,6 +132,7 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode, brw->state.dirty.brw |= BRW_NEW_SOL_INDICES; brw->sol.svbi_0_starting_index = 0; brw->sol.svbi_0_max_index = max_index; + brw->sol.offset_0_batch_start = 0; } void diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c index 81ffc0e7ade..04783ec3132 100644 --- a/src/mesa/drivers/dri/i965/gen7_sol_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c @@ -56,6 +56,7 @@ upload_3dstate_so_buffers(struct brw_context *brw) struct gl_buffer_object *bufferobj = xfb_obj->Buffers[i]; drm_intel_bo *bo; uint32_t start, end; + uint32_t stride; if (!xfb_obj->Buffers[i]) { /* The pitch of 0 in this command indicates that the buffer is @@ -72,17 +73,23 @@ upload_3dstate_so_buffers(struct brw_context *brw) } bo = intel_buffer_object(bufferobj)->buffer; + stride = linked_xfb_info->BufferStride[i] * 4; start = xfb_obj->Offset[i]; assert(start % 4 == 0); end = ALIGN(start + xfb_obj->Size[i], 4); assert(end <= bo->size); + /* Offset the starting offset by the current vertex index into the + * feedback buffer, offset register is always set to 0 at the start of the + * batchbuffer. + */ + start += brw->sol.offset_0_batch_start * stride; + assert(start <= end); + BEGIN_BATCH(4); OUT_BATCH(_3DSTATE_SO_BUFFER << 16 | (4 - 2)); - OUT_BATCH((i << SO_BUFFER_INDEX_SHIFT) | - ((linked_xfb_info->BufferStride[i] * 4) << - SO_BUFFER_PITCH_SHIFT)); + OUT_BATCH((i << SO_BUFFER_INDEX_SHIFT) | stride); OUT_RELOC(bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, start); OUT_RELOC(bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, end); ADVANCE_BATCH(); |