Search code examples
c++vulkanoculus

Oculus Rift / Vulkan : Write to swapchain with a compute shader


I would like to write to the swapchain generated by OVR with a compute shader. The problem is that the images don't have the usage VK_IMAGE_USAGE_STORAGE_BIT.

The creation of the swapchain is done with ovr_CreateTextureSwapChainVk which ask for a flag BindFlags. I added the flag ovrTextureBind_DX_UnorderedAccess but still the images don't have the correct usage.


Solution

  • The problem is that the images don't have the usage VK_IMAGE_USAGE_STORAGE_BIT.

    Then you cannot write to a swapchain image directly with a compute shader.

    The display engine that provides the swapchain images has the right to decide how you may and may not use them. The only method of interaction which is required is the ability to use them as a color render target; everything else is optional.

    So you will have to do this another way, perhaps by writing to an intermediate image and copying/rendering it to the swapchain image.