[Mesa-dev] [PATCH] panfrost: Take into account a index_bias for glDrawElementsBaseVertex calls

Rohan Garg rohan.garg at collabora.com
Thu Jul 18 11:11:21 UTC 2019


Make sure we adjust draw_start and vertex_count in order to
take into account a index_bias as required by a glDrawElementsBaseVertex
call

Signed-off-by: Rohan Garg <rohan.garg at collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 4bbf5230c6c..6484401e472 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1637,7 +1637,7 @@ panfrost_draw_vbo(
 
         ctx->payload_tiler.prefix.draw_mode = g2m_draw_mode(mode);
 
-        ctx->vertex_count = info->count;
+        ctx->vertex_count = info->count + info->index_bias;
         ctx->instance_count = info->instance_count;
 
         /* For non-indexed draws, they're the same */
@@ -1686,14 +1686,13 @@ panfrost_draw_vbo(
 
                 /* Use the corresponding values */
                 vertex_count = max_index - min_index + 1;
-                ctx->payload_vertex.draw_start = min_index;
-                ctx->payload_tiler.draw_start = min_index;
+                ctx->payload_vertex.draw_start = min_index + info->index_bias;
+                ctx->payload_tiler.draw_start = min_index + info->index_bias;
 
                 ctx->payload_tiler.prefix.negative_start = -min_index;
                 ctx->payload_tiler.prefix.index_count = MALI_POSITIVE(info->count);
 
                 //assert(!info->restart_index); /* TODO: Research */
-                assert(!info->index_bias);
 
                 draw_flags |= panfrost_translate_index_size(info->index_size);
                 ctx->payload_tiler.prefix.indices = panfrost_get_index_buffer_mapped(ctx, info);
-- 
2.17.1



More information about the mesa-dev mailing list