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

Author: Carl Worth <[email protected]>
Date:   Thu Dec 13 15:23:10 2012 -0800

i965: Force even an empty query to flush all previous queries.

The specification requires that query results are processed in order, (when
one query result is returned, all previous query of the same type must also be
available). The implementation was failing this requirement in the case of
BeginQuery and EndQuery with no intervening drawing, (the result would be made
available immediately without flushing previous queries).

This fixes the following es3conform test:

        occlusion_query_query_order

as well as the following piglit test:

        occlusion_query_order

Reviewed-by: Ian Romanick <[email protected]>

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
b/src/mesa/drivers/dri/i965/brw_queryobj.c
index b6143f9..cd9c848 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -320,6 +320,23 @@ brw_end_query(struct gl_context *ctx, struct 
gl_query_object *q)
    case GL_ANY_SAMPLES_PASSED:
    case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
    case GL_SAMPLES_PASSED_ARB:
+
+      /* No query->bo means that EndQuery was called after BeginQuery with no
+       * intervening drawing. Rather than doing nothing at all here in this
+       * case, we emit the query_begin and query_end state to the
+       * hardware. This is to guarantee that waiting on the result of this
+       * empty state will cause all previous queries to complete at all, as
+       * required by the specification:
+       *
+       *       It must always be true that if any query object
+       *       returns a result available of TRUE, all queries of the
+       *       same type issued prior to that query must also return
+       *       TRUE. [Open GL 4.3 (Core Profile) Section 4.2.1]
+       */
+      if (!query->bo) {
+         brw_emit_query_begin(brw);
+      }
+
       if (query->bo) {
         brw_emit_query_end(brw);
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to