[Mesa-dev] [PATCH] swr: Account for VBO index_bias in offsets

Cherniak, Bruce bruce.cherniak at intel.com
Mon Dec 18 20:46:32 UTC 2017


This change only affects the client buffer case (swr_user_vbuf_range), not VBOs.

Reviewed with the caveat that the patch description be changed to remove "VBO"
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

> On Dec 15, 2017, at 10:22 AM, George Kyriazis <george.kyriazis at intel.com> wrote:
> 
> Account for info.index_bias when calculating buffers offsets.
> 
> Fixes the follow piglit tests:
> arb_draw_elements_base_vertex-drawelements-user_varrays
> arb_draw_elements_base_vertex-negative-index-user_varrays
> ---
> src/gallium/drivers/swr/swr_state.cpp | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
> index 4530d37..d320c90 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -1012,8 +1012,8 @@ swr_user_vbuf_range(const struct pipe_draw_info *info,
>       *size = elems * vb->stride;
>    } else if (vb->stride) {
>       elems = info->max_index - info->min_index + 1;
> -      *totelems = info->max_index + 1;
> -      *base = info->min_index * vb->stride;
> +      *totelems = (info->max_index + info->index_bias) + 1;
> +      *base = (info->min_index + info->index_bias) * vb->stride;
>       *size = elems * vb->stride;
>    } else {
>       *totelems = 1;
> @@ -1304,7 +1304,7 @@ swr_update_derived(struct pipe_context *pipe,
>             uint32_t base;
>             swr_user_vbuf_range(&info, ctx->velems, vb, i, &elems, &base, &size);
>             partial_inbounds = 0;
> -            min_vertex_index = info.min_index;
> +            min_vertex_index = info.min_index + info.index_bias;
> 
>             size = AlignUp(size, 4);
>             /* If size of client memory copy is too large, don't copy. The
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list