I’m curious as to what the solution is to make it work in Release since the same line causes a premature error in our code when starting VR.
The error in the sample project is
[13:15:41.311][Error ] GraphicsPlugin parameter is required
My initial hunch was to build the openxr_loader.lib with the following defines, hoping that it would expose the xrGetD3D12GraphicsRequirementsKHR function, but that doesn’t seem to be the case.
You definitely do not want XR_EXTENSION_PROTOTYPES - there is almost no case in which you want to define that.
If xrGetInstanceProcAddr returns nullptr for a given function, this typically means you don’t have that extension enabled. You need to enable the XR_KHR_D3D12_enable extension (in this case) to have access to that function.
I’m not sure how Release mode would affect things here - is it that release is breaking things in your app? Hello XR should work fine in Release builds.
I already do this, but this was a really good pointer (pun intended) to where the root of the problem actually was.
Long story short, the cause is Dead-code optimization. The VS Compiler thinks it is smart enough to just remove the SelectExtensions() function altogether when in Release.
enabledExtensions results in an empty vector, thus causing the validation error later on.
PS: This is happening on the hello_xr project as well.
Thanks for the help!
Edit: If anyone stumbles upon this problem, the quick fix is to hardcode the enabledExtensions vector
hmm, so now I’m really confused, what change needs to be made to hello_xr? The extensions vector of const char * is definitely being used (in CreateInstanceInternal)… It is populated by the two std::transform calls with std::back_inserter making an output iterator.