Search Unity

OpenGLES error 0x0506 in PresentSurface:677

Discussion in 'iOS and tvOS' started by Steven-Walker, Feb 24, 2011.

  1. Steven-Walker

    Steven-Walker

    Joined:
    Oct 27, 2010
    Posts:
    38
    I've already submitted a bug report to Unity, but wanted to post my findings for the benefit of others who encounter this.

    Problem:
    When running a Unity iPhone build on an older device (old iPhone or iPod 2nd generation) a stream of errors is displayed in the Xcode debugging console:
    OpenGLES error 0x0506 in PresentSurface:677

    Cause:
    The culprit is the use of a camera script that implements OnRenderImage(). The contents of the method don't matter. I was using this script in my project to provide a nicer transition, fade to black, but because it wasn't really critical I simply removed it from the project to fix the problem.
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    What is case number?
     
  3. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I've just encountered the same problem running on an iPad2 with iOS4.3.1 installed. My message reads:

    OpenGLES error 0x0506 in PresentSurface:679

    I'm using a camera that is rendering to a texture. This is an integral feature to the update I'm developing for my app and cannot simply be removed.

    Is there any news about this problem being investigated and/or fixed?

    Thanks,
    Mal
     
  4. marjan

    marjan

    Joined:
    Jun 6, 2009
    Posts:
    563
    Did you use anti aliasing? I got such an Error having it enabled an trying to Save a Screenshot. Without anti aliasing: nö such Error.
     
    kreso likes this.
  5. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    Thanks for the tip marjan!

    Unfortunately, in this case I am not using antialiasing, so it seems there are other situations that cause this error to be produced.

    Mal
     
  6. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I found a solution for the issue, though I remain suspicious that there is an underlying problem either in Unity or iOS or the openGL driver on the device. I discovered by using Xcode instruments (Activity Monitor) that my app was leaking memory, slowly but inexorably. The source of the leak turned out to be a call to Destroy() on a rendertexture. By allocating the rendertexture at Start() time and reusing it I eliminated both the memory leak and the openGLES error message.

    The Destroy() call was included in a bit of code I salvaged from somewhere (don't recall where now) awhile ago, so I'm not sure why it was coded that way to begin with. At any rate I just wanted close the loop on this in case someone else finds the info useful.

    Cheers,
    Mal
     
  7. AndrewT

    AndrewT

    Joined:
    Nov 30, 2010
    Posts:
    3
    Hi,

    I thought we should add our voice to this thread. We're getting:

    OpenGLES error 0x0506 in PresentSurface:702

    This is happening on an iPod Touch 2nd gen and an iPhone 3G. Both are running iOS 4.2.1.
    It doesn't happen on an iPod Touch 1st gen running iOS 3.1.3.

    We're not doing any render to texture operations.
    Anti-aliasing is disabled in the Good quality profile that we appear to be using (assuming the Default Mobile Quality is the one that applies).

    Any thoughts on other places to look are welcomed!

    Cheers,
    Andrew
     
  8. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    0x0506 = INVALID_FRAMEBUFFER_OPERATION_EXT
    Apart from it - we are very close to releasing 3.4 - so i'd say wait a little and recheck (it would be difficult for us to say what exactly causing your issue, as we modified stuff heavily)
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    this time please a full list of changes for ios

    I have so many workarounds littered around i wouldn't know what to risk
     
  10. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    huh? what workarounds are you talking about? especially since release notes *should* contain everything (well, S*** happens, sure, but anyway)
     
  11. Hidden

    Hidden

    Joined:
    Apr 4, 2011
    Posts:
    20
    Hi,

    I'm experiencing the same error "OpenGLES error 0x0506 in Classes/iPhone_GlesSupport.cpp:"

    I'm using a render to texture and antialiasing on an iPad2, the render to texture works fine for the first 30 seconds or so then goes black and I see the error in the log. I've tried creating the render texture in the Start() function but the problem still happens.

    I've tried a few thoughts to fix it but none have worked, anyone managed to get a proper fix?

    Cheers,
    Hidden
     
  12. girishgap

    girishgap

    Joined:
    Oct 17, 2011
    Posts:
    10
    i have same problem while running my app on the landscape left , But it works fine with portrait can any one help me...
     
  13. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    This problem is definitely related to renderTexures, we were having the issue 100% of the time in a scene with a single render-texture. Got rid of it, problem went away. Note that we were only rendering to that texture once, and after that just treating it like a normal static texture, but the problem still happened after around 30 seconds.
     
  14. jorganmund

    jorganmund

    Joined:
    Mar 15, 2012
    Posts:
    3
    I got same error "OpenGLES error 0x0506" in rendertotexture in iPhone4S only.(unity 3.5 pro)

    On first 10~30 seconds, there seems to be no problems, but after that rendertotextured surface is gone(blackened) and flooding "OpenGLES error 0x0506" in XCode console.

    With iPhone4, no problems, no blackened texture, no 0x0506 errors....

    I googled but there's no clue but this thread.

    I suspect RenderToTexture implementation in Unity or iPhone4S's opengl driver is responsible, too.

    Is there any guys in unity3d can confirm what is the matter and who is responsible for?

    Thanks in advance.
     
  15. Rob_Fireproof

    Rob_Fireproof

    Joined:
    Jan 16, 2012
    Posts:
    9
    Is there any news on this? Is it being actively looked at by Unity?

    We're getting the same thing inconsistently in a scene with one camera rendering to a texture, and a couple of different post-fx passes which can be turned on and off.

    After a while, we get the same 0x0506 error as everyone else, and the output of the post-fx goes black.

    We're on the latest Unity version (3.5.1f2). I've only seen the bug on an iPad3 running at full resolution, I haven't seen it on iPad2. That's not conclusive since it's a pretty elusive bug, but it seems like maybe the extra space required for the post-fx passes at that resolution is causing intermittent problems (that's my best guess, at least).

    Any official line would be hugely appreciated.

    Thanks,
    Rob.
     
  16. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    I was seeing an error like this when I set some textures to anything but compressed -- I was only testing on iPad3.
     
  17. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Please submit your project as bug report and poke me with case number.
    Thanks!
     
  18. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    I can't submit my project as a bug report, there are strong limits in my NDA for my current project.

    But i have this problem, and it's one of the main features in the project (since it was supported i sold it to the client as a great thing, and in fact it is for what we need) but i need this working or at least a workaround.

    I wrote to support but i was redirected to this thread by Ben Pitt.

    Is there a solution already?

    This is a big problem for me right now.

    Cheers.
     
  19. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    are you using GL.InvalidateState? If so fix would be in next 3.5.whatever version (coming soon). If no - we need at least some repro project (try to cut stuff unless you are left with nothing sensitive)
     
  20. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    Hi Alexey.

    Thanks for anwering.

    Currently i don't know if my app uses "GL.InvalidateState", i don't use it in purpose at least, but i'm using Qualcomm Vuforia in my app, so maybe they use it.

    I'll try to get some time next week and provide you with a reproduction of the problem in another project, right now my project is too complex to strip anything and it would take a huge amount of time, but i undestand you need some kind of clue of what the problem is, maybe you can test the Vuforia extension with a simple GUI.Texture in the UI, and render a second camera to that texture, that is exactly what i'm doing.

    I hope that the "GL.InvalidateState" is the problem.

    Cheers and thanks again for answering.
     
  21. rrsimon

    rrsimon

    Joined:
    Apr 16, 2012
    Posts:
    27
    I've also been getting the same error ever since I added runtime reflections to a material using the Camera::RenderToCubemap method. I cannot submit my project but I can help with my diagnosis.

    I translated this article into C#:
    http://unity3d.com/support/documentation/ScriptReference/Camera.RenderToCubemap

    Here is the code I am using:
    This is the exact error I'm getting when m_camRenderToCubemap is called:
    OpenGLES error 0x0506 in /[PATH]/iPhone_GlesSupport.cpp:224

    Here is an article on this subject, the user in question says that his bug report 455369 has been fixed in the next release past v3.5.1f2.
    http://answers.unity3d.com/questions/233748/opengl-es-error-on-iphone-4s-and-ipad-2-when-combi.html

    I hope this information helps to track down these issues.
     
  22. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    It seems that it's working now, at least for normal render to texture, my rendered cam is working without problem now in 3.5.2f2

    Congrats fixing this.

    Cheers.
     
  23. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,799
    So is this related to RenderToTextures exclusively?

    I'm getting "OpenGLES error 0x0506 in iPhone_GlesSupport.cpp" on an iPad 3 (only it seems...) and I'm pretty sure I'm NOT using rendertotextures anywhere.

    Could it be related to antialiasing?

    I am still on Unity3.4.2f so I am not looking for a fix, but rather find what is causing it, so I can work around it.

    EDIT: Could it be related to the animated autorotation? Does that run rendertotextures?
     
    Last edited: Jun 28, 2012
  24. aleksey_173

    aleksey_173

    Joined:
    Jul 11, 2012
    Posts:
    24
    I have the same error:

    OpenGLES error 0x0506 in /Classes/iPhone_GlesSupport.cpp:224

    Where does it come from? I am using unity version 3.5.2f2 recently downloaded from the web-site...

    It sucks...Nothing heavy on the scene and makes me to restart the device each time I ran the app...
     
    Last edited: Sep 7, 2012
  25. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    I've just run into this same problem using ReadPixels and the latest 3.5 Unity. Disabling Anti-Aliasing seems to have fixed it, but I guess after reading this thread I should double check to make sure it still works after 30+ seconds.
     
  26. Will Chen

    Will Chen

    Joined:
    May 6, 2013
    Posts:
    7
    I also find this problem . I find it is caused by Unity Texture(ARGB32) . When I transform it into sample2D in cg language and I calculate its member (like a,r,g ) with other number. The error occur.
     
  27. kreso

    kreso

    Joined:
    Sep 7, 2013
    Posts:
    147
    Awesome, this helped me today!