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;
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;
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
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
}
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();