Module: Mesa
Branch: master
Commit: 772f429f0a7fc8ee0454a6480f7f71a3c45df4de
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=772f429f0a7fc8ee0454a6480f7f71a3c45df4de

Author: Edward O'Callaghan <[email protected]>
Date:   Thu Nov 26 16:55:01 2015 +1100

gallium/util: Fix util_blitter_clear_depth_stencil() for num_layers>1

Previously util_blitter_clear_depth_stencil() could not clear more
than the first layer. We need to generalise this as we did for
util_blitter_clear_render_target().

Signed-off-by: Edward O'Callaghan <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>

---

 src/gallium/auxiliary/util/u_blitter.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 7f213fa..759c88f 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1929,11 +1929,19 @@ void util_blitter_clear_depth_stencil(struct 
blitter_context *blitter,
    pipe->set_framebuffer_state(pipe, &fb_state);
    pipe->set_sample_mask(pipe, ~0);
 
-   blitter_set_common_draw_rect_state(ctx, FALSE, FALSE);
    blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
-   blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
-                           (float) depth,
-                           UTIL_BLITTER_ATTRIB_NONE, NULL);
+
+   unsigned 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, TRUE);
+      blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, (float) depth, 
num_layers);
+   }
+   else {
+      blitter_set_common_draw_rect_state(ctx, FALSE, FALSE);
+      blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
+                              (float) depth,
+                              UTIL_BLITTER_ATTRIB_NONE, NULL);
+   }
 
    blitter_restore_vertex_states(ctx);
    blitter_restore_fragment_states(ctx);

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to