Create a vulkan Instance from OpenXR

Pitou

Member
Messages
19
Reaction score
10
Hello,

I work on the translation of the hello_xr sample to C# using BRUTAL for the Vulkan API and Silk.NET.OpenXR for the OpenXR API.

The issue I have, is that OpenXR create my Vulkan instance using a function pointer to xrCreateVulkanInstanceKHR (on the Silk.NET.OpenXR side), then I convert the handle received to a Brutal.VulkanApi.VkInstance but I did not find a way to create a Brutal.VulkanApi.Instance from this handle...
Because I only have a raw Brutal.VulkanApi.VkInstance, usage of BRUTAL is way harder than it should.

For exemple, to call vkGetPhysicalDeviceQueueFamilyProperties equivalent with BRUTAL, I found this way to call the function, but it is not ideal:
C#
VkInstance m_vkInstance;
VkPhysicalDevice m_vkPhysicalDevice;
...
VkInstance.FunctionTable vkInstanceInvoke = new VkInstance.FunctionTable(m_vkInstance, Vulkan.GetInstanceProcAddr);
int queueFamilyCount = 0;
vkInstanceInvoke.vkGetPhysicalDeviceQueueFamilyProperties.Invoke(m_vkPhysicalDevice, &queueFamilyCount, null);
Console.WriteLine("queueFamilyCount " + queueFamilyCount); // Display "queueFamilyCount 6" :)
That's very brutal!

Maybe we need a way to provide custom Vulkan instance handle here, to provide it from OpenXR or other libraries?

I'm still a beginner with raw Vulkan/OpenXR, I may have not understand something, any advice is welcome!
Side question: any chance to have OpenXR bindings in BRUTAL one day?
 
Back
Top