i965 gen6: Implement transform feedback queries.
authorPaul Berry <stereotype441@gmail.com>
Thu, 15 Dec 2011 22:57:57 +0000 (14:57 -0800)
committerPaul Berry <stereotype441@gmail.com>
Tue, 20 Dec 2011 23:22:28 +0000 (15:22 -0800)
commitc59393b7069f59ca2a13bfb6500f2a5360c38031
treebf8d2c511d3ad886ef2eaf7719aa050c72017d41
parentc5e17a84983d7799fd842a62daaece3d97a670be
i965 gen6: Implement transform feedback queries.

This patch adds software-based PRIMITIVES_GENERATED and
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries that work by keeping
track of the number of primitives that are sent down the pipeline, and
adjusting as necessary to account for the way each primitive type is
tessellated.

In the long run we'll want to replace this with a hardware-based
implementation, because the software approach won't work with geometry
shaders or primitive restart.  However, at the moment, we don't have
the necessary kernel support to implement a hardware-based query (we
would need the kernel to save GPU registers when context switching, so
that drawing performed by another process doesn't get counted).

Fixes Piglit tests EXT_transform_feedback/query-primitives_generated-*
and EXT_transform_feedback/query-primitives-written-*.

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