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

Can add support for wine-vulkan on Macos by linking to MoltenVK Vulkan wrapper? #8

Closed
oscarbg opened this Issue Feb 1, 2018 · 20 comments

Comments

Projects
None yet
9 participants
@oscarbg

oscarbg commented Feb 1, 2018

Don't know if much work but MoltenVK since recent releases ships with a dynamic library (dylib on macos world) which should be more or less equivalent to libvulkan.so on Linux and maps calls to Metal.. can support that?
thanks..

@jozefkucia

This comment has been minimized.

Contributor

jozefkucia commented Feb 1, 2018

This requires support for MoltenVK specific WSI extensions. I think it could be potentially integrated into the winemac driver.

It's also more reasonable to upstream Vulkan support for one Wine display driver (winex11) before starting the work on other display drivers (e.g. winemac).

@roderickc

This comment has been minimized.

Owner

roderickc commented Feb 3, 2018

This is definitely something which can be done long-term (I don't have a Mac). It will likely be relatively easy as my work likely gets us 90% there or so. The only issue is that I believe only 64-bit software can be supported as Metal is 64-bit only, but I may be wrong.

@oscarbg

This comment has been minimized.

oscarbg commented Feb 7, 2018

thanks.. good to know..
regarding Metal 64 bit only let me see.. also can point some suggestions/tentative plan on how to approach adding Macos MoltenVK support (even in some crude way) in the fastest way possible, so I may be able to implement it..

@roderickc

This comment has been minimized.

Owner

roderickc commented Feb 7, 2018

@oscarbg

This comment has been minimized.

oscarbg commented Feb 11, 2018

@roderickc good news seems Metal is universal right now (10.13.4) (32bits also)
see:
Metal: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64]
Metal (for architecture i386): Mach-O dynamically linked shared library i386
Metal (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64

but you know Apple says 32bit may be removed in 10.14 Macos coming later this year..

what's sad is that MoltenVK for Macos right now (0.19) is 64bit only.. on both static and dynamic libs shipped..
ping @billhollings can you add 32bit support to MoltenVK Macos?

file libMoltenVK.dylib
libMoltenVK.dylib: Mach-O 64-bit dynamically linked shared library x86_64
otool -L MoltenVK
Archive : MoltenVK
MoltenVK(MoltenVK-x86_64-master.o):
MoltenVK(MoltenSPIRVToMSLConverter-x86_64-master.o):

@billhollings

This comment has been minimized.

billhollings commented Feb 12, 2018

@oscarbg

Can you point me to your sources that indicate 32-bit support for Metal on OSX, please?

As far as I know...Metal does not support 32-bit apps.

@oscarbg

This comment has been minimized.

oscarbg commented Feb 12, 2018

@billhollings
no sources.. as you see I was fool enough to think that Metal framework being a universal binary having 32 bit library included implied Metal supported 32 bit apps..
from what I understand then reading your link seems that some Metal API call will fail altough a Metal app can be perfectely compiled to 32bit..
that is sad as that should allow with Wine Vulkan linking to your MoltenVK library to have support for running 32bit Windows Vulkan games.. that is not much bad as current Vulkan games like Doom 2016 and Wolfenstein II are 64 bit apps.. sad is that by using https://github.com/doitsujin/dxvk we could run 32bit DX11 apps by translating to 32bit Vulkan calls.. (there are a lot running right now using DXVK like Tomb Raider 2013, Hitman Absolution, Unigine Heaven/Valley, Crysis2,Witness,etc..)( that should need 32bit Vulkan support in your MoltenVK lib for Wine Vulkan to expose but as you link to Metal, Metal must support 32bit also.. very bad.. Apple should enable 32bit Metal support and then you in your MoltenVK product for projects like Wine Vulkan..
anyway even with only 64bit support for D3D11 64bit games like Murdered Soul Suspect that work under DXVK+Wine Vulkan could work on Macos if we get Wine Vulkan MacOS support (linking to MoltenVK) and you support what Vulkan support(extensions,optional caps) DXVK makes use to work..

Also assuming Wine for Mac gets Vulkan support using your MoltenVK product you should evaluate two things:
*Sell a consumer version of MoltenVK (without logo,etc..) for people wanting to run Vulkan Windows games or emulators like RPCS3 on Mac etc:
MoltenVK isn't buyed by a developer for porting/implementing a game but by a general user for running existing Vulkan Windows apps on Mac..
*Prioritize MoltenVK development towards features/capabilities needed by games like Doom/Wolfenstein/RPCS3/DXVK to run correctly..

what do you think?

@billhollings

This comment has been minimized.

billhollings commented Feb 12, 2018

@oscarbg Good news!

In the next several months, MoltenVK will be moving to an open-source model. That will open up opportunities for people to modify or fork MoltenVK in ways that cannot be supported at present.

Stay tuned!

@zakk4223

This comment has been minimized.

zakk4223 commented Feb 13, 2018

Around the time that the issue with DOOM on linux were solved in wine, i attempted to get it to run with MoltenVK. I successfully hacked up the wine 'passthrough' vulkan support to call out to MVK. Unfortunately at the time it didn't support some surface types so Doom would launch but there was just a black screen.

However, I was able to successfully run some Vulkan test apps and a few simple demos. So I think this approach is doable. The 32bit/64bit thing may be an issue, though. I may see if I still have that code laying around and give it another shot with a newer MoltenVK release.

I'm glad to hear MoltenVK is moving towards an open source model. That'll be great for things like this.

@oscarbg

This comment has been minimized.

oscarbg commented Feb 14, 2018

@billhollings that news are impressive!! hoping MoltenVK will get much interest from community and evolve even faster.. just a question: are you doing something with tesselation support or that will be work for the community to implement?

@zakk4223 "I successfully hacked up the wine 'passthrough' vulkan support to call out to MVK" you cannot say this and not try find where you stored this hack and post on github.. :-) at least I will greatly appreciate the effort..

@billhollings

This comment has been minimized.

billhollings commented Feb 14, 2018

@oscarbg Tessellation is definitely on the development path...but is currently not prioritized for active development. Once MoltenVK goes open-source...then certainly...developers that place a higher priority on that can certainly contribute to its development.

@yapus

This comment has been minimized.

yapus commented Feb 27, 2018

well, it just happen, MolenVK is now open-source....

@Chidorin

This comment has been minimized.

Chidorin commented Apr 18, 2018

any new info?

@roderickc

This comment has been minimized.

Owner

roderickc commented Apr 21, 2018

It is possible for someone to implement MoltenVK support. However myself I'm not a Mac user, so unable to do the work.

@roderickc

This comment has been minimized.

Owner

roderickc commented Jul 14, 2018

Support has been implemented in Wine now.

@roderickc roderickc closed this Jul 14, 2018

@oscarbg

This comment has been minimized.

oscarbg commented Jul 15, 2018

thanks! next step complete world domination with Wine Vulkan Android support :-)

@oscarbg

This comment has been minimized.

oscarbg commented Jul 25, 2018

Hi,
just tested Wine Vulkan Macos support and works nice with lots of @SaschaWillems Vulkan demos, even https://github.com/SaschaWillems/Vulkan-glTF-PBR, also https://github.com/Novum/vkQuake is working..
must test PPSSPP and Dolphin next..
just before wasting much time, @roderickc @jozefkucia can share if vkd3d is buildable in Macos so that jointly with Wine Vulkan on Macos we can test Wine D3D12 support on MacOs too..
D3D12->Vulkan via VKD3D and Vulkan->Metal via MoltenVK on Macos?
thanks..
Oscar.

@petmac

This comment has been minimized.

petmac commented Jul 25, 2018

Did you compile wine yourself? I tried the package from:
https://dl.winehq.org/wine-builds/macosx/pool/winehq-devel-3.13.pkg

When I tested wine64 vkQuake.exe, the log indicated that it was compiled without Vulkan support. Alexandre Julliard confirmed to me by email that the build box doesn't have it yet.

@oscarbg

This comment has been minimized.

oscarbg commented Jul 25, 2018

Yep.. As you point build isn’t Vulkan enabled.. similarly Wine builds aren’t vkd3d enabled even on Linux..

@johnothwolo

This comment has been minimized.

johnothwolo commented Aug 16, 2018

@oscarbg I managed to build vkd3d, but the demos segfault on xorg. Probably a MoltenVK limitation.

[mvk-debug] Initializing MoltenVK timestamping. Mach time: 70361081696519. Time period: 1 / 1 = 1.000000.
[mvk-info] MoltenVK version 1.0.17. Vulkan version 1.0.82.
[mvk-info] GPU device:
		model: Intel HD Graphics 4000
		type: Integrated
		vendorID: 0x8086
		deviceID: 0x0166
		pipelineCacheUUID: 00000000-0000-0000-0000-271300002721
	supports the following Metal Feature Sets:
		macOS GPU Family 1 v3
		macOS GPU Family 1 v2
		macOS GPU Family 1 v1
err:vkd3d_check_extensions: Required device extension "VK_KHR_maintenance1" is not supported.
err:vkd3d_check_extensions: Required device extension "VK_KHR_shader_draw_parameters" is not supported.
[***MoltenVK ERROR***] VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_maintenance1 is not supported.
[***MoltenVK ERROR***] VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_KHR_shader_draw_parameters is not supported.
[mvk-debug] Performance to compile MSL source code into a MTLLibrary curr: 56.359 ms, avg: 56.359 ms, min: 56.359 ms, max: 56.359 ms, count: 1
[mvk-debug] Performance to access MTLCommandQueue curr: 0.335 ms, avg: 0.335 ms, min: 0.335 ms, max: 0.335 ms, count: 1
[mvk-info] Created VkDevice to run on GPU Intel HD Graphics 4000
Segmentation fault: 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment