Mesa (master): draw: add view_mask rendering support

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 12 05:34:53 UTC 2021


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Mar  4 13:56:52 2021 +1000

draw: add view_mask rendering support

This loops the draws per-view above the instance rendering

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9399>

---

 src/gallium/auxiliary/draw/draw_private.h |  1 +
 src/gallium/auxiliary/draw/draw_pt.c      | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index d29fedd91f2..e6609ee9612 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -198,6 +198,7 @@ struct draw_context
          unsigned min_index;
          unsigned max_index;
          unsigned drawid;
+         unsigned viewid;
          
          /** vertex arrays */
          struct draw_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index b89831ca746..8ee8bd7f655 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -540,7 +540,7 @@ draw_vbo(struct draw_context *draw,
    draw->pt.user.max_index = info->index_bounds_valid ? info->max_index : ~0;
    draw->pt.user.eltSize = info->index_size ? draw->pt.user.eltSizeIB : 0;
    draw->pt.user.drawid = info->drawid;
-
+   draw->pt.user.viewid = 0;
    draw->pt.vertices_per_patch = info->vertices_per_patch;
 
    if (0)
@@ -604,7 +604,13 @@ draw_vbo(struct draw_context *draw,
     * the min_index/max_index hints given by gallium frontends.
     */
 
-   draw_instances(draw, info, draws, count);
+   if (info->view_mask) {
+      u_foreach_bit(i, info->view_mask) {
+         draw->pt.user.viewid = i;
+         draw_instances(draw, info, draws, count);
+      }
+   } else
+      draw_instances(draw, info, draws, count);
 
    /* If requested emit the pipeline statistics for this run */
    if (draw->collect_statistics) {



More information about the mesa-commit mailing list