[PATCH 04/10] glamor: Use epoxy_gl_version() instead of rolling our own.
Markus Wick
markus at selfnet.de
Tue Mar 18 01:42:50 PDT 2014
---
glamor/glamor.c | 6 +++---
glamor/glamor_core.c | 23 -----------------------
glamor/glamor_priv.h | 5 -----
3 files changed, 3 insertions(+), 31 deletions(-)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 9d171b7..ef969e2 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -341,7 +341,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
else
glamor_priv->gl_flavor = GLAMOR_GL_ES2;
- gl_version = glamor_gl_get_version();
+ gl_version = epoxy_gl_version();
/* We'd like to require GL_ARB_map_buffer_range or
* GL_OES_map_buffer_range, since it offers more information to
@@ -357,12 +357,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
* Windows with Intel 4-series (G45) graphics or older.
*/
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) {
+ if (gl_version < 13) {
ErrorF("Require OpenGL version 1.3 or later.\n");
goto fail;
}
} else {
- if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) {
+ if (gl_version < 20) {
ErrorF("Require Open GLES2.0 or later.\n");
goto fail;
}
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index eeaa595..5711be7 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -559,26 +559,3 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
return ret;
}
-int
-glamor_gl_get_version(void)
-{
- int major, minor;
- const char *version = (const char *) glGetString(GL_VERSION);
- const char *dot = version == NULL ? NULL : strchr(version, '.');
- const char *major_start = dot;
-
- /* Sanity check */
- if (dot == NULL || dot == version || *(dot + 1) == '\0') {
- major = 0;
- minor = 0;
- }
- else {
- /* Find the start of the major version in the string */
- while (major_start > version && *major_start != ' ')
- --major_start;
- major = strtol(major_start, NULL, 10);
- minor = strtol(dot + 1, NULL, 10);
- }
-
- return GLAMOR_GL_VERSION_ENCODE(major, minor);
-}
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index f278bef..0f0b0f3 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -619,11 +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);
-int glamor_gl_get_version(void);
-
-#define GLAMOR_GL_VERSION_ENCODE(major, minor) ( \
- ((major) * 256) \
- + ((minor) * 1))
/* glamor_fill.c */
Bool glamor_fill(DrawablePtr drawable,
--
1.9.0
More information about the xorg-devel
mailing list