Start a new topic

Recreating Wikitude camera and trackers crash with Multitreaded Rendering Off on Unity

- Unity 2020.3.2f1

- Wikitude SKD for Unity v9.6; v9.7.1

- Bug does happen on sample Wikitude app

Step to reproduce :

- Sample Wikitude app for Unity using the Wikitude SDK 9.6 (or 9.7.1)

- Turn off "Multithreaded Rendering" in Player Settings - Other Settings

- In Scene "Camera Controls - Camera Settings", call CameraSettingsController.Restart() (or any custom function that will destroy then recreate the Wikitude Camera and trackers)


Expected :

- Wikitude Camera and trackers are recreated (with changed value on the Camera if any change has been made, i.e on "DesiredCameraResolution" or "EnableCamera2" like in the Restart function)

Result :

- App freezes and Unity console is flooded with following error :

AndroidPlayer(ADB@127.0.0.1:34999) allocation 0x0xc0000000 already registered @ ./Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:229 size 12464; now calling from ./Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:229 size 492?


Hi,


Thank you for reporting this issue. We'll investigate further and let you know as soon as we have any additional information.

May I ask what is the use-case you're trying to achieve? Perhaps we can find a workaround until the final fix is in place.


Best regards,

Alexandru

Hi again,


I have one follow-up question:

  • Are you using Unity Expert Edition or Professional Edition


Thank you,

Alexandru

Hi, We are using Unity Professional Edition. Our camera is at a fixed Resolution of "HD" to reduce performance cost. We want to increase the quality to "FULL HD" when the user wants to take a picture/screenshot of what is displayed by the camera. For that we need to destroy then recreate the camera and trackers, as stated in the documentation and forums It was working fine using a previous version of the SDK and Unity 2018.2 with the Multithreaded Rendering option off. But we upgraded to Unity 2020 and the latest SDK and it seems to not work anymore. Unfortunately we want to support Android 11, so we need to use the latest Wikitude SDK. Also another Asset we are using does not support Multithreaded Rendering at this time, so we can't turn it on. Best regards

Hello,


Any update on the subject ?


Best regards

Hi,


I tried reproducing this issue, but it didn't occur in my testing. I modified the Camera Settings sample to reset on demand and switch the camera resolution between switches and I didn't have any issues. Are you also switching between Camera1 and Camera2? Maybe that could be an issue on some devices, although it worked fine for me.


Is this issue happening on all devices, or just some?


Thank you,

Alexandru

Hello,


Here is the sample code we used :

 

    private IEnumerator RestartResolution() 
    {
        /* Destroy the existing ImageTracker and WikitudeCamera before creating them again. */
        Destroy(CurrentImageTracker.gameObject);
        Destroy(Camera.gameObject);

        /* Wait a frame before recreating everything again. */
        yield return null;

        Camera = GameObject.Instantiate(WikitudeCameraPrefab).GetComponent<WikitudeCamera>();
        Camera.DesiredCameraResolution = CaptureDeviceResolution.FullHD;
        CurrentImageTracker = GameObject.Instantiate(ImageTrackerPrefab).GetComponent<ImageTracker>();
        GameObject.Instantiate(WikitudeEyePrefab).transform.SetParent(CurrentImageTracker.transform.GetChild(0));
    }

 

 

    private IEnumerator RestartResolution() 
    {
        /* Destroy the existing ImageTracker and WikitudeCamera before creating them again. */
        Destroy(CurrentImageTracker.gameObject);
        Destroy(Camera.gameObject);

        /* Wait a frame before recreating everything again. */
        yield return null;

        Camera = GameObject.Instantiate(WikitudeCameraPrefab).GetComponent<WikitudeCamera>();
        Camera.DesiredCameraResolution = CaptureDeviceResolution.FullHD;
        CurrentImageTracker = GameObject.Instantiate(ImageTrackerPrefab).GetComponent<ImageTracker>();
        GameObject.Instantiate(WikitudeEyePrefab).transform.SetParent(CurrentImageTracker.transform.GetChild(0));
    }

 

 As you can see we are not switching between Camera1 and Camera2. The errors happen whether the application was built with the Camera2 enabled or not on the WikitudeCamera.


The only thing that we changed in the Wikitude Demo App SDK 9.6 was to turn OFF Multithreaded Rendering in the Player Settings.


The issue is happening on all devices (from Android 8 to Android 11).


Regards

Login or Signup to post a comment