glamor: Use epoxy_gl_version() instead of rolling our own.
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
9d87f66e86
commit
15d36444ac
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue