llvmpipe: add NV_conditional_render support.

This ports the softpipe NV_conditional_render support to llvmpipe.

This passes the nv_conditional_render-* piglit tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie
2011-11-07 17:31:49 +00:00
parent dbd24b5df6
commit ab14915dce
7 changed files with 43 additions and 0 deletions
+3
View File
@@ -55,6 +55,9 @@ llvmpipe_clear(struct pipe_context *pipe,
if (llvmpipe->no_rast)
return;
if (!llvmpipe_check_render_cond(llvmpipe))
return;
if (LP_PERF & PERF_NO_DEPTH)
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
+13
View File
@@ -142,6 +142,17 @@ do_flush( struct pipe_context *pipe,
}
static void
llvmpipe_render_condition ( struct pipe_context *pipe,
struct pipe_query *query,
uint mode )
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
llvmpipe->render_cond_query = query;
llvmpipe->render_cond_mode = mode;
}
struct pipe_context *
llvmpipe_create_context( struct pipe_screen *screen, void *priv )
{
@@ -170,6 +181,8 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
llvmpipe->pipe.clear = llvmpipe_clear;
llvmpipe->pipe.flush = do_flush;
llvmpipe->pipe.render_condition = llvmpipe_render_condition;
llvmpipe_init_blend_funcs(llvmpipe);
llvmpipe_init_clip_funcs(llvmpipe);
llvmpipe_init_draw_funcs(llvmpipe);
@@ -136,6 +136,10 @@ struct llvmpipe_context {
struct lp_setup_variant_list_item setup_variants_list;
unsigned nr_setup_variants;
/** Conditional query object and mode */
struct pipe_query *render_cond_query;
uint render_cond_mode;
};
@@ -56,6 +56,9 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
void *mapped_indices = NULL;
unsigned i;
if (!llvmpipe_check_render_cond(lp))
return;
if (lp->dirty)
llvmpipe_update_derived( lp );
+18
View File
@@ -154,6 +154,24 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
llvmpipe->dirty |= LP_NEW_QUERY;
}
boolean
llvmpipe_check_render_cond(struct llvmpipe_context *lp)
{
struct pipe_context *pipe = &lp->pipe;
boolean b, wait;
uint64_t result;
if (!lp->render_cond_query)
return TRUE; /* no query predicate, draw normally */
wait = (lp->render_cond_mode == PIPE_RENDER_COND_WAIT ||
lp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT);
b = pipe->get_query_result(pipe, lp->render_cond_query, wait, &result);
if (b)
return result > 0;
else
return TRUE;
}
void llvmpipe_init_query_funcs(struct llvmpipe_context *llvmpipe )
{
+1
View File
@@ -49,5 +49,6 @@ struct llvmpipe_query {
extern void llvmpipe_init_query_funcs(struct llvmpipe_context * );
extern boolean llvmpipe_check_render_cond(struct llvmpipe_context *);
#endif /* LP_QUERY_H */
+1
View File
@@ -157,6 +157,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
case PIPE_CAP_CONDITIONAL_RENDER:
return 1;
default:
return 0;