Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upRequirements for DXVK support.. #203
Comments
billhollings
added
enhancement
help wanted
labels
Jul 27, 2018
This comment has been minimized.
This comment has been minimized.
johnothwolo
commented
Aug 15, 2018
|
How did you get wine to recognise moltenVK? I get
|
This comment has been minimized.
This comment has been minimized.
|
I think had some issues but copied everywhre /lib /usr/lib /usr/local/lib.. |
This comment has been minimized.
This comment has been minimized.
KenThomases
commented
Aug 15, 2018
|
You configure with LDFLAGS="-L/path/to/the/MVK/libdir". At runtime, you need to set the DYLD_FALLBACK_LIBRARY_PATH environment variable to contain the same path. However, System Integrity Protection will strip any DYLD_* environment variables when a system executable is run and that included shell script interpreters. So, depending on how you're running Wine, you may need to take extra measures. If you're running your own build using the top-level "wine" script, create a file names .winewrapper next to it that contains "export DYLD_FALLBACK_LIBRARY_PATH=/path/to/the/MVK/libdir:/usr/lib". That will be automatically sourced by the wine script at a point after SIP has done its stripping. If you're running an installed Wine, then the "wine" command may be just the Wine loader program, not a shell script. In that case, SIP is not involved. |
This comment has been minimized.
This comment has been minimized.
iain-benson
commented
Aug 21, 2018
|
I've been experimenting with this on my fork (https://github.com/iain-benson/MoltenVK/tree/dx11), as I was hoping to play Witcher 3 on the Mac, without rebooting.
It gets further, and starts setting up the shader modules, but the conversion of the SPIR-V code fails as it tries to use an undefined method spvTexelBufferCoord. I am fully aware the changes I made wouldn't actually result in a working system, but I was looking to see what work was required, and will continue attempting to implement what I can, to see if I can get anything working. |
oscarbg
referenced this issue
Aug 26, 2018
Closed
Questions: supports creating a dynamic library ".dylib" on Macos? VKD3D support? #136
This comment has been minimized.
This comment has been minimized.
|
Hi @iain-benson,
just for curiosity what MoltenVK version are you using? from 1.1.82? |
kergoth
added a commit
to kergoth/Proton
that referenced
this issue
Aug 27, 2018
This comment has been minimized.
This comment has been minimized.
|
So far, of those extensions, I've implemented I still need to investigate the core Vulkan features that DXVK needs but MoltenVK doesn't have yet. |
This comment has been minimized.
This comment has been minimized.
|
Amazing work @cdavis5e !! |
This comment has been minimized.
This comment has been minimized.
banzr
commented
Sep 2, 2018
•
|
Hey, I'd love to help but I'm not sure where to start. Can someone help fill me in on what references/documentation are out there? Thanks! I stumbled on this while trying to install Steam Proton on my macbook pro. I'm a Sr CS undergrad with no experience with DXVK or vulkan, but I am very familiar with C/C++. |
This comment has been minimized.
This comment has been minimized.
|
Hi @banzr, hope it helps (a little).. |
This comment has been minimized.
This comment has been minimized.
|
SPIRV-Cross #675 should fix the issue with |
This comment has been minimized.
This comment has been minimized.
|
@cdavis5e I see you are contributing lots of SPIRV-Cross patches/improvements too.. thanks..
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@oscarbg Yes, these are to fix bugs in MoltenVK for Real support for cull distances (which DXVK apparently wants to create a device at all) might be difficult, though: Metal doesn't support them directly, so we'd probably need to have some sort of pre-processing stage to support that at all. In the meantime, I wonder if we could get away with saying we have it even though we don't. Logic op is similar, though I'm less sanguine about the prospects for emulating that one. The big ones, of course, are geometry and tessellation shaders. Since Metal doesn't directly support tessellation control (hull) or geometry shaders, those need preprocessing similar to cull distances. My plan right now is to run these shaders as part of a compute pipeline that runs right before the graphics pipeline. This is the way Apple actually recommends tessellation be done. I think we can fully support geometry shaders this way, too. Supporting the two together will be a real pain, though, since we'll need to run three preprocessing steps before we can run the graphics pipeline: the vertex and tess. control shader in a compute kernel, the tessellator and tess. evaluation (domain) shader, then the geometry shader in another compute kernel. I think it should be possible to just turn on |
This comment has been minimized.
This comment has been minimized.
KenThomases
commented
Sep 9, 2018
|
This may not be a good idea, but it's possible to do geometry shading in a Metal vertex shader if you change the draw command. See my StackOverflow answer here. This is mostly useful if rasterization is enabled, since it can feed directly into the rasterizer stage without switching from render to compute and back to render. My SO answer was mostly contemplating hand translation. For automated translation, you'd generate code that parallels the geometry shader much more closely (because you pretty much have to). The "emit" operations would, first, track which output primitive and vertex within that primitive they're working on. Then, they'd check if the current output primitive and vertex are the ones for the current thread/invocation. If so, they'd set the output value. If not, they'd do nothing. |
This comment has been minimized.
This comment has been minimized.
|
@billhollings many thanks for updating SPIRV-Cross and doing a release! @cdavis5e also many thanks for your great detailed overview.. really I was just asking about d3d11-triangle and d3d11-compute DXVK samples as seems DXVK is asking for a lot of things, that these simple two programs don't need to run, and even simple hacking DXVK to not use missing caps&exts. , as it's shown in first post, samples still crash.. last time I tested they were failing at spvTexelBufferCoord step.. so maybe they are fixed now or may work soon as you share are also interested in getting it working.. @KenThomases thanks for sharing the idea here.. maybe that's what's doing Vmware in his Fusion product.. as you know probably for almost a year since Fusion 10 it supports DirectX10 via Metal.. I have run some DX10 geometry sample programs and it works OK.. mainly from NV DX10 SDK(http://developer.download.nvidia.com/SDK/10/direct3d/samples.html): |
This comment has been minimized.
This comment has been minimized.
|
@oscarbg I just hit an issue that will require swizzling (related to #243). In this case, D3D puts the stencil value in green, but Metal puts it in red. By default, Vulkan also puts it in red; that's why |
This comment has been minimized.
This comment has been minimized.
|
OK, I've implemented support for all extensions that DXVK needs, and I have some patches outstanding to implement the remaining few it wants in addition (#273), and I've also turned on and/or implemented quite a few core features as well. If I then force on all the other features that DXVK needs (see attached patch), I can get MS's D3D11 samples to successfully create a device using DXVK... and then it crashes and burns because DXVK sets a (0, 0, 0, 0) swizzle and Metal doesn't support arbitrary swizzles. Don't worry; I'm working on the swizzling issue: see KhronosGroup/SPIRV-Cross#706. |
This comment has been minimized.
This comment has been minimized.
doitsujin
commented
Sep 26, 2018
•
|
I could get rid of the (0,0,0,0) swizzle if that helps. It's only used to provide support for unbound textures, but since the image used with that view is cleared to zero anyway, i could just use an identity swizzle there. Some other swizzles are necessary, though. |
This comment has been minimized.
This comment has been minimized.
Rastafabisch
commented
Jan 9, 2019
•
|
I just wanted to report the current status to those curious (like I've been). With the latest MoltenVK as of today (v1.0.30 - including @cdavis5e preliminary DXVK patch), the latest non-rc wine version (3.21) and the latest DXVK libraries (0.94) I was able to launch the Witcher 3. While it does not crash, and starts playing the prolog audio and reacts to keyboard input (skipping the prolog), it does not draw anything to the screen. It's just black (using DXVK 0.81 - the last pre stream output version the screen was blue but apart from this it was just about the same. So to draw a line: Anyone involved already achieved some huge progress. About the only error messages regarding dxvk/moltenvk are the following:
Here is the entire wine log, in case it proves to be somewhat helpful: Wine was actually build with an older version of MoltenVK. Just the runtime library have been updated, though I do not expect it to be a problem. |
This comment has been minimized.
This comment has been minimized.
|
What version of macOS are you running? The complaint about requiring MSL 1.2 or higher would imply you are running macOS 10.11. |
This comment has been minimized.
This comment has been minimized.
|
The log also says that MSL 2.1 is supported, as well as GPU Family 2 and GPU Family 1 v4, implying that this was run on macOS 10.14. |
This comment has been minimized.
This comment has been minimized.
|
It looks like I need to implement geometry shader emulation and
|
This comment has been minimized.
This comment has been minimized.
HoshiYamazaki
commented
Apr 22, 2019
|
Hey, I know this is not place to directly ask about it, but maybe somebody will help. |
This comment has been minimized.
This comment has been minimized.
HoshiYamazaki
commented
Apr 22, 2019
•
|
I compiled Wine with this script in Xcode:
But MoltenVK seems to be not working, and there is no:
By the way it took me almost whole day to get it working so I don't remember but I got somewhere in the process Thanks and have nice evening! |
HoshiYamazaki
referenced this issue
Apr 26, 2019
Open
No Man's Sky Vulkan version fails to run.. #580
This comment has been minimized.
This comment has been minimized.
HoshiYamazaki
commented
Apr 27, 2019
|
My fault, wine64 binary was compiled not wine. |
This comment has been minimized.
This comment has been minimized.
ovvldc
commented
May 6, 2019
|
The list of limitations in https://github.com/KhronosGroup/MoltenVK/blob/master/Docs/MoltenVK_Runtime_UserGuide.md#limitations has become considerably shorter, for which all the developers deserve a lot of credit. So it seems that the list of missing 'things' in the first post of this thread is no longer up to date. However, it is very unclear to me what is missing now. DXVK also developed in the intervening time, so MoltenVK is chasing a moving target here (just to make things more complicated). Of course, there is also a difference between technically working and being sufficiently optimised to be used for applications. For instance, code DX11 examples are probably less demanding than a city builder game, which in turn will be less demanding than a first-person shooter game. I am sure a lot of people are curious as to where this issue is now :) |
This comment has been minimized.
This comment has been minimized.
This is the list of things yet to be done to fully support DXVK. |
This comment has been minimized.
This comment has been minimized.
|
@cdavis5e slightly unrelated in this thread, but as we don't have a VKD3D thread, just pointing that VKD3D has added support (& requirement?) for: note also DXVK added support for this extension few days ago also (it is optional in this case): |
This comment has been minimized.
This comment has been minimized.
ovvldc
commented
May 21, 2019
|
I don't know how much work any new feature is, but cull distance seems to me the most obvious priority. If I understand correctly, no DX9-12 game will work without that. |
This comment has been minimized.
This comment has been minimized.
doitsujin
commented
May 22, 2019
|
Cull distances are very rarely used and support for them can probably be faked without causing too many issues; they are however part of the D3D11 core feature set. Geometry shaders on the other hand are fairly common, and transform feedback too. |
This comment has been minimized.
This comment has been minimized.
|
just wanted to point that since DXVK 1.1, the @cdavis5e MoltenVK simple patch/way of "supporting" DXVK via:
isn't enough as DXVK starts using Vulkan events API calls like vkCreateEvent, etc.... EDIT: I opened DXVK issue (doitsujin/dxvk#1077 (comment)) and answer seems to be that it must be solved by MoltenVK by implementing events support.. |
This comment has been minimized.
This comment has been minimized.
Rastafabisch
commented
May 28, 2019
•
|
Update to my previous report. IT DOES NOT WORK. (Just so nobody would get too exited.) The Witcher now starts and displays anything like it should, up to the menu (sequences, movies, etc.). Any options can be customised to your liking without triggering a crash. DXVK: various versions from 0.94 up to 1.2.1 (latest)
This – as previously determined – does not happen with dxvk 1.0.3 and below. The setup is run within an unofficial Wineskin Wrapper, with a patched wine64-preloader script injecting the DXVK and swizzling environment variables. Here you have the wine.log, after The Witcher crashed. The main issues here seem to be the following:
&
[…]
|
This comment has been minimized.
This comment has been minimized.
Gcenx
commented
Jun 11, 2019
|
@Rastafabisch your log says Wine-Staging-4.7, by chance is that from my MEGA folder? @oscarbg & @cdavis5e I wanted to ask is the Metal level now detected correctly for the running system or is it still locked to the SDK that’s used at wine compile time? |
This comment has been minimized.
This comment has been minimized.
doitsujin
commented
Jun 11, 2019
•
To clarify, this is mostly needed to emulate "null" vertex buffers properly. When a D3D11 application binds no vertex buffer to a given slot, DXVK will instead bind a small buffer which contains nothing but zeroes, and set the stride to 0 to avoid out-of-bounds access. I don't know any better way to emulate this that would work with this restriction. Some D3D11 apps may also do something similar themselves. |
This comment has been minimized.
This comment has been minimized.
vskllee
commented
Jun 11, 2019
|
哇哦!!! |
This comment has been minimized.
This comment has been minimized.
Rastafabisch
commented
Jun 11, 2019
•
You got me. I can send you my (minor) edits, if you like? (It might be worth it implementing a way to add environment variables. Basically expanding the wrappers existing WINEDEBUG variable GUI.)
True, but this got fixed, as I recall.
So if possible the easiest way might be ignoring the error and continuing, if this does not break subsequent functions. |
This comment has been minimized.
This comment has been minimized.
Gcenx
commented
Jun 11, 2019
•
|
@Rastafabisch I was only concerned that being compiled with the 10.11SDK could have caused false positives, I always use the current Vulkan SDK so that shouldn’t cause an issue. As for the other thing sure just open an issue here as it’s not really related to MoltenVK directly. And I might forget if it’s not an open issue ;) |
This comment has been minimized.
This comment has been minimized.
kristofferR
commented
Jun 14, 2019
|
Here's the issue for adding the necessary Vulkan Events support: |
This comment has been minimized.
This comment has been minimized.
Quenz
commented
Aug 10, 2019
•
This comment has been minimized.
This comment has been minimized.
ryao
commented
Aug 15, 2019
|
@Rastafabisch Would you retest to see if things work better now? |
This comment has been minimized.
This comment has been minimized.
ryao
commented
Aug 15, 2019
•
|
By the way, D9VK forked DXVK to implement Direct3D 9. Of the 3 features stated to be what DXVK still needs, D9VK only needs cull distance estimation. May I suggest that whoever is working on implementing the remaining three features implement cull distance estimation first? Getting D9VK working would be a nice milestone on the way to getting DXVK working. |
This comment has been minimized.
This comment has been minimized.
ovvldc
commented
Aug 15, 2019
|
We had this list of things that DXVK support requires, and VkEvents are now supported. So the infrastructure is there. Many thanks for all that hard work, progress has been impressive. So how are things on geometry shader emulation, cull distance emulation, and VK_EXT_transform_feedback? I understand that it is fairly easy to fool DXVK or any app into thinking that these features are present, but would that not lead to performance loss and/or horrible graphics glitches and/or crashes? |
This comment has been minimized.
This comment has been minimized.
Degerz
commented
Aug 15, 2019
|
@ovvldc It's impossible to fully emulate transform feedbacks just using GPU compute shaders on Metal. If geometry shaders or tessellation produces an unknown a number of primitives it's nearly impossible for GPUs to be able to correspond the output data in order with the input data ... Metal would need to expose features specific to AMD's Navi/RDNA GPUs to be able to properly emulate transform feedbacks properly such as the NGG pipeline (primitive shaders) and global ordered append (DS_Ordered_Count) ... |
This comment has been minimized.
This comment has been minimized.
ovvldc
commented
Aug 15, 2019
|
Thanks for the explanation. That is a pity. Is there any other way of pulling out the buffers? Some games depends on transform feedbacks, though not all. |
This comment has been minimized.
This comment has been minimized.
Degerz
commented
Aug 15, 2019
|
@ovvldc No, it's unfeasible to patch out the rendering logic in games. Apple should just expose geometry shaders and transform feedbacks even if it's solely just for their Mac products instead of wasting everyone's time. If they desire parity so badly either they implement some of the hardware features from AMD's Navi GPUs or implement Nvidia's mesh shaders (I wonder if this is enough to emulate transform feedbacks) because hardware features do actually matter in this instance. You could only get away with partially implementing transform feedbacks if you knew that input/output data were statically generated with an N:N ratio such as only having a vertex shader. Variably generated input/output data with an N:M ratio such as geometry shaders or tesselation which are known for doing data amplification are impossible to properly emulate with transform feedbacks unless you had certain hardware features to make it far easier. |
This comment has been minimized.
This comment has been minimized.
ryao
commented
Aug 15, 2019
|
Many games worked with DXVK before transform feedback support was added to Vulkan. There were a large minority of games that had issues such as crashing (a significant number of unity games), black screens (e.g. Job Simulator 2050), missing models (e.g. The Witcher 3) or missing effects (e.g. Overwatch) and other misrenderings (e.g. Waltz of the Wizard), but just getting to the point where transform feedback is all that is needed would be a huge step forward. You would also have D9VK working, which would be a huge step forward in itself. |
This comment has been minimized.
This comment has been minimized.
doitsujin
commented
Aug 16, 2019
•
You could technically do geometry shaders since you know the maximum number of output vertices that are going to be generated, but you'd have to compact the range afterwards (which will hurt performance). It also doesn't work with tessellation or indirect draws. So yeah, this is a mess and ultimately the main reason why I insisted on getting a Vulkan extension rather than adding weird hacks that only cover half the possible use cases. Note that most games whould be happy with those restrictions, but RenderDoc, which uses |
This comment has been minimized.
This comment has been minimized.
Gcenx
commented
Aug 16, 2019
@ryao |
This comment has been minimized.
This comment has been minimized.
kode54
commented
Aug 16, 2019
|
Well, yeah, but with the 32/64 shim and thunk dance Wine will have to start doing on Catalina to support 32 bit code, it may as well also shim 32 bit processes to be using 64 bit Metal. The real problem then becomes exchanging data between that low 32 bit address space and whatever the heck the system libraries want to map their stuff to. |
This comment has been minimized.
This comment has been minimized.
ovvldc
commented
Aug 16, 2019
|
Let's hope that Apple start moving all their laptops to 8 core CPUs ASAP. Otherwise, we won't have the performance needed to run anything. |

oscarbg commentedJul 27, 2018
•
edited
Hi,
this is just a report of "things" missing in MoltenVK to support DXVK now that Wine supports Vulkan on MacOS via MoltenVK (I use v1.0.12 included in Vulkan MacOS SDK 1.0.77)..
I tested DXVK 0.6.3 on Wine 3.13 with Vulkan support enabled on MacOS and simple programs like included d3d11-compute or d3d11-triangle failed due to unsupported extensions so I checked logs and seems it needs this extensions (as of 0.6.3):
From:
https://github.com/doitsujin/dxvk/blob/master/src/dxvk/dxvk_extensions.h
we see requirements for DxvkInstanceExtensions:
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2
the other two are emulated by Wine already..
for DxvkDeviceExtensions it needs:
VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME,
VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME,
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME,
VK_KHR_MAINTENANCE1_EXTENSION_NAME
VK_KHR_MAINTENANCE2_EXTENSION_NAME
VK_KHR_SHADER_DRAW_PARAMETERS
I modified code of this exts from DxvkExtMode::Required to DxvkExtMode::Optional but then it complains it can't create a D3D device with support for any feature levels ranging from D3D_FEATURE_LEVEL_9_1 to D3D_FEATURE_LEVEL_11_1..
it's because needs features missing in MoltenVK (as of 1.0.12 in Vulkan SDK 1.0.77):
code checking feature level is here:
https://github.com/doitsujin/dxvk/blob/master/src/d3d11/d3d11_device.cpp
`
if (featureLevel >= D3D_FEATURE_LEVEL_9_1) {
enabled.depthClamp = VK_TRUE;
enabled.depthBiasClamp = VK_TRUE;
enabled.fillModeNonSolid = VK_TRUE;
enabled.pipelineStatisticsQuery = supported.pipelineStatisticsQuery;
enabled.sampleRateShading = VK_TRUE;
enabled.samplerAnisotropy = VK_TRUE;
enabled.shaderClipDistance = VK_TRUE;
enabled.shaderCullDistance = VK_TRUE;
enabled.robustBufferAccess = VK_TRUE;
}
`
had to comment these lines (due to missing MoltenVK support):
for getting up to D3D_FEATURE_LEVEL_9_1:
enabled.sampleRateShading = VK_TRUE;
enabled.shaderCullDistance = VK_TRUE;
enabled.robustBufferAccess = VK_TRUE;
for D3D_FEATURE_LEVEL_9_3:
enabled.multiViewport = VK_TRUE;
for D3D_FEATURE_LEVEL_10_1:
enabled.fullDrawIndexUint32 = VK_TRUE;
enabled.geometryShader = VK_TRUE;
enabled.logicOp = supported.logicOp;
for D3D_FEATURE_LEVEL_11_0:
enabled.shaderFloat64 = supported.shaderFloat64;
enabled.shaderInt64 = supported.shaderInt64;
enabled.tessellationShader = VK_TRUE;
enabled.shaderStorageImageWriteWithoutFormat = VK_TRUE;
with all these "hacks" it doesn't complain but crashes executing simple d3d11 apps because it may be using missing features..
of course MoltenVK supporting DXVK might be a herculean effort but DXVK has shown it's able to run lots of DX11 modern games and this will be awesome on Mac..
this is just a report of things needed to do (as a means of guiding priorities of things to implement)..
hope is useful for someone..