diff options
author | Kenneth Graunke <[email protected]> | 2013-03-04 11:37:35 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-03-06 08:27:47 -0800 |
commit | 89e5c8e0fa0f7ec6e1dc0d1ee269c164fd1cf3b0 (patch) | |
tree | 085120fe0b4d2ed7d8ed350b1f8d1e7ac990f5f4 | |
parent | 886c5085e3f78affa524bf12ca406a617219cd68 (diff) |
i965: Fix off-by-one in query object result gathering.
If we've written N pairs of values to the buffer, then last_index = N,
but the values are 0 .. N-1. Thus, we need to use <, not <=.
This worked anyway because we fill the buffer with zeroes, so we just
added an extra (0 - 0) to our results.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_queryobj.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index de3be83c8d7..a45435eaf9c 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -208,7 +208,7 @@ brw_queryobj_get_results(struct gl_context *ctx, * run out of space in the query's BO and allocated a new one. If so, * this function was already called to accumulate the results so far. */ - for (i = 0; i <= query->last_index; i++) { + for (i = 0; i < query->last_index; i++) { query->Base.Result += results[i * 2 + 1] - results[i * 2]; } break; @@ -218,7 +218,7 @@ brw_queryobj_get_results(struct gl_context *ctx, /* If the starting and ending PS_DEPTH_COUNT from any of the batches * differ, then some fragments passed the depth test. */ - for (i = 0; i <= query->last_index; i++) { + for (i = 0; i < query->last_index; i++) { if (results[i * 2 + 1] != results[i * 2]) { query->Base.Result = GL_TRUE; break; |