Closed oscarbg closed 6 years ago
Triangle fan is not supported (which is what value 5 of VkPrimitiveTopology is).
The shader error is because the variable is named “dot” which is also the name of a function. This is valid in SPIRV but not metal shaders. The fix is to simply rename the variable.
VkPrimitiveTopology 5 is triangle fan, which is not supported in MoltenVK. This really needs to be added to the Known MoltenVK Limitations list in the Runtime User Guide.
@mmaldacker @karl-lunarg thanks to both.. In that case we have source code and we can "massage" it for MoltenVK.. but shouldn't be a motivation of MoltenVK project to do these "massage" on his own.. for example: knowing that a variable and function in Metal can't have the same name shouldn't have to be known by a user.. perhaps has learned Vulkan but has no interest on Metal.. I mean either SPIRV-Cross or MoltenVK should check these cases (in that case seems a request for SPIRV-cross) and rename the variable or function accordingly transparent to the user.. also similar to triangle fan case.. can't be emulated even if with some perf. loss? similar to geometry shaders case.. Metal doesn't support it but can be emulated and at least seems where aren't losing so much perf. by emulating correctly.. this is what Vmware Fusion is doing to support DX10.. I tested with DX10 geometry shader apps and Metal backend worked correctly and apps we running "realtime " i.e. perf loss of app vs native "overall" perhaps was less than say 2x.. that is from an old request I made on MoltenVK:
An interesting example is Vmware Fusion preview 2017 is which is using Metal to emulate up to level DX10 FL10_0(including geo shaders lacking on Metal).. from what’s new document:
“Metal Graphics support (Host) – Apple makes available an OpenGL replacement technology called ‘Metal’. The 2017 Fusion Tech Preview leverages this technology to deliver OpenGL and DirectX 10 to a Guest OS”
they say in forums full DX10 profile with geometry shaders so question is: can MoltenVK hack something similar to expose Vulkan geometry shader support in your product.. I’m afraid to repost on SPIR-V Cross the same request but seems some work of this support should be exposed there..
@oscarbg
Yes...SPIRV-Cross should handle naming conflicts. If you haven't already done so...can you post that to SPIRV-Cross to be fixed, please? If you have a sample shader, please include it.
The Triangle Fan issue is a bit more complicated. It would require MoltenVK to dynamically rebuild a completely different set of vertex indices under the covers. It is doable? I should think so. Is it straightforward? I'm not so sure. Is it performant? Probably not.
Perhaps it is a priority question. Is Triangle Fan something that we will encounter repeatedly and needs to be dealt with in the driver?
Hi @billhollings, just posted the bug to SPIRV-Cross developers with a artifical shader showing same issue..
also regarding triangle fan.. well I was to say similar to geometry shader case that Vmware Fusion Metal support has someway in fact support translating to Metal triangle fans.. but I also saw triangle fans were removed from DX10 onwards so DX11 also doesn't support triangle fans.. as I'm mostly interested on potential D3D11 games ->Metal support via Wine Vulkan going from DX11->DXVK->MoltenVK route I think doesn't seem high priority as you say.. Anyway for completeness just say that as I learn more of these details I'm appreciating more your implementation and the also effort Vmware guys have done on VMware Fusion product..
now it's working!! only some minor issues changing screen res..
I tried vkquake available here: https://github.com/Novum/vkQuake
this is mostly copy&paste from: https://github.com/Novum/vkQuake/issues/132
so tried to compile vkquake using MacOS Vulkan SDK and to my surprise compiled ok changing only libvulkan.so for -framework vulkan on Makefile.. I did previously: brew upgrade libsdl to use also new SDL 2.0.8 supporting Vulkan for Macos..
seems to crash very late in the process of Vulkan init so seems good news: as said I have reported to vkquake devs asking if it is easy to fix from their side.. errors seems to be:
VkPrimitiveTopology value 5 is not supported for rendering
and shader compiler error: Compilation failed: