]> git.cworth.org Git - fips/blobdiff - metrics.h
Move metrics-tracking code from glwrap.c to new metrics.c
[fips] / metrics.h
diff --git a/metrics.h b/metrics.h
new file mode 100644 (file)
index 0000000..261a5a5
--- /dev/null
+++ b/metrics.h
@@ -0,0 +1,53 @@
+/* Copyright © 2013, Intel Corporation
+ *
+ * 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, sublicense, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS 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 METRICS_H
+#define METRICS_H
+
+/* Add a new counter to the metrics tracking state.
+ *
+ * The value accumulated in this counter be accounted against the
+ * current program (as set with metrics_set_current_program).
+ *
+ * Returns: A counter ID suitable for use with glBeginQuery/glEndQuery
+ */
+unsigned
+metrics_add_counter (void);
+
+/* Set the ID of the currently executing shader program.
+ *
+ * The metrics-tracking code will account for per-shader-program
+ * timings by accumulating counter values measured while each porogram
+ * is active (see metrics_add_counter).
+ */
+void
+metrics_set_current_program (unsigned program);
+
+/* Should be called at the end of every function wrapper for a
+ * function that ends a frame, (glXSwapBuffers and similar).
+ *
+ * This function performs whatever bookkeeping is necessary to
+ * generate a timing report, then emits that report.
+ */
+void
+metrics_end_frame (void);
+
+#endif