[Mesa-dev] [PATCH 2/3] softpipe: don't ignore pipe_constant_buffer::buffer_offset

Marek Olšák maraeo at gmail.com
Thu Jul 25 08:58:45 PDT 2013


Reviewed-by: Marek Olšák <maraeo at gmail.com>

Marek

On Thu, Jul 25, 2013 at 5:32 PM, Brian Paul <brianp at vmware.com> wrote:
> This was never a problem since the Mesa state tracker always gives
> us a user-space constant buffer with buffer_offset=0.  But if another
> state tracker ever gave us a "HW" constant buffer with non-zero
> buffer_offset we'd mis-render.
>
> Also, use the correct buffer size.  And move an assertion to the
> top of the function.
> ---
>  src/gallium/drivers/softpipe/sp_state_shader.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c
> index 79bd597..d80955e 100644
> --- a/src/gallium/drivers/softpipe/sp_state_shader.c
> +++ b/src/gallium/drivers/softpipe/sp_state_shader.c
> @@ -347,6 +347,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
>     unsigned size;
>     const void *data;
>
> +   assert(shader < PIPE_SHADER_TYPES);
> +
>     if (cb && cb->user_buffer) {
>        constants = softpipe_user_buffer_create(pipe->screen,
>                                                (void *) cb->user_buffer,
> @@ -354,10 +356,10 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
>                                                PIPE_BIND_CONSTANT_BUFFER);
>     }
>
> -   size = constants ? constants->width0 : 0;
> +   size = cb ? cb->buffer_size : 0;
>     data = constants ? softpipe_resource(constants)->data : NULL;
> -
> -   assert(shader < PIPE_SHADER_TYPES);
> +   if (data)
> +      data = (const char *) data + cb->buffer_offset;
>
>     draw_flush(softpipe->draw);
>
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list