Skip to content

Commit

Permalink
Only call OpenVR when it's time for resolution change
Browse files Browse the repository at this point in the history
  • Loading branch information
williammck authored Mar 25, 2024
1 parent 7e942df commit d74ca41
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ int main(int argc, char *argv[])

// Initialize loop variables
long lastChangeTime = getCurrentTimeMillis();
bool adjustResolution = true;
std::list<float> gpuTimes;
std::list<float> cpuTimes;

Expand Down Expand Up @@ -359,16 +360,16 @@ int main(int argc, char *argv[])
// Get VRAM usage
float vramUsage = getVramUsage(nvmlLibrary);

// Check that we're in a supported application
bool inDashboard = vr::VROverlay()->IsDashboardVisible();
bool isCurrentAppDisabled = disabledApps.find(getCurrentApplicationKey()) != disabledApps.end();
bool adjustResolution = !inDashboard && !isCurrentAppDisabled;

// Resolution handling
if (currentTime - resChangeDelayMs > lastChangeTime)
{
lastChangeTime = currentTime;

// Check that we're in a supported application
bool inDashboard = vr::VROverlay()->IsDashboardVisible();
bool isCurrentAppDisabled = disabledApps.find(getCurrentApplicationKey()) != disabledApps.end();
adjustResolution = !inDashboard && !isCurrentAppDisabled;

if (adjustResolution)
{

Expand Down

0 comments on commit d74ca41

Please sign in to comment.