panfrost: Implement PIPE_QUERY_OCCLUSION_COUNTER
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 14 Feb 2019 02:50:30 +0000 (02:50 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 15 Feb 2019 07:46:02 +0000 (07:46 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_context.c

index 368b3b8759a26dcd53a387e6c46b44b81cae0f1b..6272578bd5f65cbc431a49561f8956c143e44574 100644 (file)
@@ -2591,6 +2591,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
         struct panfrost_query *query = (struct panfrost_query *) q;
 
         switch (query->type) {
+                case PIPE_QUERY_OCCLUSION_COUNTER:
                 case PIPE_QUERY_OCCLUSION_PREDICATE:
                 case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
                 {
@@ -2633,13 +2634,19 @@ panfrost_get_query_result(struct pipe_context *pipe,
         panfrost_flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);
 
         switch (query->type) {
+                case PIPE_QUERY_OCCLUSION_COUNTER:
                 case PIPE_QUERY_OCCLUSION_PREDICATE:
                 case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: {
                         /* Read back the query results */
                         unsigned *result = (unsigned *) query->transfer.cpu;
                         unsigned passed = *result;
 
-                        vresult->b = !!passed;
+                        if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
+                                vresult->u64 = passed;
+                        } else {
+                                vresult->b = !!passed;
+                        }
+
                         break;
                 }
                 default: