diff options
author | Brian Paul <[email protected]> | 2015-08-07 14:54:24 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-09-02 09:05:23 -0600 |
commit | 133a47107cc03a69b4b88c1fef331d507f521fa7 (patch) | |
tree | a17683b5d558052c8ffe134a97f6c5b3aa6cfbcb /src/mesa/state_tracker | |
parent | e2a1d21cb665b7e7bc2c9684cf533003cdc817b3 (diff) |
gallium/st: add pipe_context::get_timestamp()
The VMware svga driver doesn't directly support pipe_screen::get_timestamp()
but we can do a work-around. However, we need a gallium context to do so.
This patch adds a new pipe_context::get_timestamp() function that will only
be called if the pipe_screen::get_timestamp() function is NULL.
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_queryobj.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 71222e80b6b..aafae16b2df 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -289,9 +289,18 @@ 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; + struct pipe_context *pipe = st_context(ctx)->pipe; + struct pipe_screen *screen = pipe->screen; - return screen->get_timestamp(screen); + /* Prefer the per-screen function */ + if (screen->get_timestamp) { + return screen->get_timestamp(screen); + } + else { + /* Fall back to the per-context function */ + assert(pipe->get_timestamp); + return pipe->get_timestamp(pipe); + } } |