Class OVRVk
- java.lang.Object
-
- org.lwjgl.ovr.OVRVk
-
public class OVRVk extends java.lang.Object
Native bindings to libOVR, using the Oculus SDK C API.This class contains Vulkan specific functionality.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
novr_CreateMirrorTextureWithOptionsVk(long session, long device, long desc, long out_MirrorTexture)
Unsafe version of:CreateMirrorTextureWithOptionsVk
static int
novr_CreateTextureSwapChainVk(long session, long device, long desc, long out_TextureSwapChain)
Unsafe version of:CreateTextureSwapChainVk
static int
novr_GetDeviceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)
Array version of:novr_GetDeviceExtensionsVk(long, long, long)
static int
novr_GetDeviceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)
Unsafe version of:GetDeviceExtensionsVk
static int
novr_GetInstanceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)
Array version of:novr_GetInstanceExtensionsVk(long, long, long)
static int
novr_GetInstanceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)
Unsafe version of:GetInstanceExtensionsVk
static int
novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long out_Image)
Unsafe version of:GetMirrorTextureBufferVk
static int
novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)
Array version of:novr_GetMirrorTextureBufferVk(long, long, long)
static int
novr_GetSessionPhysicalDeviceVk(long session, long luid, long instance, long out_physicalDevice)
Unsafe version of:GetSessionPhysicalDeviceVk
static int
novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long out_Image)
Unsafe version of:GetTextureSwapChainBufferVk
static int
novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)
Array version of:novr_GetTextureSwapChainBufferVk(long, long, int, long)
static int
novr_SetSynchronizationQueueVk(long session, long queue)
Unsafe version of:SetSynchronizationQueueVk
static int
ovr_CreateMirrorTextureWithOptionsVk(long session, org.lwjgl.vulkan.VkDevice device, OVRMirrorTextureDesc desc, org.lwjgl.PointerBuffer out_MirrorTexture)
Creates Mirror Texture which is auto-refreshed to mirror Rift contents produced by this application.static int
ovr_CreateTextureSwapChainVk(long session, org.lwjgl.vulkan.VkDevice device, OVRTextureSwapChainDesc desc, org.lwjgl.PointerBuffer out_TextureSwapChain)
Creates Texture Swap Chain suitable for use with Vulkan.static int
ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, int[] inoutExtensionNamesSize)
Array version of:GetDeviceExtensionsVk
static int
ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, java.nio.IntBuffer inoutExtensionNamesSize)
Gets a list of VulkanvkDevice
extensions required for VR.static int
ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, int[] inoutExtensionNamesSize)
Array version of:GetInstanceExtensionsVk
static int
ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, java.nio.IntBuffer inoutExtensionNamesSize)
Gets a list of VulkanvkInstance
extensions required for VR.static int
ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)
Array version of:GetMirrorTextureBufferVk
static int
ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, java.nio.LongBuffer out_Image)
Gets the underlying mirrorVkImage
.static int
ovr_GetSessionPhysicalDeviceVk(long session, OVRGraphicsLuid luid, org.lwjgl.vulkan.VkInstance instance, org.lwjgl.PointerBuffer out_physicalDevice)
FindsVkPhysicalDevice
matchingovrGraphicsLuid
.static int
ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)
Array version of:GetTextureSwapChainBufferVk
static int
ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, java.nio.LongBuffer out_Image)
Gets a specificVkImage
within the chain.static int
ovr_SetSynchronizationQueueVk(long session, org.lwjgl.vulkan.VkQueue queue)
SelectsVkQueue
to block on till rendering is complete.
-
-
-
Method Detail
-
novr_GetInstanceExtensionsVk
public static int novr_GetInstanceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)
Unsafe version of:GetInstanceExtensionsVk
- Parameters:
inoutExtensionNamesSize
- indicates on input the capacity ofextensionNames
in chars. On output it returns the number of characters written toextensionNames
, including the terminating 0 char. In the case of this function returningError_InsufficientArraySize
, the requiredinoutExtensionNamesSize
is returned.
-
ovr_GetInstanceExtensionsVk
public static int ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, java.nio.IntBuffer inoutExtensionNamesSize)
Gets a list of VulkanvkInstance
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
- specifies theluid
for the relevant GPU, which is returned fromCreate
.extensionNames
- a character buffer which will receive a list of extension name strings, separated by a single space char between each extensioninoutExtensionNamesSize
- indicates on input the capacity ofextensionNames
in chars. On output it returns the number of characters written toextensionNames
, including the terminating 0 char. In the case of this function returningError_InsufficientArraySize
, the requiredinoutExtensionNamesSize
is returned.- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information. ReturnsError_InsufficientArraySize
in the case thatinoutExtensionNameSize
didn't have enough space, in which caseinoutExtensionNameSize
will return the requiredinoutExtensionNamesSize
.
-
novr_GetDeviceExtensionsVk
public static int novr_GetDeviceExtensionsVk(long luid, long extensionNames, long inoutExtensionNamesSize)
Unsafe version of:GetDeviceExtensionsVk
- Parameters:
inoutExtensionNamesSize
- indicates on input the capacity ofextensionNames
in chars. On output it returns the number of characters written toextensionNames
, including the terminating 0 char. In the case of this function returningError_InsufficientArraySize
, the requiredinoutExtensionNamesSize
is returned.
-
ovr_GetDeviceExtensionsVk
public static int ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, java.nio.IntBuffer inoutExtensionNamesSize)
Gets a list of VulkanvkDevice
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
- specifies theluid
for the relevant GPU, which is returned fromCreate
.extensionNames
- a character buffer which will receive a list of extension name strings, separated by a single space char between each extensioninoutExtensionNamesSize
- indicates on input the capacity ofextensionNames
in chars. On output it returns the number of characters written toextensionNames
, including the terminating 0 char. In the case of this function returningError_InsufficientArraySize
, the requiredinoutExtensionNamesSize
is returned.- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information. ReturnsError_InsufficientArraySize
in the case thatinoutExtensionNameSize
didn't have enough space, in which caseinoutExtensionNameSize
will return the requiredinoutExtensionNamesSize
.
-
novr_GetSessionPhysicalDeviceVk
public static int novr_GetSessionPhysicalDeviceVk(long session, long luid, long instance, long out_physicalDevice)
Unsafe version of:GetSessionPhysicalDeviceVk
-
ovr_GetSessionPhysicalDeviceVk
public static int ovr_GetSessionPhysicalDeviceVk(long session, OVRGraphicsLuid luid, org.lwjgl.vulkan.VkInstance instance, org.lwjgl.PointerBuffer out_physicalDevice)
FindsVkPhysicalDevice
matchingovrGraphicsLuid
.Note
This function enumerates the current physical devices and returns the one matching the
luid
. It must be called at least once prior to anyCreateTextureSwapChainVk
orCreateMirrorTextureWithOptionsVk
calls, and the instance must remain valid for the lifetime of the returned objects. It is assumed theVkDevice
created by the application will be for the returned physical device.- Parameters:
session
- anovrSession
previously returned byCreate
luid
- theluid
returned fromCreate
instance
- aVkInstance
to search for matchingluids
inout_physicalDevice
- returns theVkPhysicalDevice
matching the instance andluid
- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_SetSynchronizationQueueVk
public static int novr_SetSynchronizationQueueVk(long session, long queue)
Unsafe version of:SetSynchronizationQueueVk
-
ovr_SetSynchronizationQueueVk
public static int ovr_SetSynchronizationQueueVk(long session, org.lwjgl.vulkan.VkQueue queue)
SelectsVkQueue
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 validVkQueue
created on the sameVkDevice
the texture sets were created on prior to the first call toSubmitFrame
. An internally createdVkFence
object will be signalled by the completion of operations on queue and waited on to synchronize the VR compositor.- Parameters:
session
- anovrSession
previously returned byCreate
queue
- aVkQueue
to add aVkFence
operation to and wait on- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_CreateTextureSwapChainVk
public static int novr_CreateTextureSwapChainVk(long session, long device, long desc, long out_TextureSwapChain)
Unsafe version of:CreateTextureSwapChainVk
-
ovr_CreateTextureSwapChainVk
public static int ovr_CreateTextureSwapChainVk(long session, org.lwjgl.vulkan.VkDevice device, OVRTextureSwapChainDesc desc, org.lwjgl.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 theShaderResourceView
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 theTextureMisc_DX_Typeless
flag in theovrTextureSwapChainDesc
'sFlag
field. This will allow the application to create aRenderTargetView
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. TheTextureMisc_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
- anovrSession
previously returned byCreate
device
- the application'sVkDevice
to create resources withdesc
- specifies requested texture properties. See notes for more info about texture format.out_TextureSwapChain
- returns the createdovrTextureSwapChain
, which will be valid upon a successful return value, else it will beNULL
. This texture chain must be eventually destroyed viaDestroyTextureSwapChain
before destroying the session withDestroy
.- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_GetTextureSwapChainBufferVk
public static int novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long out_Image)
Unsafe version of:GetTextureSwapChainBufferVk
-
ovr_GetTextureSwapChainBufferVk
public static int ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, java.nio.LongBuffer out_Image)
Gets a specificVkImage
within the chain.- Parameters:
session
- anovrSession
previously returned byCreate
chain
- anovrTextureSwapChain
previously returned byCreateTextureSwapChainVk
index
- the index within the chain to retrieve. Must be between 0 and length (seeGetTextureSwapChainLength
), or may pass -1 to get the buffer at theCurrentIndex
location (saving a call toGetTextureSwapChainCurrentIndex
).- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_CreateMirrorTextureWithOptionsVk
public static int novr_CreateMirrorTextureWithOptionsVk(long session, long device, long desc, long out_MirrorTexture)
Unsafe version of:CreateMirrorTextureWithOptionsVk
-
ovr_CreateMirrorTextureWithOptionsVk
public static int ovr_CreateMirrorTextureWithOptionsVk(long session, org.lwjgl.vulkan.VkDevice device, OVRMirrorTextureDesc desc, org.lwjgl.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 givenovrSession
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 theVkImageView
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 theTextureMisc_DX_Typeless
flag in theovrMirrorTextureDesc
'sFlags
field. This will allow the application to bind aShaderResourceView
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
- anovrSession
previously returned byCreate
device
- theVkDevice
to create resources withdesc
- specifies requested texture properties. See notes for more info about texture format.out_MirrorTexture
- returns the createdovrMirrorTexture
, which will be valid upon a successful return value, else it will beNULL
. This texture must be eventually destroyed viaDestroyMirrorTexture
before destroying the session withDestroy
.- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_GetMirrorTextureBufferVk
public static int novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long out_Image)
Unsafe version of:GetMirrorTextureBufferVk
-
ovr_GetMirrorTextureBufferVk
public static int ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, java.nio.LongBuffer out_Image)
Gets the underlying mirrorVkImage
.- Parameters:
session
- anovrSession
previously returned byCreate
mirrorTexture
- anovrMirrorTexture
previously returned byCreateMirrorTextureWithOptionsVk
out_Image
- returns theVkImage
pointer retrieved- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information.
-
novr_GetInstanceExtensionsVk
public static int novr_GetInstanceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)
Array version of:novr_GetInstanceExtensionsVk(long, long, long)
-
ovr_GetInstanceExtensionsVk
public static int ovr_GetInstanceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, int[] inoutExtensionNamesSize)
Array version of:GetInstanceExtensionsVk
-
novr_GetDeviceExtensionsVk
public static int novr_GetDeviceExtensionsVk(long luid, long extensionNames, int[] inoutExtensionNamesSize)
Array version of:novr_GetDeviceExtensionsVk(long, long, long)
-
ovr_GetDeviceExtensionsVk
public static int ovr_GetDeviceExtensionsVk(OVRGraphicsLuid luid, java.nio.ByteBuffer extensionNames, int[] inoutExtensionNamesSize)
Array version of:GetDeviceExtensionsVk
-
novr_GetTextureSwapChainBufferVk
public static int novr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)
Array version of:novr_GetTextureSwapChainBufferVk(long, long, int, long)
-
ovr_GetTextureSwapChainBufferVk
public static int ovr_GetTextureSwapChainBufferVk(long session, long chain, int index, long[] out_Image)
Array version of:GetTextureSwapChainBufferVk
-
novr_GetMirrorTextureBufferVk
public static int novr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)
Array version of:novr_GetMirrorTextureBufferVk(long, long, long)
-
ovr_GetMirrorTextureBufferVk
public static int ovr_GetMirrorTextureBufferVk(long session, long mirrorTexture, long[] out_Image)
Array version of:GetMirrorTextureBufferVk
-
-