So, I am getting XrResult = -1 when calling xrGetInstanceProperties(instance, &instance_properties) and xrGetSystemProperties(instance, system_id, &system_properties).
I get XrResult = 0 on xrCreateInstance(&createInfo, &instance) and xrGetSystem(instance, &systemInfo, &system_id).
If I try to print the content of instance_properties or system_properties I get a long line like this: ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Im guessing the XR_ERROR_VALIDATION_FAILURE = -1 is the reason I cant get real property strings? What is the reason for this failure?
Im using OpenGL, OpenXR, glfw, Oculus Quest 2.
Any tips are very welcome
We’ll need more code to help you troubleshoot. VALIDATION_FAILURE is the fallback error code, for when others don’t apply. Make sure you’re initializing the .type
and .next
members of your various structures, that’s a common mistake.
Here is the beginning of my initializing code:
void Viewer::VR_Init(GLFWwindow* window) {
HWND windowHWND = glfwGetWin32Window(window);
HDC windowDC = GetDC(windowHWND);
HGLRC windowHGLRC = glfwGetWGLContext(window);
//***INSTANCE SETUP***
//EXTENSIONS
std::vector<const char*> use_extensions;
const char* ask_extensions[] = {
XR_KHR_OPENGL_ENABLE_EXTENSION_NAME, // Use OpenGL for rendering
};
uint32_t ext_count = 0;
xrEnumerateInstanceExtensionProperties(nullptr, 0, &ext_count, nullptr);
std::vector<XrExtensionProperties> xr_exts(ext_count, { XR_TYPE_EXTENSION_PROPERTIES });
xrEnumerateInstanceExtensionProperties(nullptr, ext_count, &ext_count, xr_exts.data());
//Print available extension names to console
globjects::debug() << "Extensions available:";
for (size_t i = 0; i < xr_exts.size(); i++) {
globjects::debug() << xr_exts[i].extensionName;
}
for (size_t i = 0; i < xr_exts.size(); i++) {
// Check if we're asking for this extensions, and add it to our use list!
for (int32_t ask = 0; ask < _countof(ask_extensions); ask++) {
if (strcmp(ask_extensions[ask], xr_exts[i].extensionName) == 0) {
use_extensions.push_back(ask_extensions[ask]);
break;
}
}
}
//CREATE INSTANCE
// Initialize OpenXR with the extensions we've found!
XrInstanceCreateInfo createInfo = { XR_TYPE_INSTANCE_CREATE_INFO };
createInfo.next = nullptr;
createInfo.enabledExtensionCount = use_extensions.size();
createInfo.enabledExtensionNames = use_extensions.data();
createInfo.applicationInfo.apiVersion = XR_CURRENT_API_VERSION;
strcpy_s(createInfo.applicationInfo.applicationName, "Silbits box");
XrResult createInstanceResult = xrCreateInstance(&createInfo, &instance);
globjects::debug() << "Create instance result: " << createInstanceResult << " (0 = SUCCESS)";
// ***SESSION SETUP***
//INSTANCE PROPERTIES
//Load extension methods that we'll need for this application!
XrResult getInstanceProcAdrr = xrGetInstanceProcAddr(instance, "xrGetOpenGLGraphicsRequirementsKHR", (PFN_xrVoidFunction*)(&ext_xrGetOpenGLGraphicsRequirementsKHR));
globjects::debug() << "Get instance Proaddr result: " << getInstanceProcAdrr << " (0 = SUCCESS)";
XrResult GetInstancePropertiesResult = xrGetInstanceProperties(instance, &instance_properties);
globjects::debug() << "Get instance properties result: " << GetInstancePropertiesResult << " (0 = SUCCESS)";
globjects::debug() << instance_properties.runtimeName;
//TODO: Why do we get -1 here? And just gibberish inside instance_properties?
// XR_ERROR_VALIDATION_FAILURE = -1,
//SYSTEM ID
//Request a form factor from the device (HMD, Handheld, etc.)
XrSystemGetInfo systemInfo = { XR_TYPE_SYSTEM_GET_INFO };
systemInfo.formFactor = formfactor;
XrResult getSystemResult = xrGetSystem(instance, &systemInfo, &system_id);
globjects::debug() << "Get system result: " << getSystemResult;
XrResult GetSystemPropertiesResult = xrGetSystemProperties(instance, system_id, &system_properties);
globjects::debug() << "Get system properties result: " << GetSystemPropertiesResult;
globjects::debug() << system_properties.systemName;
//TODO: Why do we get -1 here? And just gibberish inside system_properties?
Here is my debug print:
Extensions available:
XR_KHR_D3D11_enable
XR_KHR_D3D12_enable
XR_KHR_opengl_enable
XR_KHR_vulkan_enable
XR_KHR_vulkan_enable2
XR_KHR_composition_layer_depth
XR_KHR_win32_convert_performance_counter_time
XR_KHR_convert_timespec_time
XR_KHR_composition_layer_cube
XR_KHR_composition_layer_cylinder
XR_KHR_composition_layer_equirect
XR_KHR_visibility_mask
XR_KHR_composition_layer_color_scale_bias
XR_EXT_win32_appcontainer_compatible
XR_OCULUS_recenter_event
XR_FB_color_space
XR_OCULUS_ovrsession_handle
XR_OCULUS_perf_stats
XR_OCULUS_audio_device_guid
XR_EXT_debug_utils
Create instance result: 0 (0 = SUCCESS)
Get instance Proaddr result: 0 (0 = SUCCESS)
Get instance properties result: -1 (0 = SUCCESS)
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Get system result: 0
Get system properties result: -1
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
I don’t see where you’re initializing instance_properties
but it’s presumably missing type/next.
system
Closed
September 29, 2022, 3:43pm
5
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.