Function ovr_sys::directx::ovr_CreateMirrorTextureDX
[−]
[src]
pub unsafe extern "C" fn ovr_CreateMirrorTextureDX(
session: ovrSession,
d3dPtr: *mut IUnknown,
desc: *const ovrMirrorTextureDesc,
out_MirrorTexture: *mut ovrMirrorTexture
) -> ovrResult
Create Mirror Texture which is auto-refreshed to mirror Rift contents produced by this application.
A second call to ovr_CreateMirrorTextureDX
for a given ovrSession before destroying the first one
is not supported and will result in an error return.
in session
Specifies an ovrSession
previously returned by ovr_Create
.
in d3dPtr
Specifies the application's D3D11Device
to create resources with or the D3D12CommandQueue
which must be the same one the application renders to the textures with.
in desc
Specifies requested texture properties. See notes for more info about texture format.
out out_MirrorTexture
Returns the created ovrMirrorTexture
, which will be valid upon a successful return value, else it will be NULL.
This texture must be eventually destroyed via ovr_DestroyMirrorTexture
before destroying the session with ovr_Destroy
.
Returns an ovrResult
indicating success or failure. In the case of failure, use
ovr_GetLastErrorInfo
to get more information.
Note: The texture format provided in the desc should be thought of as the format the compositor will use for the RenderTargetView
when
writing into mirror texture. To that end, it is highly recommended that the application requests a mirror texture format that is
in sRGB-space (e.g. OVR_FORMAT_R8G8B8A8_UNORM_SRGB
) as the compositor does sRGB-correct rendering. If however the application wants
to still read the mirror texture as a linear format (e.g. OVR_FORMAT_R8G8B8A8_UNORM
) and handle the sRGB-to-linear conversion in
HLSL code, then it is recommended the application still requests an sRGB format and also use the ovrTextureMisc_DX_Typeless
flag in the
ovrMirrorTextureDesc
's Flags field. This will allow the application to bind a ShaderResourceView
that is a linear format while the
compositor continues to treat is as sRGB. Failure to do so will cause the compositor to apply unexpected gamma conversions leading to
gamma-curve artifacts.
Example code, not translated from C
ovrMirrorTexture mirrorTexture = nullptr; ovrMirrorTextureDesc mirrorDesc = {}; mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; mirrorDesc.Width = mirrorWindowWidth; mirrorDesc.Height = mirrorWindowHeight; ovrResult result = ovr_CreateMirrorTextureDX(session, d3d11Device, &mirrorDesc, &mirrorTexture); [...] // Destroy the texture when done with it. ovr_DestroyMirrorTexture(session, mirrorTexture); mirrorTexture = nullptr;
see ovr_GetMirrorTextureBufferDX
, ovr_DestroyMirrorTexture