panfrost: Take into account a index_bias for glDrawElementsBaseVertex calls

Submitted by Rohan Garg on July 18, 2019, 11:11 a.m.

Details

Message ID 20190718111128.17160-1-rohan.garg@collabora.com
State New
Headers show
Series "panfrost: Take into account a index_bias for glDrawElementsBaseVertex calls" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rohan Garg July 18, 2019, 11:11 a.m.
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@collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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);

Comments