[Mesa-dev] [PATCH] u_vbuf: Make sure all caps are initialized

Alex Deucher alexdeucher at gmail.com
Thu Aug 28 06:22:06 PDT 2014


On Thu, Aug 28, 2014 at 1:52 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Pointed out by valgrind.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83148
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  src/gallium/auxiliary/util/u_vbuf.c | 40 +++++++++++++++----------------------
>  1 file changed, 16 insertions(+), 24 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
> index 4bee899..650df9f 100644
> --- a/src/gallium/auxiliary/util/u_vbuf.c
> +++ b/src/gallium/auxiliary/util/u_vbuf.c
> @@ -279,30 +279,22 @@ boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
>        }
>     }
>
> -   if (!screen->get_param(screen,
> -                          PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY)) {
> -      caps->buffer_offset_unaligned = TRUE;
> -   } else {
> -      fallback = TRUE;
> -   }
> -
> -   if (!screen->get_param(screen,
> -                          PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY)) {
> -      caps->buffer_stride_unaligned = TRUE;
> -   } else {
> -      fallback = TRUE;
> -   }
> -
> -   if (!screen->get_param(screen,
> -                          PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY)) {
> -      caps->velem_src_offset_unaligned = TRUE;
> -   } else {
> -      fallback = TRUE;
> -   }
> -
> -   if (screen->get_param(screen, PIPE_CAP_USER_VERTEX_BUFFERS)) {
> -      caps->user_vertex_buffers = TRUE;
> -   } else {
> +   caps->buffer_offset_unaligned =
> +      !screen->get_param(screen,
> +                         PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY);
> +   caps->buffer_stride_unaligned =
> +     !screen->get_param(screen,
> +                        PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY);
> +   caps->velem_src_offset_unaligned =
> +      !screen->get_param(screen,
> +                         PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY);
> +   caps->user_vertex_buffers =
> +      screen->get_param(screen, PIPE_CAP_USER_VERTEX_BUFFERS);
> +
> +   if (!caps->buffer_offset_unaligned ||
> +       !caps->buffer_stride_unaligned ||
> +       !caps->velem_src_offset_unaligned ||
> +       !caps->user_vertex_buffers) {
>        fallback = TRUE;
>     }
>
> --
> 2.1.0
>
> _______________________________________________
> 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