GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
vr::IVRCompositor Class Reference

#include <openvr_mingw.h>

Public Member Functions

void SetTrackingSpace (ETrackingUniverseOrigin eOrigin)
ETrackingUniverseOrigin GetTrackingSpace ()
EVRCompositorError WaitGetPoses (VR_ARRAY_COUNT(unRenderPoseArrayCount) TrackedDevicePose_t *pRenderPoseArray, uint32_t unRenderPoseArrayCount, VR_ARRAY_COUNT(unGamePoseArrayCount) TrackedDevicePose_t *pGamePoseArray, uint32_t unGamePoseArrayCount)
EVRCompositorError GetLastPoses (VR_ARRAY_COUNT(unRenderPoseArrayCount) TrackedDevicePose_t *pRenderPoseArray, uint32_t unRenderPoseArrayCount, VR_ARRAY_COUNT(unGamePoseArrayCount) TrackedDevicePose_t *pGamePoseArray, uint32_t unGamePoseArrayCount)
EVRCompositorError GetLastPoseForTrackedDeviceIndex (TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t *pOutputPose, TrackedDevicePose_t *pOutputGamePose)
EVRCompositorError Submit (EVREye eEye, const Texture_t *pTexture, const VRTextureBounds_t *pBounds=0, EVRSubmitFlags nSubmitFlags=Submit_Default)
void ClearLastSubmittedFrame ()
void PostPresentHandoff ()
bool GetFrameTiming (Compositor_FrameTiming *pTiming, uint32_t unFramesAgo=0)
uint32_t GetFrameTimings (Compositor_FrameTiming *pTiming, uint32_t nFrames)
float GetFrameTimeRemaining ()
void GetCumulativeStats (Compositor_CumulativeStats *pStats, uint32_t nStatsSizeInBytes)
void FadeToColor (float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground=false)
HmdColor_t GetCurrentFadeColor (bool bBackground=false)
void FadeGrid (float fSeconds, bool bFadeIn)
float GetCurrentGridAlpha ()
EVRCompositorError SetSkyboxOverride (VR_ARRAY_COUNT(unTextureCount) const Texture_t *pTextures, uint32_t unTextureCount)
void ClearSkyboxOverride ()
void CompositorBringToFront ()
void CompositorGoToBack ()
void CompositorQuit ()
bool IsFullscreen ()
uint32_t GetCurrentSceneFocusProcess ()
uint32_t GetLastFrameRenderer ()
bool CanRenderScene ()
void ShowMirrorWindow ()
void HideMirrorWindow ()
bool IsMirrorWindowVisible ()
void CompositorDumpImages ()
bool ShouldAppRenderWithLowResources ()
void ForceInterleavedReprojectionOn (bool bOverride)
void ForceReconnectProcess ()
void SuspendRendering (bool bSuspend)
vr::EVRCompositorError GetMirrorTextureD3D11 (vr::EVREye eEye, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView)
void ReleaseMirrorTextureD3D11 (void *pD3D11ShaderResourceView)
vr::EVRCompositorError GetMirrorTextureGL (vr::EVREye eEye, vr::glUInt_t *pglTextureId, vr::glSharedTextureHandle_t *pglSharedTextureHandle)
bool ReleaseSharedGLTexture (vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle)
void LockGLSharedTextureForAccess (vr::glSharedTextureHandle_t glSharedTextureHandle)
void UnlockGLSharedTextureForAccess (vr::glSharedTextureHandle_t glSharedTextureHandle)
uint32_t GetVulkanInstanceExtensionsRequired (VR_OUT_STRING() char *pchValue, uint32_t unBufferSize)
uint32_t GetVulkanDeviceExtensionsRequired (VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize)
void SetExplicitTimingMode (EVRCompositorTimingMode eTimingMode)
EVRCompositorError SubmitExplicitTimingData ()

Member Function Documentation

◆ CanRenderScene()

bool vr::IVRCompositor::CanRenderScene ( )
inline

Returns true if the current process has the scene focus

◆ ClearLastSubmittedFrame()

void vr::IVRCompositor::ClearLastSubmittedFrame ( )
inline

Clears the frame that was sent with the last call to Submit. This will cause the compositor to show the grid until Submit is called again.

◆ ClearSkyboxOverride()

void vr::IVRCompositor::ClearSkyboxOverride ( )
inline

Resets compositor skybox back to defaults.

◆ CompositorBringToFront()

void vr::IVRCompositor::CompositorBringToFront ( )
inline

Brings the compositor window to the front. This is useful for covering any other window that may be on the HMD and is obscuring the compositor window.

◆ CompositorDumpImages()

void vr::IVRCompositor::CompositorDumpImages ( )
inline

Writes all images that the compositor knows about (including overlays) to a 'screenshots' folder in the SteamVR runtime root.

◆ CompositorGoToBack()

void vr::IVRCompositor::CompositorGoToBack ( )
inline

Pushes the compositor window to the back. This is useful for allowing other applications to draw directly to the HMD.

◆ CompositorQuit()

void vr::IVRCompositor::CompositorQuit ( )
inline

Tells the compositor process to clean up and exit. You do not need to call this function at shutdown. Under normal circumstances the compositor will manage its own life cycle based on what applications are running.

◆ FadeGrid()

void vr::IVRCompositor::FadeGrid ( float fSeconds,
bool bFadeIn )
inline

Fading the Grid in or out in fSeconds

◆ FadeToColor()

void vr::IVRCompositor::FadeToColor ( float fSeconds,
float fRed,
float fGreen,
float fBlue,
float fAlpha,
bool bBackground = false )
inline

Fades the view on the HMD to the specified color. The fade will take fSeconds, and the color values are between 0.0 and 1.0. This color is faded on top of the scene based on the alpha parameter. Removing the fade color instantly would be FadeToColor( 0.0, 0.0, 0.0, 0.0, 0.0 ). Values are in un-premultiplied alpha space.

◆ ForceInterleavedReprojectionOn()

void vr::IVRCompositor::ForceInterleavedReprojectionOn ( bool bOverride)
inline

Override interleaved reprojection logic to force on.

◆ ForceReconnectProcess()

void vr::IVRCompositor::ForceReconnectProcess ( )
inline

Force reconnecting to the compositor process.

◆ GetCumulativeStats()

void vr::IVRCompositor::GetCumulativeStats ( Compositor_CumulativeStats * pStats,
uint32_t nStatsSizeInBytes )
inline

Fills out stats accumulated for the last connected application. Pass in sizeof( Compositor_CumulativeStats ) as second parameter.

◆ GetCurrentFadeColor()

HmdColor_t vr::IVRCompositor::GetCurrentFadeColor ( bool bBackground = false)
inline

Get current fade color value.

◆ GetCurrentGridAlpha()

float vr::IVRCompositor::GetCurrentGridAlpha ( )
inline

Get current alpha value of grid.

◆ GetCurrentSceneFocusProcess()

uint32_t vr::IVRCompositor::GetCurrentSceneFocusProcess ( )
inline

Returns the process ID of the process that is currently rendering the scene

◆ GetFrameTimeRemaining()

float vr::IVRCompositor::GetFrameTimeRemaining ( )
inline

Returns the time in seconds left in the current (as identified by FrameTiming's frameIndex) frame. Due to "running start", this value may roll over to the next frame before ever reaching 0.0.

◆ GetFrameTiming()

bool vr::IVRCompositor::GetFrameTiming ( Compositor_FrameTiming * pTiming,
uint32_t unFramesAgo = 0 )
inline

Returns true if timing data is filled it. Sets oldest timing info if nFramesAgo is larger than the stored history. Be sure to set timing.size = sizeof(Compositor_FrameTiming) on struct passed in before calling this function.

◆ GetFrameTimings()

uint32_t vr::IVRCompositor::GetFrameTimings ( Compositor_FrameTiming * pTiming,
uint32_t nFrames )
inline

Interface for copying a range of timing data. Frames are returned in ascending order (oldest to newest) with the last being the most recent frame. Only the first entry's m_nSize needs to be set, as the rest will be inferred from that. Returns total number of entries filled out.

◆ GetLastFrameRenderer()

uint32_t vr::IVRCompositor::GetLastFrameRenderer ( )
inline

Returns the process ID of the process that rendered the last frame (or 0 if the compositor itself rendered the frame.) Returns 0 when fading out from an app and the app's process Id when fading into an app.

◆ GetLastPoseForTrackedDeviceIndex()

EVRCompositorError vr::IVRCompositor::GetLastPoseForTrackedDeviceIndex ( TrackedDeviceIndex_t unDeviceIndex,
TrackedDevicePose_t * pOutputPose,
TrackedDevicePose_t * pOutputGamePose )
inline

Interface for accessing last set of poses returned by WaitGetPoses one at a time. Returns VRCompositorError_IndexOutOfRange if unDeviceIndex not less than k_unMaxTrackedDeviceCount otherwise VRCompositorError_None. It is okay to pass NULL for either pose if you only want one of the values.

◆ GetLastPoses()

EVRCompositorError vr::IVRCompositor::GetLastPoses ( VR_ARRAY_COUNT(unRenderPoseArrayCount) TrackedDevicePose_t * pRenderPoseArray,
uint32_t unRenderPoseArrayCount,
VR_ARRAY_COUNT(unGamePoseArrayCount) TrackedDevicePose_t * pGamePoseArray,
uint32_t unGamePoseArrayCount )
inline

Get the last set of poses returned by WaitGetPoses.

◆ GetMirrorTextureD3D11()

vr::EVRCompositorError vr::IVRCompositor::GetMirrorTextureD3D11 ( vr::EVREye eEye,
void * pD3D11DeviceOrResource,
void ** ppD3D11ShaderResourceView )
inline

Opens a shared D3D11 texture with the undistorted composited image for each eye. Use ReleaseMirrorTextureD3D11 when finished instead of calling Release on the resource itself.

◆ GetMirrorTextureGL()

vr::EVRCompositorError vr::IVRCompositor::GetMirrorTextureGL ( vr::EVREye eEye,
vr::glUInt_t * pglTextureId,
vr::glSharedTextureHandle_t * pglSharedTextureHandle )
inline

Access to mirror textures from OpenGL.

◆ GetTrackingSpace()

ETrackingUniverseOrigin vr::IVRCompositor::GetTrackingSpace ( )
inline

Gets current tracking space returned by WaitGetPoses

◆ GetVulkanDeviceExtensionsRequired()

uint32_t vr::IVRCompositor::GetVulkanDeviceExtensionsRequired ( VkPhysicalDevice_T * pPhysicalDevice,
VR_OUT_STRING() char * pchValue,
uint32_t unBufferSize )
inline

[Vulkan only] return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing null. The string will be a space separated list of required device extensions to enable in VkCreateDevice

◆ GetVulkanInstanceExtensionsRequired()

uint32_t vr::IVRCompositor::GetVulkanInstanceExtensionsRequired ( VR_OUT_STRING() char * pchValue,
uint32_t unBufferSize )
inline

[Vulkan Only] return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing null. The string will be a space separated list of-required instance extensions to enable in VkCreateInstance

◆ HideMirrorWindow()

void vr::IVRCompositor::HideMirrorWindow ( )
inline

Closes the mirror window.

◆ IsFullscreen()

bool vr::IVRCompositor::IsFullscreen ( )
inline

Return whether the compositor is fullscreen

◆ IsMirrorWindowVisible()

bool vr::IVRCompositor::IsMirrorWindowVisible ( )
inline

Returns true if the mirror window is shown.

◆ LockGLSharedTextureForAccess()

void vr::IVRCompositor::LockGLSharedTextureForAccess ( vr::glSharedTextureHandle_t glSharedTextureHandle)
inline

◆ PostPresentHandoff()

void vr::IVRCompositor::PostPresentHandoff ( )
inline

Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor. This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present. For example, if your engine's render and game loop are not on separate threads, or blocking the render thread until 3ms before the next vsync would introduce a deadlock of some sort. This function tells the compositor that you have finished all rendering after having Submitted buffers for both eyes, and it is free to start its rendering work. This should only be called from the same thread you are rendering on.

◆ ReleaseMirrorTextureD3D11()

void vr::IVRCompositor::ReleaseMirrorTextureD3D11 ( void * pD3D11ShaderResourceView)
inline

◆ ReleaseSharedGLTexture()

bool vr::IVRCompositor::ReleaseSharedGLTexture ( vr::glUInt_t glTextureId,
vr::glSharedTextureHandle_t glSharedTextureHandle )
inline

◆ SetExplicitTimingMode()

void vr::IVRCompositor::SetExplicitTimingMode ( EVRCompositorTimingMode eTimingMode)
inline

[ Vulkan/D3D12 Only ] There are two purposes for SetExplicitTimingMode:

  1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications.
  2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from another thread while WaitGetPoses is executing.

More accurate GPU timestamp for the start of the frame is achieved by the application calling SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue. This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11, WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame.

Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired, the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and MUST call PostPresentHandoff itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another thread.

◆ SetSkyboxOverride()

EVRCompositorError vr::IVRCompositor::SetSkyboxOverride ( VR_ARRAY_COUNT(unTextureCount) const Texture_t * pTextures,
uint32_t unTextureCount )
inline

Override the skybox used in the compositor (e.g. for during level loads when the app can't feed scene images fast enough) Order is Front, Back, Left, Right, Top, Bottom. If only a single texture is passed, it is assumed in lat-long format. If two are passed, it is assumed a lat-long stereo pair.

◆ SetTrackingSpace()

void vr::IVRCompositor::SetTrackingSpace ( ETrackingUniverseOrigin eOrigin)
inline

Sets tracking space returned by WaitGetPoses

◆ ShouldAppRenderWithLowResources()

bool vr::IVRCompositor::ShouldAppRenderWithLowResources ( )
inline

Let an app know it should be rendering with low resources.

◆ ShowMirrorWindow()

void vr::IVRCompositor::ShowMirrorWindow ( )
inline

Creates a window on the primary monitor to display what is being shown in the headset.

◆ Submit()

EVRCompositorError vr::IVRCompositor::Submit ( EVREye eEye,
const Texture_t * pTexture,
const VRTextureBounds_t * pBounds = 0,
EVRSubmitFlags nSubmitFlags = Submit_Default )
inline

Updated scene texture to display. If pBounds is NULL the entire texture will be used. If called from an OpenGL app, consider adding a glFlush after Submitting both frames to signal the driver to start processing, otherwise it may wait until the command buffer fills up, causing the app to miss frames.

OpenGL dirty state: glBindTexture

Return codes:

  • IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
  • DoNotHaveFocus (some other app has taken focus)
  • TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo)
  • SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device)
  • TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.)
  • InvalidTexture (usually means bad arguments passed in)
  • AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again)
Here is the caller graph for this function:

◆ SubmitExplicitTimingData()

EVRCompositorError vr::IVRCompositor::SubmitExplicitTimingData ( )
inline

[ Vulkan/D3D12 Only ] Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame. This function will insert a GPU timestamp write just before the application starts its rendering. This function will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread. Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled.

◆ SuspendRendering()

void vr::IVRCompositor::SuspendRendering ( bool bSuspend)
inline

Temporarily suspends rendering (useful for finer control over scene transitions).

◆ UnlockGLSharedTextureForAccess()

void vr::IVRCompositor::UnlockGLSharedTextureForAccess ( vr::glSharedTextureHandle_t glSharedTextureHandle)
inline

◆ WaitGetPoses()

EVRCompositorError vr::IVRCompositor::WaitGetPoses ( VR_ARRAY_COUNT(unRenderPoseArrayCount) TrackedDevicePose_t * pRenderPoseArray,
uint32_t unRenderPoseArrayCount,
VR_ARRAY_COUNT(unGamePoseArrayCount) TrackedDevicePose_t * pGamePoseArray,
uint32_t unGamePoseArrayCount )
inline

Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay). This function will block until "running start" milliseconds before the start of the frame, and should be called at the last moment before needing to start rendering.

Return codes:

  • IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene)
  • DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app)
Here is the caller graph for this function:

The documentation for this class was generated from the following file: