u_vbuf: Make sure all caps are initialized
authorMichel Dänzer <michel.daenzer@amd.com>
Thu, 28 Aug 2014 02:12:20 +0000 (11:12 +0900)
committerMichel Dänzer <michel@daenzer.net>
Fri, 29 Aug 2014 03:15:10 +0000 (12:15 +0900)
Pointed out by valgrind.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83148
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/auxiliary/util/u_vbuf.c

index 4bee8998f8decb78b0023a9d5052652df46b501f..650df9f6aef8a665fb7a5ec895db98894846b367 100644 (file)
@@ -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;
    }