mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Changes to allow a single APK to run on both Quest and Pico
Link against the generic Android openxr_loader then load the correct loader library at runtime on start-up
This commit is contained in:
parent
348bd46f62
commit
0b27c1c0e9
10 changed files with 185 additions and 160 deletions
15
.gitignore
vendored
15
.gitignore
vendored
|
@ -15,9 +15,6 @@ $RECYCLE.BIN/
|
|||
*.o
|
||||
*.d
|
||||
|
||||
#binaries
|
||||
*.so
|
||||
|
||||
#libs
|
||||
*.a
|
||||
|
||||
|
@ -43,3 +40,15 @@ assets/pak0.pk3
|
|||
assets/sp_pak_weapons.pk3
|
||||
assets/z_zvr_weapons.pk3
|
||||
assets/sp_vpak8.pk3
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi-v7a/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/armeabi/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/mips/libvorbis.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libogg.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis-jni.so
|
||||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis.so
|
||||
|
|
|
@ -37,6 +37,11 @@ android {
|
|||
assets.srcDirs = ['../../assets']
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'lib/arm64-v8a/libopenxr_loader.so'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
|
|
@ -376,24 +376,26 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
|
|||
|
||||
if (!vr.cgzoommode)
|
||||
{
|
||||
#ifdef PICO_XR
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
gAppState.Projections[eye].fov, zNear, zFar);
|
||||
#endif
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrFovf fov = {};
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||
fov.angleLeft += gAppState.Projections[eye].fov.angleLeft / 2.0f;
|
||||
fov.angleRight += gAppState.Projections[eye].fov.angleRight / 2.0f;
|
||||
fov.angleUp += gAppState.Projections[eye].fov.angleUp / 2.0f;
|
||||
fov.angleDown += gAppState.Projections[eye].fov.angleDown / 2.0f;
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
||||
{
|
||||
XrFovf fov = {};
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||
fov.angleLeft += gAppState.Projections[eye].fov.angleLeft / 2.0f;
|
||||
fov.angleRight += gAppState.Projections[eye].fov.angleRight / 2.0f;
|
||||
fov.angleUp += gAppState.Projections[eye].fov.angleUp / 2.0f;
|
||||
fov.angleDown += gAppState.Projections[eye].fov.angleDown / 2.0f;
|
||||
}
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
fov, zNear, zFar);
|
||||
}
|
||||
else
|
||||
{
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
gAppState.Projections[eye].fov, zNear, zFar);
|
||||
}
|
||||
XrMatrix4x4f_CreateProjectionFov(
|
||||
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
|
||||
fov, zNear, zFar);
|
||||
#endif
|
||||
|
||||
memcpy(projection, gAppState.ProjectionMatrices[eye].m, 16 * sizeof(float));
|
||||
return true;
|
||||
|
|
|
@ -70,17 +70,14 @@ float SS_MULTIPLIER = 0.0f;
|
|||
|
||||
GLboolean stageSupported = GL_FALSE;
|
||||
|
||||
#ifdef META_QUEST
|
||||
|
||||
const char* const requiredExtensionNames[] = {
|
||||
const char* const requiredExtensionNames_meta[] = {
|
||||
XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME,
|
||||
XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME,
|
||||
XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME,
|
||||
XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME,
|
||||
XR_FB_COLOR_SPACE_EXTENSION_NAME};
|
||||
#endif //META_QUEST
|
||||
|
||||
#ifdef PICO_XR
|
||||
#define XR_PICO_CONFIGS_EXT_EXTENSION_NAME "XR_PICO_configs_ext"
|
||||
|
||||
enum ConfigsEXT
|
||||
|
@ -133,16 +130,17 @@ typedef XrResult (XRAPI_PTR *PFN_xrSetConfigPICO) (
|
|||
char * configData);
|
||||
PFN_xrSetConfigPICO pfnXrSetConfigPICO;
|
||||
|
||||
const char* const requiredExtensionNames[] = {
|
||||
const char* const requiredExtensionNames_pico[] = {
|
||||
XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME,
|
||||
XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME,
|
||||
XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME,
|
||||
XR_PICO_CONFIGS_EXT_EXTENSION_NAME};
|
||||
|
||||
#endif //PICO_XR
|
||||
|
||||
const uint32_t numRequiredExtensions =
|
||||
sizeof(requiredExtensionNames) / sizeof(requiredExtensionNames[0]);
|
||||
const uint32_t numRequiredExtensions_meta =
|
||||
sizeof(requiredExtensionNames_meta) / sizeof(requiredExtensionNames_meta[0]);
|
||||
const uint32_t numRequiredExtensions_pico =
|
||||
sizeof(requiredExtensionNames_pico) / sizeof(requiredExtensionNames_pico[0]);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -930,18 +928,21 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
|
|||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
|
||||
app->Session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, gpuPerfLevel));
|
||||
|
||||
#ifdef META_QUEST
|
||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
app->Instance,
|
||||
"xrSetAndroidApplicationThreadKHR",
|
||||
(PFN_xrVoidFunction * )(&pfnSetAndroidApplicationThreadKHR)));
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
||||
{
|
||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
app->Instance,
|
||||
"xrSetAndroidApplicationThreadKHR",
|
||||
(PFN_xrVoidFunction *) (&pfnSetAndroidApplicationThreadKHR)));
|
||||
|
||||
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
|
||||
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));
|
||||
}
|
||||
}
|
||||
} else if (state == XR_SESSION_STATE_STOPPING) {
|
||||
assert(app->SessionActive);
|
||||
|
@ -990,7 +991,6 @@ GLboolean ovrApp_HandleXrEvents(ovrApp* app) {
|
|||
perf_settings_event->fromLevel,
|
||||
perf_settings_event->toLevel);
|
||||
} break;
|
||||
#ifdef META_QUEST
|
||||
case XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB: {
|
||||
const XrEventDataDisplayRefreshRateChangedFB* refresh_rate_changed_event =
|
||||
(XrEventDataDisplayRefreshRateChangedFB*)(baseEventHeader);
|
||||
|
@ -999,7 +999,6 @@ GLboolean ovrApp_HandleXrEvents(ovrApp* app) {
|
|||
refresh_rate_changed_event->fromDisplayRefreshRate,
|
||||
refresh_rate_changed_event->toDisplayRefreshRate);
|
||||
} break;
|
||||
#endif
|
||||
case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING: {
|
||||
XrEventDataReferenceSpaceChangePending* ref_space_change_event =
|
||||
(XrEventDataReferenceSpaceChangePending*)(baseEventHeader);
|
||||
|
@ -1449,89 +1448,94 @@ void TBXR_InitRenderer( ) {
|
|||
gAppState.Instance, gAppState.SystemId, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, &gAppState.ViewportConfig));
|
||||
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
|
||||
// Enumerate the supported color space options for the system.
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
||||
{
|
||||
PFN_xrEnumerateColorSpacesFB pfnxrEnumerateColorSpacesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateColorSpacesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateColorSpacesFB)));
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
|
||||
uint32_t colorSpaceCountOutput = 0;
|
||||
OXR(pfnxrEnumerateColorSpacesFB(gAppState.Session, 0, &colorSpaceCountOutput, NULL));
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
|
||||
XrColorSpaceFB* colorSpaces =
|
||||
(XrColorSpaceFB*)malloc(colorSpaceCountOutput * sizeof(XrColorSpaceFB));
|
||||
// Enumerate the supported color space options for the system.
|
||||
{
|
||||
PFN_xrEnumerateColorSpacesFB pfnxrEnumerateColorSpacesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateColorSpacesFB",
|
||||
(PFN_xrVoidFunction *) (&pfnxrEnumerateColorSpacesFB)));
|
||||
|
||||
OXR(pfnxrEnumerateColorSpacesFB(
|
||||
gAppState.Session, colorSpaceCountOutput, &colorSpaceCountOutput, colorSpaces));
|
||||
ALOGV("Supported ColorSpaces:");
|
||||
uint32_t colorSpaceCountOutput = 0;
|
||||
OXR(pfnxrEnumerateColorSpacesFB(gAppState.Session, 0, &colorSpaceCountOutput, NULL));
|
||||
|
||||
for (uint32_t i = 0; i < colorSpaceCountOutput; i++) {
|
||||
ALOGV("%d:%d", i, colorSpaces[i]);
|
||||
XrColorSpaceFB *colorSpaces =
|
||||
(XrColorSpaceFB *) malloc(colorSpaceCountOutput * sizeof(XrColorSpaceFB));
|
||||
|
||||
OXR(pfnxrEnumerateColorSpacesFB(
|
||||
gAppState.Session, colorSpaceCountOutput, &colorSpaceCountOutput, colorSpaces));
|
||||
ALOGV("Supported ColorSpaces:");
|
||||
|
||||
for (uint32_t i = 0; i < colorSpaceCountOutput; i++)
|
||||
{
|
||||
ALOGV("%d:%d", i, colorSpaces[i]);
|
||||
}
|
||||
|
||||
const XrColorSpaceFB requestColorSpace = XR_COLOR_SPACE_REC2020_FB;
|
||||
|
||||
PFN_xrSetColorSpaceFB pfnxrSetColorSpaceFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance, "xrSetColorSpaceFB",
|
||||
(PFN_xrVoidFunction *) (&pfnxrSetColorSpaceFB)));
|
||||
|
||||
OXR(pfnxrSetColorSpaceFB(gAppState.Session, requestColorSpace));
|
||||
|
||||
free(colorSpaces);
|
||||
}
|
||||
|
||||
const XrColorSpaceFB requestColorSpace = XR_COLOR_SPACE_REC2020_FB;
|
||||
// Get the supported display refresh rates for the system.
|
||||
{
|
||||
PFN_xrEnumerateDisplayRefreshRatesFB pfnxrEnumerateDisplayRefreshRatesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateDisplayRefreshRatesFB",
|
||||
(PFN_xrVoidFunction *) (&pfnxrEnumerateDisplayRefreshRatesFB)));
|
||||
|
||||
PFN_xrSetColorSpaceFB pfnxrSetColorSpaceFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance, "xrSetColorSpaceFB", (PFN_xrVoidFunction*)(&pfnxrSetColorSpaceFB)));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session, 0, &gAppState.NumSupportedDisplayRefreshRates, NULL));
|
||||
|
||||
OXR(pfnxrSetColorSpaceFB(gAppState.Session, requestColorSpace));
|
||||
gAppState.SupportedDisplayRefreshRates =
|
||||
(float *) malloc(gAppState.NumSupportedDisplayRefreshRates * sizeof(float));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session,
|
||||
gAppState.NumSupportedDisplayRefreshRates,
|
||||
&gAppState.NumSupportedDisplayRefreshRates,
|
||||
gAppState.SupportedDisplayRefreshRates));
|
||||
ALOGV("Supported Refresh Rates:");
|
||||
for (uint32_t i = 0; i < gAppState.NumSupportedDisplayRefreshRates; i++)
|
||||
{
|
||||
ALOGV("%d:%f", i, gAppState.SupportedDisplayRefreshRates[i]);
|
||||
}
|
||||
|
||||
free(colorSpaces);
|
||||
}
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrGetDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction *) (&gAppState.pfnGetDisplayRefreshRate)));
|
||||
|
||||
// Get the supported display refresh rates for the system.
|
||||
{
|
||||
PFN_xrEnumerateDisplayRefreshRatesFB pfnxrEnumerateDisplayRefreshRatesFB = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrEnumerateDisplayRefreshRatesFB",
|
||||
(PFN_xrVoidFunction*)(&pfnxrEnumerateDisplayRefreshRatesFB)));
|
||||
OXR(gAppState.pfnGetDisplayRefreshRate(gAppState.Session,
|
||||
&gAppState.currentDisplayRefreshRate));
|
||||
ALOGV("Current System Display Refresh Rate: %f", gAppState.currentDisplayRefreshRate);
|
||||
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session, 0, &gAppState.NumSupportedDisplayRefreshRates, NULL));
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrRequestDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction *) (&gAppState.pfnRequestDisplayRefreshRate)));
|
||||
|
||||
gAppState.SupportedDisplayRefreshRates =
|
||||
(float*)malloc(gAppState.NumSupportedDisplayRefreshRates * sizeof(float));
|
||||
OXR(pfnxrEnumerateDisplayRefreshRatesFB(
|
||||
gAppState.Session,
|
||||
gAppState.NumSupportedDisplayRefreshRates,
|
||||
&gAppState.NumSupportedDisplayRefreshRates,
|
||||
gAppState.SupportedDisplayRefreshRates));
|
||||
ALOGV("Supported Refresh Rates:");
|
||||
for (uint32_t i = 0; i < gAppState.NumSupportedDisplayRefreshRates; i++) {
|
||||
ALOGV("%d:%f", i, gAppState.SupportedDisplayRefreshRates[i]);
|
||||
// Test requesting the system default.
|
||||
OXR(gAppState.pfnRequestDisplayRefreshRate(gAppState.Session, 0.0f));
|
||||
ALOGV("Requesting system default display refresh rate");
|
||||
}
|
||||
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrGetDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnGetDisplayRefreshRate)));
|
||||
|
||||
OXR(gAppState.pfnGetDisplayRefreshRate(gAppState.Session, &gAppState.currentDisplayRefreshRate));
|
||||
ALOGV("Current System Display Refresh Rate: %f", gAppState.currentDisplayRefreshRate);
|
||||
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gAppState.Instance,
|
||||
"xrRequestDisplayRefreshRateFB",
|
||||
(PFN_xrVoidFunction*)(&gAppState.pfnRequestDisplayRefreshRate)));
|
||||
|
||||
// Test requesting the system default.
|
||||
OXR(gAppState.pfnRequestDisplayRefreshRate(gAppState.Session, 0.0f));
|
||||
ALOGV("Requesting system default display refresh rate");
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t numOutputSpaces = 0;
|
||||
OXR(xrEnumerateReferenceSpaces(gAppState.Session, 0, &numOutputSpaces, NULL));
|
||||
|
@ -1561,15 +1565,16 @@ void TBXR_InitRenderer( ) {
|
|||
gAppState.Projections[eye].type = XR_TYPE_VIEW;
|
||||
}
|
||||
|
||||
#ifdef PICO_XR
|
||||
xrGetInstanceProcAddr(gAppState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
||||
xrGetInstanceProcAddr(gAppState.Instance,"xrGetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrGetConfigPICO));
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") == NULL) // PICO
|
||||
{
|
||||
xrGetInstanceProcAddr(gAppState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
|
||||
xrGetInstanceProcAddr(gAppState.Instance,"xrGetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrGetConfigPICO));
|
||||
|
||||
pfnXrSetConfigPICO(gAppState.Session,TRACKING_ORIGIN,"0");
|
||||
pfnXrSetConfigPICO(gAppState.Session,TRACKING_ORIGIN,"1");
|
||||
pfnXrSetConfigPICO(gAppState.Session,TRACKING_ORIGIN,"0");
|
||||
pfnXrSetConfigPICO(gAppState.Session,TRACKING_ORIGIN,"1");
|
||||
|
||||
pfnXrGetConfigPICO(gAppState.Session, GET_DISPLAY_RATE, &gAppState.currentDisplayRefreshRate);
|
||||
#endif
|
||||
pfnXrGetConfigPICO(gAppState.Session, GET_DISPLAY_RATE, &gAppState.currentDisplayRefreshRate);
|
||||
}
|
||||
|
||||
ovrRenderer_Create(
|
||||
gAppState.Session,
|
||||
|
@ -1592,6 +1597,9 @@ void TBXR_InitialiseOpenXR()
|
|||
ovrEgl_CreateContext(&gAppState.Egl, NULL);
|
||||
EglInitExtensions();
|
||||
|
||||
//First, find out which HMD we are using
|
||||
gAppState.OpenXRHMDModel = (char*)getenv("OPENXR_HMD");
|
||||
|
||||
PFN_xrInitializeLoaderKHR xrInitializeLoaderKHR;
|
||||
xrGetInstanceProcAddr(
|
||||
XR_NULL_HANDLE, "xrInitializeLoaderKHR", (PFN_xrVoidFunction*)&xrInitializeLoaderKHR);
|
||||
|
@ -1617,22 +1625,27 @@ void TBXR_InitialiseOpenXR()
|
|||
XrInstanceCreateInfo instanceCreateInfo;
|
||||
memset(&instanceCreateInfo, 0, sizeof(instanceCreateInfo));
|
||||
instanceCreateInfo.type = XR_TYPE_INSTANCE_CREATE_INFO;
|
||||
#ifdef META_QUEST
|
||||
instanceCreateInfo.next = NULL;
|
||||
#endif
|
||||
#ifdef PICO_XR
|
||||
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR};
|
||||
instanceCreateInfoAndroid.applicationVM = java.Vm;
|
||||
instanceCreateInfoAndroid.applicationActivity = java.ActivityObject;
|
||||
|
||||
instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
||||
#endif
|
||||
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR};
|
||||
instanceCreateInfoAndroid.applicationVM = java.Vm;
|
||||
instanceCreateInfoAndroid.applicationActivity = java.ActivityObject;
|
||||
|
||||
instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
||||
|
||||
instanceCreateInfo.createFlags = 0;
|
||||
instanceCreateInfo.applicationInfo = appInfo;
|
||||
instanceCreateInfo.enabledApiLayerCount = 0;
|
||||
instanceCreateInfo.enabledApiLayerNames = NULL;
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames;
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
||||
{
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_meta;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_meta;
|
||||
}
|
||||
else
|
||||
{
|
||||
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_pico;
|
||||
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_pico;
|
||||
}
|
||||
|
||||
XrResult initResult;
|
||||
OXR(initResult = xrCreateInstance(&instanceCreateInfo, &gAppState.Instance));
|
||||
|
@ -1676,17 +1689,18 @@ instanceCreateInfo.next = (XrBaseInStructure*)&instanceCreateInfoAndroid;
|
|||
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(gAppState.Instance, gAppState.SystemId,
|
||||
&graphicsRequirements));
|
||||
|
||||
#ifdef META_QUEST
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
|
||||
{
|
||||
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
|
||||
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
|
||||
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
XrSystemProperties systemProperties = {};
|
||||
systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES;
|
||||
systemProperties.next = &colorSpacePropertiesFB;
|
||||
OXR(xrGetSystemProperties(gAppState.Instance, gAppState.SystemId, &systemProperties));
|
||||
|
||||
ALOGV("System Color Space Properties: colorspace=%d", colorSpacePropertiesFB.colorSpace);
|
||||
#endif
|
||||
ALOGV("System Color Space Properties: colorspace=%d", colorSpacePropertiesFB.colorSpace);
|
||||
}
|
||||
|
||||
TBXR_InitialiseResolution();
|
||||
}
|
||||
|
|
|
@ -224,6 +224,7 @@ typedef struct
|
|||
bool Resumed;
|
||||
bool Focused;
|
||||
bool FrameSetup;
|
||||
char* OpenXRHMDModel;
|
||||
|
||||
float Width;
|
||||
float Height;
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
# Uncomment for the correct headset - slight changes required in OpenXR implementation
|
||||
OPENXR_HMD := META_QUEST
|
||||
#OPENXR_HMD := PICO_XR
|
||||
|
||||
JK3_BASE_CFLAGS = -O1 -D$(OPENXR_HMD) -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable -fvisibility=hidden
|
||||
JK3_BASE_CPPFLAGS = -O1 -fvisibility-inlines-hidden -Wno-invalid-offsetof -fvisibility=hidden
|
||||
JK3_BASE_CFLAGS = -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable -fvisibility=hidden
|
||||
JK3_BASE_CPPFLAGS = -fvisibility-inlines-hidden -Wno-invalid-offsetof -fvisibility=hidden
|
||||
|
||||
JK3_BASE_LDLIBS =
|
||||
|
||||
|
|
4
Projects/Android/libs/arm64-v8a/readme.txt
Normal file
4
Projects/Android/libs/arm64-v8a/readme.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Into this folder copy the libopenxr_loader.so for each HMD required to support, suffixed with the headset type:
|
||||
|
||||
libopenxr_loader_meta.so
|
||||
libopenxr_loader_pico.so
|
|
@ -4,23 +4,7 @@ include $(CLEAR_VARS)
|
|||
|
||||
LOCAL_MODULE := openxr_loader
|
||||
|
||||
ifeq ($(NDK_DEBUG),1)
|
||||
BUILDTYPE := Debug
|
||||
else
|
||||
BUILDTYPE := Release
|
||||
endif
|
||||
|
||||
|
||||
# Meta provide Debug and Release libraries
|
||||
ifeq ($(OPENXR_HMD),META_QUEST)
|
||||
LOCAL_SRC_FILES := ../../../../../OpenXR/Libs/Android/$(TARGET_ARCH_ABI)/$(BUILDTYPE)/lib$(LOCAL_MODULE).so
|
||||
endif
|
||||
|
||||
# Pico only provide the one loader
|
||||
ifeq ($(OPENXR_HMD),PICO_XR)
|
||||
LOCAL_SRC_FILES := ../../../../../OpenXR/libs/android.$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := lib$(LOCAL_MODULE).so
|
||||
|
||||
# NOTE: This check is added to prevent the following error when running a "make clean" where
|
||||
# the prebuilt lib may have been deleted: "LOCAL_SRC_FILES points to a missing file"
|
||||
|
|
BIN
Projects/AndroidPrebuilt/jni/libopenxr_loader.so
Normal file
BIN
Projects/AndroidPrebuilt/jni/libopenxr_loader.so
Normal file
Binary file not shown.
|
@ -65,7 +65,16 @@ import java.util.Vector;
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.loadLibrary("openxr_loader");
|
||||
String model = android.os.Build.MODEL;
|
||||
if (model.contains("Quest"))
|
||||
{
|
||||
System.loadLibrary("openxr_loader_meta");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.loadLibrary("openxr_loader_pico");
|
||||
}
|
||||
|
||||
System.loadLibrary( "openjk_" + game );
|
||||
}
|
||||
|
||||
|
@ -248,6 +257,8 @@ import java.util.Vector;
|
|||
|
||||
try {
|
||||
setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true);
|
||||
|
||||
setenv("OPENXR_HMD", model, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue