Search Unity

[EGL] Unable to create context

Discussion in 'Android' started by neufoctobre, Jun 20, 2015.

  1. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    78
    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 :)

     
    earthcrosser likes this.
  2. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    78
    Nobody ?
     
  3. Sam_SmartCityTec

    Sam_SmartCityTec

    Joined:
    Aug 19, 2014
    Posts:
    1
    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.
     
  4. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    78
    Ok thanks, that already help to know this don't come from any plugin ^^.
     
  5. awesome-alex

    awesome-alex

    Joined:
    Jul 9, 2012
    Posts:
    18
    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 ???
     
  6. mamoniem

    mamoniem

    Joined:
    Jul 23, 2012
    Posts:
    174
    4.x cloth might be the reason.

    -m
     
  7. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    312
    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.
     
  8. jun-yambao0312

    jun-yambao0312

    Joined:
    Dec 19, 2014
    Posts:
    3
    I also experienced this when using Asus Android phone.
     

    Attached Files:

  9. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    110
    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).

    Devices.png OS.png
     
  10. jun-yambao0312

    jun-yambao0312

    Joined:
    Dec 19, 2014
    Posts:
    3
    You mean it depends on the brand that i will be using?
     
  11. jorrit5477

    jorrit5477

    Joined:
    Aug 7, 2009
    Posts:
    51
    @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.
     
  12. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    110
    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! :)
     
  13. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    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:

    upload_2016-1-5_12-13-27.png
     
    milox777 likes this.
  14. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    236
    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
     
  15. eekgames

    eekgames

    Joined:
    May 23, 2014
    Posts:
    1
    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.
     
  16. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    110
  17. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    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 :(

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

    YAY! :D I just tested in Unity 5.3.5p4 and the crash is gone!
     
    Last edited: Jun 21, 2016
  18. _creatio_

    _creatio_

    Joined:
    Mar 21, 2013
    Posts:
    37
    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?
     
  19. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    36
    @_creatio_ 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
     
  20. JOJOGT

    JOJOGT

    Joined:
    Jan 16, 2015
    Posts:
    2
    On SM-G9200, irregularly crash when I use assetbundle.
     
  21. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    77
    On our devices we get the EGL error when we do the following:

    - Open app
    - Send app to background by pressing home-button
    - Re-open app by taping on the app-icon
    - ... see a nice black screen

    When we return to the app by using the task manager everything works fine. It happens on Unity 5.6.3 and up.

    Here's the error log:

    11-10 11:55:24.726: W/Adreno-EGL(18850): <qeglDrvAPI_eglMakeCurrent:3083>: EGL_BAD_ACCESS
    11-10 11:55:24.726: E/libEGL(18850): eglMakeCurrent:836 error 3002 (EGL_BAD_ACCESS)
    11-10 11:55:24.727: E/Unity(18850): [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
    11-10 11:55:24.727: E/Unity(18850):
    11-10 11:55:24.727: E/Unity(18850): (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 267)
     
  22. Vongolar

    Vongolar

    Joined:
    Jan 12, 2018
    Posts:
    3
    I'm getting a similar error log in Unity 2017.3.0f3

    E/libEGL: eglMakeCurrent:831 error 3002 (EGL_BAD_ACCESS)
    E/Unity: [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
    (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 267)

    I export my project to Android Studio,and it worked well.

    I use"
    Intent intent=new Intent(UnityPlayer.currentActivity,TencentOpenActivity.class);
    UnityPlayer.currentActivity.startActivity(intent);"
    to open my activity ,and then finish this activity.It also worked well.

    However,I use"
    Tencent.login(TencentOpenActivity.this,"all",listener);"to open another app.
    When the app back to my application,I finish TencentOpenActivity.Then,I got a black Screen and the error log.
     
  23. Vongolar

    Vongolar

    Joined:
    Jan 12, 2018
    Posts:
    3
    I find it works well in Unity 5.3.6p.I'm not sure that is it related to my buildsetting?
     
  24. NWagter

    NWagter

    Joined:
    Jul 18, 2016
    Posts:
    1
    I am having the same problem.
    I am trying to get it to work in 2018 now

    -------------
    Didn't work :p


    ------------
    Seems like 2017.2 works too atleast for me!
     
    Last edited: Feb 13, 2018
  25. binario_unity

    binario_unity

    Joined:
    Oct 12, 2017
    Posts:
    2
    Had a kinda similar problem, after a week of debugging I noticed that it was the instantiation of graphic objects (MeshRenderers and such) while the app is in background, I believe the bug occurs when Unity tries to send information to the graphics processor and the OS already killed the surface / buffer or whatever (Im not the most technical dev) but its just a theory. Anyway, I made a flag when the app is loading and its in background and resume the instantiation of objects when the app goes foreground again.

    In our case this was happening when our users grew tired of loading times (or ads) and went to other apps in the meantime

    Hope this saves someone's time
     
    dmax1 and Amitbuc like this.
  26. dmax1

    dmax1

    Joined:
    Jun 10, 2015
    Posts:
    4
    Well it definitely save my time.
    2018.4.5f1 and most of advertising plugins update to newest version and suddenly I starter to face this issue. I'm creating object pools during first scene for various models (that had textures, shaders, particles, etc.), so now I postponed instantiation of these models until moment when main scene is loaded.
    So, your theory has good roots.