Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

LWRP, Android, Oculus, get OPENGL NATIVE PLUG-IN ERROR

Discussion in 'Shaders' started by linojon, Sep 22, 2018.

  1. linojon

    linojon

    Joined:
    Aug 25, 2014
    Posts:
    118
    Hello, given the following steps
    * created a new unity project,
    * imported the Oculus Utilties, target Android and Oculus SDK (Go),
    * open the GearVController example scene
    * setup for LWRP
    * player settings include OpenGLES3 api, .NET 4.x/Standard 2.0, IL2CPP, ARMv7
    * XR settings: VR enabled, Oculus, Single pass
    * Build and run

    The logcat has the follow errors (dozens if not hundreds of times)

    09-22 12:21:17.951 E/Unity (17300): OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state
    09-22 12:21:17.951 E/Unity (17300):
    09-22 12:21:17.951 E/Unity (17300): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 340)

    I've tried this in 2018.2.9f1 and 2019.3.0b2
    Is this a unity bug, or a setting i should change, and/or safe to just ignore it?
     
  2. wilkens

    wilkens

    Joined:
    Feb 3, 2014
    Posts:
    6
    Same here in my VR project
     
  3. stenfeio

    stenfeio

    Joined:
    Jan 18, 2015
    Posts:
    22
    @linojon, ever figure out what the issue causing the error is? I'm getting this when I'm loading prefabs from AssetBundles.
     
  4. FloBeber

    FloBeber

    Joined:
    Jun 9, 2015
    Posts:
    166
    Same errors here with the exact same config as @linojon (except Unity 2018.3.6).
    Any update on this guys?
     
  5. SahilSinghAVR

    SahilSinghAVR

    Joined:
    Jun 14, 2019
    Posts:
    1
    Experiencing this in 2019.1.9f1, any body has any idea why does this show up
     
  6. rtorresbonetff

    rtorresbonetff

    Joined:
    Jan 3, 2019
    Posts:
    6
    We also have this and it ruins the framerate
     
  7. MSFX

    MSFX

    Joined:
    Sep 3, 2009
    Posts:
    116
    also getting this in 2018.3 Quest project, would love to know why?
     
  8. wilkens

    wilkens

    Joined:
    Feb 3, 2014
    Posts:
    6
    11 month later, Unity 2019.2 and using Oculus Quest. Still getting the same error. It seems nobody is interested in solving this bug
     
    Boodums likes this.
  9. LucasRizzotto

    LucasRizzotto

    Joined:
    Dec 11, 2015
    Posts:
    27
    Same here. Has anyone found a solution?
     
    LTPStudioXR likes this.
  10. GlitchInTheMatrix

    GlitchInTheMatrix

    Joined:
    Apr 12, 2010
    Posts:
    285
    No solution about this yet?
     
  11. KuantikoStudio

    KuantikoStudio

    Joined:
    Apr 2, 2019
    Posts:
    7
    I was having the same issue since I moved my project to Unity 2019.2. I just realized that for some reason the "Stereo Rendering Mode" (at XR Settings) changed to "Multiview", switching it back to "Single Pass" solved the problem.

    In my case, I'm building for Oculus (Android).

    I hope helps anybody else.
     
  12. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    Has anyone made any progress on this? I'm seeing it in 2019.3.14f1
     
  13. stenfeio

    stenfeio

    Joined:
    Jan 18, 2015
    Posts:
    22
    Unfortunately on my end, ended up moving away from URP (LWRP). Seemed like it was main cause of issue for me.
     
  14. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    I get this error
    OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_VALUE: Numeric argument out of range
    (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 340)

    in a complex project, have no idea where it is coming from.
    I already tried a lot of things (removing dlls, inspecting shaders etc), not sure if the error was there before and how I missed it. The project uses Unity 2018 LTS / standard RP, Oculus Quest Andoid build.
    It happens one frame only, but with a certain plugin it's each frame.
     
  15. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    This issue still exists in 2019.4.6f1 LTS
     
  16. zhangsw_good

    zhangsw_good

    Joined:
    May 2, 2020
    Posts:
    1
    This issue still exists in 2018.4.13f1 LTS
     
  17. ericloureiro

    ericloureiro

    Joined:
    Apr 7, 2020
    Posts:
    1
    Same thing here. Any progress?
     
  18. Vehicle

    Vehicle

    Joined:
    Jan 23, 2017
    Posts:
    2
    This issue still exists in 2019.4.10f1
     
  19. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hi!
    Did anyone report a bug?
     
  20. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Getting this issue on the Quest 2 with 2019.3.8f1. I haven't seen this issue on the Quest 1, only the Quest 2 so far.
     
  21. equalsequals

    equalsequals

    Joined:
    Sep 27, 2010
    Posts:
    154
    @aleksandrk

    We're seeing this spam when the HMD is removed from the user's head.

    As best as I can tell, it seems to stem from a call to ScriptableRenderContext.SetupCameraProperties, but only when the stereoSetup argument is true.

    Oddly enough, in a simple reproduction case, if bypassing that call (or forcing stereoSetup to false) while we detect the HMD has no head in it, the error spam stops, but the proximity sensor then appears to be disabled, resulting in a stuck frame in reprojection. The user then either has to return to Oculus Home and reenter the app, or cycle the screen off/on in order to recover.

    A simple Render() loop such as this can reproduce this:

    Code (CSharp):
    1. void Render(ScriptableRenderContext context, Camera[] cameras)
    2. {
    3.     foreach (var camera in cameras)
    4.     {
    5.         bool isStereoEnabled = camera.cameraType == CameraType.Game
    6.                                && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
    7.            
    8.         if (!camera.TryGetCullingParameters(
    9.             isStereoEnabled,
    10.             out ScriptableCullingParameters cullingParameters))
    11.         {
    12.             Debug.LogError("Failed to get CullingParameters", camera);
    13.             continue;
    14.         }
    15.  
    16.         // CullingResults cullResults = context.Cull(ref cullingParameters); // Not necessary to reproduce issue
    17.  
    18.         context.SetupCameraProperties(camera /*, isStereoEnabled*/); // Uncomment to get GL Error Spam
    19.  
    20.         CommandBuffer cmd = CommandBufferPool.Get("Clear All");
    21.         {
    22.             cmd.Clear();
    23.             cmd.ClearRenderTarget(true,true,Color.clear);
    24.             context.ExecuteCommandBuffer(cmd);
    25.         }
    26.         CommandBufferPool.Release(cmd);
    27.  
    28.         context.Submit();
    29.        
    30.     }
    31.     context.Submit();
    32. }
    This is under OpenGL ES 3.1+AEP.
     
  22. laurenfraz

    laurenfraz

    Joined:
    Jun 8, 2017
    Posts:
    3
    Has anyone found a fix/workaround? Also hitting this with Single Pass, running on an Oculus Quest using OpenGLES3, on 2019.4.5f1.

    It looks like this was reported here: https://issuetracker.unity3d.com/is...s-on-quest-xr-failed-to-beginframe-on-display

    It's marked as Won't Fix with a pretty cryptic resolution note, "Shader should be updated to support multiview if reasonable, otherwise the feature should be removed from the project."
     
    Last edited: Nov 8, 2020
  23. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    153
    Got the same issue. I managed to fix it by re-selecting the stereo rendering mode.
    It happen if you use single pass instanced on Standalone and switch to Android (single pass instanced being unavailable on android). For whatever reason the field seem shared between platform and you need to re select it.

    Now I got it again when I do a build using Arm64 and ILCPP. Didn't find a fix yet. I'm Using unity 2019.4.13f1
     
    funvr_9 likes this.
  24. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    233
    SAME:
    Error Unity OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state

    Unity 2020.3.8f1
     
  25. Desoxi

    Desoxi

    Joined:
    Apr 12, 2015
    Posts:
    195
    Experiencing this issue on 2020.3.21f1 with Multiview. Though I have to mention that I am calling the shadervariant collection WarmUp method to preload shaders from a collection. I was planning to do this to mitigate hiccups during runtime, but it seems like this opengl error is preventing that.
     
  26. AndyUr

    AndyUr

    Joined:
    Aug 17, 2015
    Posts:
    19
    We're also getting this error. It happens when using OpenGLES3 and Unity 2020.3.23f1 on Android (Quest). Switching to Vulkan seems to fix it, but this might be not doable for us since we have a 3rd party plugin (AVPro) that does not support Vulkan.
     
  27. AndyUr

    AndyUr

    Joined:
    Aug 17, 2015
    Posts:
    19
    After many trials we finally found what it was. An OnGUI call! Due to some unrelated issues with debug logging it might be difficult to track this down. But if you have this error it might be worth looking for a component with this callback and removing it, as it is not supported in XR devices (Quest at least).
     
  28. SGJPile

    SGJPile

    Joined:
    Apr 11, 2022
    Posts:
    6
    Anyone else have success on finding a solution?

    I searched through all our code for OnGUI calls and every one of them is either wrapped in an if "UNITY_EDITOR" or is in an "/Editor/" subfolder. So in theory, we have no OnGUI that would be running on device.

    However, we're still getting this every frame on the HTC Flow and error logs are not providing details of where it is coming from.

    For Reference: Unity 2020.3.15f2
     
  29. weiner_monkey

    weiner_monkey

    Joined:
    Aug 1, 2022
    Posts:
    49
    Getting this in 2021.3 LTS as well, latest URP. The app is running (I can hear sounds) but nothing is displayed, logs show the native plugin error constantly. Dont even see the splashscreen
     
  30. ARR_YoYo

    ARR_YoYo

    Joined:
    Mar 2, 2022
    Posts:
    1
  31. khelkun

    khelkun

    Joined:
    Dec 13, 2015
    Posts:
    1
    For Quest 2, I changed Stereo rendering mode from "single pass" to "multi pass" and the error disappeared
     
  32. travis-TAP-3D

    travis-TAP-3D

    Joined:
    Sep 12, 2022
    Posts:
    22
    This started appearing for me on our Quest 2 app startup only after upgrading from Unity 2021 to 2022. Did anyone find a solution (I'm already set to Auto Rotation and performance wise we can't move to multi-pass):

    OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_VALUE: Numeric argument out of range
    #0 0x6ff010c97c (libunity.so) GetStacktrace(int) 0x44
    #1 0x6ff09d3aac (libunity.so) DebugStringToFile(DebugStringToFileData const&) 0x234
    #2 0x6ff07e1e1c (libunity.so) LogGLES(char const*, char const*, char const*, long) 0x250
    #3 0x6ff07e1fac (libunity.so) CheckErrorGLES(ApiGLES const*, char const*, char const*, long) 0xd8
    #4 0x6ff0564c88 (libunity.so) XRDisplaySubsystem::GfxThread::AfterRendering() 0x5c
    #5 0x6ff07a1dbc (libunity.so) GfxDevice::InsertCustomMarkerCallbackAndDataWithFlags(void (*)(int, void*), int, CustomMarkerCallbackFlags, void*, unsigned long) 0x20
    #6 0x6ff0a05f60 (libunity.so) GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&) 0x7be0
    #7 0x6ff09fe318 (libunity.so) GfxDeviceWorker::RunExt(ThreadedStreamBuffer&) 0x54
    #8 0x6ff09fe2b8 (libunity.so) GfxDeviceWorker::Run() 0x8c
    #9 0x6ff09fe03c (libunity.so) GfxDeviceWorker::RunGfxDeviceWorker(void*) 0x4
    #10 0x6feff14958 (libunity.so) Thread::RunThreadWrapper(void*) 0x418
    #11 0x7104fc9dec (libc.so) __pthread_start(void*) 0x84
     
    Last edited: Jul 27, 2023
  33. DaveA_VR

    DaveA_VR

    Joined:
    May 26, 2022
    Posts:
    33
    This is happening for me when trying to play video with AVPro on a Vive XR Elite, Unity 2021.3.2
     
  34. hafizsaadcb

    hafizsaadcb

    Joined:
    Jan 15, 2024
    Posts:
    3
    for me, it was just selecting(checking) the below and things worked for me:
    1. LowOverheadMode
    2. OptimizeBufferDiscards
    3. SymmetricProjection