Support KHR_no_error in the VR context

This commit is contained in:
Brad Davis 2019-03-06 13:13:45 -08:00
parent 72ec0ea29a
commit 05ba515c73
2 changed files with 6 additions and 7 deletions

View file

@ -13,10 +13,7 @@
#include <mutex>
#include <android/log.h>
#if !defined(EGL_OPENGL_ES3_BIT_KHR)
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
#endif
#include <EGL/eglext.h>
using namespace ovr;
@ -129,7 +126,7 @@ void GLContext::doneCurrent() {
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
bool GLContext::create(EGLDisplay display, EGLContext shareContext) {
bool GLContext::create(EGLDisplay display, EGLContext shareContext, bool noError) {
this->display = display;
auto config = findConfig(display);
@ -139,7 +136,9 @@ bool GLContext::create(EGLDisplay display, EGLContext shareContext) {
return false;
}
EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3,
noError ? EGL_CONTEXT_OPENGL_NO_ERROR_KHR : EGL_NONE, EGL_TRUE,
EGL_NONE };
context = eglCreateContext(display, config, shareContext, contextAttribs);
if (context == EGL_NO_CONTEXT) {

View file

@ -25,7 +25,7 @@ struct GLContext {
static EGLConfig findConfig(EGLDisplay display);
bool makeCurrent();
void doneCurrent();
bool create(EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY), EGLContext shareContext = EGL_NO_CONTEXT);
bool create(EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY), EGLContext shareContext = EGL_NO_CONTEXT, bool noError = false);
void destroy();
operator bool() const { return context != EGL_NO_CONTEXT; }
static void initModule();