From 4ebf8d3f0f9ae8f53bf64599f47ee9a30c60ced9 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 19 Feb 2015 11:04:56 +0100 Subject: [PATCH] i965: Fix GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB for gen6 In gen6 we need to compute the primitive in the generated GS program. The current implementation only counts full primitives, that is, of the output primitive type is a triangle strip, it won't count individual triangles in the strip but just one strip primitive. If we want to count basic primitives instead we can just use CL_INVOCATION_COUNT to resolve the query. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89210 --- 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 -- 1.9.1