Mesa (master): i965/gen6: Fix GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB

Iago Toral Quiroga itoral at kemper.freedesktop.org
Fri Feb 20 10:26:01 UTC 2015


Module: Mesa
Branch: master
Commit: 2a06728ba0da5e4175843b1b53919d6167ca0aea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a06728ba0da5e4175843b1b53919d6167ca0aea

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri Feb 20 08:21:25 2015 +0100

i965/gen6: Fix GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB

In gen6 we need to compute the primitive count in the generated GS program.
The current implementation only counts full primitives, that is, if the
output primitive type is a triangle strip, it won't count individual
triangles in the strip, only complete strips.

If we want to count basic primitives instead we have two options: rework
the assembly code we generate for strip primitives or simply use
CL_INVOCATION_COUNT to resolve the query and let the hardware do that work
for us. This patch implements the latter approach.

Fixes the following piglit test:
bin/arb_pipeline_statistics_query-geom -auto

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89210
Tested-by: Mark Janes <mark.a.janes at intel.com>
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

---

 src/mesa/drivers/dri/i965/gen6_queryobj.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index 09b66ca..6431ed5 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -147,6 +147,11 @@ emit_pipeline_stat(struct brw_context *brw, drm_intel_bo *bo,
    };
    STATIC_ASSERT(ARRAY_SIZE(target_to_register) == MAX_PIPELINE_STATISTICS);
    uint32_t reg = target_to_register[pipeline_target_to_index(target)];
+   /* Gen6 GS code counts full primitives, that is, it won't count individual
+    * triangles in a triangle strip. Use CL_INVOCATION_COUNT for that.
+    */
+   if (brw->gen == 6 && target == GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB)
+      reg = CL_INVOCATION_COUNT;
    assert(reg != 0);
 
    /* Emit a flush to make sure various parts of the pipeline are complete and




More information about the mesa-commit mailing list