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

Feat: add context loss set up to WebGL #10094

Merged
merged 8 commits into from
Jan 11, 2024

Conversation

GoodBoyDigital
Copy link
Member

WebGL now loses context without exploding. You won't even notice it happened!

Added test also

@GoodBoyDigital GoodBoyDigital added this to the v8.0.0-rc.3 milestone Jan 10, 2024
Copy link

codesandbox-ci bot commented Jan 10, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2124cd4:

Sandbox Source
pixi.js-sandbox Configuration

* make tests reuse the renderer

* doc update

* fix lint

* increase jest

---------

Co-authored-by: Zyie <24736175+Zyie@users.noreply.github.com>
@GoodBoyDigital GoodBoyDigital merged commit b0e0554 into chore/v8-svg-image Jan 11, 2024
3 checks passed
@GoodBoyDigital GoodBoyDigital deleted the chore/v8-webgl-context-loss branch January 11, 2024 13:47
@Zyie Zyie changed the title added context loss set up to WebGL Feat: support context loss set up to WebGL Jan 11, 2024
@Zyie Zyie changed the title Feat: support context loss set up to WebGL Feat: add context loss set up to WebGL Jan 11, 2024
@tgrajewski
Copy link

I might be wrong, but that doesn't look like a valid code:

        // Restore the context after this event has exited
        setTimeout(() =>
        {
            if (this.gl.isContextLost() && this.extensions.loseContext)
            {
                this.extensions.loseContext.restoreContext();
            }
        }, 0);

What I mean specifically is that the function restoreContext() isn't meant to be called in production, it's only for debugging purposes. Which also means that there is no way to restore GPU context on demand, the browser decides about it, not JS application.

@GoodBoyDigital
Copy link
Member Author

I might be wrong, but that doesn't look like a valid code:

        // Restore the context after this event has exited
        setTimeout(() =>
        {
            if (this.gl.isContextLost() && this.extensions.loseContext)
            {
                this.extensions.loseContext.restoreContext();
            }
        }, 0);

What I mean specifically is that the function restoreContext() isn't meant to be called in production, it's only for debugging purposes. Which also means that there is no way to restore GPU context on demand, the browser decides about it, not JS application.

ooops :) You are totally correct! Thankyou for pointing out - let me address that

@GoodBoyDigital
Copy link
Member Author

fixed here -> https://github.com/pixijs/pixijs/pull/10111/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants