etnaviv: extend acc query provider with supports(..) function
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 19 Jul 2019 09:45:36 +0000 (11:45 +0200)
committerMarge Bot <eric+marge@anholt.net>
Sun, 5 Apr 2020 18:01:43 +0000 (18:01 +0000)
Move the logic if a query provider supports a query_type
directly to the provider.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

src/gallium/drivers/etnaviv/etnaviv_query_acc.c
src/gallium/drivers/etnaviv/etnaviv_query_acc.h

index 446a629c6e8a534c1330104ee5a7ee0e8cbcc98c..976bfa1c497f0ec06c49d4ee16dce8b1f8467efa 100644 (file)
  * interpret results
  */
 
+static bool
+occlusion_supports(unsigned query_type)
+{
+   switch (query_type) {
+   case PIPE_QUERY_OCCLUSION_COUNTER:
+      /* fallthrough */
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
+      /* fallthrough */
+   case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
+      return true;
+   default:
+      return false;
+   }
+}
+
 static void
 occlusion_resume(struct etna_acc_query *aq, struct etna_context *ctx)
 {
@@ -98,6 +113,7 @@ etna_acc_destroy_query(struct etna_context *ctx, struct etna_query *q)
 }
 
 static const struct etna_acc_sample_provider occlusion_provider = {
+   .supports = occlusion_supports,
    .suspend = occlusion_suspend,
    .resume = occlusion_resume,
    .result = occlusion_result,
index 5927d7da564a4042a2eff9699b74a4ce97f7d9d8..b22b22147283824498d3ea149616fb01734b98e2 100644 (file)
@@ -34,6 +34,8 @@
 struct etna_acc_query;
 
 struct etna_acc_sample_provider {
+   bool (*supports)(unsigned query_type);
+
    void (*resume)(struct etna_acc_query *aq, struct etna_context *ctx);
    void (*suspend)(struct etna_acc_query *aq, struct etna_context *ctx);