Function ovr_sys::directx::ovr_CreateTextureSwapChainDX
[−]
[src]
pub unsafe extern "C" fn ovr_CreateTextureSwapChainDX(
session: ovrSession,
d3dPtr: *mut IUnknown,
desc: *const ovrTextureSwapChainDesc,
out_TextureSwapChain: *mut ovrTextureSwapChain
) -> ovrResult
Create Texture Swap Chain suitable for use with Direct3D 11 and 12.
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 eye textures with.
in desc
Specifies requested texture properties. See notes for more info about texture format.
in bindFlags
Specifies what ovrTextureBindFlags
the application requires for this texture chain.
out out_TextureSwapChain
Returns the created ovrTextureSwapChain
, which will be valid upon a successful return value, else it will be NULL.
This texture chain must be eventually destroyed via ovr_DestroyTextureSwapChain
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 distortion-compositor will use for the
ShaderResourceView
when reading the contents of the texture. To that end, it is highly recommended that the application
requests texture swapchain formats that are in sRGB-space (e.g. OVR_FORMAT_R8G8B8A8_UNORM_SRGB
) as the compositor
does sRGB-correct rendering. As such, the compositor relies on the GPU's hardware sampler to do the sRGB-to-linear
conversion. If the application still prefers to render to a linear format (e.g. OVR_FORMAT_R8G8B8A8_UNORM
) while handling the
linear-to-gamma conversion via HLSL code, then the application must still request the corresponding sRGB format and also use
the ovrTextureMisc_DX_Typeless
flag in the ovrTextureSwapChainDesc
's Flag field. This will allow the application to create
a RenderTargetView that is the desired linear format while the compositor continues to treat it as sRGB. Failure to do so
will cause the compositor to apply unexpected gamma conversions leading to gamma-curve artifacts. The ovrTextureMisc_DX_Typeless
flag for depth buffer formats (e.g. OVR_FORMAT_D32_FLOAT
) is ignored as they are always converted to be typeless.
see ovr_GetTextureSwapChainLength
, ovr_GetTextureSwapChainCurrentIndex
, ovr_GetTextureSwapChainDesc
, ovr_GetTextureSwapChainBufferDX
, ovr_DestroyTextureSwapChain