Top Description Constructors Methods
org.lwjgl.ovr

public Class OVRVk

extends Object
Class Inheritance
Imports
java.nio.*, org.lwjgl.*, org.lwjgl.system.*, org.lwjgl.vulkan.*

Native bindings to libOVR, using the Oculus SDK C API.

This class contains Vulkan specific functionality.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native int
novr_CreateMirrorTextureWithOptionsVk(long session, long device, long desc, long out_MirrorTexture)

Unsafe version of: CreateMirrorTextureWithOptionsVk

public static native int
novr_CreateTextureSwapChainVk(long session, long device, long desc, long out_TextureSwapChain)

Unsafe version of: CreateTextureSwapChainVk

public static native int
novr_GetDeviceExtensionsVk(long luid, long extensionNames, long
indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.
inoutExtensionNamesSize
)

Unsafe version of: GetDeviceExtensionsVk

public static native int
novr_GetDeviceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)

Array version of: novr_GetDeviceExtensionsVk

public static native int
novr_GetInstanceExtensionsVk(long luid, long extensionNames, long
indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.
inoutExtensionNamesSize
)

Unsafe version of: GetInstanceExtensionsVk

public static native int
novr_GetInstanceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)

Array version of: novr_GetInstanceExtensionsVk

public static native int
novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long out_Image)

Unsafe version of: GetMirrorTextureBufferVk

public static native int
novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)

Array version of: novr_GetMirrorTextureBufferVk

public static native int
novr_GetSessionPhysicalDeviceVk(long session, long luid, long instance, long out_physicalDevice)

Unsafe version of: GetSessionPhysicalDeviceVk

public static native int
novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long out_Image)

Unsafe version of: GetTextureSwapChainBufferVk

public static native int
novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)

Array version of: novr_GetTextureSwapChainBufferVk

public static native int
novr_SetSynchronizationQueueVk(long session, long queue)

Unsafe version of: SetSynchronizationQueueVk

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_CreateMirrorTextureWithOptionsVk
(long
an ovrSession previously returned by Create
session
,
VkDevice
the VkDevice to create resources with
device
,
OVRMirrorTextureDesc
specifies requested texture properties. See notes for more info about texture format.
desc
,
PointerBuffer
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 DestroyMirrorTexture before destroying the session with Destroy.
out_MirrorTexture
)

Creates Mirror Texture which is auto-refreshed to mirror Rift contents produced by this application.

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_CreateTextureSwapChainVk
(long
an ovrSession previously returned by Create
session
,
VkDevice
the application's VkDevice to create resources with
device
,
OVRTextureSwapChainDesc
specifies requested texture properties. See notes for more info about texture format.
desc
,
PointerBuffer
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 DestroyTextureSwapChain before destroying the session with Destroy.
out_TextureSwapChain
)

Creates Texture Swap Chain suitable for use with Vulkan.

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information. Returns Error_InsufficientArraySize in the case that inoutExtensionNameSize didn't have enough space, in which case inoutExtensionNameSize will return the required inoutExtensionNamesSize.
ovr_GetDeviceExtensionsVk
(OVRGraphicsLuid
specifies the luid for the relevant GPU, which is returned from Create.
luid
,
ByteBuffer
a character buffer which will receive a list of extension name strings, separated by a single space char between each extension
extensionNames
,
IntBuffer
indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.
inoutExtensionNamesSize
)

Gets a list of Vulkan vkDevice extensions required for VR.

public static int
ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, int[] inoutExtensionNamesSize)

Array version of: GetDeviceExtensionsVk

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information. Returns Error_InsufficientArraySize in the case that inoutExtensionNameSize didn't have enough space, in which case inoutExtensionNameSize will return the required inoutExtensionNamesSize.
ovr_GetInstanceExtensionsVk
(OVRGraphicsLuid
specifies the luid for the relevant GPU, which is returned from Create.
luid
,
ByteBuffer
a character buffer which will receive a list of extension name strings, separated by a single space char between each extension
extensionNames
,
IntBuffer
indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.
inoutExtensionNamesSize
)

Gets a list of Vulkan vkInstance extensions required for VR.

public static int
ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, int[] inoutExtensionNamesSize)

Array version of: GetInstanceExtensionsVk

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_GetMirrorTextureBufferVk
(long
an ovrSession previously returned by Create
session
,
long
an ovrMirrorTexture previously returned by CreateMirrorTextureWithOptionsVk
mirrorTexture
,
LongBuffer
returns the VkImage pointer retrieved
out_Image
)

Gets the underlying mirror VkImage.

public static int
ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)

Array version of: GetMirrorTextureBufferVk

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_GetSessionPhysicalDeviceVk
(long
an ovrSession previously returned by Create
session
,
OVRGraphicsLuid
the luid returned from Create
luid
,
VkInstance
a VkInstance to search for matching luids in
instance
,
PointerBuffer
returns the VkPhysicalDevice matching the instance and luid
out_physicalDevice
)

Finds VkPhysicalDevice matching ovrGraphicsLuid.

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_GetTextureSwapChainBufferVk
(long
an ovrSession previously returned by Create
session
,
long
an ovrTextureSwapChain previously returned by CreateTextureSwapChainVk
chain
,
int
the index within the chain to retrieve. Must be between 0 and length (see GetTextureSwapChainLength), or may pass -1 to get the buffer at the CurrentIndex location (saving a call to GetTextureSwapChainCurrentIndex).
index
,
LongBuffer out_Image)

Gets a specific VkImage within the chain.

public static int
ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)

Array version of: GetTextureSwapChainBufferVk

public static int

Returns:

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.
ovr_SetSynchronizationQueueVk
(long
an ovrSession previously returned by Create
session
,
VkQueue
a VkQueue to add a VkFence operation to and wait on
queue
)

Selects VkQueue to block on till rendering is complete.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

OVRVkback to summary
protected OVRVk()

Method Detail

novr_CreateMirrorTextureWithOptionsVkback to summary
public static native int novr_CreateMirrorTextureWithOptionsVk(long session, long device, long desc, long out_MirrorTexture)

Unsafe version of: CreateMirrorTextureWithOptionsVk

novr_CreateTextureSwapChainVkback to summary
public static native int novr_CreateTextureSwapChainVk(long session, long device, long desc, long out_TextureSwapChain)

Unsafe version of: CreateTextureSwapChainVk

novr_GetDeviceExtensionsVkback to summary
public static native int novr_GetDeviceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)

Unsafe version of: GetDeviceExtensionsVk

Parameters
inoutExtensionNamesSize:long

indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.

novr_GetDeviceExtensionsVkback to summary
public static native int novr_GetDeviceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)

Array version of: novr_GetDeviceExtensionsVk

novr_GetInstanceExtensionsVkback to summary
public static native int novr_GetInstanceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)

Unsafe version of: GetInstanceExtensionsVk

Parameters
inoutExtensionNamesSize:long

indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.

novr_GetInstanceExtensionsVkback to summary
public static native int novr_GetInstanceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)

Array version of: novr_GetInstanceExtensionsVk

novr_GetMirrorTextureBufferVkback to summary
public static native int novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long out_Image)

Unsafe version of: GetMirrorTextureBufferVk

novr_GetMirrorTextureBufferVkback to summary
public static native int novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)

Array version of: novr_GetMirrorTextureBufferVk

novr_GetSessionPhysicalDeviceVkback to summary
public static native int novr_GetSessionPhysicalDeviceVk(long session, long luid, long instance, long out_physicalDevice)

Unsafe version of: GetSessionPhysicalDeviceVk

novr_GetTextureSwapChainBufferVkback to summary
public static native int novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long out_Image)

Unsafe version of: GetTextureSwapChainBufferVk

novr_GetTextureSwapChainBufferVkback to summary
public static native int novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)

Array version of: novr_GetTextureSwapChainBufferVk

novr_SetSynchronizationQueueVkback to summary
public static native int novr_SetSynchronizationQueueVk(long session, long queue)

Unsafe version of: SetSynchronizationQueueVk

ovr_CreateMirrorTextureWithOptionsVkback to summary
public static int ovr_CreateMirrorTextureWithOptionsVk(long session, VkDevice device, OVRMirrorTextureDesc desc, PointerBuffer out_MirrorTexture)

Creates 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.

Note

The texture format provided in desc should be thought of as the format the compositor will use for the VkImageView 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#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#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 TextureMisc_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.

Parameters
session:long

an ovrSession previously returned by Create

device:VkDevice

the VkDevice to create resources with

desc:OVRMirrorTextureDesc

specifies requested texture properties. See notes for more info about texture format.

out_MirrorTexture:PointerBuffer

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 DestroyMirrorTexture before destroying the session with Destroy.

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult
ovr_CreateTextureSwapChainVkback to summary
public static int ovr_CreateTextureSwapChainVk(long session, VkDevice device, OVRTextureSwapChainDesc desc, PointerBuffer out_TextureSwapChain)

Creates Texture Swap Chain suitable for use with Vulkan.

Note

The texture format provided in 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#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#OVR_FORMAT_R8G8B8A8_UNORM) while handling the linear-to-gamma conversion via SPIRV code, then the application must still request the corresponding sRGB format and also use the TextureMisc_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 TextureMisc_DX_Typeless flag for depth buffer formats (e.g. OVR#OVR_FORMAT_D32_FLOAT) is ignored as they are always converted to be typeless.

Parameters
session:long

an ovrSession previously returned by Create

device:VkDevice

the application's VkDevice to create resources with

desc:OVRTextureSwapChainDesc

specifies requested texture properties. See notes for more info about texture format.

out_TextureSwapChain:PointerBuffer

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 DestroyTextureSwapChain before destroying the session with Destroy.

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult
ovr_GetDeviceExtensionsVkback to summary
public static int ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, IntBuffer inoutExtensionNamesSize)

Gets a list of Vulkan vkDevice extensions required for VR.

Returns a list of strings delimited by a single space identifying Vulkan extensions that must be enabled in order for the VR runtime to support Vulkan-based applications. The returned list reflects the current runtime version and the GPU the VR system is currently connected to.

Parameters
luid:OVRGraphicsLuid

specifies the luid for the relevant GPU, which is returned from Create.

extensionNames:ByteBuffer

a character buffer which will receive a list of extension name strings, separated by a single space char between each extension

inoutExtensionNamesSize:IntBuffer

indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information. Returns Error_InsufficientArraySize in the case that inoutExtensionNameSize didn't have enough space, in which case inoutExtensionNameSize will return the required inoutExtensionNamesSize.

Annotations
@NativeType:ovrResult
ovr_GetDeviceExtensionsVkback to summary
public static int ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, int[] inoutExtensionNamesSize)

Array version of: GetDeviceExtensionsVk

Annotations
@NativeType:ovrResult
ovr_GetInstanceExtensionsVkback to summary
public static int ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, IntBuffer inoutExtensionNamesSize)

Gets a list of Vulkan vkInstance extensions required for VR.

Returns a list of strings delimited by a single space identifying Vulkan extensions that must be enabled in order for the VR runtime to support Vulkan-based applications. The returned list reflects the current runtime version and the GPU the VR system is currently connected to.

Example code:


 char extensionNames[4096];
 uint32_t extensionNamesSize = sizeof(extensionNames);
 ovr_GetInstanceExtensionsVk(luid, extensionsnames, &extensionNamesSize);

 uint32_t extensionCount = 0;
 const char* extensionNamePtrs[256];
 for(const char* p = extensionNames; *p; ++p) {
     if((p == extensionNames) || (p[-1] == ' ')) {
         extensionNamePtrs[extensionCount++] = p;
         if (p[-1] == ' ')
             p[-1] = '\0';
     }
 }

 VkInstanceCreateInfo info = { ... };
 info.enabledExtensionCount = extensionCount;
 info.ppEnabledExtensionNames = extensionNamePtrs;
 [...]
Parameters
luid:OVRGraphicsLuid

specifies the luid for the relevant GPU, which is returned from Create.

extensionNames:ByteBuffer

a character buffer which will receive a list of extension name strings, separated by a single space char between each extension

inoutExtensionNamesSize:IntBuffer

indicates on input the capacity of extensionNames in chars. On output it returns the number of characters written to extensionNames, including the terminating 0 char. In the case of this function returning Error_InsufficientArraySize, the required inoutExtensionNamesSize is returned.

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information. Returns Error_InsufficientArraySize in the case that inoutExtensionNameSize didn't have enough space, in which case inoutExtensionNameSize will return the required inoutExtensionNamesSize.

Annotations
@NativeType:ovrResult
ovr_GetInstanceExtensionsVkback to summary
public static int ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, ByteBuffer extensionNames, int[] inoutExtensionNamesSize)

Array version of: GetInstanceExtensionsVk

Annotations
@NativeType:ovrResult
ovr_GetMirrorTextureBufferVkback to summary
public static int ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, LongBuffer out_Image)

Gets the underlying mirror VkImage.

Parameters
session:long

an ovrSession previously returned by Create

mirrorTexture:long

an ovrMirrorTexture previously returned by CreateMirrorTextureWithOptionsVk

out_Image:LongBuffer

returns the VkImage pointer retrieved

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult
ovr_GetMirrorTextureBufferVkback to summary
public static int ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)

Array version of: GetMirrorTextureBufferVk

Annotations
@NativeType:ovrResult
ovr_GetSessionPhysicalDeviceVkback to summary
public static int ovr_GetSessionPhysicalDeviceVk(long session, OVRGraphicsLuid luid, VkInstance instance, PointerBuffer out_physicalDevice)

Finds VkPhysicalDevice matching ovrGraphicsLuid.

Note

This function enumerates the current physical devices and returns the one matching the luid. It must be called at least once prior to any CreateTextureSwapChainVk or CreateMirrorTextureWithOptionsVk calls, and the instance must remain valid for the lifetime of the returned objects. It is assumed the VkDevice created by the application will be for the returned physical device.

Parameters
session:long

an ovrSession previously returned by Create

luid:OVRGraphicsLuid

the luid returned from Create

instance:VkInstance

a VkInstance to search for matching luids in

out_physicalDevice:PointerBuffer

returns the VkPhysicalDevice matching the instance and luid

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult
ovr_GetTextureSwapChainBufferVkback to summary
public static int ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, LongBuffer out_Image)

Gets a specific VkImage within the chain.

Parameters
session:long

an ovrSession previously returned by Create

chain:long

an ovrTextureSwapChain previously returned by CreateTextureSwapChainVk

index:int

the index within the chain to retrieve. Must be between 0 and length (see GetTextureSwapChainLength), or may pass -1 to get the buffer at the CurrentIndex location (saving a call to GetTextureSwapChainCurrentIndex).

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult
ovr_GetTextureSwapChainBufferVkback to summary
public static int ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)

Array version of: GetTextureSwapChainBufferVk

Annotations
@NativeType:ovrResult
ovr_SetSynchronizationQueueVkback to summary
public static int ovr_SetSynchronizationQueueVk(long session, VkQueue queue)

Selects VkQueue to block on till rendering is complete.

Note

The queue may be changed at any time but only the value at the time SubmitFrame is called will be used. ovr_SetSynchronizationQueueVk must be called with a valid VkQueue created on the same VkDevice the texture sets were created on prior to the first call to SubmitFrame. An internally created VkFence object will be signalled by the completion of operations on queue and waited on to synchronize the VR compositor.

Parameters
session:long

an ovrSession previously returned by Create

queue:VkQueue

a VkQueue to add a VkFence operation to and wait on

Returns:int

an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information.

Annotations
@NativeType:ovrResult