Mesa (master): lima: fix allocation of GP outputs storage for indexed draw

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 3 19:17:59 UTC 2020


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

Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date:   Thu Jan  2 20:58:19 2020 -0800

lima: fix allocation of GP outputs storage for indexed draw

For indexed draw number of VS invocations is (ctx->max_index - ctx->min_index + 1),
so we have to use this number when calculating space for varyings, gl_Position and
gl_PointSize.

Fixes dEQP-GLES2.functional.buffer.write.use.index_array.array and
dEQP-GLES2.functional.buffer.write.use.index_array.element_array

Reviewed-by: Andreas Baierl <ichgeh at imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico at gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>

---

 src/gallium/drivers/lima/lima_draw.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 5b86cce4d0d..5fb846c7b7a 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -1239,6 +1239,7 @@ lima_update_varying(struct lima_context *ctx, const struct pipe_draw_info *info)
    struct lima_screen *screen = lima_screen(ctx->base.screen);
    struct lima_vs_shader_state *vs = ctx->vs;
    uint32_t gp_output_size;
+   unsigned num = info->index_size ? (ctx->max_index - ctx->min_index + 1) : info->count;
 
    uint32_t *varying =
       lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_varying_info,
@@ -1267,18 +1268,18 @@ lima_update_varying(struct lima_context *ctx, const struct pipe_draw_info *info)
    vs->varying_stride = align(offset, 16);
 
    /* gl_Position is always present, allocate space for it */
-   gp_output_size = align(4 * 4 * info->count, 0x40);
+   gp_output_size = align(4 * 4 * num, 0x40);
 
    /* Allocate space for varyings if there're any */
    if (vs->num_varyings) {
       ctx->gp_output_varyings_offt = gp_output_size;
-      gp_output_size += align(vs->varying_stride * info->count, 0x40);
+      gp_output_size += align(vs->varying_stride * num, 0x40);
    }
 
    /* Allocate space for gl_PointSize if it's there */
    if (vs->point_size_idx != -1) {
       ctx->gp_output_point_size_offt = gp_output_size;
-      gp_output_size += 4 * info->count;
+      gp_output_size += 4 * num;
    }
 
    /* gp_output can be too large for the suballocator, so create a




More information about the mesa-commit mailing list