struct softpipe_context *softpipe = cvbr->softpipe;
softpipe->so_target.so_count[buffer] += vertices;
+
+ softpipe->so_stats.num_primitives_written =
+ vertices / u_vertices_per_prim(cvbr->prim);
+ softpipe->so_stats.primitives_storage_needed =
+ vertices * 4 /*sizeof(float|int32)*/ * 4 /*x,y,z,w*/;
}
unsigned type;
uint64_t start;
uint64_t end;
+ struct pipe_query_data_so_statistics so;
};
{
struct softpipe_query* sq;
- assert(type == PIPE_QUERY_OCCLUSION_COUNTER || type == PIPE_QUERY_TIME_ELAPSED);
+ assert(type == PIPE_QUERY_OCCLUSION_COUNTER ||
+ type == PIPE_QUERY_TIME_ELAPSED ||
+ type == PIPE_QUERY_SO_STATISTICS);
sq = CALLOC_STRUCT( softpipe_query );
sq->type = type;
case PIPE_QUERY_TIME_ELAPSED:
sq->start = 1000*os_time_get();
break;
+ case PIPE_QUERY_SO_STATISTICS:
+ sq->so.num_primitives_written = 0;
+ sq->so.primitives_storage_needed = 0;
default:
assert(0);
break;
case PIPE_QUERY_TIME_ELAPSED:
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;
default:
assert(0);
break;
{
struct softpipe_query *sq = softpipe_query(q);
uint64_t *result = (uint64_t*)vresult;
- *result = sq->end - sq->start;
+
+ switch (sq->type) {
+ case PIPE_QUERY_SO_STATISTICS:
+ memcpy(vresult, &sq->so,
+ sizeof(struct pipe_query_data_so_statistics));
+ break;
+ default:
+ *result = sq->end - sq->start;
+ break;
+ }
return TRUE;
}
#define PIPE_QUERY_PRIMITIVES_GENERATED 1
#define PIPE_QUERY_PRIMITIVES_EMITTED 2
#define PIPE_QUERY_TIME_ELAPSED 3
-#define PIPE_QUERY_TYPES 4
+#define PIPE_QUERY_SO_STATISTICS 5
+#define PIPE_QUERY_TYPES 6
/**
#define PIPE_REFERENCED_FOR_READ (1 << 0)
#define PIPE_REFERENCED_FOR_WRITE (1 << 1)
+/**
+ * Composite query types
+ */
+struct pipe_query_data_so_statistics
+{
+ uint64_t num_primitives_written;
+ uint64_t primitives_storage_needed;
+};
#ifdef __cplusplus
}