I need to make depth comparisons on the depth buffers of my rendered VR frames in Vulkan.
For that I extract the texture pointers like this:
for (int i = 0; i < renderPassCount; i++)
{
XRDisplaySubsystem.XRRenderPass renderPass;
xrDisplaySubsystem.GetRenderPass(i, out renderPass);
RenderTexture vrRT = xrDisplaySubsystem.GetRenderTextureForRenderPass(i);
IntPtr pColorTex = vrRT.GetNativeTexturePtr();
IntPtr pDepthTex = vrRT.GetNativeDepthBufferPtr();
Plugin.setUnityRenderTargets(pColorTex, pDepthTex);
}
From that I get valid texture pointers. Looking at the color texture it is written to correctly, but the depth buffer has the default depth value of 1.0 everywhere.
I already tried setting the cameras depth mode:
cam.depthTextureMode = DepthTextureMode.Depth;
And under “Project Setting->XR Plug-in Management->OpenXR->Depth Submission Mode” I tried 16 and 24 bit to no awail. (But I’m not even quite sure what that setting does)
Any help would be quite appreciated. Thanks in advance!