FacticiusVir/SharpVk

The Triangle example for UWP?

JimSEOW opened this issue · 10 comments

I tried other Vulkan c# at github, SharpVK is the only one that make the sample run in windows 10

Request for an UWP app sample :-)

I've got a work item to move the examples to a more portable windowing library, though I was looking at something like GLFW for Windows/Linux compatibility. I'd need to investigate whether it's possible to support Vulkan in a UWP application; do you need that platform specifically?

A very crude port of SharpVk (and its dependency, GlmSharp) is now available in the UWP branch, along with a reworking of the HelloTriangle sample (SharpVk.HelloTriangle.Uwp) - https://github.com/FacticiusVir/SharpVk/tree/UWP

However, while the code runs and returns success codes the image is not rendered to the UWP window. I can't find any significant mention on the Internet of people getting Vulkan to run under UWP, so I'd strongly suggest looking at alternate application types (the samples use WinForms, but GLFW or WPF/Xaml apps should work just as well) if you want to use that API specifically; in the meantime I will do more research and see if I can make any further progress, but the code is uploaded to the branch if you want to check it out and see if you can spot something I've missed.

I download the UWP branch and compiled and deployed but it does not run.
You are right, there is very little info right now on Vulkan for UWP (PC) and even mobile (ARM) and how the graphics drivers will and will not support. Thanks for the effort.

The other 3D engine I am currently experimenting is UrhoSharp, which is now being ported to UWP Hololens

Thanks for responding to the request.

@krOoze has opened an issue at KhronosGroup/Vulkan-Docs#366 discussing a specific WSI extension for UWP SwapChains.

@FacticiusVir SkiaSharp now working on Vulkan

Okay; I've had a look at their samples, and their UWP sample doesn't support the Vulkan backend. Currently there is no WSI integration for rendering from Vulkan to UWP - you might be able to use the newer External Memory extensions to render from Vulkan to DirectX, then present from DirectX to UWP, but that's a outside the scope of a sample and support for those extensions is (to my knowledge) limited.

I would wonder if Microsoft supports Vulkan because of DX, also if you go with UWP there's no reason to use Vulkan (because I guess the code will be already very windows specific) and so I rather suggest to use DX12

@FacticiusVir Now there are SwapChainPanel example how to do XAML interop with (DirectX12) and (OpenGLES using Microsoft Angle) in both C++ and c#.

What could the problem? getting HWND from UWP?

The HWND isn't enough; that's the approach used in my original trial branch. You can output to a DirectX12 texture using VK_KHX_external_memory_win32 and then use DX12 to render to the SwapChainPanel, but there's no other case I've seen where someone renders direct to UWP through the Vulkan API.

@FacticiusVir here is a C# port of DirectX11 VS2015 template using SwapchainPanel XAML interop
I think port this sample to Direct12 should not be a problem.
Do you think this is a good start or do you think you need more for VK_KHX_external_memory_win32?