EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) { EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, " "const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list); Display *display = static_cast<Display*>(dpy); Config *configuration = static_cast<Config*>(config); gl::Context* sharedGLContext = static_cast<gl::Context*>(share_context); AttributeMap attributes(attrib_list); Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes); if (error.isError()) { SetGlobalError(error); return EGL_NO_CONTEXT; } gl::Context *context = nullptr; error = display->createContext(configuration, sharedGLContext, attributes, &context); if (error.isError()) { SetGlobalError(error); return EGL_NO_CONTEXT; } SetGlobalError(Error(EGL_SUCCESS)); return static_cast<EGLContext>(context); }
EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) { EVENT( "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = " "0x%0.8p, " "const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list); Thread *thread = GetCurrentThread(); Display *display = static_cast<Display *>(dpy); Config *configuration = static_cast<Config *>(config); gl::Context *sharedGLContext = static_cast<gl::Context *>(share_context); AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes); if (error.isError()) { thread->setError(error); return EGL_NO_CONTEXT; } gl::Context *context = nullptr; error = display->createContext(configuration, sharedGLContext, attributes, &context); if (error.isError()) { thread->setError(error); return EGL_NO_CONTEXT; } thread->setError(NoError()); return static_cast<EGLContext>(context); }