Function ovr_sys::vulkan::ovr_CreateMirrorTextureWithOptionsVk
[−]
[src]
pub unsafe extern "C" fn ovr_CreateMirrorTextureWithOptionsVk(
session: ovrSession,
device: Device,
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_CreateMirrorTextureWithOptionsVk
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 device
Specifies the Device
to create resources 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 desc
should be thought of as the format the
compositor will use for the ImageView
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 SPIRV 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
let mut mirror_texture = ptr::null_mut(); let mirror_desc = ovrMirrorTextureDesc { Format: OVR_FORMAT_R8G8B8A8_UNORM_SRGB, Width: mirror_window_width, Height: mirror_window_height, .. mem::zeroed() }; let result = ovr_CreateMirrorTextureWithOptionsVk(session, vk_device, &mirror_desc as *const _, &mut mirror_texture as *mut _); // ... // Destroy the texture when done with it. ovr_DestroyMirrorTexture(session, mirror_texture); mirror_texture = ptr::null_mut();