mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
OpenXR - Introduce platform flags
This commit is contained in:
parent
f8d29e0d19
commit
aafa17fa73
@ -103,12 +103,21 @@ bool IsVRBuild() {
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
void InitVROnAndroid(void* vm, void* activity, int version, char* name) {
|
||||
bool useVulkan = (GPUBackend)g_Config.iGPUBackend == GPUBackend::VULKAN;
|
||||
|
||||
//TODO:get the flags in runtime
|
||||
#ifdef OPENXR_PLATFORM_PICO
|
||||
VR_SetPlatformFLag(VR_PLATFORM_CONTROLLER_PICO, true);
|
||||
VR_SetPlatformFLag(VR_PLATFORM_PICO_INIT, true);
|
||||
#elifdef OPENXR_PLATFORM_QUEST
|
||||
VR_SetPlatformFLag(VR_PLATFORM_CONTROLLER_QUEST, true);
|
||||
VR_SetPlatformFLag(VR_PLATFORM_PERFORMANCE_EXT, true);
|
||||
#endif
|
||||
VR_SetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN, (GPUBackend)g_Config.iGPUBackend == GPUBackend::VULKAN);
|
||||
|
||||
ovrJava java;
|
||||
java.Vm = (JavaVM*)vm;
|
||||
java.ActivityObject = (jobject)activity;
|
||||
VR_Init(&java, useVulkan, name, version);
|
||||
VR_Init(&java, name, version);
|
||||
|
||||
__DisplaySetFramerate(72);
|
||||
}
|
||||
|
@ -37,10 +37,11 @@ PFN_xrSetEngineVersionPico pfnXrSetEngineVersionPico = nullptr;
|
||||
PFN_xrStartCVControllerThreadPico pfnXrStartCVControllerThreadPico = nullptr;
|
||||
PFN_xrStopCVControllerThreadPico pfnXrStopCVControllerThreadPico = nullptr;
|
||||
|
||||
static bool vr_platform[VR_PLATFORM_MAX];
|
||||
static engine_t vr_engine;
|
||||
int vr_initialized = 0;
|
||||
|
||||
void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
void VR_Init( void* system, char* name, int version ) {
|
||||
if (vr_initialized)
|
||||
return;
|
||||
|
||||
@ -62,24 +63,24 @@ void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
#endif
|
||||
|
||||
std::vector<const char *> extensions;
|
||||
if (useVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
extensions.push_back(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME);
|
||||
} else {
|
||||
extensions.push_back(XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME);
|
||||
}
|
||||
extensions.push_back(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME);
|
||||
#ifdef OPENXR_HAS_PERFORMANCE_EXTENSION
|
||||
extensions.push_back(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME);
|
||||
extensions.push_back(XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME);
|
||||
#endif
|
||||
#ifdef OPENXR_PLATFORM_PICO
|
||||
extensions.push_back(XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME);
|
||||
extensions.push_back("XR_PICO_android_controller_function_ext_enable");
|
||||
extensions.push_back("XR_PICO_view_state_ext_enable");
|
||||
extensions.push_back("XR_PICO_frame_end_info_ext");
|
||||
extensions.push_back("XR_PICO_configs_ext");
|
||||
extensions.push_back("XR_PICO_reset_sensor");
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PERFORMANCE_EXT)) {
|
||||
extensions.push_back(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME);
|
||||
extensions.push_back(XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME);
|
||||
}
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PICO_INIT)) {
|
||||
extensions.push_back(XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME);
|
||||
extensions.push_back("XR_PICO_android_controller_function_ext_enable");
|
||||
extensions.push_back("XR_PICO_view_state_ext_enable");
|
||||
extensions.push_back("XR_PICO_frame_end_info_ext");
|
||||
extensions.push_back("XR_PICO_configs_ext");
|
||||
extensions.push_back("XR_PICO_reset_sensor");
|
||||
}
|
||||
|
||||
// Create the OpenXR instance.
|
||||
XrApplicationInfo appInfo;
|
||||
@ -101,12 +102,14 @@ void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
instanceCreateInfo.enabledExtensionCount = extensions.size();
|
||||
instanceCreateInfo.enabledExtensionNames = extensions.data();
|
||||
|
||||
#if defined(ANDROID) && defined(OPENXR_PLATFORM_PICO)
|
||||
ovrJava* java = (ovrJava*)system;
|
||||
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR};
|
||||
instanceCreateInfoAndroid.applicationVM = java->Vm;
|
||||
instanceCreateInfoAndroid.applicationActivity = java->ActivityObject;
|
||||
instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
||||
#ifdef ANDROID
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PICO_INIT)) {
|
||||
ovrJava* java = (ovrJava*)system;
|
||||
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR};
|
||||
instanceCreateInfoAndroid.applicationVM = java->Vm;
|
||||
instanceCreateInfoAndroid.applicationActivity = java->ActivityObject;
|
||||
instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
||||
}
|
||||
#endif
|
||||
|
||||
XrResult initResult;
|
||||
@ -116,14 +119,14 @@ void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef OPENXR_PLATFORM_PICO
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrSetEngineVersionPico", (PFN_xrVoidFunction*)(&pfnXrSetEngineVersionPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrStartCVControllerThreadPico", (PFN_xrVoidFunction*)(&pfnXrStartCVControllerThreadPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrStopCVControllerThreadPico", (PFN_xrVoidFunction*)(&pfnXrStopCVControllerThreadPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
||||
if (pfnXrSetEngineVersionPico != nullptr) pfnXrSetEngineVersionPico(vr_engine.appState.Instance, "2.8.0.1");
|
||||
if (pfnXrStartCVControllerThreadPico != nullptr) pfnXrStartCVControllerThreadPico(vr_engine.appState.Instance, PXR_TRACKING_6DOF, PXR_TRACKING_6DOF);
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PICO_INIT)) {
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrSetEngineVersionPico", (PFN_xrVoidFunction*)(&pfnXrSetEngineVersionPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrStartCVControllerThreadPico", (PFN_xrVoidFunction*)(&pfnXrStartCVControllerThreadPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance, "xrStopCVControllerThreadPico", (PFN_xrVoidFunction*)(&pfnXrStopCVControllerThreadPico));
|
||||
xrGetInstanceProcAddr(vr_engine.appState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
||||
if (pfnXrSetEngineVersionPico != nullptr) pfnXrSetEngineVersionPico(vr_engine.appState.Instance, "2.8.0.1");
|
||||
if (pfnXrStartCVControllerThreadPico != nullptr) pfnXrStartCVControllerThreadPico(vr_engine.appState.Instance, PXR_TRACKING_6DOF, PXR_TRACKING_6DOF);
|
||||
}
|
||||
|
||||
XrInstanceProperties instanceInfo;
|
||||
instanceInfo.type = XR_TYPE_INSTANCE_PROPERTIES;
|
||||
@ -150,7 +153,7 @@ void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
}
|
||||
|
||||
// Get the graphics requirements.
|
||||
if (useVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
PFN_xrGetVulkanGraphicsRequirementsKHR pfnGetVulkanGraphicsRequirementsKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
vr_engine.appState.Instance,
|
||||
@ -174,17 +177,17 @@ void VR_Init( void* system, bool useVulkan, char* name, int version ) {
|
||||
|
||||
vr_engine.appState.MainThreadTid = gettid();
|
||||
vr_engine.appState.SystemId = systemId;
|
||||
vr_engine.useVulkan = useVulkan;
|
||||
vr_initialized = 1;
|
||||
}
|
||||
|
||||
void VR_Destroy( engine_t* engine ) {
|
||||
if (engine == &vr_engine) {
|
||||
#ifdef OPENXR_PLATFORM_PICO
|
||||
if (pfnXrStopCVControllerThreadPico != nullptr) {
|
||||
pfnXrStopCVControllerThreadPico(engine->appState.Instance, PXR_TRACKING_6DOF, PXR_TRACKING_6DOF);
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PICO_INIT)) {
|
||||
if (pfnXrStopCVControllerThreadPico != nullptr) {
|
||||
pfnXrStopCVControllerThreadPico(engine->appState.Instance, PXR_TRACKING_6DOF, PXR_TRACKING_6DOF);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
xrDestroyInstance(engine->appState.Instance);
|
||||
ovrApp_Destroy(&engine->appState);
|
||||
}
|
||||
@ -199,17 +202,25 @@ void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVu
|
||||
|
||||
// Create the OpenXR Session.
|
||||
XrSessionCreateInfo sessionCreateInfo = {};
|
||||
XrGraphicsBindingOpenGLESAndroidKHR graphicsBindingAndroidGLES = {};
|
||||
#ifdef ANDROID
|
||||
XrGraphicsBindingOpenGLESAndroidKHR graphicsBindingGL = {};
|
||||
#else
|
||||
XrGraphicsBindingOpenGLWin32KHR graphicsBindingGL = {};
|
||||
#endif
|
||||
memset(&sessionCreateInfo, 0, sizeof(sessionCreateInfo));
|
||||
if (engine->useVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
sessionCreateInfo.next = graphicsBindingVulkan;
|
||||
} else {
|
||||
graphicsBindingAndroidGLES.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR;
|
||||
graphicsBindingAndroidGLES.next = NULL;
|
||||
graphicsBindingAndroidGLES.display = eglGetCurrentDisplay();
|
||||
graphicsBindingAndroidGLES.config = eglGetCurrentSurface(EGL_DRAW);
|
||||
graphicsBindingAndroidGLES.context = eglGetCurrentContext();
|
||||
sessionCreateInfo.next = &graphicsBindingAndroidGLES;
|
||||
#ifdef ANDROID
|
||||
graphicsBindingGL.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR;
|
||||
graphicsBindingGL.next = NULL;
|
||||
graphicsBindingGL.display = eglGetCurrentDisplay();
|
||||
graphicsBindingGL.config = eglGetCurrentSurface(EGL_DRAW);
|
||||
graphicsBindingGL.context = eglGetCurrentContext();
|
||||
#else
|
||||
//TODO:PCVR definition
|
||||
#endif
|
||||
sessionCreateInfo.next = &graphicsBindingGL;
|
||||
}
|
||||
sessionCreateInfo.type = XR_TYPE_SESSION_CREATE_INFO;
|
||||
sessionCreateInfo.createFlags = 0;
|
||||
@ -221,9 +232,9 @@ void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVu
|
||||
ALOGE("Failed to create XR session: %d.", initResult);
|
||||
exit(1);
|
||||
}
|
||||
#ifdef OPENXR_PLATFORM_PICO
|
||||
pfnXrSetConfigPICO(engine->appState.Session, TRACKING_ORIGIN, "1");
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_PICO_INIT)) {
|
||||
pfnXrSetConfigPICO(engine->appState.Session, TRACKING_ORIGIN, "1");
|
||||
}
|
||||
|
||||
// Create a space to the first path
|
||||
XrReferenceSpaceCreateInfo spaceCreateInfo = {};
|
||||
@ -251,4 +262,12 @@ engine_t* VR_GetEngine( void ) {
|
||||
return &vr_engine;
|
||||
}
|
||||
|
||||
bool VR_GetPlatformFLag(VRPlatformFlag flag) {
|
||||
return vr_platform[flag];
|
||||
}
|
||||
|
||||
void VR_SetPlatformFLag(VRPlatformFlag flag, bool value) {
|
||||
vr_platform[flag] = value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -100,10 +100,6 @@ static void OXR_CheckErrors(XrInstance instance, XrResult result, const char* fu
|
||||
#define OXR(func) func;
|
||||
#endif
|
||||
|
||||
#ifdef OPENXR_PLATFORM_QUEST
|
||||
#define OPENXR_HAS_PERFORMANCE_EXTENSION
|
||||
#endif
|
||||
|
||||
enum { ovrMaxLayerCount = 2 };
|
||||
enum { ovrMaxNumEyes = 2 };
|
||||
|
||||
@ -133,7 +129,6 @@ typedef struct {
|
||||
VkImageView* VKDepthImages;
|
||||
|
||||
bool Acquired;
|
||||
bool UseVulkan;
|
||||
XrGraphicsBindingVulkanKHR* VKContext;
|
||||
} ovrFramebuffer;
|
||||
|
||||
@ -178,16 +173,27 @@ typedef struct {
|
||||
uint64_t frameIndex;
|
||||
ovrApp appState;
|
||||
float predictedDisplayTime;
|
||||
bool useVulkan;
|
||||
XrGraphicsBindingVulkanKHR graphicsBindingVulkan;
|
||||
} engine_t;
|
||||
|
||||
void VR_Init( void* system, bool useVulkan, char* name, int version );
|
||||
enum VRPlatformFlag {
|
||||
VR_PLATFORM_CONTROLLER_PICO,
|
||||
VR_PLATFORM_CONTROLLER_QUEST,
|
||||
VR_PLATFORM_PERFORMANCE_EXT,
|
||||
VR_PLATFORM_PICO_INIT,
|
||||
VR_PLATFORM_RENDERER_VULKAN,
|
||||
VR_PLATFORM_TRACKING_FLOOR,
|
||||
VR_PLATFORM_MAX
|
||||
};
|
||||
|
||||
void VR_Init( void* system, char* name, int version );
|
||||
void VR_Destroy( engine_t* engine );
|
||||
void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVulkan );
|
||||
void VR_LeaveVR( engine_t* engine );
|
||||
|
||||
engine_t* VR_GetEngine( void );
|
||||
bool VR_GetPlatformFLag(VRPlatformFlag flag);
|
||||
void VR_SetPlatformFLag(VRPlatformFlag flag, bool value);
|
||||
|
||||
void ovrApp_Clear(ovrApp* app);
|
||||
void ovrApp_Destroy(ovrApp* app);
|
||||
|
@ -49,7 +49,6 @@ bool ovrFramebuffer_CreateGL(XrSession session, ovrFramebuffer* frameBuffer, int
|
||||
|
||||
frameBuffer->Width = width;
|
||||
frameBuffer->Height = height;
|
||||
frameBuffer->UseVulkan = false;
|
||||
|
||||
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_OVR_multiview2") == nullptr)
|
||||
{
|
||||
@ -142,7 +141,6 @@ bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuffer, int
|
||||
|
||||
frameBuffer->Width = width;
|
||||
frameBuffer->Height = height;
|
||||
frameBuffer->UseVulkan = true;
|
||||
frameBuffer->VKContext = (XrGraphicsBindingVulkanKHR*)context;
|
||||
|
||||
XrSwapchainCreateInfo swapChainCreateInfo;
|
||||
@ -242,7 +240,7 @@ bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuffer, int
|
||||
}
|
||||
|
||||
void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) {
|
||||
if (frameBuffer->UseVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
for (int i = 0; i < frameBuffer->TextureSwapChainLength; i++) {
|
||||
vkDestroyImageView(frameBuffer->VKContext->device, frameBuffer->VKColorImages[i], nullptr);
|
||||
vkDestroyImageView(frameBuffer->VKContext->device, frameBuffer->VKDepthImages[i], nullptr);
|
||||
@ -266,7 +264,7 @@ void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) {
|
||||
}
|
||||
|
||||
void* ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer) {
|
||||
if (frameBuffer->UseVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
return (void *)frameBuffer->VKFrameBuffers[frameBuffer->TextureSwapChainIndex];
|
||||
} else {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
@ -298,7 +296,7 @@ void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) {
|
||||
|
||||
ovrFramebuffer_SetCurrent(frameBuffer);
|
||||
|
||||
if (frameBuffer->UseVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
//TODO:implement
|
||||
} else {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
@ -320,7 +318,7 @@ void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer) {
|
||||
frameBuffer->Acquired = false;
|
||||
|
||||
// Clear the alpha channel, other way OpenXR would not transfer the framebuffer fully
|
||||
if (frameBuffer->UseVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
//TODO:implement
|
||||
} else {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
@ -369,7 +367,7 @@ void ovrRenderer_Destroy(ovrRenderer* renderer) {
|
||||
}
|
||||
|
||||
void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int size) {
|
||||
if (renderer->FrameBuffer[0].UseVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
//TODO:implement
|
||||
} else {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
@ -428,14 +426,9 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
|
||||
|
||||
XrResult result;
|
||||
OXR(result = xrBeginSession(app->Session, &sessionBeginInfo));
|
||||
|
||||
app->SessionActive = (result == XR_SUCCESS);
|
||||
|
||||
// Set session state once we have entered VR mode and have a valid session object.
|
||||
|
||||
// TODO: This should be a runtime check of the extension's presence, no?
|
||||
#ifdef OPENXR_HAS_PERFORMANCE_EXTENSION
|
||||
if (app->SessionActive) {
|
||||
if (app->SessionActive && VR_GetPlatformFLag(VR_PLATFORM_PERFORMANCE_EXT)) {
|
||||
XrPerfSettingsLevelEXT cpuPerfLevel = XR_PERF_SETTINGS_LEVEL_BOOST_EXT;
|
||||
XrPerfSettingsLevelEXT gpuPerfLevel = XR_PERF_SETTINGS_LEVEL_BOOST_EXT;
|
||||
|
||||
@ -457,7 +450,6 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(app->Session, XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, app->MainThreadTid));
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(app->Session, XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, app->RenderThreadTid));
|
||||
}
|
||||
#endif
|
||||
} else if (state == XR_SESSION_STATE_STOPPING) {
|
||||
assert(app->SessionActive);
|
||||
|
||||
|
@ -268,25 +268,27 @@ void IN_VRInit( engine_t *engine ) {
|
||||
handPoseRightAction = CreateAction(runningActionSet, XR_ACTION_TYPE_POSE_INPUT, "hand_pose_right", NULL, 1, &rightHandPath);
|
||||
|
||||
XrPath interactionProfilePath = XR_NULL_PATH;
|
||||
#ifdef OPENXR_PLATFORM_QUEST
|
||||
OXR(xrStringToPath(engine->appState.Instance, "/interaction_profiles/oculus/touch_controller", &interactionProfilePath));
|
||||
#elif OPENXR_PLATFORM_PICO
|
||||
OXR(xrStringToPath(engine->appState.Instance, "/interaction_profiles/pico/neo3_controller", &interactionProfilePath));
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_CONTROLLER_QUEST)) {
|
||||
OXR(xrStringToPath(engine->appState.Instance, "/interaction_profiles/oculus/touch_controller", &interactionProfilePath));
|
||||
} else if (VR_GetPlatformFLag(VR_PLATFORM_CONTROLLER_PICO)) {
|
||||
OXR(xrStringToPath(engine->appState.Instance, "/interaction_profiles/pico/neo3_controller", &interactionProfilePath));
|
||||
}
|
||||
|
||||
// Map bindings
|
||||
XrActionSuggestedBinding bindings[32]; // large enough for all profiles
|
||||
int currBinding = 0;
|
||||
|
||||
#ifdef OPENXR_PLATFORM_QUEST
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexLeftAction, "/user/hand/left/input/trigger");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexRightAction, "/user/hand/right/input/trigger");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/left/input/menu/click");
|
||||
#elif OPENXR_PLATFORM_PICO
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexLeftAction, "/user/hand/left/input/trigger/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexRightAction, "/user/hand/right/input/trigger/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/left/input/back/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/right/input/back/click");
|
||||
#endif
|
||||
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_CONTROLLER_QUEST)) {
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexLeftAction, "/user/hand/left/input/trigger");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexRightAction, "/user/hand/right/input/trigger");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/left/input/menu/click");
|
||||
} else if (VR_GetPlatformFLag(VR_PLATFORM_CONTROLLER_PICO)) {
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexLeftAction, "/user/hand/left/input/trigger/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(indexRightAction, "/user/hand/right/input/trigger/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/left/input/back/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(menuAction, "/user/hand/right/input/back/click");
|
||||
}
|
||||
bindings[currBinding++] = ActionSuggestedBinding(buttonXAction, "/user/hand/left/input/x/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(buttonYAction, "/user/hand/left/input/y/click");
|
||||
bindings[currBinding++] = ActionSuggestedBinding(buttonAAction, "/user/hand/right/input/a/click");
|
||||
|
@ -152,9 +152,10 @@ void VR_Recenter(engine_t* engine) {
|
||||
// Create a default stage space to use if SPACE_TYPE_STAGE is not
|
||||
// supported, or calls to xrGetReferenceSpaceBoundsRect fail.
|
||||
spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
|
||||
#ifdef OPENXR_FLOOR_STAGE
|
||||
spaceCreateInfo.poseInReferenceSpace.position.y = -1.6750f;
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_TRACKING_FLOOR))
|
||||
{
|
||||
spaceCreateInfo.poseInReferenceSpace.position.y = -1.6750f;
|
||||
}
|
||||
OXR(xrCreateReferenceSpace(engine->appState.Session, &spaceCreateInfo, &engine->appState.FakeStageSpace));
|
||||
ALOGV("Created fake stage space from local space with offset");
|
||||
engine->appState.CurrentSpace = engine->appState.FakeStageSpace;
|
||||
@ -164,9 +165,10 @@ void VR_Recenter(engine_t* engine) {
|
||||
spaceCreateInfo.poseInReferenceSpace.position.y = 0.0;
|
||||
OXR(xrCreateReferenceSpace(engine->appState.Session, &spaceCreateInfo, &engine->appState.StageSpace));
|
||||
ALOGV("Created stage space");
|
||||
#ifdef OPENXR_FLOOR_STAGE
|
||||
engine->appState.CurrentSpace = engine->appState.StageSpace;
|
||||
#endif
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_TRACKING_FLOOR))
|
||||
{
|
||||
engine->appState.CurrentSpace = engine->appState.StageSpace;
|
||||
}
|
||||
}
|
||||
|
||||
// Update menu orientation
|
||||
@ -209,7 +211,7 @@ void VR_InitRenderer( engine_t* engine, bool multiview ) {
|
||||
projections = (XrView*)(malloc(ovrMaxNumEyes * sizeof(XrView)));
|
||||
|
||||
void* vulkanContext = nullptr;
|
||||
if (engine->useVulkan) {
|
||||
if (VR_GetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
vulkanContext = &engine->graphicsBindingVulkan;
|
||||
}
|
||||
ovrRenderer_Create(engine->appState.Session, &engine->appState.Renderer,
|
||||
|
Loading…
Reference in New Issue
Block a user