-
Notifications
You must be signed in to change notification settings - Fork 50
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
WIP: Attempt to use IOSurface
on macOS
#95
base: master
Are you sure you want to change the base?
Conversation
It looks like `BytesPerRow` (the stride) has some kind of alignment requirement (testing on M1), that doesn't let us just use the width. So for this to work, softbuffer needs to expose the stride, and the user needs to deal with that... This doesn't seem to be showing the right thing even when width matches stride. Not sure why.
Ah, so this part is due to the alpha channel. https://developer.apple.com/documentation/corevideo/cvpixelformatdescription/1563591-pixel_format_identifiers doesn't list an |
We'll probably need to expose a So I think we'll ultimately want an API change like this. |
let blue = (x * y) % 255; | ||
|
||
buffer[index as usize] = blue | (green << 8) | (red << 16); | ||
let stride = buffer.stride(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, Android needs the same!
I would highly recommend looking into |
Is We need the |
Should we move this discussion over to #98 which is now open to discuss the API considering requirements of various platforms, not just limiting it to macOS here? FWIW such a crate could be provided behind a |
The Bonus if you do |
Yeah, that part gets back to #98. Unfortunately it seems we need to use RGBA on some platforms for no-copy presentation.... So I think we've settled on this solution for macOS, it's just that it requires breaking API changes, and we may want to do that along with #98. |
Well right now you say |
It looks like
BytesPerRow
(the stride) has some kind of alignment requirement (testing on M1), that doesn't let us just use the width. So for this to work, softbuffer needs to expose the stride, and the user needs to deal with that...This doesn't seem to be showing the right thing even when width matches stride. Not sure why.