-
Notifications
You must be signed in to change notification settings - Fork 3k
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: MoltenVK/Vulkan backend for macOS #7482
Conversation
i am not recommending anything. even said it's a dirty way. i didn't look into building/linking properly yet. |
video/out/vulkan/context_mac.m
Outdated
.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK, | ||
.pNext = NULL, | ||
.flags = 0, | ||
.pView = p->vo_macos.video, |
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.
segfaulted, until I have changed it to p->vo_macos.video.layer
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.
that's kinda interesting since the docs say something else https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkMacOSSurfaceCreateInfoMVK.html
on the other hand the moltenVK docs say something else and the layer is recommended KhronosGroup/MoltenVK@e546b83
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.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkMetalSurfaceCreateInfoEXT.html
this one should be used with the layer directly.
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.
VK_MVK_macos_surface is called obsolete here KhronosGroup/Vulkan-Tools#220, so maybe it's better to just use VK_EXT_metal_surface
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. i was planning to use the Metal Layer directly at some point anyway (i looked into metal surface ext beforehand), to reduce some redundancy and make it similar to cocoa-cb with its layer.
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.
no, i don't think i have enough time for that.
a little update. i finished unifying the two backends to get rid of a majority of all the code duplications. the cocoa-cb generalisation is completely done and properly cleaned up, and could possibly be merged independently. though there are no real benefits besides me not having to backport possible fixes from master. the molten backend still has to be cleaned up properly. |
2c3a49c
to
7a3e19f
Compare
5243559
to
a9e376e
Compare
some findings:
for myself building libplacebo so i don't forget it:
|
some more findings:
stats with the follwoing: |
includes for the molten stuff needs to be manually installed?
https://github.com/haasn/libplacebo/blob/5e517936c15583e3148f46d76135d63537617f9f/src/vulkan/swapchain.c#L164-L172 check why it picks an 8bit format even so 10/16bit formats are available. |
20af3e4
to
c6bb856
Compare
some more info:
some more info from recent testing with moltenvk 1.2.148.0 i updated to:
|
did some performance tests today. i couldn't find any sample or settings that would indicate any kind of performance difference, neither better nor worse, that weren't bottlenecked by decoding speed. only thing i noticed is that vsyncing on moltenvk is a tad more unstable so far. |
Download the artifacts for this pull request: |
Nice, thanks! I've did a quick test, looks very promising :) |
Download the artifacts for this pull request: |
i fixed/adjusted the precise timer. it's there for testing purpose mostly. when i started with this +2 years ago, moltenvk had some problems where the precise timing worked better than directly using the displaylink callback. it should be tested further, hence the new option to switch between 3 different modes. in the long run the precise timer should be removed and the proper presentation feedback should be used. this won't be done in the PR most likely. |
Download the artifacts for this pull request: |
Great. All 3 modes are working good. I'm not sure how to properly test this but playback, seeking, The only difference I can find is vsync jitter.
But anyway, I can't tell any difference without stats menu, so I'm fine with whatever mode. |
if it doesn't make any difference anymore, that's good. i found one issue with the precise timer. toggling fullscreen several times throws off the vsync in windowed mode on my end. everything fine in fullscreen. |
Hmm, works fine for me... |
i am done with this now and i am comfortable with it being merged.
also i am not quite sure about the commit message prefix. |
add support for vulkan through metal and a translation layer like MoltenVK. also add the possibility to use different render timing modes for testing. i still consider this experimental atm.
Download the artifacts for this pull request: |
have fun and happy testing. |
would this work with libmpv and ios as well? or would more work need to be done first? |
libmpv only has opengl support, if you run your own render loop. wid embedding ist not supported. so it won't work. also see my previous comment #7482 (comment) |
|
nothing else was claimed. it does not work currently with the code related to this PR. like you said yourself. the feature is not implemented. |
someone's ported it to ios via flurry which you can embed as a (heavy?) wrapped component inside a non-flurry ios project |
this is in a very early state. i still need to majorly clean this code up and kill all the code duplications. my goal is to have one code base to use in all the macOS backends (might be a bit tricky with libmpv/cocoa-cb). nothing really has been tested so far. it renders the video and the basic windowing stuff works.
TODO:
properly detect moltenvk(?)Bundle creation changesdoesn't work properly atm, needs to be fixed separately10bit checkneeds to be implemented in vulkan contextthough feel free to report any kind of problems you encounter.
simple and dirty way to install the dependencies:
python install_vulkan.py
ln -s vulkansdk-macos-1.2.131.2/macOS/lib/pkgconfig/vulkan.pc /usr/local/lib/pkgconfig/vulkan.pc
fixes #5571