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: Limit WebGL contexts in use by replacing thumbnails with snapshots when done #517

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

gwhitney
Copy link
Collaborator

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


Resolves #506.

Also adds a method to the VisualizerInterface that indicates whether the visualizer uses WebGL. This could/should probably be used in testing to determine which tests use WebGL rather than checking the name of the visualizer, but that would be a different PR.

Also makes a baby step toward trying to understand the sporadic failures of the "minimizing a tab" e2e test in scope.test.ts.

@katestange
Copy link
Member

Query: how is the order of thumbnail ordering chosen? On my computer it seems to choose rather randomly (not the first 8 thumbnails).

@gwhitney
Copy link
Collaborator Author

Well, when each thumbnail starts up, it looks at the count of how many have already started up, and if it's less than 8, it displays, otherwise it waits. So the browser's async call scheduler is determining the order, maybe together with how many times each specimen card happens to yield control via an async or await call. In other words, the current scheme doesn't allow much control over the ordering. If it's important that they appear to fill in with the same ordering as they appear in the switcher (left to right, top to bottom), I'll have to come up with another scheme... Let me know.

@katestange
Copy link
Member

No, I don't think fussing over the ordering is necessary for alpha, and will be naturally revisited later when we get to the later stages of this webgl thumbnail management after alpha. Ok, well, I can't break it by messing around and it passes all tests on my machine, etc. I can't think of anything to improve, so I'll merge!

@katestange katestange merged commit b275244 into numberscope:ui2 Dec 13, 2024
2 checks passed
gwhitney added a commit that referenced this pull request Jan 20, 2025
…ots when done (#517)

* feat: keep count of how many thumbnail gl contexts in use

* feat: limit Thumbnails to 8 WebGL graphics contexts

* refactor: replace thumbnail canvases with snapshot images when done

* feat: If a WebGL graphics context not available for thumbnail, wait
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