Mesa (master): gallium/util: add helper function util_query_clear_result

Marek Olšák mareko at kemper.freedesktop.org
Fri Mar 30 15:13:47 UTC 2012


Module: Mesa
Branch: master
Commit: 452d07759db7077a62d231f758f9d5e69af3fe60
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=452d07759db7077a62d231f758f9d5e69af3fe60

Author: Marek Olšák <maraeo at gmail.com>
Date:   Fri Mar 30 17:07:45 2012 +0200

gallium/util: add helper function util_query_clear_result

---

 src/gallium/auxiliary/util/u_inlines.h |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 2fe680f..23658bc 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -494,6 +494,36 @@ util_get_min_point_size(const struct pipe_rasterizer_state *state)
           !state->multisample ? 1.0f : 0.0f;
 }
 
+static INLINE void
+util_query_clear_result(union pipe_query_result *result, unsigned type)
+{
+   switch (type) {
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
+   case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+   case PIPE_QUERY_GPU_FINISHED:
+      result->b = FALSE;
+      break;
+   case PIPE_QUERY_OCCLUSION_COUNTER:
+   case PIPE_QUERY_TIMESTAMP:
+   case PIPE_QUERY_TIME_ELAPSED:
+   case PIPE_QUERY_PRIMITIVES_GENERATED:
+   case PIPE_QUERY_PRIMITIVES_EMITTED:
+      result->u64 = 0;
+      break;
+   case PIPE_QUERY_SO_STATISTICS:
+      memset(&result->so_statistics, 0, sizeof(result->so_statistics));
+      break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
+      memset(&result->timestamp_disjoint, 0, sizeof(result->timestamp_disjoint));
+      break;
+   case PIPE_QUERY_PIPELINE_STATISTICS:
+      memset(&result->pipeline_statistics, 0, sizeof(result->pipeline_statistics));
+      break;
+   default:
+      assert(0);
+   }
+}
+
 #ifdef __cplusplus
 }
 #endif




More information about the mesa-commit mailing list