[Mesa-dev] [PATCH] [swr] fix index buffers with non-zero indices

George Kyriazis george.kyriazis at intel.com
Tue Jan 31 16:38:59 UTC 2017


Fix issue with index buffers that do not contain 0 index.  Use core
BaseVertex functionality to offset index buffer indices, instead of
offsetting vertex buffer to point before the buffer origin.
---
 src/gallium/drivers/swr/swr_draw.cpp  | 2 +-
 src/gallium/drivers/swr/swr_state.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp
index c4d5e5c..88000e5 100644
--- a/src/gallium/drivers/swr/swr_draw.cpp
+++ b/src/gallium/drivers/swr/swr_draw.cpp
@@ -200,7 +200,7 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
                               info->count,
                               info->instance_count,
                               info->start,
-                              info->index_bias,
+                              info->index_bias - info->min_index,
                               info->start_instance);
    else
       SwrDrawInstanced(ctx->swrContext,
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index f1f4963..f03f814 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -1133,7 +1133,7 @@ swr_update_derived(struct pipe_context *pipe,
             memcpy(scratch, ptr, size);
             ptr = scratch;
             scratch += size;
-            p_data = (const uint8_t *)ptr - base;
+            p_data = (const uint8_t *)ptr;
          }
 
          swrVertexBuffers[i] = {0};
-- 
2.7.4



More information about the mesa-dev mailing list