aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/CAPI/CAPI_DistortionRenderer.h
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-28 02:08:11 +0100
committerSven Gothel <[email protected]>2015-03-28 02:08:11 +0100
commit450aa6f7df9e67dd256b86f94e65eaf707032aad (patch)
tree04aa207d84ddc8ca246d2573aaaf756b3ce8a0b5 /LibOVR/Src/CAPI/CAPI_DistortionRenderer.h
parent3c7b8a17e907f4ef2afd9f77db566a3f6179cbe4 (diff)
parent4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (diff)
Merge branch 'vanilla_0.5.0.1' into jogamp_0.5.0.1
Conflicts: LibOVR/Include/OVR_CAPI_0_5_0.h LibOVR/Src/CAPI/CAPI_HMDState.cpp LibOVR/Src/Displays/OVR_Win32_Dxgi_Display.h LibOVR/Src/Kernel/OVR_System.cpp LibOVR/Src/OVR_CAPI.cpp LibOVR/Src/OVR_Profile.cpp LibOVRKernel/Src/Kernel/OVR_ThreadsWinAPI.cpp LibOVRKernel/Src/Kernel/OVR_Types.h
Diffstat (limited to 'LibOVR/Src/CAPI/CAPI_DistortionRenderer.h')
-rw-r--r--LibOVR/Src/CAPI/CAPI_DistortionRenderer.h76
1 files changed, 33 insertions, 43 deletions
diff --git a/LibOVR/Src/CAPI/CAPI_DistortionRenderer.h b/LibOVR/Src/CAPI/CAPI_DistortionRenderer.h
index 0c93387..6c5b934 100644
--- a/LibOVR/Src/CAPI/CAPI_DistortionRenderer.h
+++ b/LibOVR/Src/CAPI/CAPI_DistortionRenderer.h
@@ -28,12 +28,16 @@ limitations under the License.
#define OVR_CAPI_DistortionRenderer_h
#include "CAPI_HMDRenderState.h"
-#include "CAPI_FrameTimeManager.h"
+#include "CAPI_FrameLatencyTracker.h"
+#include "CAPI_FrameTimeManager3.h"
+#include "CAPI_DistortionTiming.h"
+#include "../Vision/SensorFusion/Vision_SensorStateReader.h"
typedef void (*PostDistortionCallback)(void* pRenderContext);
namespace OVR { namespace CAPI {
+
//-------------------------------------------------------------------------------------
// ***** CAPI::DistortionRenderer
@@ -41,77 +45,62 @@ namespace OVR { namespace CAPI {
// in platform-independent way.
// Platform-specific renderer back ends for CAPI are derived from this class.
-class DistortionRenderer : public RefCountBase<DistortionRenderer>
+class DistortionRenderer : public RefCountBase<DistortionRenderer>
{
// Quiet assignment compiler warning.
void operator = (const DistortionRenderer&) { }
public:
-
- DistortionRenderer(ovrRenderAPIType api, ovrHmd hmd,
- FrameTimeManager& timeManager,
- const HMDRenderState& renderState) :
- LastUsedOverdriveTextureIndex(-1),
- LatencyTestActive(false),
- LatencyTest2Active(false),
- RenderAPI(api),
- HMD(hmd),
- TimeManager(timeManager),
- RState(renderState),
- GfxState(),
- RegisteredPostDistortionCallback(NULL)
- {
-#ifdef OVR_OS_WIN32
- timer = CreateWaitableTimer(NULL, TRUE, NULL);
- OVR_ASSERT(timer != NULL);
-#endif
- }
- virtual ~DistortionRenderer()
- {
- }
-
+ DistortionRenderer();
+ virtual ~DistortionRenderer();
// Configures the Renderer based on externally passed API settings. Must be
// called before use.
// Under D3D, apiConfig includes D3D Device pointer, back buffer and other
// needed structures.
- virtual bool Initialize(const ovrRenderAPIConfig* apiConfig) = 0;
+ bool Initialize(ovrRenderAPIConfig const * apiConfig,
+ Vision::TrackingStateReader* stateReader,
+ DistortionTimer* distortionTiming,
+ HMDRenderState const * renderState);
// Submits one eye texture for rendering. This is in the separate method to
// allow "submit as you render" scenarios on horizontal screens where one
// eye can be scanned out before the other.
virtual void SubmitEye(int eyeId, const ovrTexture* eyeTexture) = 0;
+ virtual void SubmitEyeWithDepth(int eyeId, const ovrTexture* eyeColorTexture, const ovrTexture* eyeDepthTexture) = 0;
// Finish the frame, optionally swapping buffers.
// Many implementations may actually apply the distortion here.
- virtual void EndFrame(bool swapBuffers) = 0;
-
+ virtual void EndFrame(uint32_t frameIndex, bool swapBuffers) = 0;
+
void RegisterPostDistortionCallback(PostDistortionCallback postDistortionCallback)
{
RegisteredPostDistortionCallback = postDistortionCallback;
}
// Stores the current graphics pipeline state so it can be restored later.
- void SaveGraphicsState() { if (GfxState && !(RState.DistortionCaps & ovrDistortionCap_NoRestore)) GfxState->Save(); }
+ void SaveGraphicsState() { if (GfxState && !(RenderState->DistortionCaps & ovrDistortionCap_NoRestore)) GfxState->Save(); }
// Restores the saved graphics pipeline state.
- void RestoreGraphicsState() { if (GfxState && !(RState.DistortionCaps & ovrDistortionCap_NoRestore)) GfxState->Restore(); }
+ void RestoreGraphicsState() { if (GfxState && !(RenderState->DistortionCaps & ovrDistortionCap_NoRestore)) GfxState->Restore(); }
// *** Creation Factory logic
-
+
ovrRenderAPIType GetRenderAPI() const { return RenderAPI; }
// Creation function for this interface, registered for API.
- typedef DistortionRenderer* (*CreateFunc)(ovrHmd hmd,
- FrameTimeManager &timeManager,
- const HMDRenderState& renderState);
+ typedef DistortionRenderer* (*CreateFunc)();
static CreateFunc APICreateRegistry[ovrRenderAPI_Count];
// Color is expected to be 3 byte RGB
void SetLatencyTestColor(unsigned char* color);
void SetLatencyTest2Color(unsigned char* color);
-
+
+ void SetPositionTimewarpDesc(const ovrPositionTimewarpDesc& posTimewarpDesc) { PositionTimewarpDesc = posTimewarpDesc; }
+
protected:
+ virtual bool initializeRenderer(const ovrRenderAPIConfig* apiConfig) = 0;
+
// Used for pixel luminance overdrive on DK2 displays
// A copy of back buffer images will be ping ponged
// TODO: figure out 0 dynamically based on DK2 latency?
@@ -127,9 +116,7 @@ protected:
{
// doesn't make sense to use overdrive when vsync is disabled as we cannot guarantee
// when the rendered frame will be displayed
- return LastUsedOverdriveTextureIndex >= 0 &&
- !((RState.EnabledHmdCaps & ovrHmdCap_NoVSync) > 0) &&
- (RState.DistortionCaps & ovrDistortionCap_Chromatic);
+ return LastUsedOverdriveTextureIndex >= 0 && (RenderState->EnabledHmdCaps & ovrHmdCap_NoVSync) == 0;
}
void GetOverdriveScales(float& outRiseScale, float& outFallScale);
@@ -152,15 +139,18 @@ protected:
protected:
bool IsValid;
};
-
- const ovrRenderAPIType RenderAPI;
- const ovrHmd HMD;
- FrameTimeManager& TimeManager;
- const HMDRenderState& RState;
+
+ ovrRenderAPIType RenderAPI;
+ Vision::TrackingStateReader* SensorReader; // For reading head pose for timewarp
+ DistortionTimer* Timing;
+ HMDRenderState const * RenderState;
+
Ptr<GraphicsState> GfxState;
+ ovrPositionTimewarpDesc PositionTimewarpDesc;
PostDistortionCallback RegisteredPostDistortionCallback;
};
+
}} // namespace OVR::CAPI