exokitxr / exokit

Native VR/AR/XR engine for JavaScript 🦖

Home Page:https://exokit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aframe 0.9.2 crash

extraymond opened this issue · comments

Describe the bug

Aframe app won't load starting from version 0.9.2.

Error log

Error: Compositor error: VRCompositorError_TextureUsesUnsupportedFormat                                                                                                                                    [608/5809]
    at _submitFrame (/media/user/storages/git/exokit/src/index.js:1219:42)
    at Immediate._topRenderLoop (/media/extraymond/storages/git/exokit/src/index.js:1314:11)    

Downgrading to 0.9.0 works

To Reproduce
Build demo app with aframe 0.9.2

System information:

  • OS: Ubuntu 18.04

  • Exokit Version mater branch

  • Node version v11.15.0

What is the GPU in this repro?

RX 480 with steamvr+padoka ppa: ppa

Thanks, I suspect that's the issue. Do you know what texture formats StreamVR supports with this driver setup?

I'm not sure where to find that info, I will try it later.

Having tested both 0.9.0 0.9.1 0.9.2, this issue is started after 0.9.1, is there any way I can find the corresponding code path in aframe that caused this behavior?

I think it would be easier to bisect from their change logs.

Change log from 0.9.1 release

Things that seems to relate to texture or introduce major breakage would be:

  1. Use a fork of anime.js that has memory improvements from Kevin (#4028).
  2. Detaching entity from scene will preserve component data. Add
    Entity.destroy() method to clear components and return their memory to the
    pool (#4121).

Is there a reproduction case, or is this happening with anything that uses A-Frame?

It could be that some texture gets destroyed prematurely, or a resize at the wrong time messes up the framebuffer.

I would actually start with logging what's coming into the submit frame call -- Is it the first submit that fails? Or is something changing on VR entry, or a subsequent frame? Does this also happen in 2D mode (-x none)?

Ah! I forget to add that, the app loads into 2D(app window), but would never go into VR. It's not crashing the whole thing, just not going into VR as it should. It might be something to do with what you said VR entry.

I tried the Hello world setup from aframe, still not working, it's safe to say that since such simple setup caught the bug, more complex scenes would be affected too.

<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>

Blank scene with single entity not working either.

@extraymond Does -x webvr enter VR for your case?

Sorry for the delay. Unfortunately adding -x webvr isn't working either.

At that point I would look into A-Frame and see why it isn't attempting to start the VR render loop.

Hi! After Some testing, here's some additional info that might help.
Version prior to 0.9.1 get this crash when trying to pre-load images in a-assets, it goes crashing without any external resources starting from 0.9.1.

Since in aframe, a-asstes are loaded via XHR request instead of fetch api, that might be a reason that caused this error.

If I preload assets using fetch api, and attach them to entities, the program works.

Another thing I noticed, is that comparing between -x none and -x webvr, when loading assets via fetch-api, webvr mode works while none mode will unable to load texture:

THREE.WebGLState: Error: WebGLRenderingContext::TexImage2D: invalid texture argument
    at Object.A [as texImage2D] (https://aframe.io/releases/0.9.0/aframe.min.js:98:26256)
    at M (https://aframe.io/releases/0.9.0/aframe.min.js:99:3348)
    at we.y [as setTexture2D] (https://aframe.io/releases/0.9.0/aframe.min.js:98:30577)
    at Re.setTexture2D (https://aframe.io/releases/0.9.0/aframe.min.js:100:9212)
    at Ft._t [as setValue] (https://aframe.io/releases/0.9.0/aframe.min.js:97:23927)
    at Function.Wt.upload (https://aframe.io/releases/0.9.0/aframe.min.js:109:8142)
    at M (https://aframe.io/releases/0.9.0/aframe.min.js:99:27748)
    at Re.renderBufferDirect (https://aframe.io/releases/0.9.0/aframe.min.js:100:6115)
    at x (https://aframe.io/releases/0.9.0/aframe.min.js:99:22431)
    at y (https://aframe.io/releases/0.9.0/aframe.min.js:99:22087)

But when loading assets via a-asstes instead of fetch-api, none mode works while webvr mode crashed with the same crash message that started this issue.

I was thinking that a potential root cause for this is that, when putting external media resources in a-assets, a-frame will try to get all resources with XHR request and receive them as text response, but if they are loaded via fetch-api, developers can use file reader and readAsDataUrl to convert blob into url object.

Aframe might be doing something different at first launch, that changes how assets are imported and rendered in the application, hence the crash when unexpected format is retrieved.