diff options
author | Brian Paul <brianp@vmware.com> | 2010-01-04 11:47:39 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-01-04 11:47:39 -0700 |
commit | 0fb1eaddfbaf487067e0ff4f1d6f82145b6b0acd (patch) | |
tree | 0f3f0239f09d5681e38a474259e018ba34a160a2 /src/gallium/drivers/softpipe/sp_query.c | |
parent | 195568e4cb0524d71db0ac68cf5a95b33a1af6b4 (diff) | |
parent | c9b558351847133dced0c9daaeb84d57d550afc9 (diff) |
Merge branch 'gallium-conditional-rendering'
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_query.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_query.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index 379cf4ad06..4ef5d9f7b1 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -99,6 +99,32 @@ softpipe_get_query_result(struct pipe_context *pipe, } +/** + * Called by rendering function to check rendering is conditional. + * \return TRUE if we should render, FALSE if we should skip rendering + */ +boolean +softpipe_check_render_cond(struct softpipe_context *sp) +{ + struct pipe_context *pipe = &sp->pipe; + boolean b, wait; + uint64_t result; + + if (!sp->render_cond_query) { + return TRUE; /* no query predicate, draw normally */ + } + + wait = (sp->render_cond_mode == PIPE_RENDER_COND_WAIT || + sp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT); + + b = pipe->get_query_result(pipe, sp->render_cond_query, wait, &result); + if (b) + return result > 0; + else + return TRUE; +} + + void softpipe_init_query_funcs(struct softpipe_context *softpipe ) { softpipe->pipe.create_query = softpipe_create_query; |