summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-08-13 10:51:51 -0400
committerRob Clark <[email protected]>2016-08-16 09:21:13 -0400
commit142dd7b9c043fca81f8ef1d0bbd378968f9260df (patch)
tree7f08641e24bd5a9335f704301f3ba6a6a008750a /src/gallium/auxiliary/util
parent2b2f436c696c4da9e1a45fb03406876340ae31ed (diff)
gallium/u_blitter: split out a helper for common clear state
Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c38
-rw-r--r--src/gallium/auxiliary/util/u_blitter.h5
2 files changed, 30 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 9fbef9be82a..e008100af87 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1268,19 +1268,13 @@ static void *get_clear_blend_state(struct blitter_context_priv *ctx,
return ctx->blend_clear[index];
}
-static void util_blitter_clear_custom(struct blitter_context *blitter,
- unsigned width, unsigned height,
- unsigned num_layers,
- unsigned clear_buffers,
- const union pipe_color_union *color,
- double depth, unsigned stencil,
- void *custom_blend, void *custom_dsa)
+void util_blitter_common_clear_setup(struct blitter_context *blitter,
+ unsigned width, unsigned height,
+ unsigned clear_buffers,
+ void *custom_blend, void *custom_dsa)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
- struct pipe_stencil_ref sr = { { 0 } };
-
- assert(ctx->has_layered || num_layers <= 1);
util_blitter_set_running_flag(blitter);
blitter_check_saved_vertex_states(ctx);
@@ -1306,14 +1300,32 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
}
+ pipe->set_sample_mask(pipe, ~0);
+ blitter_set_dst_dimensions(ctx, width, height);
+}
+
+static void util_blitter_clear_custom(struct blitter_context *blitter,
+ unsigned width, unsigned height,
+ unsigned num_layers,
+ unsigned clear_buffers,
+ const union pipe_color_union *color,
+ double depth, unsigned stencil,
+ void *custom_blend, void *custom_dsa)
+{
+ struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
+ struct pipe_context *pipe = ctx->base.pipe;
+ struct pipe_stencil_ref sr = { { 0 } };
+
+ assert(ctx->has_layered || num_layers <= 1);
+
+ util_blitter_common_clear_setup(blitter, width, height, clear_buffers,
+ custom_blend, custom_dsa);
+
sr.ref_value[0] = stencil & 0xff;
pipe->set_stencil_ref(pipe, &sr);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
bind_fs_write_all_cbufs(ctx);
- pipe->set_sample_mask(pipe, ~0);
-
- blitter_set_dst_dimensions(ctx, width, height);
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, FALSE, TRUE);
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index 0f5da6bd3a7..d7d9f4a40ee 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -542,6 +542,11 @@ util_blitter_save_render_condition(struct blitter_context *blitter,
blitter->saved_render_cond_cond = condition;
}
+void util_blitter_common_clear_setup(struct blitter_context *blitter,
+ unsigned width, unsigned height,
+ unsigned clear_buffers,
+ void *custom_blend, void *custom_dsa);
+
void util_blitter_set_running_flag(struct blitter_context *blitter);
void util_blitter_unset_running_flag(struct blitter_context *blitter);