{
CGLPBufferObj pbuffer = NULL;
CGLError error;
+ bool is_3_2_core = false;
YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_pbuffer_surface_create,
"dpy = %p, width = %d, height = %d",
width,
height);
- error = CGLCreatePBuffer(width, height, GL_TEXTURE_2D, GL_RGBA,
- 0, &pbuffer);
-
- if (error) {
- YAGL_LOG_ERROR("CGLCreatePBuffer failed: %s", CGLErrorString(error));
- pbuffer = NULL;
+ if (driver->gl_version > yagl_gl_2)
+ is_3_2_core = true;
+
+ // TODO: Migrate to Metal Framework
+ // CGLCreatePBuffer is deprecated on MAC.
+ // Below hack is to fix Emulator launch issue on MAC.
+ // The surface returned by CGLCreatePBuffer is not used in case of opengl 3.2
+ // Hence return dummy surface in case of opengl 3.2 instead of returning null and exiting.
+ if (is_3_2_core) {
+ YAGL_LOG_INFO("Creating Dummy EGLSurface\n");
+ pbuffer = (EGLSurface)1;
}
+ else {
+ error = CGLCreatePBuffer(width, height, GL_TEXTURE_2D, GL_RGBA,
+ 0, &pbuffer);
+ if (error) {
+ YAGL_LOG_ERROR("CGLCreatePBuffer failed: %s", CGLErrorString(error));
+ pbuffer = NULL;
+ }
+ }
YAGL_LOG_FUNC_EXIT("%p", pbuffer);
return pbuffer;
"dpy = %p, sfc = %p",
dpy,
sfc);
+ if (driver->gl_version > yagl_gl_2)
+ goto done;
error = CGLDestroyPBuffer((CGLPBufferObj)sfc);
if (error) {
YAGL_LOG_ERROR("CGLDestroyPBuffer failed: %s", CGLErrorString(error));
}
-
+done:
YAGL_LOG_FUNC_EXIT(NULL);
}
share_ctx = NULL;
}
- if ((egl_cgl->base.gl_version > yagl_gl_2) && (version != 1)) {
+ if (egl_cgl->base.gl_version > yagl_gl_2) {
ctx->is_3_2_core = true;
} else {
ctx->is_3_2_core = false;