loader: fix the no-modifiers case
[mesa.git] / src / loader / loader_dri3_helper.c
index 20fe4cbdabc118e87ee24e0741555dbb3ed5b08e..ad9b9d87b05325d08a29087c1690c3a174600231 100644 (file)
@@ -1319,12 +1319,20 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
 
          free(mod_reply);
 
-         buffer->image = draw->ext->image->createImageWithModifiers(draw->dri_screen,
-                                                                    width, height,
-                                                                    format,
-                                                                    modifiers,
-                                                                    count,
-                                                                    buffer);
+         /* don't use createImageWithModifiers() if we have no
+          * modifiers, other things depend on the use flags when
+          * there are no modifiers to know that a buffer can be
+          * shared.
+          */
+         if (modifiers) {
+            buffer->image = draw->ext->image->createImageWithModifiers(draw->dri_screen,
+                                                                       width, height,
+                                                                       format,
+                                                                       modifiers,
+                                                                       count,
+                                                                       buffer);
+         }
+
          free(modifiers);
       }
 #endif