roderickc / wine-vulkan

Other
53 stars 7 forks source link

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

Closed oscarbg closed 6 years ago

oscarbg commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Just copy vulkan.c from winex11 into the Mac driver and replicate some of the logic. That's all what is needed. Winevulkan will leverage the functionality when available.

On Feb 7, 2018 11:13 AM, "Oscar Barenys" notifications@github.com wrote:

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..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/roderickc/wine-vulkan/issues/8#issuecomment-363877931, or mute the thread https://github.com/notifications/unsubscribe-auth/ATd3y6TdbGqtXLZHUZaEKlnLZpGNJUSOks5tSfXjgaJpZM4R1ZLU .

oscarbg commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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

Chidorin commented 6 years ago

any new info?

roderickc commented 6 years ago

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

roderickc commented 6 years ago

Support has been implemented in Wine now.

oscarbg commented 6 years ago

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

oscarbg commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

johnothwolo commented 6 years ago

@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
roderickc commented 5 years ago

Moltenvk support is already implemented in upstream Wine. Applications probably work. Be aware moltenvk may not support all vulkan features needed for dx12 or dxvk.

On Wed, Apr 17, 2019, 4:12 PM The-SamminAter notifications@github.com wrote:

I know that this seemed to die around Jul/Aug 2018, but I'm wondering if any progress has been made towards/can this be used to run DX10/11 Windows applications on macOS w/ Wine?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roderickc/wine-vulkan/issues/8#issuecomment-484295254, or mute the thread https://github.com/notifications/unsubscribe-auth/AE3XPS5ZQ7LZMHNKCGYKQNTPQ6VEJANCNFSM4EOVSLKA .