Mesa (master): util/indirect: handle stride less than number of parameters.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 02:54:59 UTC 2020


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Apr 20 15:39:50 2020 +1000

util/indirect: handle stride less than number of parameters.

It's legal to have a stride less than the num of parameters,
in this case no need to try and over map the buffer which asserts

Fixes:
GTF-GL45.gtf43.GL3Tests.multi_draw_indirect.multi_draw_indirect_stride

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>

---

 src/gallium/auxiliary/util/u_draw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c
index a2ce0e39483..a43938774bb 100644
--- a/src/gallium/auxiliary/util/u_draw.c
+++ b/src/gallium/auxiliary/util/u_draw.c
@@ -136,7 +136,7 @@ util_draw_indirect(struct pipe_context *pipe,
    struct pipe_draw_info info;
    struct pipe_transfer *transfer;
    uint32_t *params;
-   const unsigned num_params = info_in->index_size ? 5 : 4;
+   unsigned num_params = info_in->index_size ? 5 : 4;
 
    assert(info_in->indirect);
    assert(!info_in->count_from_stream_output);
@@ -160,6 +160,8 @@ util_draw_indirect(struct pipe_context *pipe,
       pipe_buffer_unmap(pipe, dc_transfer);
    }
 
+   if (info_in->indirect->stride)
+      num_params = MIN2(info_in->indirect->stride / 4, num_params);
    params = (uint32_t *)
       pipe_buffer_map_range(pipe,
                             info_in->indirect->buffer,



More information about the mesa-commit mailing list