Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on multi-app #6388

Closed
LeXXik opened this issue May 16, 2024 · 2 comments · Fixed by #6645
Closed

Question on multi-app #6388

LeXXik opened this issue May 16, 2024 · 2 comments · Fixed by #6645
Assignees

Comments

@LeXXik
Copy link
Contributor

LeXXik commented May 16, 2024

There was a question on Discord, so decided to put it here, as I am not sure if it is an error. If you change the multi-app example to start with two WebGL2 instances, only the last one starts. Is this an expected behavior? If set to WebGPU - both apps start normally.

image

image

@kungfooman
Copy link
Collaborator

Definitely fishy and it starts working if you don't make all the code dependent on the single font asset.

Why don't make the cube rotate just because the font isn't loaded?

You can remove lots of intendation that way aswell, it only requires this:

    app.on('update', (/** @type {number} */ dt) => box.rotate(10 * dt, 20 * dt, 30 * dt));
    assetListLoader.load(() => {
        textOutline.addComponent('element', {
            pivot: new pc.Vec2(0.5, 0.5),
            anchor: new pc.Vec4(0.5, -0.2, 0.5, 0.5),
            fontAsset: assets.font.id,
            fontSize: 130,
            text: text,
            color: new pc.Color(1, 0.9, 0.9),
            outlineColor: new pc.Color(0, 0, 0),
            outlineThickness: 1,
            type: pc.ELEMENTTYPE_TEXT
        });
    });

But I think it should work anyway, so something seems to cause issues when loading two assets at the same time, maybe some kind of static variable reuse conflict?

@kungfooman
Copy link
Collaborator

kungfooman commented May 16, 2024

I went a bit with RuntimeTypeInspector over this example and it also found Infinity calculations (because 1 / device.width where device width is 0 when I add/remove a bunch of WebGL2 apps). I don't know why it happens but when it happens it even continues triggering this error even though all apps are seemingly removed:

image

Add conditional breakpoint device.width === 0 at pc.ForwardRenderer.prototype.setSceneConstants (double click evaluated function in F12/DevTools)

Also happens in https://playcanvas.github.io/#/misc/multi-app (a bit older, still does WebGL1, but same issue)

@kpal81xd kpal81xd self-assigned this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants