From eae9674f187ea0f250723fef75d4f71bb3ba632e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 7 Dec 2012 19:52:00 +0100 Subject: gallium: manage render condition in cso_context and fix postprocessing w/ it Reviewed-by: Brian Paul --- src/gallium/auxiliary/cso_cache/cso_context.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gallium/auxiliary/cso_cache/cso_context.c') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b3decc58f0e..b4ffac6ef42 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -106,6 +106,8 @@ struct cso_context { void *vertex_shader, *vertex_shader_saved; void *geometry_shader, *geometry_shader_saved; void *velements, *velements_saved; + struct pipe_query *render_condition, *render_condition_saved; + uint render_condition_mode, render_condition_mode_saved; struct pipe_clip_state clip; struct pipe_clip_state clip_saved; @@ -723,6 +725,30 @@ void cso_restore_stencil_ref(struct cso_context *ctx) } } +void cso_set_render_condition(struct cso_context *ctx, + struct pipe_query *query, uint mode) +{ + struct pipe_context *pipe = ctx->pipe; + + if (ctx->render_condition != query || ctx->render_condition_mode != mode) { + pipe->render_condition(pipe, query, mode); + ctx->render_condition = query; + ctx->render_condition_mode = mode; + } +} + +void cso_save_render_condition(struct cso_context *ctx) +{ + ctx->render_condition_saved = ctx->render_condition; + ctx->render_condition_mode_saved = ctx->render_condition_mode; +} + +void cso_restore_render_condition(struct cso_context *ctx) +{ + cso_set_render_condition(ctx, ctx->render_condition_saved, + ctx->render_condition_mode_saved); +} + enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle) { -- cgit v1.2.3