90hz Support for Quest 2

This commit is contained in:
Simon 2020-12-10 20:48:58 +00:00
parent c45b6046a6
commit 8a77c03073
6 changed files with 44 additions and 17 deletions

14
.gitignore vendored
View file

@ -28,20 +28,13 @@ $RECYCLE.BIN/
*.class
projects/Android/build/*
assets/oculussig*
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/android_gradle_build.json
Projects/Android/.cxx/*
*.json
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_output.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_output.txt
*.bin
Projects/Android/.gradle/4.4/fileHashes/fileHashes.lock
*.ser
Projects/Android/.idea/codeStyles/Project.xml
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_output.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_output.txt
Projects/Android/.externalNativeBuild/*
Projects/Android/.gradle/4.6/fileHashes/fileHashes.lock
Projects/Android/.gradle/vcsWorkingDirs/gc.properties
drbeef-release-key.keystore
@ -53,3 +46,6 @@ assets/pak0.pk3
assets/sp_pak_weapons.pk3
assets/z_zvr_weapons.pk3
assets/sp_vpak8.pk3
Projects/Android/.gradle/5.4.1/fileHashes/fileHashes.lock
Projects/Android/.gradle/5.4.1/gc.properties
Projects/Android/.gradle/vcs-1/gc.properties

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.rtcwquest"
android:versionCode="43"
android:versionName="1.1.5" android:installLocation="auto" >
android:versionCode="45"
android:versionName="1.1.7" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
@ -18,6 +18,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:allowBackup="false" android:icon="@drawable/ic_rtcwquest" android:label="@string/rtcwquest">
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<!-- The activity is the built-in NativeActivity framework class. -->
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
<!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition. -->

View file

@ -1,6 +1,6 @@
#Sat Jul 27 06:47:04 BST 2019
#Wed Dec 09 11:51:35 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View file

@ -80,6 +80,8 @@ int GPU_LEVEL = 4;
int NUM_MULTI_SAMPLES = 1;
float SS_MULTIPLIER = 1.25f;
float maximumSupportedFramerate=60.0; //The lowest default framerate
jclass clazz;
float radians(float deg) {
@ -1033,7 +1035,12 @@ static void ovrApp_HandleVrModeChanges( ovrApp * app )
// Set performance parameters once we have entered VR mode and have a valid ovrMobile.
if ( app->Ovr != NULL )
{
vrapi_SetClockLevels( app->Ovr, app->CpuLevel, app->GpuLevel );
//AmmarkoV : Set our refresh rate..!
ovrResult result = vrapi_SetDisplayRefreshRate(app->Ovr,maximumSupportedFramerate);
if (result == ovrSuccess) { ALOGV("Changed refresh rate. %f Hz",maximumSupportedFramerate); } else
{ ALOGV("Failed to change refresh rate to 90Hz Result=%d",result); }
vrapi_SetClockLevels( app->Ovr, app->CpuLevel, app->GpuLevel );
ALOGV( " vrapi_SetClockLevels( %d, %d )", app->CpuLevel, app->GpuLevel );
@ -1531,7 +1538,29 @@ void * AppThreadFunction(void * parm ) {
showLoadingIcon();
}
//start
//AmmarkoV : Query Refresh rates and select maximum..!
//-----------------------------------------------------------------------------------------------------------
int numberOfRefreshRates = vrapi_GetSystemPropertyInt(&java,VRAPI_SYS_PROP_NUM_SUPPORTED_DISPLAY_REFRESH_RATES);
float refreshRatesArray[16]; //Refresh rates are currently (12/2020) the following 4 : 60.0 / 72.0 / 80.0 / 90.0
if (numberOfRefreshRates > 16 ) { numberOfRefreshRates = 16; }
vrapi_GetSystemPropertyFloatArray(&java, VRAPI_SYS_PROP_SUPPORTED_DISPLAY_REFRESH_RATES,&refreshRatesArray[0], numberOfRefreshRates);
for (int i = 0; i < numberOfRefreshRates; i++) {
ALOGV("Supported refresh rate : %s Hz", refreshRatesArray[i]);
if (maximumSupportedFramerate<refreshRatesArray[i])
{
maximumSupportedFramerate=refreshRatesArray[i];
}
}
if (maximumSupportedFramerate>90.0)
{
ALOGV("Soft limiting to 90.0 Hz as per John carmack's request ( https://www.onlinepeeps.org/oculus-quest-2-according-to-carmack-in-the-future-also-at-120-hz/ );P");
maximumSupportedFramerate=90.0;
}
//-----------------------------------------------------------------------------------------------------------
//start
VR_main(argc, argv);
//We are done, shutdown cleanly

View file

@ -54,7 +54,7 @@ void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
void QuatToYawPitchRoll(ovrQuatf q, vec3_t rotation, vec3_t out);
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
void interactWithTouchScreen(qboolean reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState);
int GetRefresh();
//Called from engine code
qboolean RTCWVR_useScreenLayer();

View file

@ -417,7 +417,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Positional movement speed correction for when we are not hitting target framerate
static double lastframetime = 0;
double newframetime = GetTimeInMilliSeconds();
float multiplier = (float)((1000.0 / 72.0) / (newframetime - lastframetime));
float multiplier = (float)((1000.0 / GetRefresh()) / (newframetime - lastframetime));
lastframetime = newframetime;
vec2_t v;