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>
if (llvmpipe->no_rast)
return;
+ if (!llvmpipe_check_render_cond(llvmpipe))
+ return;
+
if (LP_PERF & PERF_NO_DEPTH)
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
}
+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 )
{
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);
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;
};
void *mapped_indices = NULL;
unsigned i;
+ if (!llvmpipe_check_render_cond(lp))
+ return;
+
if (lp->dirty)
llvmpipe_update_derived( lp );
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 )
{
extern void llvmpipe_init_query_funcs(struct llvmpipe_context * );
+extern boolean llvmpipe_check_render_cond(struct llvmpipe_context *);
#endif /* LP_QUERY_H */
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;