[PATCH 03/10] glamor: Use epoxy_has_gl_extension() instead of rolling our own.

Markus Wick markus at selfnet.de
Tue Mar 18 01:42:49 PDT 2014


---
 glamor/glamor.c      | 10 +++++-----
 glamor/glamor_core.c | 22 ----------------------
 glamor/glamor_priv.h |  1 -
 3 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 0f7d68b..9d171b7 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -367,19 +367,19 @@ glamor_init(ScreenPtr screen, unsigned int flags)
             goto fail;
         }
 
-        if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
+        if (!epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888")) {
             ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
             goto fail;
         }
     }
 
-    glamor_priv->has_khr_debug = glamor_gl_has_extension("GL_KHR_debug");
+    glamor_priv->has_khr_debug = epoxy_has_gl_extension("GL_KHR_debug");
     glamor_priv->has_pack_invert =
-        glamor_gl_has_extension("GL_MESA_pack_invert");
+        epoxy_has_gl_extension("GL_MESA_pack_invert");
     glamor_priv->has_fbo_blit =
-        glamor_gl_has_extension("GL_EXT_framebuffer_blit");
+        epoxy_has_gl_extension("GL_EXT_framebuffer_blit");
     glamor_priv->has_buffer_storage =
-        glamor_gl_has_extension("GL_ARB_buffer_storage");
+        epoxy_has_gl_extension("GL_ARB_buffer_storage");
     glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
 #ifdef MAX_FBO_SIZE
     glamor_priv->max_fbo_size = MAX_FBO_SIZE;
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 6c0b3c8..eeaa595 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -559,28 +559,6 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
     return ret;
 }
 
-/* Borrow from cairo. */
-Bool
-glamor_gl_has_extension(const char *extension)
-{
-    const char *pext;
-    int ext_len;
-
-    ext_len = strlen(extension);
-
-    pext = (const char *) glGetString(GL_EXTENSIONS);
-
-    if (pext == NULL || extension == NULL)
-        return FALSE;
-
-    while ((pext = strstr(pext, extension)) != NULL) {
-        if (pext[ext_len] == ' ' || pext[ext_len] == '\0')
-            return TRUE;
-        pext += ext_len;
-    }
-    return FALSE;
-}
-
 int
 glamor_gl_get_version(void)
 {
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index bc7d3f8..f278bef 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -619,7 +619,6 @@ Bool glamor_set_alu(ScreenPtr screen, unsigned char alu);
 Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
 Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
 RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap);
-Bool glamor_gl_has_extension(const char *extension);
 int glamor_gl_get_version(void);
 
 #define GLAMOR_GL_VERSION_ENCODE(major, minor) ( \
-- 
1.9.0



More information about the xorg-devel mailing list