summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2013-04-29 15:40:06 +0100
committerJosé Fonseca <[email protected]>2013-04-29 15:40:06 +0100
commit220ef8295c3807c55df69af663ae8689597f9a9e (patch)
tree0faf372da02d914135d51372661d119cd82b9bed /src/gallium
parentc4bea00fb39fb1813d220b95f0bc94e6fce8c84a (diff)
llvmpipe: Fix queries when screen->num_threads == 0.
That is, when llvmpipe is run in single-threaded mode. Trivial. Tested with LP_NUM_THREADS=0 glean --run results --overwrite --quick --tests occluQry
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 6b1da8bf3ec..0fd91c044a8 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -94,6 +94,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
union pipe_query_result *vresult)
{
struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen);
+ unsigned num_threads = MAX2(1, screen->num_threads);
struct llvmpipe_query *pq = llvmpipe_query(q);
uint64_t *result = (uint64_t *)vresult;
int i;
@@ -120,12 +121,12 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
switch (pq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
- for (i = 0; i < screen->num_threads; i++) {
+ for (i = 0; i < num_threads; i++) {
*result += pq->count[i];
}
break;
case PIPE_QUERY_TIMESTAMP:
- for (i = 0; i < screen->num_threads; i++) {
+ for (i = 0; i < num_threads; i++) {
if (pq->count[i] > *result) {
*result = pq->count[i];
}