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

Fix Texture rebuild on context lost #13299

Merged
merged 2 commits into from
Nov 30, 2022
Merged

Fix Texture rebuild on context lost #13299

merged 2 commits into from
Nov 30, 2022

Conversation

sebavan
Copy link
Member

@sebavan sebavan commented Nov 30, 2022

@azure-pipelines
Copy link

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@azure-pipelines
Copy link

@Popov72
Copy link
Contributor

Popov72 commented Nov 30, 2022

See https://forum.babylonjs.com/t/context-restore-for-textures-with-bloburl-not-working/36114, it seems it is not enough, the restored texture is Y inverted...

RaananW
RaananW previously approved these changes Nov 30, 2022
@Popov72
Copy link
Contributor

Popov72 commented Nov 30, 2022

One way to fix the problem is to remove this (in thinEngine._createTextureBase):

if (fromBlob && !this._doNotHandleContextLost) {
    // We need to store the image if we need to rebuild the texture
    // in case of a webgl context lost
    texture._buffer = img;
}

As _buffer will be null, the original url will be used instead ("blob:...") when recreating the texture after the context lost and it will work. But maybe for some other types of blob urls it would not work...

Without removing this block of code I could not make it work. Currently, _buffer is what is used to recreate the texture after a context lost (when the texture has been created from a blob in the first place) and even by setting invertY=false before calling engine.createTexture the texture is not re-inverted...

@sebavan
Copy link
Member Author

sebavan commented Nov 30, 2022

I ll have a look in a bit thanks for the feedback :-)

@sebavan sebavan enabled auto-merge November 30, 2022 16:30
@sebavan sebavan merged commit dcfed6c into BabylonJS:master Nov 30, 2022
RaananW pushed a commit that referenced this pull request Dec 9, 2022
Fix Texture rebuild on context lost

Former-commit-id: ef8ac3bf0bbb8845a828d842aa981c2d3e5b3f47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants