summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_query.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-01-04 17:38:55 +0000
committerDave Airlie <[email protected]>2012-01-10 12:07:51 +0000
commitec8cbd79ac4065111365a6720c9564de56855cc8 (patch)
tree741b04a8e779a4ce401f59bbe505fbd1e55e78ab /src/gallium/drivers/softpipe/sp_query.c
parent67e3cbf1632e361220234013147331e4618b70cb (diff)
draw/softpipe: EXT_transform_feedback support (v2)
This replaces the current code with an implementation compatible with the new gallium interface. I've left some of the remains of the interface intact so llvmpipe keeps building correctly, and I'll take a look at fixing llvmpipe up later. v2: fixup as per Brian's review Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_query.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index c2c48e8ecb3..2e54e023091 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -42,6 +42,7 @@ struct softpipe_query {
uint64_t start;
uint64_t end;
struct pipe_query_data_so_statistics so;
+ unsigned num_primitives_generated;
};
@@ -59,6 +60,8 @@ softpipe_create_query(struct pipe_context *pipe,
assert(type == PIPE_QUERY_OCCLUSION_COUNTER ||
type == PIPE_QUERY_TIME_ELAPSED ||
type == PIPE_QUERY_SO_STATISTICS ||
+ type == PIPE_QUERY_PRIMITIVES_EMITTED ||
+ type == PIPE_QUERY_PRIMITIVES_GENERATED ||
type == PIPE_QUERY_GPU_FINISHED ||
type == PIPE_QUERY_TIMESTAMP ||
type == PIPE_QUERY_TIMESTAMP_DISJOINT);
@@ -91,8 +94,14 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
sq->start = 1000*os_time_get();
break;
case PIPE_QUERY_SO_STATISTICS:
- sq->so.num_primitives_written = 0;
sq->so.primitives_storage_needed = 0;
+ case PIPE_QUERY_PRIMITIVES_EMITTED:
+ sq->so.num_primitives_written = 0;
+ softpipe->so_stats.num_primitives_written = 0;
+ break;
+ case PIPE_QUERY_PRIMITIVES_GENERATED:
+ sq->num_primitives_generated = 0;
+ softpipe->num_primitives_generated = 0;
break;
case PIPE_QUERY_TIMESTAMP:
case PIPE_QUERY_GPU_FINISHED:
@@ -125,10 +134,14 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
sq->end = 1000*os_time_get();
break;
case PIPE_QUERY_SO_STATISTICS:
- sq->so.num_primitives_written =
- softpipe->so_stats.num_primitives_written;
sq->so.primitives_storage_needed =
softpipe->so_stats.primitives_storage_needed;
+ case PIPE_QUERY_PRIMITIVES_EMITTED:
+ sq->so.num_primitives_written =
+ softpipe->so_stats.num_primitives_written;
+ break;
+ case PIPE_QUERY_PRIMITIVES_GENERATED:
+ sq->num_primitives_generated = softpipe->num_primitives_generated;
break;
case PIPE_QUERY_GPU_FINISHED:
break;
@@ -166,6 +179,12 @@ softpipe_get_query_result(struct pipe_context *pipe,
sizeof(struct pipe_query_data_timestamp_disjoint));
}
break;
+ case PIPE_QUERY_PRIMITIVES_EMITTED:
+ *result = sq->so.num_primitives_written;
+ break;
+ case PIPE_QUERY_PRIMITIVES_GENERATED:
+ *result = sq->num_primitives_generated;
+ break;
default:
*result = sq->end - sq->start;
break;