[Mesa-dev] [PATCH 08/10] i965: Turn if (query->bo) into an assertion.

Kenneth Graunke kenneth at whitecape.org
Thu Feb 28 00:25:11 PST 2013


The code a few lines above calls brw_emit_query_begin() if !query->bo,
and that creates query->bo.  So it should always be non-NULL.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_queryobj.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 064c8eb..c8492d0 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -404,12 +404,12 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
          brw_emit_query_begin(brw);
       }
 
-      if (query->bo) {
-	 brw_emit_query_end(brw);
+      assert(query->bo);
 
-	 drm_intel_bo_unreference(brw->query.bo);
-	 brw->query.bo = NULL;
-      }
+      brw_emit_query_end(brw);
+
+      drm_intel_bo_unreference(brw->query.bo);
+      brw->query.bo = NULL;
 
       brw->query.obj = NULL;
 
-- 
1.8.1.4



More information about the mesa-dev mailing list