cancel
Showing results for 
Search instead for 
Did you mean: 

A way to attach to a running Vulkan instance/device?

AlexDiy
Level 2

 

Hi!

 

I'm porting an application from OpenGL to Vulkan and it's time for VR. Until now I've been obtaining swapchain images via OpenGL API and it worked well in the following way:
- Runnig application wants to turn on VR

- Oculus session is initialized, gl texture handles obtained for swapchain

- Rendering is blitted into those textures and they are presented

 

Now with Vulkan things look a bit different, but ideally I would like to keep the workflow:

- Running application wants to turn on VR

- I get a physical device for existing vk instance (already used for usual desktop rendering) via ovr_GetSessionPhysicalDeviceVk (this step works)

- I create swapchain via ovr_CreateTextureSwapChainVk using existing device (this step fails)

- I obtain images to render to

- Rendering is blitted into those images and they are presented

 

The step that fails uses logical device created during application startup - not a new one I supposed to create from the physical device returned from Oculus SDK call, although physical device LUIDs match.

The questions are:

- Am I supposed to create a new logical device for sure? Can't I recycle the one I already have?

- How is interop between my existing logical device and the one I'll create for Oculus supposed to work? Can I blit (or attach) to the images obtained from oculus swapchain from the images I create using my first device at all?

- Or am I supposed to first create device using Oculus SDK and use it during the whole application lifetime for all the rendering work I do? So basically no hot-load of VR feature.

Thank you!

1 REPLY 1

AlexDiy
Level 2

 

For the devs who will encounter this question: it is possible to attach existing logical device - be sure that vulkan instance and logical device extensions required by Oculus are all enabled.