aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_query.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-12-05 06:50:07 +1000
committerDave Airlie <[email protected]>2012-12-06 14:48:10 +1000
commit77b26564c3f0395bf3e744abbf6d0e7aa9d2c8da (patch)
treeb592e6ecfdfad109ee33e1de801f144033175ea1 /src/gallium/drivers/llvmpipe/lp_query.c
parent71f06344a0d72a6bd27750ceca571fc016b8de85 (diff)
llvmpipe: EXT_transform_feedback support (v1.1)
I'd written most of this ages ago, but never finished it off. This passes 115/130 piglit tests so far. I'll look into the others as time permits. v1.1: fix calloc return check as suggested by Jose. Reviewed-by: Jose Fonseca <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_query.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index e3021972566..7a62a809d58 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -138,6 +138,12 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
*result = os_time_get_nano();
}
break;
+ case PIPE_QUERY_PRIMITIVES_GENERATED:
+ *result = pq->num_primitives_generated;
+ break;
+ case PIPE_QUERY_PRIMITIVES_EMITTED:
+ *result = pq->num_primitives_written;
+ break;
default:
assert(0);
break;
@@ -165,6 +171,16 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
memset(pq->count, 0, sizeof(pq->count));
lp_setup_begin_query(llvmpipe->setup, pq);
+ if (pq->type == PIPE_QUERY_PRIMITIVES_EMITTED) {
+ pq->num_primitives_written = 0;
+ llvmpipe->so_stats.num_primitives_written = 0;
+ }
+
+ if (pq->type == PIPE_QUERY_PRIMITIVES_GENERATED) {
+ pq->num_primitives_generated = 0;
+ llvmpipe->num_primitives_generated = 0;
+ }
+
if (pq->type == PIPE_QUERY_OCCLUSION_COUNTER) {
llvmpipe->active_occlusion_query = TRUE;
llvmpipe->dirty |= LP_NEW_OCCLUSION_QUERY;
@@ -180,6 +196,14 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
lp_setup_end_query(llvmpipe->setup, pq);
+ if (pq->type == PIPE_QUERY_PRIMITIVES_EMITTED) {
+ pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written;
+ }
+
+ if (pq->type == PIPE_QUERY_PRIMITIVES_GENERATED) {
+ pq->num_primitives_generated = llvmpipe->num_primitives_generated;
+ }
+
if (pq->type == PIPE_QUERY_OCCLUSION_COUNTER) {
assert(llvmpipe->active_occlusion_query);
llvmpipe->active_occlusion_query = FALSE;