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

Simplify EGL/GLFW/SDL/GLUT/Browser canvas access. NFC #23614

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 6, 2025

All of these frameworks still use Module['canvas']. This change simplifies and unifies the access to the canvas to single helper function per library.

As a followup we may want to extend this to all use of Module['canvas'].

@sbc100 sbc100 requested review from kripken and brendandahl February 6, 2025 19:12
All of these frameworks still use `Module['canvas']`.  This change
simplifies and unifies the access to the canvas to single helper
function.
@sbc100 sbc100 changed the title Simply EGL/GLFW/SDL/GLUT canvas access. NFC Simply EGL/GLFW/SDL/GLUT/Browser canvas access. NFC Feb 6, 2025
@sbc100 sbc100 changed the title Simply EGL/GLFW/SDL/GLUT/Browser canvas access. NFC Simplify EGL/GLFW/SDL/GLUT/Browser canvas access. NFC Feb 6, 2025
@sbc100 sbc100 enabled auto-merge (squash) February 6, 2025 21:07
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the impact on code size?

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 6, 2025

What is the impact on code size?

We don't have codesize tests for any of these frameworks, but I imagine it can only be positive since it avoid duplicating the string canvas a bunch of times. I'll do a comparison for a simple SDL example.

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 6, 2025

For browser.test_sdl_alloctext I see a tiny regression from 157890 to 157905 bytes of JS (0.09%)

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 6, 2025

For test_sdl_image_prepare_data_closure_webonly that uses closure I see a size reduction from 98389 to 98326 (0.06%)

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for measuring.

@sbc100 sbc100 merged commit a9651ff into emscripten-core:main Feb 6, 2025
29 checks passed
@sbc100 sbc100 deleted the getCanvas branch February 6, 2025 22:24
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