diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-07-23 18:45:34 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-07-23 18:45:34 +0100 |
commit | 11f01789444d4ebe97581c31d8756d773e18356f (patch) | |
tree | c8ae452349673f9ab9930ef6f62dd311bd85b45f /retrace | |
parent | 1541b0c7f45819ef20ef9abfd005006ee4a94b31 (diff) |
glretrace: Allow to create GLES1 GLX contexts.
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/glws_glx.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/retrace/glws_glx.cpp b/retrace/glws_glx.cpp index c423fccf..480466f1 100644 --- a/retrace/glws_glx.cpp +++ b/retrace/glws_glx.cpp @@ -39,6 +39,9 @@ namespace glws { static unsigned glxVersion = 0; static const char *extensions = 0; static bool has_GLX_ARB_create_context = false; +static bool has_GLX_ARB_create_context_profile = false; +static bool has_GLX_EXT_create_context_es_profile = false; +static bool has_GLX_EXT_create_context_es2_profile = false; class GlxVisual : public Visual @@ -160,7 +163,16 @@ init(void) { glxVersion = (major << 8) | minor; extensions = glXQueryExtensionsString(display, screen); - has_GLX_ARB_create_context = checkExtension("GLX_ARB_create_context", extensions); + +#define CHECK_EXTENSION(name) \ + has_##name = checkExtension(#name, extensions) + + CHECK_EXTENSION(GLX_ARB_create_context); + CHECK_EXTENSION(GLX_ARB_create_context_profile); + CHECK_EXTENSION(GLX_EXT_create_context_es_profile); + CHECK_EXTENSION(GLX_EXT_create_context_es2_profile); + +#undef CHECK_EXTENSION } void @@ -262,15 +274,27 @@ createContext(const Visual *_visual, Context *shareContext, bool debug) case PROFILE_COMPAT: break; case PROFILE_ES1: - return NULL; + if (!has_GLX_EXT_create_context_es_profile) { + return NULL; + } + attribs.add(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES_PROFILE_BIT_EXT); + attribs.add(GLX_CONTEXT_MAJOR_VERSION_ARB, 1); + break; case PROFILE_ES2: + if (!has_GLX_EXT_create_context_es2_profile) { + return NULL; + } attribs.add(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT); + attribs.add(GLX_CONTEXT_MAJOR_VERSION_ARB, 2); break; default: { attribs.add(GLX_CONTEXT_MAJOR_VERSION_ARB, desc.major); attribs.add(GLX_CONTEXT_MINOR_VERSION_ARB, desc.minor); if (desc.core) { + if (!has_GLX_ARB_create_context_profile) { + return NULL; + } attribs.add(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB); } break; |