summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-02-25 22:30:21 -0800
committerKenneth Graunke <[email protected]>2013-03-01 22:09:04 -0800
commit90feda81de3c608d5a6041246fc010904a3afa81 (patch)
tree5fb8fb8b906ce0e2808359eb2d03fb7b415c08f4 /src
parentec5d502ec3215c7610bcff0be4418f698b2f36ab (diff)
i965: Use query->last_index instead of the global brw->query.index.
Since we already have an index in the brw_query_object, there's no need to also keep a global variable that shadows it. Plus, if we ever add support for more types of queries that still need the per-batch before/after treatment we do for occlusion queries, we won't be able to use a single global variable. In contrast, per-query object variables will work fine. Signed-off-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_queryobj.c12
2 files changed, 6 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index d6746bf2302..9f386255b9e 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1044,7 +1044,6 @@ struct brw_context
struct {
struct brw_query_object *obj;
drm_intel_bo *bo;
- int index;
bool begin_emitted;
} query;
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 8893dd77994..d218631aaf2 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -531,7 +531,7 @@ brw_emit_query_begin(struct brw_context *brw)
* buffer's results momentarily.
*/
if (brw->query.bo == NULL ||
- brw->query.index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
+ query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
drm_intel_bo_unreference(brw->query.bo);
brw->query.bo = NULL;
@@ -542,10 +542,10 @@ brw_emit_query_begin(struct brw_context *brw)
memset((char *)brw->query.bo->virtual, 0, 4096);
drm_intel_bo_unmap(brw->query.bo);
- brw->query.index = 0;
+ query->last_index = 0;
}
- write_depth_count(intel, brw->query.bo, brw->query.index * 2);
+ write_depth_count(intel, brw->query.bo, query->last_index * 2);
if (query->bo != brw->query.bo) {
if (query->bo != NULL) {
@@ -558,7 +558,6 @@ brw_emit_query_begin(struct brw_context *brw)
drm_intel_bo_reference(brw->query.bo);
query->bo = brw->query.bo;
}
- query->last_index = brw->query.index;
brw->query.begin_emitted = true;
}
@@ -571,14 +570,15 @@ void
brw_emit_query_end(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
+ struct brw_query_object *query = brw->query.obj;
if (!brw->query.begin_emitted)
return;
- write_depth_count(intel, brw->query.bo, brw->query.index * 2 + 1);
+ write_depth_count(intel, brw->query.bo, query->last_index * 2 + 1);
brw->query.begin_emitted = false;
- brw->query.index++;
+ query->last_index++;
}
/**