On 07/09/2014 08:34 AM, Samuel Pitoiset wrote:
This generic function will be used to get groups of queries.
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
src/gallium/auxiliary/Makefile.sources | 1 +
src/gallium/auxiliary/util/u_query.c | 46 ++++++++++++++++++++++++++++++++++
src/gallium/auxiliary/util/u_query.h | 44 ++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 src/gallium/auxiliary/util/u_query.c
create mode 100644 src/gallium/auxiliary/util/u_query.h
diff --git a/src/gallium/auxiliary/Makefile.sources
b/src/gallium/auxiliary/Makefile.sources
index 8919783..1188c94 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -130,6 +130,7 @@ C_SOURCES := \
util/u_math.c \
util/u_mm.c \
util/u_pstipple.c \
+ util/u_query.c \
util/u_ringbuffer.c \
util/u_sampler.c \
util/u_simple_shaders.c \
diff --git a/src/gallium/auxiliary/util/u_query.c
b/src/gallium/auxiliary/util/u_query.c
new file mode 100644
index 0000000..327cabc
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_query.c
@@ -0,0 +1,46 @@
+/**************************************************************************
+ *
+ * Copyright 2014 Samuel Pitoiset <samuel.pitoi...@gmail.com>
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "util/u_memory.h"
+#include "util/u_query.h"
+
Please add comments to this function to explain what it's doing.
+int util_get_driver_query_group_info(unsigned index, unsigned num_queries,
+ struct pipe_driver_query_group_info *info)
We usually put the function name on the next line.
Should the return type be unsigned?
+{
+ struct pipe_driver_query_group_info list[] = {
+ {"Driver queries", num_queries, num_queries}
+ };
+
+ if (!info)
+ return Elements(list);
+
+ if (index >= Elements(list))
+ return 0;
+
+ *info = list[index];
+ return 1;
+}
diff --git a/src/gallium/auxiliary/util/u_query.h
b/src/gallium/auxiliary/util/u_query.h
new file mode 100644
index 0000000..84f57d1
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_query.h
@@ -0,0 +1,44 @@
+/**************************************************************************
+ *
+ * Copyright 2014 Samuel Pitoiset <samuel.pitoi...@gmail.com>
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef U_QUERY_H
+#define U_QUERY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pipe/p_state.h"
+
+int util_get_driver_query_group_info(unsigned index, unsigned num_queries,
+ struct pipe_driver_query_group_info
*info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev