Skip to content

Use state guard in WebGL constructor#1603

Merged
LaurenzV merged 3 commits into
mainfrom
laurenz/fb
Apr 27, 2026
Merged

Use state guard in WebGL constructor#1603
LaurenzV merged 3 commits into
mainfrom
laurenz/fb

Conversation

@LaurenzV
Copy link
Copy Markdown
Collaborator

Another bug that makes it evident that we should work on a better abstraction for our WebGL backend soon to avoid subtle state bugs! Note that this is only a bandaid fix until we have a better abstraction in place.

Currently, when constructing a new WebGlRenderer, we end up leaving a different framebuffer bound tot he WebGL2 context. As a result. when trying to create a second renderer, we hit a panic because DEPTH_BITS ends up being 0. For now, the solution is to simply use a state guard in the constructor so that the default framebuffer is bound again in the end.

It's possible that we currently have other functions that result in leaked framebuffers, I haven't checked that yet. As mentioned, this is just a bandaid fix for this specific bug.

@LaurenzV LaurenzV requested a review from taj-p April 27, 2026 06:20
@LaurenzV LaurenzV added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 4cbd755 Apr 27, 2026
17 checks passed
@LaurenzV LaurenzV deleted the laurenz/fb branch April 27, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants