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

When the context is lost, silently ignore failed shader compilation #5644

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Sep 18, 2023

When the context is lost, all gl functionality should silently work, but gl.createShader returns null (which documentation of the function does not mentioned). This generates an error in the application.

The solution in this PR is to silently ignore shader compilation / linking errors when the device is lost, as those are compiled again when the device is restored, avoiding logging errors without real error message.

Related to https://forum.playcanvas.com/t/what-cause-webgl-context-lost/32886

Tested using CompileShader example, modified to compile a shader each frame - the errors are gone and all works correctly when the context is restored.

@mvaligursky mvaligursky self-assigned this Sep 18, 2023
@mvaligursky mvaligursky added bug area: graphics Graphics related issue labels Sep 18, 2023
@mvaligursky mvaligursky merged commit bdf8eac into main Sep 18, 2023
7 checks passed
@mvaligursky mvaligursky deleted the mv-shader-error-device-lost branch September 18, 2023 12:03
@figo2264
Copy link
Contributor

Can I simply cheery pick webgl-shader.js file and apply it to 1.65.3 version?

@mvaligursky
Copy link
Contributor Author

Yep that should work without a problem @figo2264

mvaligursky added a commit that referenced this pull request Sep 25, 2023
…5644)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants