Making SDK based buffer swap optional

This commit is contained in:
Brad Davis 2014-05-29 23:07:32 -07:00
parent 4da51b2d5b
commit 6b8c9fbbee
10 changed files with 17 additions and 19 deletions

View File

@ -190,6 +190,7 @@ typedef enum
{
ovrDistortionCap_Chromatic = 0x01, // Supports chromatic aberration correction.
ovrDistortionCap_TimeWarp = 0x02, // Supports timewarp.
ovrDistortionCap_NoSwapBuffers = 0x04,
ovrDistortionCap_Vignette = 0x08 // Supports vignetting around the edges of the view.
} ovrDistortionCaps;

View File

@ -69,7 +69,7 @@ public:
// Finish the frame, optionally swapping buffers.
// Many implementations may actually apply the distortion here.
virtual void EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor,
virtual void EndFrame(unsigned char* latencyTesterDrawColor,
unsigned char* latencyTester2DrawColor) = 0;
// Stores the current graphics pipeline state so it can be restored later.

View File

@ -68,7 +68,7 @@ ovrHmdDesc HMDRenderState::GetDesc()
d.HmdCaps = ovrHmdCap_Present | ovrHmdCap_NoVSync;
d.SensorCaps = ovrSensorCap_YawCorrection | ovrSensorCap_Orientation;
d.DistortionCaps = ovrDistortionCap_Chromatic | ovrDistortionCap_TimeWarp | ovrDistortionCap_Vignette;
d.DistortionCaps = ovrDistortionCap_Chromatic | ovrDistortionCap_TimeWarp | ovrDistortionCap_Vignette | ovrDistortionCap_NoSwapBuffers;
if (strstr(HMDInfo.ProductName, "DK1"))
{

View File

@ -235,7 +235,7 @@ void DistortionRenderer::SubmitEye(int eyeId, ovrTexture* eyeTexture)
}
}
void DistortionRenderer::EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor,
void DistortionRenderer::EndFrame(unsigned char* latencyTesterDrawColor,
unsigned char* latencyTester2DrawColor)
{
if (!TimeManager.NeedDistortionTimeMeasurement())
@ -270,7 +270,7 @@ void DistortionRenderer::EndFrame(bool swapBuffers, unsigned char* latencyTester
renderLatencyPixel(latencyTester2DrawColor);
}
if (swapBuffers)
if (0 == RState.DistortionCaps & ovrDistortionCap_NoSwapBuffers)
{
if (RParams.pSwapChain)
{
@ -803,4 +803,4 @@ void DistortionRenderer::GraphicsState::Restore()
}
}}} // OVR::CAPI::D3D1X
#endif
#endif

View File

@ -61,7 +61,7 @@ public:
virtual void SubmitEye(int eyeId, ovrTexture* eyeTexture);
virtual void EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
virtual void EndFrame(unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
// TBD: Make public?
void WaitUntilGpuIdle();
@ -146,4 +146,4 @@ private:
};
}}} // OVR::CAPI::D3D1X
#endif
#endif

View File

@ -102,10 +102,8 @@ void DistortionRenderer::SubmitEye(int eyeId, ovrTexture* eyeTexture)
/******************************************************************/
void DistortionRenderer::EndFrame(bool swapBuffers,
unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor)
void DistortionRenderer::EndFrame(unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor)
{
OVR_UNUSED(swapBuffers);
OVR_UNUSED(latencyTesterDrawColor);
///QUESTION : Should I be clearing the screen?
@ -145,7 +143,7 @@ void DistortionRenderer::EndFrame(bool swapBuffers,
// TODO:
}
if (swapBuffers)
if (0 == RState.DistortionCaps & ovrDistortionCap_NoSwapBuffers)
{
if (swapChain)
{

View File

@ -65,7 +65,7 @@ public:
virtual void SubmitEye(int eyeId, ovrTexture* eyeTexture);
virtual void EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
virtual void EndFrame(unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
// TBD: Make public?
void WaitUntilGpuIdle();

View File

@ -184,8 +184,7 @@ void DistortionRenderer::SubmitEye(int eyeId, ovrTexture* eyeTexture)
}
}
void DistortionRenderer::EndFrame(bool swapBuffers,
unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor)
void DistortionRenderer::EndFrame(unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor)
{
if (!TimeManager.NeedDistortionTimeMeasurement())
{
@ -219,7 +218,7 @@ void DistortionRenderer::EndFrame(bool swapBuffers,
renderLatencyPixel(latencyTester2DrawColor);
}
if (swapBuffers)
if (0 == RState.DistortionCaps & ovrDistortionCap_NoSwapBuffers)
{
bool useVsync = ((RState.EnabledHmdCaps & ovrHmdCap_NoVSync) == 0);
int swapInterval = (useVsync) ? 1 : 0;

View File

@ -49,7 +49,7 @@ public:
virtual void SubmitEye(int eyeId, ovrTexture* eyeTexture);
virtual void EndFrame(bool swapBuffers, unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
virtual void EndFrame(unsigned char* latencyTesterDrawColor, unsigned char* latencyTester2DrawColor);
void WaitUntilGpuIdle();
@ -175,4 +175,4 @@ protected:
}}} // OVR::CAPI::GL
#endif // OVR_CAPI_GL_DistortionRenderer_h
#endif // OVR_CAPI_GL_DistortionRenderer_h

View File

@ -481,9 +481,9 @@ OVR_EXPORT void ovrHmd_EndFrame(ovrHmd hmd)
if (hmds->pRenderer)
{
hmds->pRenderer->SaveGraphicsState();
hmds->pRenderer->EndFrame(false,
hmds->LatencyTestActive ? hmds->LatencyTestDrawColor : NULL,
hmds->pRenderer->EndFrame(hmds->LatencyTestActive ? hmds->LatencyTestDrawColor : NULL,
// MA: Use this color since we are running DK2 test all the time.
dk2LatencyTest ? hmds->LatencyTest2DrawColor : 0