int context_attrs[3];
int config_attrs[40];
int major_version, minor_version;
- int num_config, n = 0;
+ int num_config, n;
const GLubyte *vendor, *renderer, *version;
Eina_Bool blacklist = EINA_FALSE;
struct wl_display *wl_disp;
+ int val = 0;
//TIZEN_ONLY(20171123) : bug fixed : using wl_surface
struct wl_surface *wl_surface;
-//
-//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach
- int val = 0;
-//
+
/* try to allocate space for our window */
if (!(gw = calloc(1, sizeof(Outbuf))))
return NULL;
gw->depth = einfo->info.depth;
gw->alpha = einfo->info.destination_alpha;
gw->rot = einfo->info.rotation;
+ gw->depth_bits = einfo->depth_bits;
+ gw->stencil_bits = einfo->stencil_bits;
+ gw->msaa_bits = einfo->msaa_bits;
//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach
gw->depth_bits = einfo->depth_bits;
context_attrs[1] = 2;
context_attrs[2] = EGL_NONE;
- config_attrs[n++] = EGL_SURFACE_TYPE;
- config_attrs[n++] = EGL_WINDOW_BIT;
- config_attrs[n++] = EGL_RENDERABLE_TYPE;
- config_attrs[n++] = EGL_OPENGL_ES2_BIT;
-
- config_attrs[n++] = EGL_RED_SIZE;
- config_attrs[n++] = 1;
- config_attrs[n++] = EGL_GREEN_SIZE;
- config_attrs[n++] = 1;
- config_attrs[n++] = EGL_BLUE_SIZE;
- config_attrs[n++] = 1;
-
- config_attrs[n++] = EGL_ALPHA_SIZE;
- config_attrs[n++] = 8 * !!gw->alpha;
- config_attrs[n++] = EGL_DEPTH_SIZE;
-//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach
-// config_attrs[n++] = 0;
- config_attrs[n++] = gw->depth_bits;
-//
- config_attrs[n++] = EGL_STENCIL_SIZE;
-
-//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach
-// config_attrs[n++] = 0;
- config_attrs[n++] = gw->stencil_bits;
- if (gw->msaa_bits > 0)
- {
- config_attrs[n++] = EGL_SAMPLE_BUFFERS;
- config_attrs[n++] = 1;
- config_attrs[n++] = EGL_SAMPLES;
- config_attrs[n++] = gw->msaa_bits;
- }
-//
- config_attrs[n++] = EGL_NONE;
-
/* FIXME: Remove this line as soon as eglGetDisplay() autodetection
* gets fixed. Currently it is incorrectly detecting wl_display and
* returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
return NULL;
}
+try_again:
+ n = 0;
+ config_attrs[n++] = EGL_SURFACE_TYPE;
+ config_attrs[n++] = EGL_WINDOW_BIT;
+ config_attrs[n++] = EGL_RENDERABLE_TYPE;
+ config_attrs[n++] = EGL_OPENGL_ES2_BIT;
+
+ config_attrs[n++] = EGL_RED_SIZE;
+ config_attrs[n++] = 1;
+ config_attrs[n++] = EGL_GREEN_SIZE;
+ config_attrs[n++] = 1;
+ config_attrs[n++] = EGL_BLUE_SIZE;
+ config_attrs[n++] = 1;
+
+ config_attrs[n++] = EGL_ALPHA_SIZE;
+ config_attrs[n++] = 8 * !!gw->alpha;
+ config_attrs[n++] = EGL_DEPTH_SIZE;
+ config_attrs[n++] = gw->depth_bits;
+ config_attrs[n++] = EGL_STENCIL_SIZE;
+ config_attrs[n++] = gw->stencil_bits;
+ if (gw->msaa_bits > 0)
+ {
+ config_attrs[n++] = EGL_SAMPLE_BUFFERS;
+ config_attrs[n++] = 1;
+ config_attrs[n++] = EGL_SAMPLES;
+ config_attrs[n++] = gw->msaa_bits;
+ }
+ config_attrs[n++] = EGL_NONE;
+
num_config = 0;
if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
1, &num_config) || (num_config != 1))
{
ERR("eglChooseConfig() fail. code=%#x", eglGetError());
+
+ if ((gw->depth_bits > 24) || (gw->stencil_bits > 8))
+ {
+ WRN("Please note that your driver might not support 32-bit depth or "
+ "16-bit stencil buffers, so depth24, stencil8 are the maximum "
+ "recommended values.");
+ if (gw->depth_bits > 24) gw->depth_bits = 24;
+ if (gw->stencil_bits > 8) gw->stencil_bits = 8;
+ DBG("Trying again with depth:%d, stencil:%d", gw->depth_bits, gw->stencil_bits);
+ goto try_again;
+ }
+ else if (gw->msaa_bits)
+ {
+ gw->msaa_bits /= 2;
+ DBG("Trying again with msaa_samples: %d", gw->msaa_bits);
+ goto try_again;
+ }
+ else if (gw->depth_bits || gw->stencil_bits)
+ {
+ gw->depth_bits = 0;
+ gw->stencil_bits = 0;
+ DBG("Trying again without any depth or stencil buffer");
+ goto try_again;
+ }
+
eng_window_free(gw);
return NULL;
}
return NULL;
}
-//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach
eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_DEPTH_SIZE, &val);
gw->detected.depth_buffer_size = val;
DBG("Detected depth size %d", val);
eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_SAMPLES, &val);
gw->detected.msaa = val;
DBG("Detected msaa %d", val);
-//
if (!gw->gl_context)
{
return gw;
}
-void
+void
eng_window_free(Outbuf *gw)
{
Outbuf *wl_win;