From f68798666fc0f775dd89cba239b0b95012f97d77 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Fri, 3 Jun 2016 13:02:38 +0300 Subject: [PATCH] Update LibOVR bindings to 1.4.0 --- .../src/main/kotlin/org/lwjgl/ovr/OVRTypes.kt | 20 +++++++++---------- .../kotlin/org/lwjgl/ovr/templates/OVR.kt | 20 ++++++++++++++++--- .../org/lwjgl/ovr/templates/OVR_ErrorCode.kt | 15 +++++++++++--- .../org/lwjgl/ovr/templates/OVR_Util.kt | 2 +- .../org/lwjgl/ovr/templates/OVR_Version.kt | 4 ++-- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/modules/templates/src/main/kotlin/org/lwjgl/ovr/OVRTypes.kt b/modules/templates/src/main/kotlin/org/lwjgl/ovr/OVRTypes.kt index 9fe40d1ae2..b076fe08f5 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/ovr/OVRTypes.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/ovr/OVRTypes.kt @@ -218,7 +218,7 @@ val ovrGraphicsLuid_p = struct_p(OVR_PACKAGE, "OVRGraphicsLuid", nativeName = "o val ovrHmdDesc = struct(OVR_PACKAGE, "OVRHmdDesc", nativeName = "ovrHmdDesc", mutable = false) { documentation = "A complete descriptor of the HMD." - ovrHmdType.member("Type", "this HMD's type") + ovrHmdType.member("Type", "this HMD's type").links("Hmd_\\w+") padding(4, "Pointer.BITS64") charUTF8.array("ProductName", "name string describing the product: \"Oculus Rift DK1\", etc.", size = 64) charUTF8.array("Manufacturer", "string describing the manufacturer. Usually \"Oculus\".", size = 64) @@ -313,7 +313,7 @@ val ovrEyeRenderDesc = struct(OVR_PACKAGE, "OVREyeRenderDesc", nativeName = "ovr included here as it can be specified separately and modified per frame by passing different viewport values in the layer structure. """ - ovrEyeType.member("Eye", "the eye index this instance corresponds to") + ovrEyeType.member("Eye", "the eye index this instance corresponds to").links("Eye_\\w+") ovrFovPort.member("Fov", "the field of view") ovrRecti.member("DistortedViewport", "distortion viewport") ovrVector2f.member("PixelsPerTanAngleAtCenter", "wow many display pixels will fit in tan(angle) = 1") @@ -356,25 +356,25 @@ val ovrTextureFormat = "ovrTextureFormat".enumType val ovrTextureSwapChainDesc_p = struct_p(OVR_PACKAGE, "OVRTextureSwapChainDesc", nativeName = "ovrTextureSwapChainDesc") { documentation = "Description used to create a texture swap chain." - ovrTextureType.member("Type", "") - ovrTextureFormat.member("Format", "") + ovrTextureType.member("Type", "").links("Texture_\\w+") + ovrTextureFormat.member("Format", "").links("OVR_FORMAT_\\w+") int.member("ArraySize", "only supported with OVR#ovrTexture_2D. Not supported on PC at this time.") int.member("Width", "") int.member("Height", "") int.member("MipLevels", "") int.member("SampleCount", "current only supported on depth textures") ovrBool.member("StaticImage", "not buffered in a chain. For images that don't change") - unsigned_int.member("MiscFlags", "{@code ovrTextureMiscFlags}") - unsigned_int.member("BindFlags", "{@code ovrTextureBindFlags}. Not used for GL.") + unsigned_int.member("MiscFlags", "{@code ovrTextureFlags}").links("TextureMisc_\\w+", LinkMode.BITFIELD) + unsigned_int.member("BindFlags", "{@code ovrTextureBindFlags}. Not used for GL.").links("TextureBind_\\w+", LinkMode.BITFIELD) } val ovrMirrorTextureDesc_p = struct_p(OVR_PACKAGE, "OVRMirrorTextureDesc", nativeName = "ovrMirrorTextureDesc") { documentation = "Description used to create a mirror texture." - ovrTextureFormat.member("Format", "") + ovrTextureFormat.member("Format", "").links("OVR_FORMAT_\\w+") int.member("Width", "") int.member("Height", "") - unsigned_int.member("MiscFlags", "{@code ovrTextureMiscFlags}") + unsigned_int.member("MiscFlags", "{@code ovrTextureFlags}").links("TextureMisc_\\w+", LinkMode.BITFIELD) } val ovrTextureSwapChain = "ovrTextureSwapChain".opaque_p @@ -412,7 +412,7 @@ val ovrInputState_p = struct_p(OVR_PACKAGE, "OVRInputState", nativeName = "ovrIn "horizontal and vertical thumbstick axis values (OVR#ovrHand_Left and OVR#ovrHand_Right), in the range -1.0f to 1.0f.", size = ovrHand_Count ) - ovrControllerType.member("ControllerType", "The type of the controller this state is for.") + ovrControllerType.member("ControllerType", "The type of the controller this state is for.").links("ControllerType_\\w+") } val ovrLayerHeader = struct(OVR_PACKAGE, "OVRLayerHeader", nativeName = "ovrLayerHeader") { @@ -424,7 +424,7 @@ val ovrLayerHeader = struct(OVR_PACKAGE, "OVRLayerHeader", nativeName = "ovrLaye OVR#ovrLayerType_Disabled. """ - ovrLayerType.member("Type", "described by {@code ovrLayerType}") + ovrLayerType.member("Type", "described by {@code ovrLayerType}").links("LayerType_\\w+") unsigned_int.member("Flags", "described by {@code ovrLayerFlags}") }.nativeType val ovrLayerHeader_p = ovrLayerHeader.p diff --git a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR.kt b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR.kt index 46cbf8feb4..7c7b432420 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR.kt @@ -238,6 +238,14 @@ ENABLE_WARNINGS()""") "TextureMisc_AllowGenerateMips".enum( "DX only: Allow generation of the mip chain on the GPU via the GenerateMips call. This flag requires that RenderTarget binding also be specified.", 0x0002 + ), + + "TextureMisc_ProtectedContent".enum( + """ + Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD. Also prevents mirroring or other + redirection of any frame containing this contents + """, + 0x0004 ) ) @@ -326,9 +334,9 @@ ENABLE_WARNINGS()""") "Initialize", """ Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT shared library. No LibOVR API functions, other than - #GetLastErrorInfo(), can be called unless #Initialize() succeeds. A successful call to {@code ovr_Initialize} must be eventually followed by a call to - #Shutdown(). {@code ovr_Initialize} calls are idempotent. Calling {@code ovr_Initialize} twice does not require two matching calls to - {@code ovr_Shutdown}. If already initialized, the return value is OVRErrorCode#Success. + #GetLastErrorInfo() and #_Detect(), can be called unless #Initialize() succeeds. A successful call to {@code ovr_Initialize} must be eventually + followed by a call to #Shutdown(). {@code ovr_Initialize} calls are idempotent. Calling {@code ovr_Initialize} twice does not require two matching + calls to {@code ovr_Shutdown}. If already initialized, the return value is OVRErrorCode#Success. LibOVRRT shared library search order: ${ol( @@ -751,6 +759,12 @@ ENABLE_WARNINGS()""") Higher FOV will generally require larger textures to maintain quality. Apps packing multiple eye views together on the same texture should ensure there are at least 8 pixels of padding between them to prevent texture filtering and chromatic aberration causing images to leak between the two eye views. + + Example code: +${codeBlock(""" +ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session); +ovrSizei eyeSizeLeft = ovr_GetFovTextureSize(session, ovrEye_Left, hmdDesc.DefaultEyeFov[ovrEye_Left], 1.0f); +ovrSizei eyeSizeRight = ovr_GetFovTextureSize(session, ovrEye_Right, hmdDesc.DefaultEyeFov[ovrEye_Right], 1.0f);""")} """, session, diff --git a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_ErrorCode.kt b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_ErrorCode.kt index 8f8a82a830..70f3928bea 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_ErrorCode.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_ErrorCode.kt @@ -46,6 +46,7 @@ val OVR_ErrorCode = "OVRErrorCode".nativeClass(OVR_PACKAGE, prefixMethod = "OVR_ "Error_InvalidHeadsetOrientation".enumExpr("The headset was in an invalid orientation for the requested operation (e.g. vertically oriented during OVR##ovr_RecenterTrackingOrigin()).", "-1011"), "Error_ClientSkippedDestroy".enumExpr("The client failed to call OVR##ovr_Destroy() on an active session before calling OVR##ovr_Shutdown(). Or the client crashed.", "-1012"), "Error_ClientSkippedShutdown".enumExpr("The client failed to call OVR##ovr_Shutdown() or the client crashed.", "-1013"), + "Error_ServiceDeadlockDetected".enumExpr("The service watchdog discovered a deadlock.", "-1014"), /* Audio error range, reserved for Audio errors. */ "Error_AudioReservedBegin".enumExpr("First Audio error.", "-2000"), @@ -105,10 +106,17 @@ val OVR_ErrorCode = "OVRErrorCode".nativeClass(OVR_PACKAGE, prefixMethod = "OVR_ "Error_BootloaderDeviceDetected".enumExpr("A bootloader HMD is detected by the service.", "-4102"), "Error_TrackerCalibrationError".enumExpr("The sensor calibration is missing or incorrect.", "-4103"), "Error_ControllerFirmwareMismatch".enumExpr("The controller firmware is out of date and is unacceptable.", "-4104"), + "Error_DevManDeviceDetected".enumExpr("A DeviceManagement mode HMD is detected by the service.", "-4105"), + "Error_RebootedBootloaderDevice".enumExpr("Had to reboot bootloader device, which succeeded.", "-4106"), + "Error_FailedRebootBootloaderDev".enumExpr("Had to reboot bootloader device, which failed. Device is stuck in bootloader mode.", "-4107"), "Error_IMUTooManyLostSamples".enumExpr("Too many lost IMU samples.", "-4200"), "Error_IMURateError".enumExpr("IMU rate is outside of the expected range.", "-4201"), "Error_FeatureReportFailure".enumExpr("A feature report has failed.", "-4202"), + "Error_HMDWirelessTimeout".enumExpr("HMD wireless interface never returned from busy state.", "-4203"), + + "Error_BootloaderAssertLog".enumExpr("HMD Bootloader Assert Log was not empty.", "-4300"), + "Error_AppAssertLog".enumExpr("HMD App Assert Log was not empty.", "-4301"), /* Synchronization errors */ "Error_Incomplete".enumExpr("Requested async work not yet complete.", "-5000"), @@ -120,8 +128,10 @@ val OVR_ErrorCode = "OVRErrorCode".nativeClass(OVR_PACKAGE, prefixMethod = "OVR_ "Error_TextureSwapChainInvalid".enumExpr("The {@code ovrTextureSwapChain} is in an incomplete or inconsistent state. Ensure #CommitTextureSwapChain() was called at least once first.", "-6002"), "Error_GraphicsDeviceReset".enumExpr("Graphics device has been reset (TDR, etc...)", "-6003"), "Error_DisplayRemoved".enumExpr("HMD removed from the display adapter", "-6004"), - "Error_ApplicationInvisible".enumExpr("Application declared itself as an invisible type and is not allowed to submit frames.", "-6005"), - "Error_Disallowed".enumExpr("The given request is disallowed under the current conditions.", "-6006"), + "Error_ContentProtectionNotAvailable".enumExpr("Content protection is not available for the display", "-6005"), + "Error_ApplicationInvisible".enumExpr("Application declared itself as an invisible type and is not allowed to submit frames.", "-6006"), + "Error_Disallowed".enumExpr("The given request is disallowed under the current conditions.", "-6007"), + "Error_DisplayPluggedIncorrectly".enumExpr("Display portion of HMD is plugged into an incompatible port (ex: IGP)", "-6008"), /* Fatal errors */ "Error_RuntimeException".enumExpr("A runtime exception occurred. The application is required to shutdown LibOVR and re-initialize it before this error state will be cleared.", "-7000"), @@ -140,7 +150,6 @@ val OVR_ErrorCode = "OVRErrorCode".nativeClass(OVR_PACKAGE, prefixMethod = "OVR_ "Error_MetricsSessionNotActive".enumExpr("", "-90010") ) - val SUCCESS = bool( "SUCCESS", """ diff --git a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Util.kt b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Util.kt index f2b818f725..d734a45904 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Util.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Util.kt @@ -145,7 +145,7 @@ val OVR_Util = "OVRUtil".nativeClass(packageName = OVR_PACKAGE, prefixMethod = " """ ), Check(2)..const..ovrVector3f_p.IN( - "HmdToEyeOffset", + "hmdToEyeOffset", """ can be ##OVREyeRenderDesc{@code .HmdToEyeOffset} returned from OVR#_GetRenderDesc(). For monoscopic rendering, use a vector that is the average of the two vectors for both eyes. diff --git a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Version.kt b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Version.kt index 520e75d791..1e3c9c3432 100644 --- a/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Version.kt +++ b/modules/templates/src/main/kotlin/org/lwjgl/ovr/templates/OVR_Version.kt @@ -15,8 +15,8 @@ val OVR_Version = "OVRVersion".nativeClass(packageName = OVR_PACKAGE, prefix = " "PRODUCT_VERSION".."1", "MAJOR_VERSION".."1", - "MINOR_VERSION".."3", - "PATCH_VERSION".."2", + "MINOR_VERSION".."4", + "PATCH_VERSION".."0", "BUILD_NUMBER".."0" )