[Mesa-dev] [PATCH 6/7] gallium: implement what's left for TIMESTAMP query
Marek Olšák
maraeo at gmail.com
Tue Jun 26 18:50:01 PDT 2012
---
src/gallium/include/pipe/p_defines.h | 3 ++-
src/mesa/state_tracker/st_cb_queryobj.c | 5 +++++
src/mesa/state_tracker/st_extensions.c | 7 +++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 479b26e..8d787ec 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -485,7 +485,8 @@ enum pipe_cap {
PIPE_CAP_USER_INDEX_BUFFERS = 69,
PIPE_CAP_USER_CONSTANT_BUFFERS = 70,
PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71,
- PIPE_CAP_START_INSTANCE = 72
+ PIPE_CAP_START_INSTANCE = 72,
+ PIPE_CAP_QUERY_TIMESTAMP = 73
};
/**
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index b6a236e..a2a3fd7 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -133,6 +133,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);
}
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index dacad9b..2e006e8 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -30,6 +30,7 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/mfeatures.h"
+#include "main/queryobj.h"
#include "main/version.h"
#include "pipe/p_context.h"
@@ -638,4 +639,10 @@ 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;
+ _mesa_init_cpu_gpu_timestamp_diff(ctx);
+ }
}
--
1.7.9.5
More information about the mesa-dev
mailing list