mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
openvr: Non-threaded present work
In the unlikely event you hit 90htz in non-threaded present mode, you will have perfect tracking and latency. This verifies that there are no other sources of tracking or rendering latency, other then the ones we already know about.
This commit is contained in:
parent
50ac101d56
commit
209524a5c0
3 changed files with 10 additions and 5 deletions
|
@ -17,9 +17,9 @@
|
|||
#include <GLMHelpers.h>
|
||||
#include <SimpleMovingAverage.h>
|
||||
#include <gl/OglplusHelpers.h>
|
||||
#include <gl/GLEscrow.h>
|
||||
|
||||
#define THREADED_PRESENT 1
|
||||
#include <gl/GLEscrow.h>
|
||||
|
||||
class OpenGLDisplayPlugin : public DisplayPlugin {
|
||||
protected:
|
||||
|
|
|
@ -71,11 +71,16 @@ public:
|
|||
}
|
||||
|
||||
bool signaled() const {
|
||||
#if THREADED_PRESENT
|
||||
auto result = glClientWaitSync(_sync, 0, 0);
|
||||
if (GL_TIMEOUT_EXPIRED != result && GL_WAIT_FAILED != result) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
glWaitSync(_sync, 0, GL_TIMEOUT_IGNORED);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ void OpenVrDisplayPlugin::internalActivate() {
|
|||
_compositor = vr::VRCompositor();
|
||||
Q_ASSERT(_compositor);
|
||||
|
||||
// enable async time warp
|
||||
// _compositor->ForceInterleavedReprojectionOn(true);
|
||||
|
||||
// set up default sensor space such that the UI overlay will align with the front of the room.
|
||||
auto chaperone = vr::VRChaperone();
|
||||
if (chaperone) {
|
||||
|
@ -123,10 +126,7 @@ void OpenVrDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
|||
const float NUM_PREDICTION_FRAMES = 2.0f;
|
||||
float predictedSecondsFromNow = NUM_PREDICTION_FRAMES * frameDuration + vsyncToPhotons;
|
||||
#else
|
||||
uint64_t frameCounter;
|
||||
float timeSinceLastVsync;
|
||||
_system->GetTimeSinceLastVsync(&timeSinceLastVsync, &frameCounter);
|
||||
float predictedSecondsFromNow = 2.0f * frameDuration - timeSinceLastVsync + vsyncToPhotons;
|
||||
float predictedSecondsFromNow = frameDuration + vsyncToPhotons;
|
||||
#endif
|
||||
|
||||
vr::TrackedDevicePose_t predictedTrackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||
|
|
Loading…
Reference in a new issue