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(web): use softbuffer to draw into the canvas #191

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Conversation

CBenoit
Copy link
Member

@CBenoit CBenoit commented Sep 8, 2023

cc @ngirot-devolutions

Instead of copying and sending image buffers to JavaScript, the WASM module now draws into the canvas by itself.
This removes some overhead associated with the previous approach and open the door for further optimizations.

In order to achieve good performance, the newest API of [email protected] is used: the "owned buffer" that can be written into by us with direct access and present_with_damage to apply partial updates.
The presentation itself is currently not yet "no-copy" in the case of the web backend because the current API of softbuffer is expecting a pixel buffer in the BGRX format while the underlying canvas can only takes RGBA pixels. There is an open issue for this.

There was a bug with the present_with_damage implementation for the web backend.
I fixed the issue and opened a PR to upstream the patch: rust-windowing/softbuffer#150
The cargo dependency patch will be removed once the fix is published on crates.io.

Issue: ARC-164

@CBenoit CBenoit requested a review from pacmancoder September 8, 2023 20:43
@CBenoit CBenoit enabled auto-merge (squash) September 8, 2023 20:44
@CBenoit CBenoit disabled auto-merge September 8, 2023 20:45
@CBenoit CBenoit enabled auto-merge (squash) September 8, 2023 20:45
Copy link
Contributor

@pacmancoder pacmancoder left a comment

Choose a reason for hiding this comment

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

Looks nice! 👍

@CBenoit CBenoit merged commit 9d33cad into master Sep 8, 2023
@CBenoit CBenoit deleted the ARC-164 branch September 8, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants