KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Requirements for DXVK support..

oscarbg opened this issue · comments

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;
}

if (featureLevel >= D3D_FEATURE_LEVEL_9_2) {
  enabled.occlusionQueryPrecise                 = VK_TRUE;
}

if (featureLevel >= D3D_FEATURE_LEVEL_9_3) {
  enabled.multiViewport                         = VK_TRUE;
  enabled.independentBlend                      = VK_TRUE;
}

if (featureLevel >= D3D_FEATURE_LEVEL_10_0) {
  enabled.fullDrawIndexUint32                   = VK_TRUE;
  enabled.fragmentStoresAndAtomics              = VK_TRUE;
  enabled.geometryShader                        = VK_TRUE;
  enabled.logicOp                               = supported.logicOp;
  enabled.shaderImageGatherExtended             = VK_TRUE;
  enabled.textureCompressionBC                  = VK_TRUE;
}

if (featureLevel >= D3D_FEATURE_LEVEL_10_1) {
  enabled.dualSrcBlend                          = VK_TRUE;
  enabled.imageCubeArray                        = VK_TRUE;
}

if (featureLevel >= D3D_FEATURE_LEVEL_11_0) {
  enabled.shaderFloat64                         = supported.shaderFloat64;
  enabled.shaderInt64                           = supported.shaderInt64;
  enabled.tessellationShader                    = VK_TRUE;
  // TODO enable unconditionally once RADV gains support
  enabled.shaderStorageImageMultisample         = supported.shaderStorageImageMultisample;
  enabled.shaderStorageImageReadWithoutFormat   = supported.shaderStorageImageReadWithoutFormat;
  enabled.shaderStorageImageWriteWithoutFormat  = VK_TRUE;
}

if (featureLevel >= D3D_FEATURE_LEVEL_11_1) {
  enabled.logicOp                               = VK_TRUE;
  enabled.vertexPipelineStoresAndAtomics        = 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..

How did you get wine to recognise moltenVK? I get

checking for -lMoltenVK... not found

I think had some issues but copied everywhre /lib /usr/lib /usr/local/lib..

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.

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.

  • Added (and implemented) vkGetPhysicalDeviceFeatures2KHR and vkGetPhysicalDeviceProperties2KHR
  • Added stubs for the remaining methods for VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2, and the methods listed above
  • Set the flags to true for the device features required for DX11

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.

Hi @iain-benson,
nice work..
strange thing is spvTexelBufferCoord seems to be introduced recently in https://github.com/KhronosGroup/SPIRV-Cross/blob/master/spirv_msl.cpp by :
KhronosGroup/SPIRV-Cross@4c5142b
"Emit and use spvTexelBufferCoord() function to convert 1D texel buffer coordinates to 2D Metal texture coordinates."

uint2 spvTexelBufferCoord(uint tc)
{
    return uint2(tc % 4096, tc / 4096);
}

just for curiosity what MoltenVK version are you using? from 1.1.82?

So far, of those extensions, I've implemented VK_KHR_maintenance1, VK_KHR_shader_draw_parameters, VK_KHR_get_physical_device_properties2, and VK_KHR_descriptor_update_template. The patches for the first three were merged (#230, #232, #235). The patch for the last one depends on another patch I have to implement VK_KHR_push_descriptor (#236), which vkd3d (a different library for D3D12) wants but doesn't need to work. The reason for that is that those two extensions interact--there's a call that's available only if both extensions are supported. You can see the patch for VK_KHR_descriptor_update_template at my fork.

I still need to investigate the core Vulkan features that DXVK needs but MoltenVK doesn't have yet.

Amazing work @cdavis5e !!
I thought we were months from seeing real progress on this..
Thanks..

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

Hi @banzr,
I don't know what's the best answer I can gave you, but I will try..
basically for this specific issue you need to gain some Metal and Vulkan knowledge/experience..
as this is what MoltenVK is about..
For Metal see:
https://developer.apple.com/documentation/metal
(deprecated) https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction/Introduction.html
useful will be:
https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
also see : https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
(some things are only avaiable in newer OS or GPUs)
then familiarize with MoltenVK codebase and also SPIR-V Cross as this is used for shader translation.. then seeing the extensions/optional Vulkan features DXVK needs (first post in this thread) and try to know how you map these to Metal and implement it..
in theory, you don't even need to know anything about DXVK.. as far as MoltenVK exposes all required DXVK Vulkan functionality you are done..
or you may forgot everything I said until now and go the opposite way.. of learning as needed to implement individual items.. let's take two examples:
1)Imagine you want to add double precision support to MoltenVK (really DXVK can use it but not useful in real games):
you read Metal-Shading-Language-Specification and see:
"Metal does not support the double.."
so it can't be done.. well not easily.. it can be emulated by doing something similar to guys in Mesa have done:
"The Student Working On "Soft" FP64 Support Is Good News For Older GPUs"..
on mesa cgit you should find shader code emulating doubles via floats..
2) Similar thing will be found for geometry shader, you will find Metal doesn't support it..
3) Imagine you want to add tesselation support to MoltenVK:
read in Apple how it's exposed:
https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Tessellation/Tessellation.html
find a Vulkan simple sample:
https://github.com/SaschaWillems/Vulkan/tree/master/examples/tessellation
you will find MoltenVK uses SPIR-V Cross for shader translation you will need to add translation from tesselation stage to Metal..

hope it helps (a little)..

SPIRV-Cross #675 should fix the issue with spvTexelBufferCoord().

@cdavis5e I see you are contributing lots of SPIRV-Cross patches/improvements too.. thanks..
let me ask two questions:

  1. are they fixing (simiar to spvTexelBufferCoord issue) some MoltenVK bugs for DXVK or VKD3D?
    I say as sadly seems MoltenVK is still referencing an "old" SPIRVCross tag without all you improvements so would l like to know what benefits I get by compiling SPIRV-Cross up to latest commit..
  2. will all your MoltenVK & SPIRV-Cross commits (& possibly your pull requests not yet merged on this two repos) is DXVK simple included apps like d3d11-triangle and d3d11-compute working?
    have you an estimate of how much work/patches still remaining to get these two "simple" demos (d3d11-triangle and d3d11-compute) working under MoltenVK?
    thanks..

@oscarbg I'll be doing a MoltenVK release this weekend that will include an upgrade to the latest SPIRV-Cross...including all the wonderful work @cdavis5e has been contributing.

@oscarbg Yes, these are to fix bugs in MoltenVK for vkd3d (which will inevitably benefit DXVK as well). Eventually, I would like to get the DXVK samples running. Hopefully I should be able to have them up within about a week—a month, tops.

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 robustBufferAccess, shaderImageGatherExtended, and drawIndirectFirstInstance right now. Most of the remaining needed extensions and features shouldn't be too hard to implement.

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.

@billhollings many thanks for updating SPIRV-Cross and doing a release!

@cdavis5e also many thanks for your great detailed overview..
as you talk about cull distances & "pre-processing stage to support that at all".. I would love to know what do you think also about swizzle Metal limitations.. seems will require similar preprocess stage and seem like AAA Vulkan games (like Doom and Wolfenstein II) and other Vulkan programs (RPCS3 via Wine ( #205 ) ) make use of it..
I posted results of running these two games under Wine+MoltenVK around a month ago here showing swizzle limitations:
#204 (comment)
#204 (comment)

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):
Lightning,Rain,MetaBalls ,Fur - Shells and Fins..
also interesting is "Lightning" sample uses also stream out:
"efficiently implemented using geometry shaders and stream out"
so Vmware is emulating stream out also in Metal, I say because stream output much in the news these days like on khronos.org "Some Vulkan members are developing a multi-vendor EXT extension for transform feedback" right now because seems is the last big Vulkan "missing feature" for DXVK playing DX11 games using it "correctly" like "Witcher 3".. so eventually might make sense for MoltenVK to support also that extension..

@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 vkd3d uses a swizzle to make it appear in green. To make this work for any arbitrary swizzle, we'll probably need to apply a technique similar to what wined3d does when the GL_ARB_texture_swizzle extension isn't available, by manually swizzling the texture and/or fixing up the shader to do a swizzle on every load.

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.

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.

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:

[***MoltenVK ERROR***] VK_ERROR_INITIALIZATION_FAILED: Vertex shader function could not be compiled into pipeline. See previous error.
err:   DxvkGraphicsPipeline: Failed to compile pipeline
err:     vs  : VS_71ac5766523bfe85650fb70fe2faa3b7a4efa3b8
err:     fs  : FS_a06e822f5ba921672573f4b95e59a40b14bf6ed7
[***MoltenVK ERROR***] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (error code 3):
Compilation failed: 

program_source:8:31: error: 'function_constant' attribute requires Metal language standard macos-metal1.2 or higher
constant bool cb0_bound_tmp [[function_constant(0)]];

Here is the entire wine log, in case it proves to be somewhat helpful:
Wine_MoltenVK_DXVK.txt

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.

@Rastafabisch

What version of macOS are you running?

The complaint about requiring MSL 1.2 or higher would imply you are running macOS 10.11.

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.

It looks like I need to implement geometry shader emulation and VK_EXT_transform_feedback to make this particular game work:

err:   D3D11: CreateGeometryShaderWithStreamOutput:
  Transform feedback not supoorted by device

Here's my list of things still to be done for DXVK:

  • Geometry shader emulation
  • Cull distance emulation
  • Tessellation shaders
  • VK_EXT_transform_feedback

Without cull distances, DXVK won't even let you create a 10level9 (D3D_FEATURE_LEVEL_9_1) device. My preliminary patch right now fakes the first three, which allows device creation to succeed. But if you attempt to use the unimplemented features...

@Rastafabisch

What version of macOS are you running?

The complaint about requiring MSL 1.2 or higher would imply you are running macOS 10.11.

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.

Indeed I‘m running the latest stable version of Mojave. Having my build environment set up now, I can do some additional testing for new patches if needed.

I wonder if this is a bug in Mojave--or even worse, intended behavior; i.e. it's looking at the version the binary was built for and using that to set the version of MSL to use. In either case, I think we can work around this by explicitly setting MTLCompileOptions.languageVersion to the latest version supported by the host system.

How would I actually insert this option? And do you think, it would already viable or shall I want until some additional patches and features are available/implemented?

Try applying this patch to MoltenVK.

Hmmm...the doc for MTLCompileOptions.languageVersion explicitly states:

By default, the most recent language version available is used.

So...it's worth a shot...but I'll be surprised (happily so...but silently cursing Apple) if your patch changes anything.

I just tested this patch after pulling the current 1.0.31 build. As the patch would need to be rebased I applied it manually instead and it compiled fine. However I do not get the improved swizzling support enabled during build.

Even if mslOpts.swizzle_texture_samples = context.options.shouldSwizzleTextureSamples; is reversed to mslOpts.swizzle_texture_samples = true; the wine.log is spammed with [***MoltenVK ERROR***] Pipeline does not support component swizzle errors.

The difference compared to the previous trial so war is, that the black screen got replaced by an pale violet one, and the game apparently freezes bevor I get audio. However now I get a themed mouse cursor.

bildschirmfoto 2019-01-16 um 04 58 52

I'll attache the current wine.log anyway.
Wine_MoltenVK_DXVK.txt

Try running it with the MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable set to 1.

To elaborate on that: It's not enough that SPIRV-Cross generates the code for this. MoltenVK has to know that it can successfully use component swizzling with the shader. Otherwise, it won't know to pass the component swizzle to the shader. So this has to be turned on in the pipeline. The easiest way to do that is to set the environment variable when running the program.

I do not know what I'm doing wrong. However I cannot get past wine.logs including the following:

[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY) required by a VkImageView used in the compute shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.

You did do as I suggested, didn't you?

Also, this:

program_source:145:79: error: use of undeclared identifier 'u0'
       uint _362 = atomic_fetch_add_explicit((volatile thread atomic_uint*)&(u0, (_350.x * 1) + (_350.y / 4)), as_type<uint>(r1.x), memory_order_relaxed);
                                                                             ^

That looks like an atomic access to a texture, which Metal doesn't support (rdar://41859236).

@cdavis5e some testing by me..
DXVK works for me for simple apps like d3d11-triangle.exe and d3d11-compute..
but as @Rastafabisch says there is some error with swizzling support..
in that case I tested Wolfenstein II via wine.. and situation has improved a lot..
don't know if useful for that game but I enabled logic ops using your Metal private API patch..
anyway lots of swizzle errors using:

export MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE=1

or even changing/forcing support in MVKenviroment.h:

#ifndef MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE
#   define MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE    1
#endif

also changed in the end of function void MVKInstance::initConfig() :
_mvkConfig.fullImageViewSwizzle = VK_TRUE;

minimal sample:

[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ONE) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ONE) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ONE) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.
[***MoltenVK ERROR***] Pipeline does not support component swizzle (VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ONE) required by a VkImageView used in the vertex shader. Full VkImageView component swizzling will be supported by a pipeline if the MVKConfiguration::fullImageViewSwizzle config parameter or MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE environment variable was enabled when the pipeline is compiled.

That's... very strange. It should not be doing that--especially after you forced fullImageViewSwizzle to true.

Can you provide a full log?

Does #489 help?

@cdavis5e Sorry for the big lag in answering.. will test this patch this weekend.. logs are in the hundreds of MBytes when game really starts after menus.. I will attach compressed logs but I remember upon quick inspection nothing else relevant..

I wonder if this is a bug in Mojave--or even worse, intended behavior; i.e. it's looking at the version the binary was built for and using that to set the version of MSL to use. In either case, I think we can work around this by explicitly setting MTLCompileOptions.languageVersion to the latest version supported by the host system.

I've confirmed that the default value of MTLCompileOptions.languageVersion is set based on the OS version the binary was built for. PR #512 fixes this by setting MTLCompileOptions.languageVersion based on the highest supported Metal feature set.

Any updates about support of Wine/DXVK?

Any updates about support of Wine/DXVK?

I very recently implemented tessellation, so there's one item down.

Hey, I know this is not place to directly ask about it, but maybe somebody will help.
I am trying to compile Wine from GIT with Vulkan & MoltenVK, and everything seems to working fine (I copied libraries (dylibs) to /usr/local/lib), configure see it, and everything wents smoothly until I not do build (make) under Xcode -> I get this error:
:-1: po.c:31:10: fatal error: 'gettext-po.h' file not found
In google and stack there are no workarounds, also macOS wineHQ page is outdated.
Any ideas?

I compiled Wine with this script in Xcode:

export PATH="$HOME/Vulkan/bin:$PATH"

# Vulkan Paths
export VK_ICD_FILENAMES=$HOME/Vulkan/etc/vulkan/icd.d/MoltenVK_icd.json
export DYLD_LIBRARY_PATH=$HOME/Vulkan/lib
export VK_LAYER_PATH=$HOME/Vulkan/etc/vulkan/explicit_layer.d

export LD_LIBRARY_PATH=$HOME/Vulkan/lib
export CFLAGS='-I/usr/local/include'
export LDFLAGS='-L/usr/local/lib'
export DYLD_FALLBACK_LIBRARY_PATH='/usr/local/lib'
./configure CC="clang" CXX="clang++" CFLAGS="-std=gnu89 -g" --enable-win64
/usr/bin/make -j5

But MoltenVK seems to be not working, and there is no:
checking for -lMoltenVK... <SOMETHING>
Prompt, so I don't know if MoltenVK got compiled into Wine. Vulkan of course is compiled because I got this line in build log:

checking for -lodbc... libodbc.2.dylib
checking for -lnetapi... not found
**checking for -lvulkan... libvulkan.1.dylib**
checking for -lvkd3d... not found

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 checking for -lMoltenVK prompt, I do something wrong?

Thanks and have nice evening!

My fault, wine64 binary was compiled not wine.
Still if somebody want to configure xCode my script are fine so.

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 :)

I am sure a lot of people are curious as to where this issue is now :)

This is the list of things yet to be done to fully support DXVK.

@cdavis5e slightly unrelated in this thread, but as we don't have a VKD3D thread, just pointing that VKD3D has added support (& requirement?) for:
VK_KHR_draw_indirect_count
for "Resident Evil 2" (supports D3D12) game:
https://source.winehq.org/git/vkd3d.git/commit/ca744ae57918c138be9ed12ea96403f07e4c0620
https://source.winehq.org/git/vkd3d.git/commit/f1076bb15333a7177e7b5406121a77601c8dfb54
Don't know how much difficult is to add support for that extension in MoltenVK.. but just want to say I'm ready for testing Rage 2 under MoltenVK as fast as some patches are ready for testing.. :-)

note also DXVK added support for this extension few days ago also (it is optional in this case):
doitsujin/dxvk@13359d6

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.

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.

just wanted to point that since DXVK 1.1, the @cdavis5e MoltenVK simple patch/way of "supporting" DXVK via:

_features.shaderCullDistance = true;
_features.geometryShader = true;
_features.logicOp = true;

isn't enough as DXVK starts using Vulkan events API calls like vkCreateEvent, etc....
of course well know limitation:
from https://github.com/KhronosGroup/MoltenVK/blob/master/Docs/MoltenVK_Runtime_UserGuide.md
Known MoltenVK Limitations:
"VkEvents are not supported."
never known if it's due to much needed work to support it or some underlying Metal API limitation vs Vulkan..

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

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.
Starting a new game the initial sequence is shown including parts which look like live rendering, rather than a movie in the end (unconfirmed). However I never got into the game as the executable just crashes silently thereafter.

DXVK: various versions from 0.94 up to 1.2.1 (latest)
Wine: Wine4.7
MoltenVK: latest as of today (a684b47) with @cdavis5e's fake-extensions patch
(opposing @oscarbg's previous command, although indeed the log is spammed)

[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCmdSetEvent(): Vukan events are not supported.
[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkResetEvent(): Vukan events are not supported.
[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: vkCreateEvent(): Vukan events are not supported.
err:   DXVK: Failed to create GPU event

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.

MoltenVK_DXVK_The_Witcher_3

Here you have the wine.log, after The Witcher crashed. The main issues here seem to be the following:

[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Under Metal, vertex attribute offsets must not exceed the vertex buffer stride.

&

[mvk-error] VK_ERROR_INVALID_SHADER_NV: Vertex shader function could not be compiled into pipeline. See previous logged error.

[…]

[mvk-info] Shader library compilation succeeded with warnings (Error code 4):
Compilation succeeded with: 

program_source:14:15: warning: unused variable 'cb0_bound'
constant bool cb0_bound = is_function_constant_defined(cb0_bound_tmp) ? cb0_bound_tmp : true;
              ^
program_source:22:15: warning: unused variable 'cb1_bound'
constant bool cb1_bound = is_function_constant_defined(cb1_bound_tmp) ? cb1_bound_tmp : true;
              ^
program_source:24:15: warning: unused variable 't0_bound'
constant bool t0_bound = is_function_constant_defined(t0_bound_tmp) ? t0_bound_tmp : true;
              ^
program_source:26:15: warning: unused variable 't1_bound'
constant bool t1_bound = is_function_constant_defined(t1_bound_tmp) ? t1_bound_tmp : true;
              ^
program_source:28:15: warning: unused variable 'omap0_r'
constant uint omap0_r = is_function_constant_defined(omap0_r_tmp) ? omap0_r_tmp : 0u;
              ^
program_source:30:15: warning: unused variable 'omap0_g'
constant uint omap0_g = is_function_constant_defined(omap0_g_tmp) ? omap0_g_tmp : 1u;
              ^
program_source:32:15: warning: unused variable 'omap0_b'
constant uint omap0_b = is_function_constant_defined(omap0_b_tmp) ? omap0_b_tmp : 2u;
              ^
program_source:34:15: warning: unused variable 'omap0_a'
constant uint omap0_a = is_function_constant_defined(omap0_a_tmp) ? omap0_a_tmp : 3u;
              ^

@Rastafabisch your log says Wine-Staging-4.7, by chance is that from my MEGA folder?
If so you should know those were all the cross-compiles were built using the 10.11 SDK since osxcross only recently added support for newer SDK versions. That would explain the Metal 1.2 issue from earlier.

@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?

Under Metal, vertex attribute offsets must not exceed the vertex buffer stride.

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.

哇哦!!!

@Rastafabisch your log says Wine-Staging-4.7, by chance is that from my MEGA folder?

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

If so you should know those were all the cross-compiles were built using the 10.11 SDK since osxcross only recently added support for newer SDK versions. That would explain the Metal 1.2 issue from earlier.

@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?

True, but this got fixed, as I recall.

Under Metal, vertex attribute offsets must not exceed the vertex buffer stride.

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 […]

So if possible the easiest way might be ignoring the error and continuing, if this does not break subsequent functions.

@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 ;)

Here's the issue for adding the necessary Vulkan Events support:
#192

commented

#192 fixed and closed, supported added in #708

@Rastafabisch Would you retest to see if things work better now?

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.

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?

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

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.

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

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.

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.

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 VK_EXT_transform_feedback for its mesh view, requires proper support for this.

You would also have D9VK working, which would be a huge step forward in itself.

@ryao
The thing is how many 64Bit games use DirectX9?
Remember wine can’t currently make use of MoltenVK only wine64 can as Metal is a 64Bit API.

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.

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.

@ovvldc A Hat In Time is the only Direct3D 9 game that I know to be 64-bit. There are likely others. @kode54’s point about the thunking does make it a moot point though.

By the way, the lack of geometry shader emulation, cull distance emulation, and VK_EXT_transform_feedback should be added to the known limitations list for MoltenVK.

64 Bit D3D9 games:

  • A Hat in Time
  • Risen 3
  • Sims 4
  • Blade Symphony
  • Final Fantasy 9
  • Guild Wars 2

By the way, the lack of geometry shader emulation, cull distance emulation, and VK_EXT_transform_feedback should be added to the known limitations list for MoltenVK.

I disagree. The known issues with MoltenVK are in regard to the Vulkan CTS. Unlike D3D11, geometry and tessellation shaders are not mandatory for complient Vulkan implementations. It lets you query if geometry/tessellation shaders are supported. Same for the extension obviously. Most Android drivers don't support those either.

Depends on who is the target for the documentation. If for developers who are up to speed on the entire Vulkan ecosystem, you can refer to compliance with CTS. If for people who are not deeply into Vulkan and want to know if MoltenVK can cover the features of some application, then having a section of limitations that go beyond the CTS would be good. Just as a bit of friendly guidance to the wider ecosystem.

He might have been pulling my leg, but gamedev1909 in the yuzu discord claims that renderdoc works with Witcher III and hairworks enabled in Parallels Desktop 15 on Mac OS X. He sent me this screenshot (which sadly does not appear to show renderdoc):

He declined to comment here despite multiple requests. Parallels Desktop 15 implements Direct3D 11 using Metal. If his claim is accurate, then there could be an undocumented API extension in Metal for getting transform feedback that Parallels Desktop 15 uses.

Is it just me seeings things incorrectly or are the limitations of Metal that MoltenVK is hitting in supporting DXVK all in areas unfriendly to tiling GPU architectures like the one used in the iPhone?

No, from what I know geometry shaders and especially transform feedback are generally unfriendly to modern desktop GPUs as well.

Metal supports a lot of stuff that's not supported on any of their mobile GPUs.
https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf

Referencing Winetricks/winetricks#1318

Any news on MacOS support for DXVK?

https://www.khronos.org/registry/OpenGL/extensions/NV/NV_mesh_shader.txt

(7) Do we support transform feedback with mesh shaders?

 RESOLVED:  No.  In the initial implementation of this extension, the hardware doesn't support it.

:/

Turing's mesh shaders are not totally capable of emulating the traditional geometry pipeline like I had hoped as it is with AMD's Primitive Shaders with global ordered append ... (supersede vs superset)

If D3D standardizes this behaviour then there is very little hope for Metal to be able to realistically provide full transform feedback functionality ...

Most Mac OS X systems are using either AMD or Intel graphics, and Vulkan extensions are not available from Metal. Why is the Vulkan extension for Turing relevant? Is there an equivalent function exposed in Metal that you are using the Vulkan documentation to understand?

@ryao Mesh shaders are getting standardized in D3D and with imposed limitations on all 3 desktop hardware graphics vendors. If Nvidia can't support transform feedbacks with mesh shaders then D3D likely won't as well ...

Apple still cares about portability with Metal even with Nvidia GPUs because they don't want to be tied down to either AMD or Intel on macOS for the foreseeable future so if Apple decides to include mesh shaders as well in Metal then it'll come with the same limitations or with even more limitations judging by Apple's history to water down features ...

Besides, global ordered append is way too specific to AMD HW so it's not a portable mechanism to expose for relying on emulating transform feedbacks. (Apple has no desire to expose low level access for any other vendors except maybe for themselves with their own iOS GPUs)

We have another release with great work done by a cool group of contributors :).

Any features needed for DXVK that we can check off in this release? It was not entirely clear to me. Recent discussion suggests the geometry shaders are certainly not done yet.

DXVK 1.5.2 got released needing both Vulkan 1.1 device driver and loader 1.1 support..
let's see if a hack reporting MoltenVK driver as 1.1 helps with running simple "hello world" dx11 apps..

Vulkan 1.1 support was already on my radar, since DXVK wanted it to accelerate fragment discard. You may encounter problems with that.

Hi, what is the current status of this?
Even if we leave geometry shader out for now, does transform feedback without Geometry shader work yet?
I came across steam proton project and noticed they dropped macos support from their plan. A couple of searches led me here.

also slightly related noticed recently two Vulkan projects have recently updated needing/benefiting also from Vulkan 1.1 support:
*VKD3D DXIL branch:
https://www.winehq.org/pipermail/wine-devel/2020-January/158470.html
Vulkan 1.1 for wave ops:
"Vulkan 1.1 is enabled if active, because subgroup operations requires it. SM 6.0 support is only activated if subgroup operations are sufficiently supported and DXIL is enabled.
There are other features required for SM 6.0 such as 16-bit arithmetic and storage, but that is left for later."
*VkBasalt (since 1.3) "Vulkan 1.1 is now required"
https://github.com/DadSchoorse/vkBasalt/releases/tag/v0.3.0

10.15.4 supposedly exposes transform feedback. Is this confirmed, and would it be enough for Molten?

10.15.4 supposedly exposes transform feedback. Is this confirmed, and would it be enough for Molten?

It sounds interesting. Where have you found transform feedback mention in 10.15.4?

10.15.4 supposedly exposes transform feedback. Is this confirmed, and would it be enough for Molten?

It sounds interesting. Where have you found transform feedback mention in 10.15.4?

I'm curious, too. I only saw vertex amplification (i.e. multiview) and rasterization rate maps.

Well it’s possible considering the changes Apple made to no32exec=0

Edit;
Not related to this directly, it’s just one of the undocumented changes Apple made to 10.15.4

@diegov12 are you thinking about transform feedback support in OpenGL? that's irrelevant for MoltenVK.. in case it's about new Metal support please share info..
@Gcenx how no32exec=0 is related to transform feedback? seems related to remaining 32bit Mac support in Catalina..

I also was interested in using D9VK / DXVK 1.5.1 with MoltenVK with a wine 32 bit game, but it also crashes on launch. I wonder if it is because the game is 32 bit and the 32on64 wine stuff doesn't work well with MoltenVK, or if MoltenVK doesn't have enough to support D9VK. I'm looking into getting more logs.

It might make more sense to try to get D9VK / DVVK1.5.1 working with D3D9 first rather than chasing after DXVK's latest as it increments the Vulkan version and continues to outchase MoltenVK.

What features do you all think are missing for D3D9 support?

What features do you all think are missing for D3D9 support?

The only feature D9VK requires that we don't support is geometryShaders, and only because they're used for some DXVK meta operations. DXVK has versions of those meta shaders that don't need geometry shaders because they use VK_EXT_shader_viewport_index_layer, so we don't actually need geometry shader support. Other than that, there's nothing that D9VK requires that MoltenVK doesn't support.

What's left are a bunch of optional features, most of which we can't support right now because they require support from Metal:

  • vertexPipelineStoresAndAtomics, for SOFTWARE_VERTEXPROCESSING and IDirect3DDevice9::ProcessVertices(): while we could support the latter with what Metal gives us, the problem is that we can't simultaneously draw and store from the vertex shader, so we can't draw with SWVP. I guess you could try hacking that feature on.
  • shaderDemoteToHelperInvocation (VK_EXT_shader_demote_to_helper_invocation), because SM 2.x/3.x texkill has the same semantics as SM 4.x+ discard: needs support from Metal Shading Language, then SPIRV-Cross.
  • memoryPriority (VK_EXT_memory_priority)
  • fillModeNonSolid with VK_POLYGON_MODE_POINTS, for D3DFILL_POINT: Needs MTLTriangleFillModePoints
  • depthClipEnable (VK_EXT_depth_clip_enable): Needs MTLDepthClipModeClipAndClamp
  • depthBounds, for 'NVDB': Needs depth bounds test support
  • customBorderColors (VK_EXT_custom_border_colors): Needs support for arbitrary border colors from MTLSamplerState

The one optional feature that can be implemented is:

  • pipelineStatisticsQuery: Only on 10.15+; someone just needs to do the work to integrate this.

@cdavis5e just curious, have all this Metal needs been requested to Apple devs already? also curious about names like MTLDepthClipModeClipAndClamp , hope you are finding undocumented functionality on Metal API or playing with prerelease builds..

@cdavis5e just curious, have all this Metal needs been requested to Apple devs already?

Yes they have.

also curious about names like MTLDepthClipModeClipAndClamp , hope you are finding undocumented functionality on Metal API or playing with prerelease builds..

They're names I made up.

Is there any possibility of creating work-arounds for these missing Metal APIs? It's very disappointing to not have DX10/11/12 support for MacOS.

Regardless, I very greatly appreciate all of the hard work on Vulkan and MoltenVK!

This is my opinion on this whole dxvk issue. I don't think Apple is going to make all those missing Metal APIs public. Apple loves control. They also work closely with Parallels, and probably so with Feral Interactive and any other big graphics app publisher, which explains AAA titles on Mac and Parallels' DX11 support.

They have a pattern of contributing only to things that somehow benefit them and their ecosystem. Will supporting DXVK bring them any revenue? Will it make Mac any more valuable? Will it improve the Apple ecosystem? How will their customers react? Despite their controlling nature, they still have to ask all these question before supporting something like DXVK. It could have larger implications than just enabling a niche of gamers. Their primary goal is to preserve the ecosystem.

I believe one other reason they moved to Metal is to control what is released on their platforms. Bill Hollings and his team are that were capable enough to challenge that locked ecosystem-centric decision that Apple made. They sort of broke down that cross platform wall Apple put up, and thanks to them developers don't have to completely rewrite code for Metal. However, that wall still has a foundation which is the whole proprietary graphics layer... basically Apple's control.

So not to be a cynic, but unless there's a sign from Apple, I don't think Dxvk will ever exist - maybe until Macs are ARM only, and by that time Steam, wine, etc won't be possible.

Will it make Mac any more valuable?

yes

Will it improve the Apple ecosystem

a little

How will their customers react?

positive to neutral, because some macs have the hardware to game.. if there is a port or if you install windows/linux

Will they pull their head out of their ass tho? Very unlikely :/ (Which is what's keeping me from using macOS/Mac)

Metal is still missing some features that make DXVK viable such as Transform Feedbacks and Geometry Shaders. I believe these features are very difficult and tedius to emulate in MoltenVK.
I talked to Metal team some time in the past. And they clearly had no interest in making those features available since they are legacy and not very hardware friendly in their views. The moving to proprietary API such as Metal might not be a good move, however from my understanding their GPU team is very small compare to Khronos Group or NVIDIA/AMD GPU teams hence they cannot afford to follow bloated features of open standard API such as Vulkan and opt for their own API instead. It’s also easy to map the features to their in-house GPU on mobile devices.
Nevertheless, imo at least they should have allowed the 3rd party GPU vendors on macOS to write their own drivers so that hidden features or even Vulkan vendor specific implementation could be made available on mac. Maybe Apple is afraid that no body will use Metal if they allow vendor to expose Vulkan implementation.

That’s a bit sad since I really want to play some of my favourite windows only games on mac without installing a secondary OS.

@kakashidinho Things are about to get even worse with their in-house Apple silicon since it's tile-based deferred renderer ...

No chance that we'll ever see these features being exposed on Metal since they don't work well on a TBDR architecture. Transform feedback and geometry shaders is only considered 'legacy' to them because their GPUs doesn't handle it well compared to a desktop GPU. ;)

I guess the developers behind these graphics translation layers can ditch the idea of making D3D work over Metal altogether since emulating immediate mode over a TBDR GPU is too painful ...

I feel this thread has gotten a bit off-topic with a bit of misinformation. The one bit I want to correct is that Nvidia has been shipping TBDR in desktops since Maxwell, and as of a few years ago (possibly even no longer true) only Intel had hardware support for geometry shaders. Industry support for geometry shaders and transform feedback are indeed legacy features that are emulated in the drivers, and is actively discouraged since they incur such penalties.

@mbarriault You're the one spreading misinformation ...

Nvidia GPUs don't do tiling at all. None of their GPUs store a small portion of the framebuffer state on-chip and they don't serialize draws per-tile. Vulkan renderpasses are practically meaningless and blend modes can be a dynamic state on their hardware too. Changing the blend state on a tiler involves a shader recompilation but this is not true for Nvidia hardware. Quite simply, Nvidia hardware don't pay for the penalties and don't gain the same optimizations as a tiler would so they're hardware obviously doesn't do tile-based rendering ...

Geometry shaders and transform feedback are all natively supported on desktop GPUs too so you made another incorrect statement. These are all very real features that actually maps to their hardware. Even lower level console APIs expose those features so they wouldn't even be considered legacy features at least with desktop GPUs ...

None of these features are 'emulated' with desktop GPUs ...

https://www.techpowerup.com/231129/on-nvidias-tile-based-rendering

http://jason-blog.jlekstrand.net/2018/10/transform-feedback-is-terrible-so-why.html

http://www.joshbarczak.com/blog/?p=667

These facts are well established amongst GPU programmers and have been for years, but ultimately this discussion sidetracks the thread.