1

xrCreateSession takes in an XrInstance and an XrSessionCreateInfo.

The XrInstanceCreateInfo used to create the instance isn't particularly interesting: the only parameters of note are enabledExtensionCount (= 1), and enabledExtensionNames (= XR_KHR_VULKAN_ENABLE_EXTENSION_NAME). The rest is arbitrary title/version info.

The XRSessionCreateInfo used to create the session has systemId set to the result of xrGetSystem, and next set to a pointer of type XrGraphicsBindingVulkanKHR.

The values of that simply point to a vulkan instance, physicalDevice, device, queueFamilyIndex, and queueIndex I am reasonably confident I have gathered correctly (I have vulkan working fine without openXR).

But the second xrCreateSession is called, I get about 20 validation errors of the following form:

Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x24341691190, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Header block 512[%512] is contained in the loop construct headed by 505[%505], but its merge block 513[%513] is not
  %512 = OpLabel

(with different numbers for header block, headed by, merge block, etc...).

I haven't at this point yet supplied any SPIR-V to either vulkan nor openXR, so I'm unsure what is within my control.

Why am I getting these errors? What can be done to prevent them?

Phildo
  • 986
  • 2
  • 20
  • 36
  • I don't know for sure, but my guess would be that the implementation of XR needs to invoke shaders during later calls, and it loads these during `xrCreateSession`. So if those shader modules are invalid in some way, you'll see the validation errors during xrCreateSession. If you get a stack trace from your debug message callback and `xrCreateSession` is on the stack, I'd report a bug to your OpenXR vendor. – Jesse Hall Jul 13 '20 at 04:44
  • It's also possible that this is caused by an implicit Vulkan layer. There all kinds of tools and applications that install Vulkan layers that are implicitly loaded, and those can also trigger validation layer errors. On Windows you can disable them in the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers registry key, by setting their values to 1 or by simply renaming the whole key. If the validation layer error is then gone, it was one of those implicit layers. – Sascha Willems Jul 14 '20 at 06:03
  • Phildo> same error, did you find the solution? – Leon Apr 05 '22 at 20:39

0 Answers0