Mesa (master): st/mesa: implement ARB_timer_query
Marek Olšák
mareko at kemper.freedesktop.org
Tue Jul 10 17:08:28 UTC 2012
Module: Mesa
Branch: master
Commit: 21f78d21898dd8aa74beb6aeeabda68f4c07ae1b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=21f78d21898dd8aa74beb6aeeabda68f4c07ae1b
Author: Marek Olšák <maraeo at gmail.com>
Date: Thu Jul 5 20:27:01 2012 +0200
st/mesa: implement ARB_timer_query
---
src/mesa/state_tracker/st_cb_queryobj.c | 14 ++++++++++++++
src/mesa/state_tracker/st_extensions.c | 5 +++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index b6a236e..e5e4a81 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -39,6 +39,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
#include "st_cb_bitmap.h"
@@ -133,6 +134,11 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object *q)
st_flush_bitmap_cache(st_context(ctx));
+ if (q->Target == GL_TIMESTAMP && !stq->pq) {
+ stq->pq = pipe->create_query(pipe, PIPE_QUERY_TIMESTAMP);
+ stq->type = PIPE_QUERY_TIMESTAMP;
+ }
+
pipe->end_query(pipe, stq->pq);
}
@@ -169,6 +175,13 @@ st_CheckQuery(struct gl_context *ctx, struct gl_query_object *q)
}
+static uint64_t
+st_GetTimestamp(struct gl_context *ctx)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+
+ return screen->get_timestamp(screen);
+}
void st_init_query_functions(struct dd_function_table *functions)
@@ -179,6 +192,7 @@ void st_init_query_functions(struct dd_function_table *functions)
functions->EndQuery = st_EndQuery;
functions->WaitQuery = st_WaitQuery;
functions->CheckQuery = st_CheckQuery;
+ functions->GetTimestamp = st_GetTimestamp;
}
#endif /* FEATURE_queryobj */
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index fd95075..5b333ad 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -636,4 +636,9 @@ void st_init_extensions(struct st_context *st)
if (ctx->Const.MaxDualSourceDrawBuffers > 0)
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
+
+ if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY) &&
+ screen->get_param(screen, PIPE_CAP_QUERY_TIMESTAMP)) {
+ ctx->Extensions.ARB_timer_query = GL_TRUE;
+ }
}
More information about the mesa-commit
mailing list