summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-12-07 19:52:00 +0100
committerMarek Olšák <[email protected]>2012-12-12 13:09:53 +0100
commiteae9674f187ea0f250723fef75d4f71bb3ba632e (patch)
treedafb0ce62d43280d0dff7e69dfdb66d9e42bd60e /src/gallium/auxiliary
parent9ec6ffd85d019cdba3bbeba24dbc49981791df28 (diff)
gallium: manage render condition in cso_context and fix postprocessing w/ it
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c26
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h5
-rw-r--r--src/gallium/auxiliary/postprocess/pp_run.c3
-rw-r--r--src/gallium/auxiliary/util/u_blit.c3
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c3
5 files changed, 40 insertions, 0 deletions
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)
{
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 16158edacc3..b991eb9f94e 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -173,6 +173,11 @@ enum pipe_error cso_set_stencil_ref(struct cso_context *cso,
void cso_save_stencil_ref(struct cso_context *cso);
void cso_restore_stencil_ref(struct cso_context *cso);
+void cso_set_render_condition(struct cso_context *cso,
+ struct pipe_query *query, uint mode);
+void cso_save_render_condition(struct cso_context *cso);
+void cso_restore_render_condition(struct cso_context *cso);
+
/* clip state */
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c
index 6f063246562..112458f384e 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -82,11 +82,13 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
cso_save_vertex_shader(cso);
cso_save_viewport(cso);
cso_save_aux_vertex_buffer_slot(cso);
+ cso_save_render_condition(cso);
/* set default state */
cso_set_sample_mask(cso, ~0);
cso_set_stream_outputs(cso, 0, NULL, 0);
cso_set_geometry_shader_handle(cso, NULL);
+ cso_set_render_condition(cso, NULL, 0);
// Kept only for this frame.
pipe_resource_reference(&ppq->depth, indepth);
@@ -139,6 +141,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
cso_restore_vertex_shader(cso);
cso_restore_viewport(cso);
cso_restore_aux_vertex_buffer_slot(cso);
+ cso_restore_render_condition(cso);
pipe_resource_reference(&ppq->depth, NULL);
pipe_resource_reference(&refin, NULL);
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index ab1549e2de6..9fe15b8108a 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -666,6 +666,7 @@ util_blit_pixels(struct blit_state *ctx,
cso_save_geometry_shader(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_aux_vertex_buffer_slot(ctx->cso);
+ cso_save_render_condition(ctx->cso);
/* set misc state we care about */
if (writemask)
@@ -677,6 +678,7 @@ util_blit_pixels(struct blit_state *ctx,
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
+ cso_set_render_condition(ctx->cso, NULL, 0);
/* default sampler state */
ctx->sampler.normalized_coords = normalized;
@@ -799,6 +801,7 @@ util_blit_pixels(struct blit_state *ctx,
cso_restore_vertex_elements(ctx->cso);
cso_restore_aux_vertex_buffer_slot(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
+ cso_restore_render_condition(ctx->cso);
pipe_sampler_view_reference(&sampler_view, NULL);
if (dst_surface != dst)
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 48ebdb9fa3d..90588a022df 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1566,6 +1566,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_viewport(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_aux_vertex_buffer_slot(ctx->cso);
+ cso_save_render_condition(ctx->cso);
/* bind our state */
cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color :
@@ -1576,6 +1577,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_set_sample_mask(ctx->cso, ~0);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
+ cso_set_render_condition(ctx->cso, NULL, 0);
set_fragment_shader(ctx, type, is_depth);
set_vertex_shader(ctx);
@@ -1699,4 +1701,5 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_restore_vertex_elements(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
cso_restore_aux_vertex_buffer_slot(ctx->cso);
+ cso_restore_render_condition(ctx->cso);
}