glamor: Select VBO path by ARB_mbr extension.
authorMarkus Wick <markus@selfnet.de>
Tue, 18 Mar 2014 08:42:52 +0000 (09:42 +0100)
committerEric Anholt <eric@anholt.net>
Wed, 26 Mar 2014 19:58:40 +0000 (12:58 -0700)
The mbr path was hard coded enabled for desktop gl and disabled for
gles.  But there are both desktop without mbr and GLES with mbr.

v2: Don't forget to update the fini path, too (change by anholt)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
glamor/glamor.c
glamor/glamor_priv.h
glamor/glamor_vbo.c

index eb13430..0d0f52c 100644 (file)
@@ -378,6 +378,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         epoxy_has_gl_extension("GL_MESA_pack_invert");
     glamor_priv->has_fbo_blit =
         epoxy_has_gl_extension("GL_EXT_framebuffer_blit");
+    glamor_priv->has_map_buffer_range =
+        epoxy_has_gl_extension("GL_ARB_map_buffer_range");
     glamor_priv->has_buffer_storage =
         epoxy_has_gl_extension("GL_ARB_buffer_storage");
     glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
index 0f0b0f3..d4d2e75 100644 (file)
@@ -213,6 +213,7 @@ typedef struct glamor_screen_private {
     enum glamor_gl_flavor gl_flavor;
     int has_pack_invert;
     int has_fbo_blit;
+    int has_map_buffer_range;
     int has_buffer_storage;
     int has_khr_debug;
     int max_fbo_size;
index 5e98bfe..2731692 100644 (file)
@@ -96,7 +96,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
         *vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset;
         data = glamor_priv->vb + glamor_priv->vbo_offset;
         glamor_priv->vbo_offset += size;
-    } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+    } else if (glamor_priv->has_map_buffer_range) {
         if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) {
             glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
             glamor_priv->vbo_offset = 0;
@@ -147,7 +147,7 @@ glamor_put_vbo_space(ScreenPtr screen)
          * persistent mapping, so we can leave it around until we
          * reach the end of the buffer.
          */
-    } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+    } else if (glamor_priv->has_map_buffer_range) {
         glUnmapBuffer(GL_ARRAY_BUFFER);
     } else {
         glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset,
@@ -179,7 +179,7 @@ glamor_fini_vbo(ScreenPtr screen)
     glamor_get_context(glamor_priv);
 
     glDeleteBuffers(1, &glamor_priv->vbo);
-    if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP)
+    if (!glamor_priv->has_map_buffer_range)
         free(glamor_priv->vb);
 
     glamor_put_context(glamor_priv);