summaryrefslogtreecommitdiff
path: root/glamor/glamor.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-25 11:39:13 -0800
committerEric Anholt <eric@anholt.net>2014-02-14 18:30:01 -0800
commit9553020b7184ed7a7ef3f02d60556d519ea3e769 (patch)
treeb666e6e403c0229f5f5e1392f2a72a5d8fbca5cb /glamor/glamor.c
parentc3c8a5f36034b6a2ce48d1d42e3de5af36406c38 (diff)
glamor: Drop a bunch of GLES2 ifdefs.
Now that we're using epoxy, we can write code using both desktop and ES symbols and decide what to use at runtime. v2: Fix a spelling mistake (latter), since the lines were moved anyway (noticed by Rémi Cardona). Fix condition invert in glamor_set_composite_texture (caught by Michel Dänzer). Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com> (v1) Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
Diffstat (limited to 'glamor/glamor.c')
-rw-r--r--glamor/glamor.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 4c962aca3..baee4dd2f 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -301,26 +301,29 @@ glamor_init(ScreenPtr screen, unsigned int flags)
goto fail;;
}
+ if (epoxy_is_desktop_gl())
+ glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
+ else
+ glamor_priv->gl_flavor = GLAMOR_GL_ES2;
+
gl_version = glamor_gl_get_version();
-#ifndef GLAMOR_GLES2
- if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) {
- ErrorF("Require OpenGL version 1.3 or latter.\n");
- goto fail;
- }
-#else
- if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) {
- ErrorF("Require Open GLES2.0 or latter.\n");
- goto fail;
- }
-#endif
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) {
+ ErrorF("Require OpenGL version 1.3 or later.\n");
+ goto fail;
+ }
+ } else {
+ if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) {
+ ErrorF("Require Open GLES2.0 or later.\n");
+ goto fail;
+ }
-#ifdef GLAMOR_GLES2
- if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
- ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
- goto fail;
+ if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
+ ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
+ goto fail;
+ }
}
-#endif
glamor_priv->has_pack_invert =
glamor_gl_has_extension("GL_MESA_pack_invert");
@@ -333,11 +336,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_set_debug_level(&glamor_debug_level);
-#ifdef GLAMOR_GLES2
- glamor_priv->gl_flavor = GLAMOR_GL_ES2;
-#else
- glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
-#endif
/* If we are using egl screen, call egl screen init to
* register correct close screen function. */
if (flags & GLAMOR_USE_EGL_SCREEN) {