[Mesa-dev] [PATCH 1/5] llvmpipe: implement so_overflow query

Zack Rusin zackr at vmware.com
Tue Apr 23 15:58:35 PDT 2013


Signed-off-by: Zack Rusin <zackr at vmware.com>
---
 src/gallium/drivers/llvmpipe/lp_query.c |   12 ++++++++++++
 src/gallium/drivers/llvmpipe/lp_query.h |    1 +
 src/gallium/drivers/llvmpipe/lp_rast.c  |    2 ++
 3 files changed, 15 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 96e1e3f..d013ff0 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -137,6 +137,9 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
    case PIPE_QUERY_PRIMITIVES_EMITTED:
       *result = pq->num_primitives_written;
       break;
+   case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+      *result = pq->so_has_overflown;
+      break;
    case PIPE_QUERY_SO_STATISTICS: {
       struct pipe_query_data_so_statistics *stats =
          (struct pipe_query_data_so_statistics *)vresult;
@@ -194,6 +197,10 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
       llvmpipe->num_primitives_generated = 0;
    }
 
+   if (pq->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE) {
+      pq->so_has_overflown = FALSE;
+   }
+
    if (pq->type == PIPE_QUERY_PIPELINE_STATISTICS) {
       /* reset our cache */
       if (llvmpipe->active_statistics_queries == 0) {
@@ -232,6 +239,11 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
       pq->num_primitives_generated = llvmpipe->num_primitives_generated;
    }
 
+   if (pq->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE) {
+      pq->so_has_overflown = (llvmpipe->num_primitives_generated >
+                              llvmpipe->so_stats.num_primitives_written);
+   }
+
    if (pq->type == PIPE_QUERY_PIPELINE_STATISTICS) {
       pq->stats.ia_vertices =
          llvmpipe->pipeline_statistics.ia_vertices - pq->stats.ia_vertices;
diff --git a/src/gallium/drivers/llvmpipe/lp_query.h b/src/gallium/drivers/llvmpipe/lp_query.h
index 68dfe99..e29022a 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.h
+++ b/src/gallium/drivers/llvmpipe/lp_query.h
@@ -47,6 +47,7 @@ struct llvmpipe_query {
    unsigned type;                   /* PIPE_QUERY_* */
    unsigned num_primitives_generated;
    unsigned num_primitives_written;
+   boolean so_has_overflown;
 
    struct pipe_query_data_pipeline_statistics stats;
 };
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 29dd933..ef49ba9 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -478,6 +478,7 @@ lp_rast_begin_query(struct lp_rasterizer_task *task,
    case PIPE_QUERY_PRIMITIVES_EMITTED:
    case PIPE_QUERY_SO_STATISTICS:
    case PIPE_QUERY_PIPELINE_STATISTICS:
+   case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
       break;
    default:
       assert(0);
@@ -511,6 +512,7 @@ lp_rast_end_query(struct lp_rasterizer_task *task,
    case PIPE_QUERY_PRIMITIVES_EMITTED:
    case PIPE_QUERY_SO_STATISTICS:
    case PIPE_QUERY_PIPELINE_STATISTICS:
+   case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
       break;
    default:
       assert(0);
-- 
1.7.10.4


More information about the mesa-dev mailing list