summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_blitter.c
diff options
context:
space:
mode:
authorItalo Nicola <italonicola@collabora.com>2023-06-22 17:41:16 +0000
committerMarge Bot <emma+marge@anholt.net>2023-07-10 15:23:06 +0000
commit491110f02ed6fc7eeccc80ae01a1e8e92d92a2dd (patch)
tree5bad77716bc8da904a2dcc09c19225530acb50f4 /src/gallium/auxiliary/util/u_blitter.c
parent3d9438ecd63b64a304df8b800484bfc52eb16a90 (diff)
gallium: cleanup util_blitter_clear_render_target
Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>
Diffstat (limited to 'src/gallium/auxiliary/util/u_blitter.c')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 643477c6f4e..da66556baaa 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -2388,6 +2388,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
struct pipe_framebuffer_state fb_state;
bool msaa;
unsigned num_layers;
+ blitter_get_vs_func get_vs;
assert(dstsurf->texture);
if (!dstsurf->texture)
@@ -2419,24 +2420,24 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
msaa = util_framebuffer_get_num_samples(&fb_state) > 1;
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
+ blitter_set_common_draw_rect_state(ctx, false, msaa);
union blitter_attrib attrib;
memcpy(attrib.color, color->ui, sizeof(color->ui));
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
+
if (num_layers > 1 && ctx->has_layered) {
- blitter_set_common_draw_rect_state(ctx, false, msaa);
- blitter->draw_rectangle(blitter, ctx->velem_state, get_vs_layered,
- dstx, dsty, dstx+width, dsty+height, 0,
- num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ get_vs = get_vs_layered;
} else {
- blitter_set_common_draw_rect_state(ctx, false, msaa);
- blitter->draw_rectangle(blitter, ctx->velem_state,
- get_vs_passthrough_pos_generic,
- dstx, dsty, dstx+width, dsty+height, 0,
- 1, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ get_vs = get_vs_passthrough_pos_generic;
+ num_layers = 1;
}
+ blitter->draw_rectangle(blitter, ctx->velem_state, get_vs,
+ dstx, dsty, dstx+width, dsty+height, 0,
+ num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
util_blitter_restore_fb_state(blitter);