diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-05-28 15:55:33 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-05-29 16:22:54 +0100 |
commit | 4a697ec692aa762eb8cdb7812f5a051c5870020f (patch) | |
tree | 8c8a7eab61c46ea42a55391cd9695e47a631a163 /wrappers | |
parent | 04c307a8a8439adf38c0f14d065275f571a7b486 (diff) |
egltrace: Warn instead of assert on GL API mismatch.
Some OpenGL ES implementions end up being just a thin veil on top of
desktop OpenGL.
Fixes #341.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/egltrace.py | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py index 9ce62b38..7d2d182c 100644 --- a/wrappers/egltrace.py +++ b/wrappers/egltrace.py @@ -56,29 +56,31 @@ class EglTracer(GlTracer): print ' gltrace::createContext((uintptr_t)_result);' if function.name == 'eglMakeCurrent': - print ' if (_result) {' - print ' // update the profile' - print ' if (ctx != EGL_NO_CONTEXT) {' - print ' gltrace::setContext((uintptr_t)ctx);' - print '#ifndef NDEBUG' - print ' gltrace::Context *tr = gltrace::getContext();' - print ' EGLint api = EGL_OPENGL_ES_API;' - print ' _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);' - print ' if (api == EGL_OPENGL_API) {' - print ' assert(tr->profile.api == glprofile::API_GL);' - print ' } else if (api == EGL_OPENGL_ES_API) {' - print ' assert(tr->profile.api == glprofile::API_GLES);' - print ' EGLint version = 1;' - print ' _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);' - print ' assert(tr->profile.major >= version);' - print ' } else {' - print ' assert(0);' - print ' }' - print '#endif' - print ' } else {' - print ' gltrace::clearContext();' - print ' }' - print ' }' + print r' if (_result) {' + print r' // update the profile' + print r' if (ctx != EGL_NO_CONTEXT) {' + print r' gltrace::setContext((uintptr_t)ctx);' + print r' gltrace::Context *tr = gltrace::getContext();' + print r' EGLint api = EGL_OPENGL_ES_API;' + print r' _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);' + print r' if (api == EGL_OPENGL_API) {' + print r' assert(tr->profile.api == glprofile::API_GL);' + print r' } else if (api == EGL_OPENGL_ES_API) {' + print r' EGLint client_version = 1;' + print r' _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &client_version);' + print r' if (tr->profile.api != glprofile::API_GLES ||' + print r' tr->profile.major < client_version) {' + print r' std::string version = tr->profile.str();' + print r' os::log("apitrace: warning: eglMakeCurrent: expected OpenGL ES %i.x context, but got %s\n",' + print r' client_version, version.c_str());' + print r' }' + print r' } else {' + print r' assert(0);' + print r' }' + print r' } else {' + print r' gltrace::clearContext();' + print r' }' + print r' }' if function.name == 'eglDestroyContext': print ' if (_result) {' |