diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 7dc1180..3b0ea55 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -18,6 +18,7 @@ + diff --git a/Src/QuakeQuest_SurfaceView.c b/Src/QuakeQuest_SurfaceView.c index 25e068e..1a759dc 100644 --- a/Src/QuakeQuest_SurfaceView.c +++ b/Src/QuakeQuest_SurfaceView.c @@ -49,6 +49,8 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved. #define SOURCE_JOYSTICK 0x01000010 +float maximumSupportedFramerate=60.0; //The lowest default framerate + // EXT_texture_border_clamp #ifndef GL_CLAMP_TO_BORDER #define GL_CLAMP_TO_BORDER 0x812D @@ -1457,6 +1459,11 @@ static void ovrApp_HandleVrModeChanges( ovrApp * app ) // Set performance parameters once we have entered VR mode and have a valid ovrMobile. if ( app->Ovr != NULL ) { + //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 ); @@ -2299,6 +2306,30 @@ void * AppThreadFunction( void * parm ) vrHeight=vrWidth; + + //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 (maximumSupportedFramerate90.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; + } + //----------------------------------------------------------------------------------------------------------- + + + + ovrEgl_CreateContext( &appState.Egl, NULL ); EglInitExtensions();