Vulkan pendant to quadbuffered stereo

Hi folks,

I’ve been looking into stereo rendering using Vulkan, as I’m trying to run some tests on a Quadro M6000. The topic seems to be hardly touched so far, since I’m unable to find any samples or how-to’s online, also the Vulkan documentation is very sparse when it comes to the stereo. I posted on stackoverflow and got forwarded to Nvidia for a vendor-specific implementation of how to render to the buffers for left/right eye. I don’t know where to start and how to accomplish that, in OpenGL there was a pretty straightforward way by enabling GL_STEREO and then rendering to the LEFT/RIGHT variants of front or back buffers, but how would I do this using Vulkan? Maybe there are some samples I missed, that can get me started? Also, is there really no hardware agnostic way (maybe “yet”) to do this, would a solution really be specific to Nvidia drivers?

Thanks!

Hey iko79,

unfortunately, there doesn’t seem to be something equivalent for Vulkan (yet), you can however work around the problem by using Nvidia’s NV_draw_vulkan_image extension (https://www.khronos.org/registry/OpenGL/extensions/NV/NV_draw_vulkan_image.txt) to draw a Vulkan-generated image into an existing OpenGL context. jherico has an example app how to use it at Vulkan/glinterop.cpp at cpp · jherico/Vulkan · GitHub

Extending usage to quad-buffered stereo then is easy, the workflow is essentially

glDrawBuffer(GL_BACK_LEFT)
glDrawVkImage(vulkanImageLeft, ...)

glDrawBuffer(GL_BACK_RIGHT)
glDrawVkImage(vulkanImageRight, ...)

glSwapBuffers()
glSignalVkSemaphoreNV(waitSemaphore)

The semaphore there is important to make sure OpenGL and Vulkan render in-step.