Mesa (9.0): i965: Actually add support for GL_ANY_SAMPLES_PASSED from GL_ARB_oq2.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Feb 2 00:22:58 UTC 2013


Module: Mesa
Branch: 9.0
Commit: ebd4883a0c53a3584f6da78042dbc38da779291b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebd4883a0c53a3584f6da78042dbc38da779291b

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 17 13:07:33 2012 -0700

i965: Actually add support for GL_ANY_SAMPLES_PASSED from GL_ARB_oq2.

v2: Fix mangled sentence in the comment, and make the loop exit early.

Fixes assertion failures in Piglit's spec/ARB_occlusion_query2/render
test as well as the game PlaneShift.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com> (v1)
(cherry picked from commit e755c1a36b27d6e45f0ae81729908342b8775c74)

---

 src/mesa/drivers/dri/i965/brw_queryobj.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index d5c4fdf..e63c528 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -191,6 +191,16 @@ brw_queryobj_get_results(struct gl_context *ctx,
       }
       break;
 
+   case GL_ANY_SAMPLES_PASSED:
+      /* Set true if any of the sub-queries passed. */
+      for (i = query->first_index; i <= query->last_index; i++) {
+	 if (results[i * 2 + 1] != results[i * 2]) {
+            query->Base.Result = GL_TRUE;
+            break;
+         }
+      }
+      break;
+
    case GL_PRIMITIVES_GENERATED:
    case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
       /* We don't actually query the hardware for this value, so query->bo
@@ -247,6 +257,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
       write_timestamp(intel, query->bo, 0);
       break;
 
+   case GL_ANY_SAMPLES_PASSED:
    case GL_SAMPLES_PASSED_ARB:
       /* Reset our driver's tracking of query state. */
       drm_intel_bo_unreference(query->bo);
@@ -302,6 +313,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
       intel_batchbuffer_flush(intel);
       break;
 
+   case GL_ANY_SAMPLES_PASSED:
    case GL_SAMPLES_PASSED_ARB:
       /* Flush the batchbuffer in case it has writes to our query BO.
        * Have later queries write to a new query BO so that further rendering




More information about the mesa-commit mailing list