softpipe: add support for indexed queries.
authorDave Airlie <airlied@gmail.com>
Wed, 27 May 2015 07:37:46 +0000 (17:37 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 9 Apr 2019 01:19:38 +0000 (11:19 +1000)
We need indexed queries to retrieve the geom shader info.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_prim_vbuf.c
src/gallium/drivers/softpipe/sp_query.c
src/gallium/include/pipe/p_state.h

index 7c42403009ce550f82064204196edfdbf5f1a77d..3bde9baa23a88474c33c5e56a59a1e3ca71e371e 100644 (file)
@@ -94,7 +94,7 @@ struct softpipe_context {
    struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS];
    unsigned num_so_targets;
    
-   struct pipe_query_data_so_statistics so_stats;
+   struct pipe_query_data_so_statistics so_stats[PIPE_MAX_VERTEX_STREAMS];
 
    struct pipe_query_data_pipeline_statistics pipeline_statistics;
    unsigned active_statistics_queries;
index 783adf4f4488df37cd5a371874d3e95cdfa67d98..12734314bf0158a4fee7b0c102322125319e8a9f 100644 (file)
@@ -602,8 +602,8 @@ sp_vbuf_so_info(struct vbuf_render *vbr, uint stream, uint primitives, uint prim
    struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
    struct softpipe_context *softpipe = cvbr->softpipe;
 
-   softpipe->so_stats.num_primitives_written += primitives;
-   softpipe->so_stats.primitives_storage_needed += prim_generated;
+   softpipe->so_stats[stream].num_primitives_written += primitives;
+   softpipe->so_stats[stream].primitives_storage_needed += prim_generated;
 }
 
 static void
index 5c9afe6fe47ea0898924630b09836042081ac425..7187c56206822f44045784ff68a5b6f3bb59ac7f 100644 (file)
@@ -39,6 +39,7 @@
 
 struct softpipe_query {
    unsigned type;
+   unsigned index;
    uint64_t start;
    uint64_t end;
    struct pipe_query_data_so_statistics so;
@@ -73,7 +74,7 @@ softpipe_create_query(struct pipe_context *pipe,
           type == PIPE_QUERY_TIMESTAMP_DISJOINT);
    sq = CALLOC_STRUCT( softpipe_query );
    sq->type = type;
-
+   sq->index = index;
    return (struct pipe_query *)sq;
 }
 
@@ -101,8 +102,8 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
       sq->start = os_time_get_nano();
       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;
+      sq->so.num_primitives_written = softpipe->so_stats[0].num_primitives_written;
+      sq->so.primitives_storage_needed = softpipe->so_stats[0].primitives_storage_needed;
       break;
    case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
    case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
@@ -110,10 +111,10 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
       sq->so.primitives_storage_needed = softpipe->so_stats.primitives_storage_needed;
       break;
    case PIPE_QUERY_PRIMITIVES_EMITTED:
-      sq->so.num_primitives_written = softpipe->so_stats.num_primitives_written;
+      sq->so.num_primitives_written = softpipe->so_stats[sq->index].num_primitives_written;
       break;
    case PIPE_QUERY_PRIMITIVES_GENERATED:
-      sq->so.primitives_storage_needed = softpipe->so_stats.primitives_storage_needed;
+      sq->so.primitives_storage_needed = softpipe->so_stats[sq->index].primitives_storage_needed;
       break;
    case PIPE_QUERY_TIMESTAMP:
    case PIPE_QUERY_GPU_FINISHED:
@@ -161,24 +162,24 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
    case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
    case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
       sq->so.num_primitives_written =
-         softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
+         softpipe->so_stats[0].num_primitives_written - sq->so.num_primitives_written;
       sq->so.primitives_storage_needed =
-         softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
+         softpipe->so_stats[0].primitives_storage_needed - sq->so.primitives_storage_needed;
       sq->end = sq->so.primitives_storage_needed > sq->so.num_primitives_written;
       break;
    case PIPE_QUERY_SO_STATISTICS:
       sq->so.num_primitives_written =
-         softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
+         softpipe->so_stats[sq->index].num_primitives_written - sq->so.num_primitives_written;
       sq->so.primitives_storage_needed =
-         softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
+         softpipe->so_stats[sq->index].primitives_storage_needed - sq->so.primitives_storage_needed;
       break;
    case PIPE_QUERY_PRIMITIVES_EMITTED:
       sq->so.num_primitives_written =
-         softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
+         softpipe->so_stats[sq->index].num_primitives_written - sq->so.num_primitives_written;
       break;
    case PIPE_QUERY_PRIMITIVES_GENERATED:
       sq->so.primitives_storage_needed =
-         softpipe->so_stats.primitives_storage_needed - sq->so.primitives_storage_needed;
+         softpipe->so_stats[sq->index].primitives_storage_needed - sq->so.primitives_storage_needed;
       break;
    case PIPE_QUERY_GPU_FINISHED:
    case PIPE_QUERY_TIMESTAMP_DISJOINT:
index 3a91ddd71b5b7c6a0d6415166512ee791e452ab0..b7fa76a803ac757b1036afad5376c06e4c2e2fbc 100644 (file)
@@ -77,6 +77,7 @@ extern "C" {
 #define PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE 4
 
 #define PIPE_MAX_HW_ATOMIC_BUFFERS 32
+#define PIPE_MAX_VERTEX_STREAMS   4
 
 struct pipe_reference
 {