[Mesa-dev] [PATCH] swr: fix resource backed constant buffers

Markus Wick markus at selfnet.de
Tue Apr 19 05:45:06 UTC 2016


Am 2016-04-19 01:12, schrieb Tim Rowley:
> Code was using an incorrect address for the base pointer.

Tested-by: Markus Wick <markus at selfnet.de>
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94979
> ---
>  src/gallium/drivers/swr/swr_state.cpp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/swr/swr_state.cpp
> b/src/gallium/drivers/swr/swr_state.cpp
> index ded51a9..0e0979d 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -1138,7 +1138,8 @@ swr_update_derived(struct pipe_context *pipe,
>           pDC->num_constantsVS[i] = cb->buffer_size;
>           if (cb->buffer)
>              pDC->constantVS[i] =
> -               (const float *)((const uint8_t *)cb->buffer +
> cb->buffer_offset);
> +               (const float 
> *)(swr_resource(cb->buffer)->swr.pBaseAddress +
> +                               cb->buffer_offset);
>           else {
>              /* Need to copy these constants to scratch space */
>              if (cb->user_buffer && cb->buffer_size) {
> @@ -1163,7 +1164,8 @@ swr_update_derived(struct pipe_context *pipe,
>           pDC->num_constantsFS[i] = cb->buffer_size;
>           if (cb->buffer)
>              pDC->constantFS[i] =
> -               (const float *)((const uint8_t *)cb->buffer +
> cb->buffer_offset);
> +               (const float 
> *)(swr_resource(cb->buffer)->swr.pBaseAddress +
> +                               cb->buffer_offset);
>           else {
>              /* Need to copy these constants to scratch space */
>              if (cb->user_buffer && cb->buffer_size) {



More information about the mesa-dev mailing list