[EGL] Unable to create context

Hi everybody,
First thing I’m a novice about coding, I learn by myself 9 month ago so I’m really not strong ^^.

I have a game with google analytic installed and I get a lot of error report related to [EGL] like this :

. [EGL] Unable to create context!: EGL_BAD_CONTEXT: An EGLContext argument does not name a valid EGL rendering context.
. [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.
. [EGL] Unable to acquire context: EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.
. [EGL] Unable to find a configuration matching minimum spec!
. [EGL] Failed to create window surface: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.
. [EGL] Unable to acquire context: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
. [EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
. [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
. [EGL] eglDestroySurface(m_EGLDisplay, m_EGLSurface): EGL_BAD_PARAMETER: One or more argument values are invalid.
. [EGL] eglDestroySurface(m_EGLDisplay, m_EGLSurface): EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.
. [EGL] Unable to release context: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.

I use Unity 5.0.2 with NGui and some othe plugin (social,ads and unibill).
I don’t even know how to recreate these problem, and of course of to solve them. I just know these problem comes from :

. Samsung Galaxy Pocket Plus (S5301, GT-S5301L , GT-S5301B, GT-S5303B
. Samsung Galaxy Tab 3 lite
. Samsung Galaxy Y Plus
. and more and more ^^

I use an automatic compression for all my texture, may be the problem come frome here, should I use ETC instead ?

Thanks in advance for your patience :slight_smile:

1 Like

Nobody ?

Same problem as I am facing.
I have tried to start a new blank project but got the same problem.
So, the reason should not be related to plugin.

Ok thanks, that already help to know this don’t come from any plugin ^^.

I only got that one too :
[EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindow Type argument does not refer to a valid native window.

Still have no idea from where it could come ???

4.x cloth might be the reason.

-m

Getting

on multiple Android devices, including at least the following:
Samsung GT-P5100
Samsung GT-P5110
Samsung GT-P5210
Samsung GT-P5220
Quanta Gigaset QV830

Judging from the logs, it seems to happen when leaving the app on the background and switching back. Using Unity 5.1.3p2, forced OpenGL ES 2.0. Left a bug report (725668) but couldn’t really post a repro.

I also experienced this when using Asus Android phone.

1 Like

I’m also getting:

[EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.

Here’s a break down of devices it’s occurring on and OS’s (if it helps).

You mean it depends on the brand that i will be using?

@jun-yambao0312 No, I don’t think it depends on the brand, nor the Android version.

We also see quite some of these types of errors in our Unity Android projects. I am not sure if this actually causes a crash, or that it is merely an error log and the user’s experience is not affected in a (really) bad manner. Maybe a Unity dev/support can elaborate on this, since it pretty much clutters error reporting, but the cause is rather unclear, as is reproducibility.

Not entirely sure if it’s a certain brand or OS, but I dumped the data, in case there was some sort of pattern. Every little helps! :slight_smile:

We are also seeing a fairly substantial number of these being reported in our crash tracking tool and interestingly they seems to be a lot of overlap with the devices listed by poolts:

1 Like

Up +1
E/Unity: [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType
(Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 205)

Note 4

I got the same error when I upgraded to Unity 5.3.2 (from 4.3.4) and tried to deploy my previously working game to my Nexus 7:

Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType
(Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 205)

In my case I found the error was slightly misleading, and seemed to be caused by an earlier error: a call to Shader.Find(“Standard”) was returning null. It appears that Unity’s stripping seemed to be working differently and had stripped out the standard shader (since I never directly referenced it).

Hope that helps someone.

This seems to now be fixed in Unity 5.4.1

2 Likes

We were getting a similar error log using Unity 5.3.5p2.

06-20 17:01:25.949: E/Unity(6687): [EGL] Unable to acquire context: EGL_BAD_MATCH: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).

We don’t get this error with Unity 5.4.1. The problem is the beta breaks several other things so upgrading at this point is not an option for us since our project is live :frowning:

Did upgrading to 5.4.1 fix the issue for the rest of you?

YAY! :smile: I just tested in Unity 5.3.5p4 and the crash is gone!

Getting the error:
[EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.

with Unity 5.5.0f3
Does anyone still getting this issue?

@_creatio_1 I’m on Unity 5.5.2f1 and we have a sligtly different error that was reported in our log files. Seems like this is still happening, there is no callstack so it`s ready hard to see what’s wrong.

[EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.

Edit:
Occurs on the SAMSUNG SM-G920W8 running Android 6.0.1

On SM-G9200, irregularly crash when I use assetbundle.