6

I'm working on C# bindings for Vulkan, and these include a set of sample projects that render simple shapes to demonstrate the API calls. These projects run as WinForms applications, passing the HWND of the Forms to Vulkan to attach the Surface objects for creating swapchains.

I've had a request to provide a sample project that runs as a UWP application, but while I've got the project running (after porting all the code to UWP-portable libraries) and returning success codes from the Vulkan API, nothing appears in the UWP app window. I'm using the method described in this question to get a HWND from the UWP CoreWindow for the Vulkan Surface, and the sample code is uploaded at https://github.com/FacticiusVir/SharpVk/blob/UWP/SharpVk/SharpVk.HelloTriangle.Uwp/MainPage.xaml.cs - unfortunately I can't pick out a specific section of code to quote, as I've no idea where in the project the problem lies.

So, to summarise - should it be possible to use Vulkan as a renderer for UWP applications, and if so how should I go about it?

Community
  • 1
  • 1
FacticiusVir
  • 2,037
  • 15
  • 28
  • 3
    Side note: copy-paste :-P https://github.com/FacticiusVir/SharpVk/blob/UWP/SharpVk/SharpVk.HelloTriangle.Uwp/MainPage.xaml.cs#L156 – zerkms Sep 08 '16 at 02:45
  • Huh...well spotted – FacticiusVir Sep 08 '16 at 03:02
  • @krOoze Well, even if I don't fix this specific issue I'm getting some great fixes for the existing samples :-D I'll fix that up, but on my test machine the graphics & present queue are the same so that shouldn't be the cause here. – FacticiusVir Sep 08 '16 at 12:33
  • Oh, and can I assume it otherwisely work as a whole? E.g. in a headless mode drawing to a *.raw. And layers are silent? – krOoze Sep 08 '16 at 12:51
  • @krOoze This code is duplicated from a working example against WinForms (typos and all), with the only difference being in the CreateSurface (https://github.com/FacticiusVir/SharpVk/blob/UWP/SharpVk/SharpVk.HelloTriangle.Uwp/MainPage.xaml.cs#L208) where it gets the HWND from UWP CoreWindow instead of the Form object, and the location that calls DrawFrame (originally in the main message loop, here triggered by a looping background task). – FacticiusVir Sep 08 '16 at 13:00
  • Am not at the test machine right now, but will test the return value of surface present support ASAP – FacticiusVir Sep 08 '16 at 13:01
  • 2
    I think it may be possible, but without XAML getting in the way. That is for CoreWindow (which is not ideal, but better than nothing.). I am trying to test it using as a base some older DirectX based tutorials which do use the CoreWindow (but I take too long). Also I raised a question on Vulkan GitHub, asking if SwapChainPanel (which DX is supposed to use) can be added to WSI. – krOoze Sep 17 '16 at 13:38
  • @FacticiusVir did you get anywhere with this? – Display Name Oct 13 '17 at 00:34
  • @DisplayName The issue raised by krOoze is still pending - https://github.com/KhronosGroup/Vulkan-Docs/issues/366. With the new External Memory extensions, it should be possible to build a pass-through that renders in Vulkan then copies to a DirectX texture for presenting, but I've not had chance to write up any code for that. – FacticiusVir Oct 16 '17 at 11:22

0 Answers0