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

Update to softbuffer 0.3, tracking up to age sets of primitives #2190

Closed
wants to merge 1 commit into from

Conversation

ids1024
Copy link
Contributor

@ids1024 ids1024 commented Jan 9, 2024

This should perform better on Windows, Wayland, and X11, and the same of macOS. (rust-windowing/softbuffer#95 would allow macOS to also perform better here.)

I've done basic testing on Wayland and Windows. I haven't tested X11 or macOS yet. I'm not sure how best to check the profile the performance impact.

The latest version of softbuffer is 0.4, which uses raw-window-handle 0.6. That probably will need #2169, and maybe an update to wgpu (which has updated to raw-window-handle 0.6, but hasn't released a change with that yet).

It should also be possible to make use of Softbuffer's present_with_damage, if we can get damage regions relative to the last present (not necessarily the same buffer). Some backends can benefit from that.

I did run into an issue with buffer age in softbuffer, which I seem to have made a small mistake in the Wayland implementation of (rust-windowing/softbuffer#191). If everything else is fine, I can probably do a patch release with that for both Softbuffer 0.3 and 0.4. But currently this uses a git dependency with that patch.

@ids1024
Copy link
Contributor Author

ids1024 commented Jan 11, 2024

Well, it crashes when I try to run on macOS, but I guess #2113 is the issue there.

@ids1024
Copy link
Contributor Author

ids1024 commented Jan 11, 2024

MacOS can be tested with softbuffer 0.4 in #2191, since winit 0.29 fixes that issue.

and the same of macOS

It seems I was misremembering. It's a bit awkward to implement buffer swapping with how the macOS backend works, so .age() on macOS currently always returns 0. So this loses damage tracking on macOS. Though it does avoid a copy during presentation.

Softbuffer could internally copy from a buffer, but I guess that would add unnecessary overhead for applications not using incremental rendering.

That may be fine for now though. In previous discussion it was noted that Metal and thus wgpu should be pretty widely supported on macOS, so the software rendering fallback isn't as important there. It it also still performs pretty well, on an M1 Mac at least.

@ids1024 ids1024 marked this pull request as ready for review January 11, 2024 02:27
@ids1024
Copy link
Contributor Author

ids1024 commented Jan 11, 2024

I've released softbuffer 0.4.1 and 0.3.4 with that fix.

This seems to work correctly across platforms. Other than that limitation on macOS, I think this is an overall improvement.

Having Iced updated here should also be handy for testing relevant improvements in softbuffer.

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.

1 participant