i965: Properly reset SVBI counters on ResumeTransformFeedback().
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 17 Feb 2017 05:24:20 +0000 (21:24 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 21 Feb 2017 20:38:13 +0000 (12:38 -0800)
commit0235757422d825c37ca2d2c3feb9e58a28deedd4
tree281a834df0ac54197ddd751bc97af8c1842060e8
parenteb0331382aab7322380c330b015dca2d54ca2881
i965: Properly reset SVBI counters on ResumeTransformFeedback().

This fixes Piglit's ARB_transform_feedback2/change-objects-while-paused
GLES 3.0 test.  When resuming the transform feedback object, we need to
reset the SVBI counters so we continue writing at the correct point in
the buffer.

Instead of SO_WRITE_OFFSET counters (with a DWord offset), we have the
Streamed Vertex Buffer Index (SVBI) counters, which contain a count of
vertices emitted.

Unfortunately, there's no straightforward way to store the current SVBI
counter values to a buffer.  They're not available in a register.  You
can use a bit in the 3DSTATE_SVB_INDEX packet to copy them to another
internal counter which 3DPRIMITIVE can use...but there's no good way to
extract that either.

So, once again, we use SO_NUM_PRIMS_WRITTEN to calculate the vertex
numbers.  Thankfully, we can reuse most of the existing Gen7+ code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/gen6_sol.c