Merge mozilla-central to autoland. a=merge CLOSED TREE

--HG--
extra : rebase_source : ba12f05efc62a616ff831b24e38823be9e69c8ea
This commit is contained in:
Margareta Eliza Balazs 2018-05-14 19:48:37 +03:00
Родитель 6845fe60f6 5c27454e73
Коммит c4a535377f
55 изменённых файлов: 1071 добавлений и 652 удалений

Просмотреть файл

@ -610,7 +610,7 @@
label="&reportDeceptiveSiteMenu.title;" label="&reportDeceptiveSiteMenu.title;"
accesskey="&reportDeceptiveSiteMenu.accesskey;" accesskey="&reportDeceptiveSiteMenu.accesskey;"
observes="reportPhishingBroadcaster" observes="reportPhishingBroadcaster"
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event);" oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})});"
onclick="checkForMiddleClick(this, event);" onclick="checkForMiddleClick(this, event);"
hidden="true"/> hidden="true"/>
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu" <menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"

Просмотреть файл

@ -1222,9 +1222,10 @@
<vbox id="appcontent" flex="1"> <vbox id="appcontent" flex="1">
<notificationbox id="high-priority-global-notificationbox" notificationside="top"/> <notificationbox id="high-priority-global-notificationbox" notificationside="top"/>
<tabbox id="tabbrowser-tabbox" <tabbox id="tabbrowser-tabbox"
flex="1" eventnode="document" tabcontainer="tabbrowser-tabs" flex="1" eventnode="document" tabcontainer="tabbrowser-tabs">
onselect="if (event.target.localName == 'tabpanels') gBrowser.updateCurrentBrowser();"> <tabpanels id="tabbrowser-tabpanels"
<tabpanels flex="1" class="plain" selectedIndex="0" id="tabbrowser-tabpanels"> flex="1" class="plain" selectedIndex="0"
onselect="if (event.target == this) gBrowser.updateCurrentBrowser();">
<notificationbox flex="1" notificationside="top"> <notificationbox flex="1" notificationside="top">
<!-- Set large flex to allow the devtools toolbox to set a flex attribute. <!-- Set large flex to allow the devtools toolbox to set a flex attribute.
We don't want the toolbox to actually take up free space, but we do want it to collapse when the window shrinks, and with flex=0 it can't. We don't want the toolbox to actually take up free space, but we do want it to collapse when the window shrinks, and with flex=0 it can't.

Просмотреть файл

@ -45,7 +45,7 @@ function addRow(name, type, url) {
urlLabel.className = "text-link"; urlLabel.className = "text-link";
urlLabel.textContent = url; urlLabel.textContent = url;
urlLabel.setAttribute("tooltiptext", url); urlLabel.setAttribute("tooltiptext", url);
urlLabel.addEventListener("click", ev => openUILink(this.value, ev)); urlLabel.addEventListener("click", ev => openUILink(this.value, ev, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})}));
urlContainer.appendChild(urlLabel); urlContainer.appendChild(urlLabel);
const subscribeButton = document.createElement("button"); const subscribeButton = document.createElement("button");

Просмотреть файл

@ -107,5 +107,5 @@ function test_openUILink() {
runNextTest(); runNextTest();
}); });
openUILink("http://example.org/"); // defaults to "current" openUILink("http://example.org/", null, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})}); // defaults to "current"
} }

Просмотреть файл

@ -120,12 +120,7 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
} }
if (!params.triggeringPrincipal) { if (!params.triggeringPrincipal) {
let dt = event ? event.dataTransfer : null; throw new Error("Required argument triggeringPrincipal missing within openUILink");
if (!!dt && dt.mozSourceNode) {
params.triggeringPrincipal = dt.mozSourceNode.nodePrincipal;
} else {
params.triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
}
} }
let where = whereToOpenLink(event, aIgnoreButton, aIgnoreAlt); let where = whereToOpenLink(event, aIgnoreButton, aIgnoreAlt);

Просмотреть файл

@ -688,8 +688,6 @@ notification[value="translation"] menulist > .menulist-dropmarker {
#titlebar-buttonbox { #titlebar-buttonbox {
z-index: 1; z-index: 1;
-moz-box-align: center; -moz-box-align: center;
padding-top: 2px;
padding-bottom: 2px;
} }
/* Render titlebar command buttons according to system config. /* Render titlebar command buttons according to system config.

Просмотреть файл

@ -102,6 +102,10 @@ check_and_add_gcc_warning('-Wno-error=free-nonheap-object')
# Would be a pain to fix all occurrences, for very little gain # Would be a pain to fix all occurrences, for very little gain
check_and_add_gcc_warning('-Wno-error=multistatement-macros') check_and_add_gcc_warning('-Wno-error=multistatement-macros')
# Disable the -Werror for return-std-move because of a false positive
# on nsTAutoStringN: https://bugs.llvm.org/show_bug.cgi?id=37249
check_and_add_gcc_warning('-Wno-error=return-std-move')
# catches format/argument mismatches with printf # catches format/argument mismatches with printf
c_format_warning, cxx_format_warning = check_and_add_gcc_warning( c_format_warning, cxx_format_warning = check_and_add_gcc_warning(
'-Wformat', when=depends(target)(lambda t: t.kernel != 'WINNT')) '-Wformat', when=depends(target)(lambda t: t.kernel != 'WINNT'))

Просмотреть файл

@ -1024,6 +1024,7 @@ VRSystemManagerOpenVR::GetGamepadHandFromControllerRole(
switch(aRole) { switch(aRole) {
case ::vr::ETrackedControllerRole::TrackedControllerRole_Invalid: case ::vr::ETrackedControllerRole::TrackedControllerRole_Invalid:
case ::vr::ETrackedControllerRole::TrackedControllerRole_OptOut:
hand = dom::GamepadHand::_empty; hand = dom::GamepadHand::_empty;
break; break;
case ::vr::ETrackedControllerRole::TrackedControllerRole_LeftHand: case ::vr::ETrackedControllerRole::TrackedControllerRole_LeftHand:
@ -1033,6 +1034,7 @@ VRSystemManagerOpenVR::GetGamepadHandFromControllerRole(
hand = dom::GamepadHand::Right; hand = dom::GamepadHand::Right;
break; break;
default: default:
hand = dom::GamepadHand::_empty;
MOZ_ASSERT(false); MOZ_ASSERT(false);
break; break;
} }

Просмотреть файл

@ -1,4 +1,4 @@
This directory contains files from the OpenVR SDK, version 1.0.8. This directory contains files from the OpenVR SDK, version 1.0.18.
This SDK contains the OpenVR API interface headers and functions to load the This SDK contains the OpenVR API interface headers and functions to load the
OpenVR runtime libraries which actually implement the functionality. The OpenVR runtime libraries which actually implement the functionality. The

Просмотреть файл

@ -36,7 +36,7 @@ typedef uint32_t glUInt_t;
// right-handed system // right-handed system
// +y is up // +y is up
// +x is to the right // +x is to the right
// -z is going away from you // -z is forward
// Distance unit is meters // Distance unit is meters
struct HmdMatrix34_t struct HmdMatrix34_t
{ {
@ -112,6 +112,8 @@ enum ETextureType
TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure
TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef
TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure
TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets.
// this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it
}; };
enum EColorSpace enum EColorSpace
@ -151,7 +153,7 @@ static const uint32_t k_unMaxDriverDebugResponseSize = 32768;
/** Used to pass device IDs to API calls */ /** Used to pass device IDs to API calls */
typedef uint32_t TrackedDeviceIndex_t; typedef uint32_t TrackedDeviceIndex_t;
static const uint32_t k_unTrackedDeviceIndex_Hmd = 0; static const uint32_t k_unTrackedDeviceIndex_Hmd = 0;
static const uint32_t k_unMaxTrackedDeviceCount = 16; static const uint32_t k_unMaxTrackedDeviceCount = 64;
static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE; static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE;
static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF; static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF;
@ -173,6 +175,8 @@ enum ETrackedControllerRole
TrackedControllerRole_Invalid = 0, // Invalid value for controller type TrackedControllerRole_Invalid = 0, // Invalid value for controller type
TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand
TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand
TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection
TrackedControllerRole_Max = 4
}; };
@ -199,6 +203,9 @@ enum ETrackingUniverseOrigin
TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one.
}; };
typedef uint64_t WebConsoleHandle_t;
#define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0)
// Refers to a single container of properties // Refers to a single container of properties
typedef uint64_t PropertyContainerHandle_t; typedef uint64_t PropertyContainerHandle_t;
typedef uint32_t PropertyTypeTag_t; typedef uint32_t PropertyTypeTag_t;
@ -206,6 +213,9 @@ typedef uint32_t PropertyTypeTag_t;
static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0;
static const PropertyTypeTag_t k_unInvalidPropertyTag = 0; static const PropertyTypeTag_t k_unInvalidPropertyTag = 0;
typedef PropertyContainerHandle_t DriverHandle_t;
static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0;
// Use these tags to set/get common types as struct properties // Use these tags to set/get common types as struct properties
static const PropertyTypeTag_t k_unFloatPropertyTag = 1; static const PropertyTypeTag_t k_unFloatPropertyTag = 1;
static const PropertyTypeTag_t k_unInt32PropertyTag = 2; static const PropertyTypeTag_t k_unInt32PropertyTag = 2;
@ -219,6 +229,11 @@ static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22;
static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23;
static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30;
static const PropertyTypeTag_t k_unPathHandleInfoTag = 31;
static const PropertyTypeTag_t k_unActionPropertyTag = 32;
static const PropertyTypeTag_t k_unInputValuePropertyTag = 33;
static const PropertyTypeTag_t k_unWildcardPropertyTag = 34;
static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35;
static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000;
static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000;
@ -267,6 +282,11 @@ enum ETrackedDeviceProperty
Prop_ViveSystemButtonFixRequired_Bool = 1033, Prop_ViveSystemButtonFixRequired_Bool = 1033,
Prop_ParentDriver_Uint64 = 1034, Prop_ParentDriver_Uint64 = 1034,
Prop_ResourceRoot_String = 1035, Prop_ResourceRoot_String = 1035,
Prop_RegisteredDeviceType_String = 1036,
Prop_InputProfilePath_String = 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided
Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design
Prop_NumCameras_Int32 = 1039,
Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value
// Properties that are unique to TrackedDeviceClass_HMD // Properties that are unique to TrackedDeviceClass_HMD
Prop_ReportsTimeSinceVSync_Bool = 2000, Prop_ReportsTimeSinceVSync_Bool = 2000,
@ -316,6 +336,20 @@ enum ETrackedDeviceProperty
Prop_DisplayDebugMode_Bool = 2044, Prop_DisplayDebugMode_Bool = 2044,
Prop_GraphicsAdapterLuid_Uint64 = 2045, Prop_GraphicsAdapterLuid_Uint64 = 2045,
Prop_DriverProvidedChaperonePath_String = 2048, Prop_DriverProvidedChaperonePath_String = 2048,
Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for
Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for
Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded
Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded
Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded
Prop_DoNotApplyPrediction_Bool = 2054,
Prop_CameraToHeadTransforms_Matrix34_Array = 2055,
Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion
Prop_DriverIsDrawingControllers_Bool = 2057,
Prop_DriverRequestsApplicationPause_Bool = 2058,
Prop_DriverRequestsReducedRendering_Bool = 2059,
Prop_MinimumIpdStepMeters_Float = 2060,
Prop_AudioBridgeFirmwareVersion_Uint64 = 2061,
Prop_ImageBridgeFirmwareVersion_Uint64 = 2062,
// Properties that are unique to TrackedDeviceClass_Controller // Properties that are unique to TrackedDeviceClass_Controller
Prop_AttachedDeviceId_String = 3000, Prop_AttachedDeviceId_String = 3000,
@ -350,6 +384,7 @@ enum ETrackedDeviceProperty
// Properties that are used by helpers, but are opaque to applications // Properties that are used by helpers, but are opaque to applications
Prop_DisplayHiddenArea_Binary_Start = 5100, Prop_DisplayHiddenArea_Binary_Start = 5100,
Prop_DisplayHiddenArea_Binary_End = 5150, Prop_DisplayHiddenArea_Binary_End = 5150,
Prop_ParentContainer = 5151,
// Properties that are unique to drivers // Properties that are unique to drivers
Prop_UserConfigPath_String = 6000, Prop_UserConfigPath_String = 6000,
@ -360,9 +395,15 @@ enum ETrackedDeviceProperty
Prop_HasDriverDirectModeComponent_Bool = 6005, Prop_HasDriverDirectModeComponent_Bool = 6005,
Prop_HasVirtualDisplayComponent_Bool = 6006, Prop_HasVirtualDisplayComponent_Bool = 6006,
// Properties that are set internally based on other information provided by drivers
Prop_ControllerType_String = 7000,
Prop_LegacyInputProfile_String = 7001,
// Vendors are free to expose private debug data in this reserved region // Vendors are free to expose private debug data in this reserved region
Prop_VendorSpecific_Reserved_Start = 10000, Prop_VendorSpecific_Reserved_Start = 10000,
Prop_VendorSpecific_Reserved_End = 10999, Prop_VendorSpecific_Reserved_End = 10999,
Prop_TrackedDeviceProperty_Max = 1000000,
}; };
/** No string property will ever be longer than this length */ /** No string property will ever be longer than this length */
@ -383,6 +424,7 @@ enum ETrackedPropertyError
TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later.
TrackedProp_PermissionDenied = 10, TrackedProp_PermissionDenied = 10,
TrackedProp_InvalidOperation = 11, TrackedProp_InvalidOperation = 11,
TrackedProp_CannotWriteToWildcards = 12,
}; };
/** Allows the application to control what part of the provided texture will be used in the /** Allows the application to control what part of the provided texture will be used in the
@ -393,6 +435,28 @@ struct VRTextureBounds_t
float uMax, vMax; float uMax, vMax;
}; };
/** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */
struct VRTextureWithPose_t : public Texture_t
{
HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures.
};
struct VRTextureDepthInfo_t
{
void* handle; // See ETextureType definition above
HmdMatrix44_t mProjection;
HmdVector2_t vRange; // 0..1
};
struct VRTextureWithDepth_t : public Texture_t
{
VRTextureDepthInfo_t depth;
};
struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t
{
VRTextureDepthInfo_t depth;
};
/** Allows the application to control how scene textures are used by the compositor when calling Submit. */ /** Allows the application to control how scene textures are used by the compositor when calling Submit. */
enum EVRSubmitFlags enum EVRSubmitFlags
@ -410,6 +474,14 @@ enum EVRSubmitFlags
// Do not use // Do not use
Submit_Reserved = 0x04, Submit_Reserved = 0x04,
// Set to indicate that pTexture is a pointer to a VRTextureWithPose_t.
// This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t.
Submit_TextureWithPose = 0x08,
// Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t.
// This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t.
Submit_TextureWithDepth = 0x10,
}; };
/** Data required for passing Vulkan textures to IVRCompositor::Submit. /** Data required for passing Vulkan textures to IVRCompositor::Submit.
@ -473,6 +545,15 @@ enum EVREventType
VREvent_ButtonTouch = 202, // data is controller VREvent_ButtonTouch = 202, // data is controller
VREvent_ButtonUntouch = 203, // data is controller VREvent_ButtonUntouch = 203, // data is controller
VREvent_DualAnalog_Press = 250, // data is dualAnalog
VREvent_DualAnalog_Unpress = 251, // data is dualAnalog
VREvent_DualAnalog_Touch = 252, // data is dualAnalog
VREvent_DualAnalog_Untouch = 253, // data is dualAnalog
VREvent_DualAnalog_Move = 254, // data is dualAnalog
VREvent_DualAnalog_ModeSwitch1 = 255, // data is dualAnalog
VREvent_DualAnalog_ModeSwitch2 = 256, // data is dualAnalog
VREvent_DualAnalog_Cancel = 257, // data is dualAnalog
VREvent_MouseMove = 300, // data is mouse VREvent_MouseMove = 300, // data is mouse
VREvent_MouseButtonDown = 301, // data is mouse VREvent_MouseButtonDown = 301, // data is mouse
VREvent_MouseButtonUp = 302, // data is mouse VREvent_MouseButtonUp = 302, // data is mouse
@ -490,10 +571,15 @@ enum EVREventType
VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene
VREvent_InputFocusChanged = 406, // data is process VREvent_InputFocusChanged = 406, // data is process
VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process
VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process
VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for
VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily
VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility
VREvent_ConsoleOpened = 420,
VREvent_ConsoleClosed = 421,
VREvent_OverlayShown = 500, VREvent_OverlayShown = 500,
VREvent_OverlayHidden = 501, VREvent_OverlayHidden = 501,
VREvent_DashboardActivated = 502, VREvent_DashboardActivated = 502,
@ -508,11 +594,12 @@ enum EVREventType
VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it
VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else
VREvent_OverlaySharedTextureChanged = 513, VREvent_OverlaySharedTextureChanged = 513,
VREvent_DashboardGuideButtonDown = 514, //VREvent_DashboardGuideButtonDown = 514, // These are no longer sent
VREvent_DashboardGuideButtonUp = 515, //VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot
VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
VREvent_DashboardOverlayCreated = 518, VREvent_DashboardOverlayCreated = 518,
VREvent_SwitchGamepadFocus = 519,
// Screenshot API // Screenshot API
VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot
@ -522,6 +609,8 @@ enum EVREventType
VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted
VREvent_PrimaryDashboardDeviceChanged = 525, VREvent_PrimaryDashboardDeviceChanged = 525,
VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled
VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled
VREvent_Notification_Shown = 600, VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601, VREvent_Notification_Hidden = 601,
@ -542,16 +631,27 @@ enum EVREventType
VREvent_AudioSettingsHaveChanged = 820, VREvent_AudioSettingsHaveChanged = 820,
VREvent_BackgroundSettingHasChanged = 850, VREvent_BackgroundSettingHasChanged = 850,
VREvent_CameraSettingsHaveChanged = 851, VREvent_CameraSettingsHaveChanged = 851,
VREvent_ReprojectionSettingHasChanged = 852, VREvent_ReprojectionSettingHasChanged = 852,
VREvent_ModelSkinSettingsHaveChanged = 853, VREvent_ModelSkinSettingsHaveChanged = 853,
VREvent_EnvironmentSettingsHaveChanged = 854, VREvent_EnvironmentSettingsHaveChanged = 854,
VREvent_PowerSettingsHaveChanged = 855, VREvent_PowerSettingsHaveChanged = 855,
VREvent_EnableHomeAppSettingsHaveChanged = 856, VREvent_EnableHomeAppSettingsHaveChanged = 856,
VREvent_SteamVRSectionSettingChanged = 857,
VREvent_LighthouseSectionSettingChanged = 858,
VREvent_NullSectionSettingChanged = 859,
VREvent_UserInterfaceSectionSettingChanged = 860,
VREvent_NotificationsSectionSettingChanged = 861,
VREvent_KeyboardSectionSettingChanged = 862,
VREvent_PerfSectionSettingChanged = 863,
VREvent_DashboardSectionSettingChanged = 864,
VREvent_WebInterfaceSectionSettingChanged = 865,
VREvent_StatusUpdate = 900, VREvent_StatusUpdate = 900,
VREvent_WebInterface_InstallDriverCompleted = 950,
VREvent_MCImageUpdated = 1000, VREvent_MCImageUpdated = 1000,
VREvent_FirmwareUpdateStarted = 1100, VREvent_FirmwareUpdateStarted = 1100,
@ -586,7 +686,10 @@ enum EVREventType
VREvent_PerformanceTest_FidelityLevel = 1602, VREvent_PerformanceTest_FidelityLevel = 1602,
VREvent_MessageOverlay_Closed = 1650, VREvent_MessageOverlay_Closed = 1650,
VREvent_MessageOverlayCloseRequested = 1651,
VREvent_Input_HapticVibration = 1700, // data is hapticVibration
// Vendors are free to expose private events in this reserved region // Vendors are free to expose private events in this reserved region
VREvent_VendorSpecific_Reserved_Start = 10000, VREvent_VendorSpecific_Reserved_Start = 10000,
VREvent_VendorSpecific_Reserved_End = 19999, VREvent_VendorSpecific_Reserved_End = 19999,
@ -670,7 +773,8 @@ struct VREvent_Scroll_t
}; };
/** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger /** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger
is on the touchpad (or just released from it) is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents
flag set.
**/ **/
struct VREvent_TouchPadMove_t struct VREvent_TouchPadMove_t
{ {
@ -709,6 +813,7 @@ struct VREvent_Process_t
struct VREvent_Overlay_t struct VREvent_Overlay_t
{ {
uint64_t overlayHandle; uint64_t overlayHandle;
uint64_t devicePath;
}; };
@ -741,6 +846,8 @@ struct VREvent_Reserved_t
{ {
uint64_t reserved0; uint64_t reserved0;
uint64_t reserved1; uint64_t reserved1;
uint64_t reserved2;
uint64_t reserved3;
}; };
struct VREvent_PerformanceTest_t struct VREvent_PerformanceTest_t
@ -787,6 +894,33 @@ struct VREvent_Property_t
ETrackedDeviceProperty prop; ETrackedDeviceProperty prop;
}; };
enum EDualAnalogWhich
{
k_EDualAnalog_Left = 0,
k_EDualAnalog_Right = 1,
};
struct VREvent_DualAnalog_t
{
float x, y; // coordinates are -1..1 analog values
float transformedX, transformedY; // transformed by the center and radius numbers provided by the overlay
EDualAnalogWhich which;
};
struct VREvent_HapticVibration_t
{
uint64_t containerHandle; // property container handle of the device with the haptic component
uint64_t componentHandle; // Which haptic component needs to vibrate
float fDurationSeconds;
float fFrequency;
float fAmplitude;
};
struct VREvent_WebConsole_t
{
WebConsoleHandle_t webConsoleHandle;
};
/** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */
typedef union typedef union
{ {
@ -810,6 +944,9 @@ typedef union
VREvent_EditingCameraSurface_t cameraSurface; VREvent_EditingCameraSurface_t cameraSurface;
VREvent_MessageOverlay_t messageOverlay; VREvent_MessageOverlay_t messageOverlay;
VREvent_Property_t property; VREvent_Property_t property;
VREvent_DualAnalog_t dualAnalog;
VREvent_HapticVibration_t hapticVibration;
VREvent_WebConsole_t webConsole;
} VREvent_Data_t; } VREvent_Data_t;
@ -833,6 +970,21 @@ struct VREvent_t
#pragma pack( pop ) #pragma pack( pop )
#endif #endif
enum EVRInputError
{
VRInputError_None = 0,
VRInputError_NameNotFound = 1,
VRInputError_WrongType = 2,
VRInputError_InvalidHandle = 3,
VRInputError_InvalidParam = 4,
VRInputError_NoSteam = 5,
VRInputError_MaxCapacityReached = 6,
VRInputError_IPCError = 7,
VRInputError_NoActiveActionSet = 8,
VRInputError_InvalidDevice = 9,
};
/** The mesh to draw into the stencil (or depth) buffer to perform /** The mesh to draw into the stencil (or depth) buffer to perform
* early stencil (or depth) kills of pixels that will never appear on the HMD. * early stencil (or depth) kills of pixels that will never appear on the HMD.
* This mesh draws on all the pixels that will be hidden after distortion. * This mesh draws on all the pixels that will be hidden after distortion.
@ -970,6 +1122,9 @@ enum EVROverlayError
VROverlayError_NoNeighbor = 27, VROverlayError_NoNeighbor = 27,
VROverlayError_TooManyMaskPrimitives = 29, VROverlayError_TooManyMaskPrimitives = 29,
VROverlayError_BadMaskPrimitive = 30, VROverlayError_BadMaskPrimitive = 30,
VROverlayError_TextureAlreadyLocked = 31,
VROverlayError_TextureLockCapacityReached = 32,
VROverlayError_TextureNotLocked = 33,
}; };
/** enum values to pass in to VR_Init to identify whether the application will /** enum values to pass in to VR_Init to identify whether the application will
@ -1019,65 +1174,70 @@ enum EVRInitError
VRInitError_None = 0, VRInitError_None = 0,
VRInitError_Unknown = 1, VRInitError_Unknown = 1,
VRInitError_Init_InstallationNotFound = 100, VRInitError_Init_InstallationNotFound = 100,
VRInitError_Init_InstallationCorrupt = 101, VRInitError_Init_InstallationCorrupt = 101,
VRInitError_Init_VRClientDLLNotFound = 102, VRInitError_Init_VRClientDLLNotFound = 102,
VRInitError_Init_FileNotFound = 103, VRInitError_Init_FileNotFound = 103,
VRInitError_Init_FactoryNotFound = 104, VRInitError_Init_FactoryNotFound = 104,
VRInitError_Init_InterfaceNotFound = 105, VRInitError_Init_InterfaceNotFound = 105,
VRInitError_Init_InvalidInterface = 106, VRInitError_Init_InvalidInterface = 106,
VRInitError_Init_UserConfigDirectoryInvalid = 107, VRInitError_Init_UserConfigDirectoryInvalid = 107,
VRInitError_Init_HmdNotFound = 108, VRInitError_Init_HmdNotFound = 108,
VRInitError_Init_NotInitialized = 109, VRInitError_Init_NotInitialized = 109,
VRInitError_Init_PathRegistryNotFound = 110, VRInitError_Init_PathRegistryNotFound = 110,
VRInitError_Init_NoConfigPath = 111, VRInitError_Init_NoConfigPath = 111,
VRInitError_Init_NoLogPath = 112, VRInitError_Init_NoLogPath = 112,
VRInitError_Init_PathRegistryNotWritable = 113, VRInitError_Init_PathRegistryNotWritable = 113,
VRInitError_Init_AppInfoInitFailed = 114, VRInitError_Init_AppInfoInitFailed = 114,
VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver
VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup
VRInitError_Init_AnotherAppLaunching = 117, VRInitError_Init_AnotherAppLaunching = 117,
VRInitError_Init_SettingsInitFailed = 118, VRInitError_Init_SettingsInitFailed = 118,
VRInitError_Init_ShuttingDown = 119, VRInitError_Init_ShuttingDown = 119,
VRInitError_Init_TooManyObjects = 120, VRInitError_Init_TooManyObjects = 120,
VRInitError_Init_NoServerForBackgroundApp = 121, VRInitError_Init_NoServerForBackgroundApp = 121,
VRInitError_Init_NotSupportedWithCompositor = 122, VRInitError_Init_NotSupportedWithCompositor = 122,
VRInitError_Init_NotAvailableToUtilityApps = 123, VRInitError_Init_NotAvailableToUtilityApps = 123,
VRInitError_Init_Internal = 124, VRInitError_Init_Internal = 124,
VRInitError_Init_HmdDriverIdIsNone = 125, VRInitError_Init_HmdDriverIdIsNone = 125,
VRInitError_Init_HmdNotFoundPresenceFailed = 126, VRInitError_Init_HmdNotFoundPresenceFailed = 126,
VRInitError_Init_VRMonitorNotFound = 127, VRInitError_Init_VRMonitorNotFound = 127,
VRInitError_Init_VRMonitorStartupFailed = 128, VRInitError_Init_VRMonitorStartupFailed = 128,
VRInitError_Init_LowPowerWatchdogNotSupported = 129, VRInitError_Init_LowPowerWatchdogNotSupported = 129,
VRInitError_Init_InvalidApplicationType = 130, VRInitError_Init_InvalidApplicationType = 130,
VRInitError_Init_NotAvailableToWatchdogApps = 131, VRInitError_Init_NotAvailableToWatchdogApps = 131,
VRInitError_Init_WatchdogDisabledInSettings = 132, VRInitError_Init_WatchdogDisabledInSettings = 132,
VRInitError_Init_VRDashboardNotFound = 133, VRInitError_Init_VRDashboardNotFound = 133,
VRInitError_Init_VRDashboardStartupFailed = 134, VRInitError_Init_VRDashboardStartupFailed = 134,
VRInitError_Init_VRHomeNotFound = 135, VRInitError_Init_VRHomeNotFound = 135,
VRInitError_Init_VRHomeStartupFailed = 136, VRInitError_Init_VRHomeStartupFailed = 136,
VRInitError_Init_RebootingBusy = 137,
VRInitError_Init_FirmwareUpdateBusy = 138,
VRInitError_Init_FirmwareRecoveryBusy = 139,
VRInitError_Init_USBServiceBusy = 140,
VRInitError_Init_VRWebHelperStartupFailed = 141,
VRInitError_Driver_Failed = 200, VRInitError_Driver_Failed = 200,
VRInitError_Driver_Unknown = 201, VRInitError_Driver_Unknown = 201,
VRInitError_Driver_HmdUnknown = 202, VRInitError_Driver_HmdUnknown = 202,
VRInitError_Driver_NotLoaded = 203, VRInitError_Driver_NotLoaded = 203,
VRInitError_Driver_RuntimeOutOfDate = 204, VRInitError_Driver_RuntimeOutOfDate = 204,
VRInitError_Driver_HmdInUse = 205, VRInitError_Driver_HmdInUse = 205,
VRInitError_Driver_NotCalibrated = 206, VRInitError_Driver_NotCalibrated = 206,
VRInitError_Driver_CalibrationInvalid = 207, VRInitError_Driver_CalibrationInvalid = 207,
VRInitError_Driver_HmdDisplayNotFound = 208, VRInitError_Driver_HmdDisplayNotFound = 208,
VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209,
// VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons
VRInitError_Driver_HmdDriverIdOutOfBounds = 211, VRInitError_Driver_HmdDriverIdOutOfBounds = 211,
VRInitError_Driver_HmdDisplayMirrored = 212, VRInitError_Driver_HmdDisplayMirrored = 212,
VRInitError_IPC_ServerInitFailed = 300, VRInitError_IPC_ServerInitFailed = 300,
VRInitError_IPC_ConnectFailed = 301, VRInitError_IPC_ConnectFailed = 301,
VRInitError_IPC_SharedStateInitFailed = 302, VRInitError_IPC_SharedStateInitFailed = 302,
VRInitError_IPC_CompositorInitFailed = 303, VRInitError_IPC_CompositorInitFailed = 303,
VRInitError_IPC_MutexInitFailed = 304, VRInitError_IPC_MutexInitFailed = 304,
VRInitError_IPC_Failed = 305, VRInitError_IPC_Failed = 305,
VRInitError_IPC_CompositorConnectFailed = 306, VRInitError_IPC_CompositorConnectFailed = 306,
VRInitError_IPC_CompositorInvalidConnectResponse = 307, VRInitError_IPC_CompositorInvalidConnectResponse = 307,
VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308,
@ -1088,7 +1248,8 @@ enum EVRInitError
VRInitError_Compositor_ScreenshotsInitFailed = 404, VRInitError_Compositor_ScreenshotsInitFailed = 404,
VRInitError_Compositor_UnableToCreateDevice = 405, VRInitError_Compositor_UnableToCreateDevice = 405,
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VRInitError_VendorSpecific_WindowsNotInDevMode = 1001,
VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101,
VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
@ -1144,6 +1305,14 @@ enum EVRTrackedCameraError
VRTrackedCameraError_InvalidFrameBufferSize = 115, VRTrackedCameraError_InvalidFrameBufferSize = 115,
}; };
enum EVRTrackedCameraFrameLayout
{
EVRTrackedCameraFrameLayout_Mono = 0x0001,
EVRTrackedCameraFrameLayout_Stereo = 0x0002,
EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right)
EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right
};
enum EVRTrackedCameraFrameType enum EVRTrackedCameraFrameType
{ {
VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted. VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted.
@ -1173,17 +1342,30 @@ typedef uint32_t ScreenshotHandle_t;
static const uint32_t k_unScreenshotHandleInvalid = 0; static const uint32_t k_unScreenshotHandleInvalid = 0;
/** Frame timing data provided by direct mode drivers. */
struct DriverDirectMode_FrameTiming
{
uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming )
uint32_t m_nNumFramePresents; // number of times frame was presented
uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to
uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync)
uint32_t m_nReprojectionFlags;
};
enum EVSync
{
VSync_None,
VSync_WaitRender, // block following render work until vsync
VSync_NoWaitRender, // do not block following render work (allow to get started early)
};
#pragma pack( pop ) #pragma pack( pop )
#define VR_INTERFACE
// Mozilla changed VR_INTERFACE. We don't want to extern the API functions.
// See README.mozilla
#define VR_INTERFACE
/* /*
// figure out how to import from the VR API dll // figure out how to import from the VR API dll
#if defined(_WIN32) #if defined(_WIN32)
#ifdef VR_API_EXPORT #ifdef VR_API_EXPORT
#define VR_INTERFACE extern "C" __declspec( dllexport ) #define VR_INTERFACE extern "C" __declspec( dllexport )
#else #else
@ -1203,6 +1385,7 @@ static const uint32_t k_unScreenshotHandleInvalid = 0;
#endif #endif
*/ */
#if defined( _WIN32 ) #if defined( _WIN32 )
#define VR_CALLTYPE __cdecl #define VR_CALLTYPE __cdecl
#else #else
@ -1289,17 +1472,25 @@ public:
* Returns platform- and texture-type specific adapter identification so that applications and the * Returns platform- and texture-type specific adapter identification so that applications and the
* compositor are creating textures and swap chains on the same GPU. If an error occurs the device * compositor are creating textures and swap chains on the same GPU. If an error occurs the device
* will be set to 0. * will be set to 0.
* pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan.
* [D3D10/11/12 Only (D3D9 Not Supported)] * [D3D10/11/12 Only (D3D9 Not Supported)]
* Returns the adapter LUID that identifies the GPU attached to the HMD. The user should * Returns the adapter LUID that identifies the GPU attached to the HMD. The user should
* enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find * enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find
* the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid. * the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid.
* The discovered IDXGIAdapter should be used to create the device and swap chain. * The discovered IDXGIAdapter should be used to create the device and swap chain.
* [Vulkan Only] * [Vulkan Only]
* Returns the vk::PhysicalDevice that should be used by the application. * Returns the VkPhysicalDevice that should be used by the application.
* pInstance must be the instance the application will use to query for the VkPhysicalDevice. The application
* must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled.
* [macOS Only] * [macOS Only]
* Returns an id<MTLDevice> that should be used by the application. * For TextureType_IOSurface returns the id<MTLDevice> that should be used by the application.
* On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used
* by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the
* new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK.
* Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice
* with a GL Renderer.
*/ */
virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType ) = 0; virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0;
// ------------------------------------ // ------------------------------------
// Display Mode methods // Display Mode methods
@ -1406,6 +1597,11 @@ public:
/** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */ /** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */
virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
/** Returns an array of one type of property. If the device index is not valid or the property is not a single value or an array of the specified type,
* this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is
* greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */
virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0;
/** Returns a string property. If the device index is not valid or the property is not a string type this function will /** Returns a string property. If the device index is not valid or the property is not a string type this function will
* return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
@ -1470,17 +1666,21 @@ public:
/** returns the name of an EVRControllerAxisType enum value */ /** returns the name of an EVRControllerAxisType enum value */
virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0; virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0;
/** Tells OpenVR that this process wants exclusive access to controller button states and button events. Other apps will be notified that /** Returns true if this application is receiving input from the system. This would return false if
* they have lost input focus with a VREvent_InputFocusCaptured event. Returns false if input focus could not be captured for * system-related functionality is consuming the input stream. */
* some reason. */ virtual bool IsInputAvailable() = 0;
virtual bool CaptureInputFocus() = 0;
/** Tells OpenVR that this process no longer wants exclusive access to button states and button events. Other apps will be notified /** Returns true SteamVR is drawing controllers on top of the application. Applications should consider
* that input focus has been released with a VREvent_InputFocusReleased event. */ * not drawing anything attached to the user's hands in this case. */
virtual void ReleaseInputFocus() = 0; virtual bool IsSteamVRDrawingControllers() = 0;
/** Returns true if input focus is captured by another process. */ /** Returns true if the user has put SteamVR into a mode that is distracting them from the application.
virtual bool IsInputFocusCapturedByAnotherProcess() = 0; * For applications where this is appropriate, the application should pause ongoing activity. */
virtual bool ShouldApplicationPause() = 0;
/** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce
* its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */
virtual bool ShouldApplicationReduceRenderingWork() = 0;
// ------------------------------------ // ------------------------------------
// Debug Methods // Debug Methods
@ -1489,7 +1689,7 @@ public:
/** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k, /** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k,
* but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated. * but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated.
* The size of the response including its terminating null is returned. */ * The size of the response including its terminating null is returned. */
virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0; virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0;
// ------------------------------------ // ------------------------------------
// Firmware methods // Firmware methods
@ -1517,7 +1717,7 @@ public:
}; };
static const char * const IVRSystem_Version = "IVRSystem_016"; static const char * const IVRSystem_Version = "IVRSystem_019";
} }
@ -1572,6 +1772,7 @@ namespace vr
VRApplicationProperty_NewsURL_String = 51, VRApplicationProperty_NewsURL_String = 51,
VRApplicationProperty_ImagePath_String = 52, VRApplicationProperty_ImagePath_String = 52,
VRApplicationProperty_Source_String = 53, VRApplicationProperty_Source_String = 53,
VRApplicationProperty_ActionManifestURL_String = 54,
VRApplicationProperty_IsDashboardOverlay_Bool = 60, VRApplicationProperty_IsDashboardOverlay_Bool = 60,
VRApplicationProperty_IsTemplate_Bool = 61, VRApplicationProperty_IsTemplate_Bool = 61,
@ -1629,7 +1830,7 @@ namespace vr
/** Returns the key of the application for the specified Process Id. The buffer should be at least /** Returns the key of the application for the specified Process Id. The buffer should be at least
* k_unMaxApplicationKeyLength in order to fit the key. */ * k_unMaxApplicationKeyLength in order to fit the key. */
virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Launches the application. The existing scene application will exit and then the new application will start. /** Launches the application. The existing scene application will exit and then the new application will start.
* This call is not valid for dashboard overlay applications. */ * This call is not valid for dashboard overlay applications. */
@ -1683,21 +1884,21 @@ namespace vr
virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0; virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0;
/** return the app key that will open this mime type */ /** return the app key that will open this mime type */
virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Get the list of supported mime types for this application, comma-delimited */ /** Get the list of supported mime types for this application, comma-delimited */
virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0; virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0;
/** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */ /** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */
virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0; virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0;
/** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */ /** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */
virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, char *pchArgs, uint32_t unArgs ) = 0; virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0;
// --------------- Transition methods --------------- // // --------------- Transition methods --------------- //
/** Returns the app key for the application that is starting up */ /** Returns the app key for the application that is starting up */
virtual EVRApplicationError GetStartingApplication( char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Returns the application transition state */ /** Returns the application transition state */
virtual EVRApplicationTransitionState GetTransitionState() = 0; virtual EVRApplicationTransitionState GetTransitionState() = 0;
@ -1824,15 +2025,25 @@ namespace vr
static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride";
static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
static const char * const k_pch_SteamVR_DebugInput = "debugInput";
static const char * const k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding";
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// lighthouse keys // lighthouse keys
static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; static const char * const k_pch_Lighthouse_Section = "driver_lighthouse";
static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations";
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// null keys // null keys
@ -1908,6 +2119,7 @@ namespace vr
static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
static const char * const k_pch_Camera_RoomViewMode_Int32 = "cameraRoomViewMode";
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// audio keys // audio keys
@ -1934,6 +2146,8 @@ namespace vr
static const char * const k_pch_Dashboard_Section = "dashboard"; static const char * const k_pch_Dashboard_Section = "dashboard";
static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
static const char * const k_pch_Dashboard_EnableWebUI = "webUI";
static const char * const k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools";
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// model skin keys // model skin keys
@ -1943,6 +2157,11 @@ namespace vr
// driver keys - These could be checked in any driver_<name> section // driver keys - These could be checked in any driver_<name> section
static const char * const k_pch_Driver_Enable_Bool = "enable"; static const char * const k_pch_Driver_Enable_Bool = "enable";
//-----------------------------------------------------------------------------
// web interface keys
static const char* const k_pch_WebInterface_Section = "WebInterface";
static const char* const k_pch_WebInterface_WebPort_String = "WebPort";
} // namespace vr } // namespace vr
// ivrchaperone.h // ivrchaperone.h
@ -2129,6 +2348,14 @@ enum EVRCompositorError
VRCompositorError_InvalidBounds = 109, VRCompositorError_InvalidBounds = 109,
}; };
/** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */
enum EVRCompositorTimingMode
{
VRCompositorTimingMode_Implicit = 0,
VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1,
VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2,
};
const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01; const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01;
const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02; const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02;
const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active, const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active,
@ -2375,9 +2602,36 @@ public:
* null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */ * null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */
virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
/** [ Vulkan/D3D12 Only ]
* There are two purposes for SetExplicitTimingMode:
* 1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications.
* 2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from
* another thread while WaitGetPoses is executing.
*
* More accurate GPU timestamp for the start of the frame is achieved by the application calling
* SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue.
* This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11,
* WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the
* application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for
* Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame.
*
* Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired,
* the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff
* itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff
* and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another
* thread. */
virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0;
/** [ Vulkan/D3D12 Only ]
* Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before
* the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame.
* This function will insert a GPU timestamp write just before the application starts its rendering. This function
* will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread.
* Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */
virtual EVRCompositorError SubmitExplicitTimingData() = 0;
}; };
static const char * const IVRCompositor_Version = "IVRCompositor_020"; static const char * const IVRCompositor_Version = "IVRCompositor_022";
} // namespace vr } // namespace vr
@ -2493,6 +2747,7 @@ namespace vr
{ {
VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay
VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically
VROverlayInputMethod_DualAnalog = 2, // Analog inputs from tracked controllers are turned into DualAnalog events
}; };
/** Allows the caller to figure out which overlay transform getter to call. */ /** Allows the caller to figure out which overlay transform getter to call. */
@ -2760,7 +3015,7 @@ namespace vr
virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0; virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0;
/** Gets render model to draw behind this overlay */ /** Gets render model to draw behind this overlay */
virtual uint32_t GetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, char *pchValue, uint32_t unBufferSize, HmdColor_t *pColor, vr::EVROverlayError *pError ) = 0; virtual uint32_t GetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, HmdColor_t *pColor, vr::EVROverlayError *pError ) = 0;
/** Sets render model to draw behind this overlay and the vertex color to use, pass null for pColor to match the overlays vertex color. /** Sets render model to draw behind this overlay and the vertex color to use, pass null for pColor to match the overlays vertex color.
The model is scaled by the same amount as the overlay, with a default of 1m. */ The model is scaled by the same amount as the overlay, with a default of 1m. */
@ -2786,7 +3041,7 @@ namespace vr
virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0; virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0;
/** Gets the transform information when the overlay is rendering on a component. */ /** Gets the transform information when the overlay is rendering on a component. */
virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, char *pchComponentName, uint32_t unComponentNameSize ) = 0; virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0;
/** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */ /** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */
virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0;
@ -2832,13 +3087,6 @@ namespace vr
* specified settings. Returns false if there is no intersection. */ * specified settings. Returns false if there is no intersection. */
virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0; virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0;
/** Processes mouse input from the specified controller as though it were a mouse pointed at a compositor overlay with the
* specified settings. The controller is treated like a laser pointer on the -z axis. The point where the laser pointer would
* intersect with the overlay is the mouse position, the trigger is left mouse, and the track pad is right mouse.
*
* Return true if the controller is pointed at the overlay and an event was generated. */
virtual bool HandleControllerOverlayInteractionAsMouse( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unControllerDeviceIndex ) = 0;
/** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" /** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over"
* by the virtual mouse pointer */ * by the virtual mouse pointer */
virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
@ -2858,6 +3106,12 @@ namespace vr
* neighbor in that direction */ * neighbor in that direction */
virtual EVROverlayError MoveGamepadFocusToNeighbor( EOverlayDirection eDirection, VROverlayHandle_t ulFrom ) = 0; virtual EVROverlayError MoveGamepadFocusToNeighbor( EOverlayDirection eDirection, VROverlayHandle_t ulFrom ) = 0;
/** Sets the analog input to Dual Analog coordinate scale for the specified overlay. */
virtual EVROverlayError SetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, const HmdVector2_t & vCenter, float fRadius ) = 0;
/** Gets the analog input to Dual Analog coordinate scale for the specified overlay. */
virtual EVROverlayError GetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, HmdVector2_t *pvCenter, float *pfRadius ) = 0;
// --------------------------------------------- // ---------------------------------------------
// Overlay texture methods // Overlay texture methods
// --------------------------------------------- // ---------------------------------------------
@ -2962,9 +3216,12 @@ namespace vr
/** Show the message overlay. This will block and return you a result. **/ /** Show the message overlay. This will block and return you a result. **/
virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0; virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0;
/** If the calling process owns the overlay and it's open, this will close it. **/
virtual void CloseMessageOverlay() = 0;
}; };
static const char * const IVROverlay_Version = "IVROverlay_016"; static const char * const IVROverlay_Version = "IVROverlay_018";
} // namespace vr } // namespace vr
@ -3384,7 +3641,7 @@ public:
/** Provides the full path to the specified resource. Resource names can include named directories for /** Provides the full path to the specified resource. Resource names can include named directories for
* drivers and other things, and this resolves all of those and returns the actual physical path. * drivers and other things, and this resolves all of those and returns the actual physical path.
* pchResourceTypeDirectory is the subdirectory of resources to look in. */ * pchResourceTypeDirectory is the subdirectory of resources to look in. */
virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, char *pchPathBuffer, uint32_t unBufferLen ) = 0; virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0;
}; };
static const char * const IVRResources_Version = "IVRResources_001"; static const char * const IVRResources_Version = "IVRResources_001";
@ -3402,6 +3659,8 @@ public:
/** Returns the length of the number of bytes necessary to hold this string including the trailing null. */ /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */
virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0;
}; };
static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; static const char * const IVRDriverManager_Version = "IVRDriverManager_001";
@ -3422,8 +3681,10 @@ namespace vr
* *
* This path is to the "root" of the VR API install. That's the directory with * This path is to the "root" of the VR API install. That's the directory with
* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. * the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself.
*
* pStartupInfo is reserved for future use.
*/ */
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType ); inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr );
/** unloads vrclient.dll. Any interface pointers from the interface are /** unloads vrclient.dll. Any interface pointers from the interface are
* invalid after this point */ * invalid after this point */
@ -3693,17 +3954,17 @@ namespace vr
m_pVRScreenshots = nullptr; m_pVRScreenshots = nullptr;
m_pVRDriverManager = nullptr; m_pVRDriverManager = nullptr;
} }
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType ); VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo );
VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal(); VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal();
/** Finds the active installation of vrclient.dll and initializes it */ /** Finds the active installation of vrclient.dll and initializes it */
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType ) inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo )
{ {
IVRSystem *pVRSystem = nullptr; IVRSystem *pVRSystem = nullptr;
EVRInitError eError; EVRInitError eError;
VRToken() = VR_InitInternal( &eError, eApplicationType ); VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo );
COpenVRContext &ctx = OpenVRInternal_ModuleContext(); COpenVRContext &ctx = OpenVRInternal_ModuleContext();
ctx.Clear(); ctx.Clear();

Просмотреть файл

@ -13,76 +13,80 @@ const char *GetEnglishStringForHmdError( vr::EVRInitError eError )
{ {
switch( eError ) switch( eError )
{ {
case VRInitError_None: return "No Error (0)"; case VRInitError_None: return "No Error (0)";
case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)"; case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)";
case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)"; case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)";
case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)"; case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)";
case VRInitError_Init_FileNotFound: return "File Not Found (103)"; case VRInitError_Init_FileNotFound: return "File Not Found (103)";
case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)"; case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)";
case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)"; case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)";
case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)"; case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)";
case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)"; case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)";
case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)"; case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)";
case VRInitError_Init_NotInitialized: return "Not Initialized (109)"; case VRInitError_Init_NotInitialized: return "Not Initialized (109)";
case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)"; case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)";
case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)"; case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)";
case VRInitError_Init_NoLogPath: return "Log path could not be located (112)"; case VRInitError_Init_NoLogPath: return "Log path could not be located (112)";
case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)"; case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)";
case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)"; case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)";
case VRInitError_Init_Retry: return "Internal Retry (115)"; case VRInitError_Init_Retry: return "Internal Retry (115)";
case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)"; case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)";
case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)"; case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)";
case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)"; case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)";
case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)"; case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)";
case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)"; case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)";
case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)"; case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)";
case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)"; case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)";
case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)"; case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)";
case VRInitError_Init_Internal: return "vrserver internal error (124)"; case VRInitError_Init_Internal: return "vrserver internal error (124)";
case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)"; case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)";
case VRInitError_Init_HmdNotFoundPresenceFailed: return "Hmd Not Found Presence Failed (126)"; case VRInitError_Init_HmdNotFoundPresenceFailed: return "Hmd Not Found Presence Failed (126)";
case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)"; case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)";
case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)"; case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)";
case VRInitError_Init_LowPowerWatchdogNotSupported: return "Low Power Watchdog Not Supported (129)"; case VRInitError_Init_LowPowerWatchdogNotSupported: return "Low Power Watchdog Not Supported (129)";
case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)"; case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)";
case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)"; case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)";
case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)"; case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)";
case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)"; case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)";
case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)"; case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)";
case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)"; case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)";
case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)"; case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)";
case VRInitError_Init_RebootingBusy: return "Rebooting In Progress (137)";
case VRInitError_Init_FirmwareUpdateBusy: return "Firmware Update In Progress (138)";
case VRInitError_Init_FirmwareRecoveryBusy: return "Firmware Recovery In Progress (139)";
case VRInitError_Init_USBServiceBusy: return "USB Service Busy (140)";
case VRInitError_Driver_Failed: return "Driver Failed (200)"; case VRInitError_Driver_Failed: return "Driver Failed (200)";
case VRInitError_Driver_Unknown: return "Driver Not Known (201)"; case VRInitError_Driver_Unknown: return "Driver Not Known (201)";
case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)"; case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)";
case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)"; case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)";
case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)"; case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)";
case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)"; case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)";
case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)"; case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)";
case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)"; case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)";
case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)"; case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)";
case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)"; case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)";
// case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208 // case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208
case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)"; case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)";
case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)"; case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)";
case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)"; case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)";
case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)"; case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)";
case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)"; case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)";
case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)"; case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)";
case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)"; case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)";
case VRInitError_IPC_Failed: return "Shared IPC Failed (305)"; case VRInitError_IPC_Failed: return "Shared IPC Failed (305)";
case VRInitError_IPC_CompositorConnectFailed: return "Shared IPC Compositor Connect Failed (306)"; case VRInitError_IPC_CompositorConnectFailed: return "Shared IPC Compositor Connect Failed (306)";
case VRInitError_IPC_CompositorInvalidConnectResponse: return "Shared IPC Compositor Invalid Connect Response (307)"; case VRInitError_IPC_CompositorInvalidConnectResponse: return "Shared IPC Compositor Invalid Connect Response (307)";
case VRInitError_IPC_ConnectFailedAfterMultipleAttempts: return "Shared IPC Connect Failed After Multiple Attempts (308)"; case VRInitError_IPC_ConnectFailedAfterMultipleAttempts: return "Shared IPC Connect Failed After Multiple Attempts (308)";
case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)"; case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)";
case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)"; case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)";
case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)"; case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)";
case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)"; case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)";
case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)"; case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)";
case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)"; case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)";
// Oculus // Oculus
case VRInitError_VendorSpecific_UnableToConnectToOculusRuntime: return "Unable to connect to Oculus Runtime (1000)"; case VRInitError_VendorSpecific_UnableToConnectToOculusRuntime: return "Unable to connect to Oculus Runtime (1000)";
@ -105,11 +109,7 @@ const char *GetEnglishStringForHmdError( vr::EVRInitError eError )
case VRInitError_Steam_SteamInstallationNotFound: return "Unable to find Steam installation (2000)"; case VRInitError_Steam_SteamInstallationNotFound: return "Unable to find Steam installation (2000)";
default: default:
{ return GetIDForVRInitError( eError );
static char buf[128];
sprintf( buf, "Unknown error (%d)", eError );
return buf;
}
} }
} }
@ -147,6 +147,8 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Init_NotSupportedWithCompositor ); RETURN_ENUM_AS_STRING( VRInitError_Init_NotSupportedWithCompositor );
RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToUtilityApps ); RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToUtilityApps );
RETURN_ENUM_AS_STRING( VRInitError_Init_Internal ); RETURN_ENUM_AS_STRING( VRInitError_Init_Internal );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorNotFound ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorNotFound );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorStartupFailed ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_LowPowerWatchdogNotSupported ); RETURN_ENUM_AS_STRING( VRInitError_Init_LowPowerWatchdogNotSupported );
@ -157,9 +159,11 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardStartupFailed ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeNotFound ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeNotFound );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeStartupFailed ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_RebootingBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone ); RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareUpdateBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed ); RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareRecoveryBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_USBServiceBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRWebHelperStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed );
RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown );
@ -192,8 +196,9 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Compositor_ScreenshotsInitFailed ); RETURN_ENUM_AS_STRING( VRInitError_Compositor_ScreenshotsInitFailed );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_UnableToCreateDevice ); RETURN_ENUM_AS_STRING( VRInitError_Compositor_UnableToCreateDevice );
// Oculus // Vendor-specific errors
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime); RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime);
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_WindowsNotInDevMode );
// Lighthouse // Lighthouse
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantOpenDevice); RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantOpenDevice);

Просмотреть файл

@ -7,6 +7,7 @@
#include "envvartools_public.h" #include "envvartools_public.h"
#include "hmderrors_public.h" #include "hmderrors_public.h"
#include "vrpathregistry_public.h" #include "vrpathregistry_public.h"
#include <mutex>
using vr::EVRInitError; using vr::EVRInitError;
using vr::IVRSystem; using vr::IVRSystem;
@ -18,6 +19,7 @@ namespace vr
static void *g_pVRModule = NULL; static void *g_pVRModule = NULL;
static IVRClientCore *g_pHmdSystem = NULL; static IVRClientCore *g_pHmdSystem = NULL;
static std::recursive_mutex g_mutexSystem;
typedef void* (*VRClientCoreFactoryFn)(const char *pInterfaceName, int *pReturnCode); typedef void* (*VRClientCoreFactoryFn)(const char *pInterfaceName, int *pReturnCode);
@ -33,50 +35,50 @@ EVRInitError VR_LoadHmdSystemInternal();
void CleanupInternalInterfaces(); void CleanupInternalInterfaces();
uint32_t VR_InitInternal( EVRInitError *peError, vr::EVRApplicationType eApplicationType ) uint32_t VR_InitInternal2( EVRInitError *peError, vr::EVRApplicationType eApplicationType, const char *pStartupInfo )
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
EVRInitError err = VR_LoadHmdSystemInternal(); EVRInitError err = VR_LoadHmdSystemInternal();
if (err != vr::VRInitError_None) if ( err == vr::VRInitError_None )
{ {
SharedLib_Unload(g_pVRModule); err = g_pHmdSystem->Init( eApplicationType );
}
if ( peError )
*peError = err;
if ( err != VRInitError_None )
{
SharedLib_Unload( g_pVRModule );
g_pHmdSystem = NULL; g_pHmdSystem = NULL;
g_pVRModule = NULL; g_pVRModule = NULL;
if (peError)
*peError = err;
return 0; return 0;
} }
err = g_pHmdSystem->Init(eApplicationType);
if (err != VRInitError_None)
{
SharedLib_Unload(g_pVRModule);
g_pHmdSystem = NULL;
g_pVRModule = NULL;
if (peError)
*peError = err;
return 0;
}
if (peError)
*peError = VRInitError_None;
return ++g_nVRToken; return ++g_nVRToken;
} }
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType );
uint32_t VR_InitInternal( EVRInitError *peError, vr::EVRApplicationType eApplicationType )
{
return VR_InitInternal2( peError, eApplicationType, nullptr );
}
void VR_ShutdownInternal() void VR_ShutdownInternal()
{ {
if (g_pHmdSystem) std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if ( g_pHmdSystem )
{ {
g_pHmdSystem->Cleanup(); g_pHmdSystem->Cleanup();
g_pHmdSystem = NULL; g_pHmdSystem = NULL;
} }
if (g_pVRModule) if ( g_pVRModule )
{ {
SharedLib_Unload(g_pVRModule); SharedLib_Unload( g_pVRModule );
g_pVRModule = NULL; g_pVRModule = NULL;
} }
@ -152,6 +154,8 @@ EVRInitError VR_LoadHmdSystemInternal()
void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peError) void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peError)
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if (!g_pHmdSystem) if (!g_pHmdSystem)
{ {
if (peError) if (peError)
@ -164,6 +168,8 @@ void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peEr
bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion) bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion)
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if (!g_pHmdSystem) if (!g_pHmdSystem)
{ {
return false; return false;
@ -174,6 +180,8 @@ bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion)
bool VR_IsHmdPresent() bool VR_IsHmdPresent()
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem ) if( g_pHmdSystem )
{ {
// if we're already initialized, just call through // if we're already initialized, just call through
@ -199,6 +207,8 @@ bool VR_IsHmdPresent()
/** Returns true if the OpenVR runtime is installed. */ /** Returns true if the OpenVR runtime is installed. */
bool VR_IsRuntimeInstalled() bool VR_IsRuntimeInstalled()
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem ) if( g_pHmdSystem )
{ {
// if we're already initialized, OpenVR is obviously installed // if we're already initialized, OpenVR is obviously installed
@ -255,6 +265,8 @@ const char *VR_RuntimePath()
/** Returns the symbol version of an HMD error. */ /** Returns the symbol version of an HMD error. */
const char *VR_GetVRInitErrorAsSymbol( EVRInitError error ) const char *VR_GetVRInitErrorAsSymbol( EVRInitError error )
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem ) if( g_pHmdSystem )
return g_pHmdSystem->GetIDForVRInitError( error ); return g_pHmdSystem->GetIDForVRInitError( error );
else else
@ -265,6 +277,8 @@ const char *VR_GetVRInitErrorAsSymbol( EVRInitError error )
/** Returns the english string version of an HMD error. */ /** Returns the english string version of an HMD error. */
const char *VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ) const char *VR_GetVRInitErrorAsEnglishDescription( EVRInitError error )
{ {
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if ( g_pHmdSystem ) if ( g_pHmdSystem )
return g_pHmdSystem->GetEnglishStringForHmdError( error ); return g_pHmdSystem->GetEnglishStringForHmdError( error );
else else

Просмотреть файл

@ -188,11 +188,8 @@ bool Path_IsAbsolute( const std::string & sPath )
/** Makes an absolute path from a relative path and a base path */ /** Makes an absolute path from a relative path and a base path */
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath, char slash ) std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath )
{ {
if( slash == 0 )
slash = Path_GetSlash();
if( Path_IsAbsolute( sRelativePath ) ) if( Path_IsAbsolute( sRelativePath ) )
return sRelativePath; return sRelativePath;
else else
@ -200,7 +197,7 @@ std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::str
if( !Path_IsAbsolute( sBasePath ) ) if( !Path_IsAbsolute( sBasePath ) )
return ""; return "";
std::string sCompacted = Path_Compact( Path_Join( sBasePath, sRelativePath, slash ), slash ); std::string sCompacted = Path_Compact( Path_Join( sBasePath, sRelativePath ) );
if( Path_IsAbsolute( sCompacted ) ) if( Path_IsAbsolute( sCompacted ) )
return sCompacted; return sCompacted;
else else
@ -464,10 +461,11 @@ bool Path_IsDirectory( const std::string & sPath )
bool Path_IsAppBundle( const std::string & sPath ) bool Path_IsAppBundle( const std::string & sPath )
{ {
#if defined(OSX) #if defined(OSX)
NSBundle *bundle = [ NSBundle bundleWithPath: [ NSString stringWithUTF8String:sPath.c_str() ] ]; @autoreleasepool {
bool bisAppBundle = ( nullptr != bundle ); NSBundle *bundle = [ NSBundle bundleWithPath: [ NSString stringWithUTF8String:sPath.c_str() ] ];
[ bundle release ]; bool bisAppBundle = ( nullptr != bundle );
return bisAppBundle; return bisAppBundle;
}
#else #else
return false; return false;
#endif #endif
@ -655,7 +653,7 @@ bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData,
fclose(f); fclose(f);
} }
return written = nSize ? true : false; return written == nSize ? true : false;
} }
std::string Path_ReadTextFile( const std::string &strFilename ) std::string Path_ReadTextFile( const std::string &strFilename )

Просмотреть файл

@ -35,7 +35,7 @@ std::string Path_GetExtension( const std::string & sPath );
bool Path_IsAbsolute( const std::string & sPath ); bool Path_IsAbsolute( const std::string & sPath );
/** Makes an absolute path from a relative path and a base path */ /** Makes an absolute path from a relative path and a base path */
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath, char slash = 0 ); std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath );
/** Fixes the directory separators for the current platform. /** Fixes the directory separators for the current platform.
* If slash is unspecified the native path separator of the current platform * If slash is unspecified the native path separator of the current platform

Просмотреть файл

@ -3,6 +3,8 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sstream>
#include <iostream>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
@ -142,8 +144,8 @@ std::wstring UTF8to16(const char * in)
void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource ) void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource )
{ {
pchBuffer[ unBufferSizeBytes - 1 ] = '\0';
strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 ); strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 );
pchBuffer[unBufferSizeBytes - 1] = '\0';
} }
@ -197,13 +199,6 @@ uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t
return unLen; return unLen;
} }
void BufferToStdString( std::string & sDest, const char *pchBuffer, uint32_t unBufferLen )
{
sDest.resize( unBufferLen + 1 );
memcpy( const_cast< char* >( sDest.c_str() ), pchBuffer, unBufferLen );
const_cast< char* >( sDest.c_str() )[ unBufferLen ] = '\0';
}
// Commented out by Mozilla, please see README.mozilla // Commented out by Mozilla, please see README.mozilla
/** Returns a std::string from a uint64_t */ /** Returns a std::string from a uint64_t */
/* /*
@ -437,3 +432,19 @@ void V_StripExtension( std::string &in )
} }
} }
//-----------------------------------------------------------------------------
// Purpose: Tokenizes a string into a vector of strings
//-----------------------------------------------------------------------------
std::vector<std::string> TokenizeString( const std::string & sString, char cToken )
{
std::vector<std::string> vecStrings;
std::istringstream stream( sString );
std::string s;
while ( std::getline( stream, s, cToken ) )
{
vecStrings.push_back( s );
}
return vecStrings;
}

Просмотреть файл

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.h>
#include <vector>
/** returns true if the string has the prefix */ /** returns true if the string has the prefix */
bool StringHasPrefix( const std::string & sString, const std::string & sPrefix ); bool StringHasPrefix( const std::string & sString, const std::string & sPrefix );
@ -64,6 +65,7 @@ inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *str
return strlcpy(strDest, strSource, numberOfElements); return strlcpy(strDest, strSource, numberOfElements);
} }
*/ */
#endif #endif
#if defined( LINUX ) #if defined( LINUX )
@ -92,9 +94,6 @@ inline uint64_t strtoull(const char *str, char **endptr, int base) { return _str
/* Handles copying a std::string into a buffer as would be provided in an API */ /* Handles copying a std::string into a buffer as would be provided in an API */
uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen ); uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen );
/* Handles copying a buffer into an std::string and auto adds null terminator */
void BufferToStdString( std::string & sDest, const char *pchBuffer, uint32_t unBufferLen );
/** Returns a std::string from a uint64_t */ /** Returns a std::string from a uint64_t */
// std::string Uint64ToString( uint64_t ulValue ); // std::string Uint64ToString( uint64_t ulValue );
// Commented out by Mozilla, please see README.mozilla // Commented out by Mozilla, please see README.mozilla
@ -127,3 +126,5 @@ size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEnco
void V_StripExtension( std::string &in ); void V_StripExtension( std::string &in );
/** Tokenizes a string into a vector of strings */
std::vector<std::string> TokenizeString( const std::string & sString, char cToken );

Просмотреть файл

@ -60,7 +60,7 @@ static std::string GetAppSettingsPath()
NSString *resolvedPath = [paths objectAtIndex:0]; NSString *resolvedPath = [paths objectAtIndex:0];
resolvedPath = [resolvedPath stringByAppendingPathComponent: @"OpenVR"]; resolvedPath = [resolvedPath stringByAppendingPathComponent: @"OpenVR"];
if ( ![[NSFileManager new] createDirectoryAtPath: resolvedPath withIntermediateDirectories:YES attributes:nil error:nil] ) if ( ![[NSFileManager defaultManager] createDirectoryAtPath: resolvedPath withIntermediateDirectories:YES attributes:nil error:nil] )
{ {
return ""; return "";
} }

Просмотреть файл

@ -43,14 +43,14 @@ impl Example for App {
let bounds = (0, 0).to(200, 200); let bounds = (0, 0).to(200, 200);
let filters = vec![ let filters = vec![
FilterOp::Opacity(PropertyBinding::Binding(self.opacity_key), self.opacity), FilterOp::Opacity(PropertyBinding::Binding(self.opacity_key, self.opacity), self.opacity),
]; ];
let info = LayoutPrimitiveInfo::new(bounds); let info = LayoutPrimitiveInfo::new(bounds);
builder.push_stacking_context( builder.push_stacking_context(
&info, &info,
None, None,
Some(PropertyBinding::Binding(self.property_key)), Some(PropertyBinding::Binding(self.property_key, LayoutTransform::identity())),
TransformStyle::Flat, TransformStyle::Flat,
None, None,
MixBlendMode::Normal, MixBlendMode::Normal,

Просмотреть файл

@ -65,7 +65,7 @@ impl Example for App {
builder.push_stacking_context( builder.push_stacking_context(
&info, &info,
None, None,
Some(PropertyBinding::Binding(PropertyBindingKey::new(42))), Some(PropertyBinding::Binding(PropertyBindingKey::new(42), LayoutTransform::identity())),
TransformStyle::Flat, TransformStyle::Flat,
None, None,
MixBlendMode::Normal, MixBlendMode::Normal,

Просмотреть файл

@ -20,8 +20,6 @@ uniform sampler2DArray sCacheRGBA8;
// An A8 target for standalone tasks that is available to all passes. // An A8 target for standalone tasks that is available to all passes.
uniform sampler2DArray sSharedCacheA8; uniform sampler2DArray sSharedCacheA8;
uniform sampler2D sGradients;
vec2 clamp_rect(vec2 pt, RectWithSize rect) { vec2 clamp_rect(vec2 pt, RectWithSize rect) {
return clamp(pt, rect.p0, rect.p0 + rect.size); return clamp(pt, rect.p0, rect.p0 + rect.size);
} }

Просмотреть файл

@ -21,7 +21,8 @@ use picture::{PictureCompositeMode, PicturePrimitive, PictureSurface};
use plane_split::{BspSplitter, Polygon, Splitter}; use plane_split::{BspSplitter, Polygon, Splitter};
use prim_store::{BrushKind, BrushPrimitive, BrushSegmentTaskId, CachedGradient, DeferredResolve}; use prim_store::{BrushKind, BrushPrimitive, BrushSegmentTaskId, CachedGradient, DeferredResolve};
use prim_store::{EdgeAaSegmentMask, ImageSource, PictureIndex, PrimitiveIndex, PrimitiveKind}; use prim_store::{EdgeAaSegmentMask, ImageSource, PictureIndex, PrimitiveIndex, PrimitiveKind};
use prim_store::{PrimitiveMetadata, PrimitiveRun, PrimitiveStore}; use prim_store::{PrimitiveMetadata, PrimitiveRun, PrimitiveStore, VisibleGradientTile};
use prim_store::CachedGradientIndex;
use render_task::{RenderTaskAddress, RenderTaskId, RenderTaskKind, RenderTaskTree}; use render_task::{RenderTaskAddress, RenderTaskId, RenderTaskKind, RenderTaskTree};
use renderer::{BlendMode, ImageBufferKind}; use renderer::{BlendMode, ImageBufferKind};
use renderer::{BLOCKS_PER_UV_RECT, ShaderColorMode}; use renderer::{BLOCKS_PER_UV_RECT, ShaderColorMode};
@ -615,6 +616,8 @@ impl AlphaBatchBuilder {
let brush = &ctx.prim_store.cpu_brushes[prim_metadata.cpu_prim_index.0]; let brush = &ctx.prim_store.cpu_brushes[prim_metadata.cpu_prim_index.0];
match brush.kind { match brush.kind {
BrushKind::Image { ref visible_tiles, .. } => !visible_tiles.is_empty(), BrushKind::Image { ref visible_tiles, .. } => !visible_tiles.is_empty(),
BrushKind::LinearGradient { ref visible_tiles, .. } => !visible_tiles.is_empty(),
BrushKind::RadialGradient { ref visible_tiles, .. } => !visible_tiles.is_empty(),
_ => false, _ => false,
} }
} }
@ -1018,6 +1021,40 @@ impl AlphaBatchBuilder {
} }
} }
} }
BrushKind::LinearGradient { gradient_index, ref visible_tiles, .. } if !visible_tiles.is_empty() => {
add_gradient_tiles(
visible_tiles,
gradient_index,
BrushBatchKind::LinearGradient,
specified_blend_mode,
&task_relative_bounding_rect,
clip_chain_rect_index,
scroll_id,
task_address,
clip_task_address,
z,
ctx,
gpu_cache,
&mut self.batch_list,
);
}
BrushKind::RadialGradient { gradient_index, ref visible_tiles, .. } if !visible_tiles.is_empty() => {
add_gradient_tiles(
visible_tiles,
gradient_index,
BrushBatchKind::RadialGradient,
specified_blend_mode,
&task_relative_bounding_rect,
clip_chain_rect_index,
scroll_id,
task_address,
clip_task_address,
z,
ctx,
gpu_cache,
&mut self.batch_list,
);
}
_ => { _ => {
if let Some((batch_kind, textures, user_data)) = brush.get_batch_params( if let Some((batch_kind, textures, user_data)) = brush.get_batch_params(
ctx.resource_cache, ctx.resource_cache,
@ -1348,6 +1385,57 @@ impl AlphaBatchBuilder {
} }
} }
fn add_gradient_tiles(
visible_tiles: &[VisibleGradientTile],
gradient_index: CachedGradientIndex,
kind: BrushBatchKind,
blend_mode: BlendMode,
task_relative_bounding_rect: &DeviceIntRect,
clip_chain_rect_index: ClipChainRectIndex,
scroll_id: ClipScrollNodeIndex,
task_address: RenderTaskAddress,
clip_task_address: RenderTaskAddress,
z: ZBufferId,
ctx: &RenderTargetContext,
gpu_cache: &GpuCache,
batch_list: &mut BatchList,
) {
batch_list.add_bounding_rect(task_relative_bounding_rect);
let batch = batch_list.get_suitable_batch(
BatchKey {
blend_mode: blend_mode,
kind: BatchKind::Brush(kind),
textures: BatchTextures::no_texture(),
},
task_relative_bounding_rect
);
let stops_handle = &ctx.cached_gradients[gradient_index.0].handle;
let user_data = [stops_handle.as_int(gpu_cache), 0, 0];
let base_instance = BrushInstance {
picture_address: task_address,
prim_address: GpuCacheAddress::invalid(),
clip_chain_rect_index,
scroll_id,
clip_task_address,
z,
segment_index: 0,
edge_flags: EdgeAaSegmentMask::all(),
brush_flags: BrushFlags::PERSPECTIVE_INTERPOLATION,
user_data,
};
for tile in visible_tiles {
batch.push(PrimitiveInstance::from(
BrushInstance {
prim_address: gpu_cache.get_address(&tile.handle),
..base_instance
}
));
}
}
fn get_image_tile_params( fn get_image_tile_params(
resource_cache: &ResourceCache, resource_cache: &ResourceCache,
gpu_cache: &mut GpuCache, gpu_cache: &mut GpuCache,

Просмотреть файл

@ -1800,7 +1800,7 @@ impl<'a> DisplayListFlattener<'a> {
} }
} }
fn add_gradient_impl( pub fn add_gradient(
&mut self, &mut self,
clip_and_scroll: ScrollNodeAndClipChain, clip_and_scroll: ScrollNodeAndClipChain,
info: &LayoutPrimitiveInfo, info: &LayoutPrimitiveInfo,
@ -1809,9 +1809,19 @@ impl<'a> DisplayListFlattener<'a> {
stops: ItemRange<GradientStop>, stops: ItemRange<GradientStop>,
stops_count: usize, stops_count: usize,
extend_mode: ExtendMode, extend_mode: ExtendMode,
gradient_index: CachedGradientIndex,
stretch_size: LayoutSize, stretch_size: LayoutSize,
mut tile_spacing: LayoutSize,
) { ) {
let gradient_index = CachedGradientIndex(self.cached_gradients.len());
self.cached_gradients.push(CachedGradient::new());
let mut prim_rect = info.rect;
simplify_repeated_primitive(&stretch_size, &mut tile_spacing, &mut prim_rect);
let info = LayoutPrimitiveInfo {
rect: prim_rect,
.. *info
};
// Try to ensure that if the gradient is specified in reverse, then so long as the stops // Try to ensure that if the gradient is specified in reverse, then so long as the stops
// are also supplied in reverse that the rendered result will be equivalent. To do this, // are also supplied in reverse that the rendered result will be equivalent. To do this,
// a reference orientation for the gradient line must be chosen, somewhat arbitrarily, so // a reference orientation for the gradient line must be chosen, somewhat arbitrarily, so
@ -1840,109 +1850,15 @@ impl<'a> DisplayListFlattener<'a> {
end_point: ep, end_point: ep,
gradient_index, gradient_index,
stretch_size, stretch_size,
tile_spacing,
visible_tiles: Vec::new(),
}, },
None, None,
); );
let prim = PrimitiveContainer::Brush(prim); let prim = PrimitiveContainer::Brush(prim);
self.add_primitive(clip_and_scroll, info, Vec::new(), prim); self.add_primitive(clip_and_scroll, &info, Vec::new(), prim);
}
pub fn add_gradient(
&mut self,
clip_and_scroll: ScrollNodeAndClipChain,
info: &LayoutPrimitiveInfo,
start_point: LayoutPoint,
end_point: LayoutPoint,
stops: ItemRange<GradientStop>,
stops_count: usize,
extend_mode: ExtendMode,
stretch_size: LayoutSize,
mut tile_spacing: LayoutSize,
) {
let gradient_index = CachedGradientIndex(self.cached_gradients.len());
self.cached_gradients.push(CachedGradient::new());
let mut prim_rect = info.rect;
simplify_repeated_primitive(&stretch_size, &mut tile_spacing, &mut prim_rect);
let info = LayoutPrimitiveInfo {
rect: prim_rect,
.. *info
};
if tile_spacing != LayoutSize::zero() {
let prim_infos = info.decompose(
stretch_size,
tile_spacing,
64 * 64,
);
if !prim_infos.is_empty() {
for prim_info in prim_infos {
self.add_gradient_impl(
clip_and_scroll,
&prim_info,
start_point,
end_point,
stops,
stops_count,
extend_mode,
gradient_index,
prim_info.rect.size,
);
}
return;
}
}
self.add_gradient_impl(
clip_and_scroll,
&info,
start_point,
end_point,
stops,
stops_count,
extend_mode,
gradient_index,
stretch_size,
);
}
fn add_radial_gradient_impl(
&mut self,
clip_and_scroll: ScrollNodeAndClipChain,
info: &LayoutPrimitiveInfo,
center: LayoutPoint,
start_radius: f32,
end_radius: f32,
ratio_xy: f32,
stops: ItemRange<GradientStop>,
extend_mode: ExtendMode,
gradient_index: CachedGradientIndex,
stretch_size: LayoutSize,
) {
let prim = BrushPrimitive::new(
BrushKind::RadialGradient {
stops_range: stops,
extend_mode,
center,
start_radius,
end_radius,
ratio_xy,
gradient_index,
stretch_size,
},
None,
);
self.add_primitive(
clip_and_scroll,
info,
Vec::new(),
PrimitiveContainer::Brush(prim),
);
} }
pub fn add_radial_gradient( pub fn add_radial_gradient(
@ -1968,44 +1884,27 @@ impl<'a> DisplayListFlattener<'a> {
.. *info .. *info
}; };
if tile_spacing != LayoutSize::zero() { let prim = BrushPrimitive::new(
let prim_infos = info.decompose( BrushKind::RadialGradient {
stops_range: stops,
extend_mode,
center,
start_radius,
end_radius,
ratio_xy,
gradient_index,
stretch_size, stretch_size,
tile_spacing, tile_spacing,
64 * 64, visible_tiles: Vec::new(),
); },
None,
);
if !prim_infos.is_empty() { self.add_primitive(
for prim_info in prim_infos {
self.add_radial_gradient_impl(
clip_and_scroll,
&prim_info,
center,
start_radius,
end_radius,
ratio_xy,
stops,
extend_mode,
gradient_index,
stretch_size,
);
}
return;
}
}
self.add_radial_gradient_impl(
clip_and_scroll, clip_and_scroll,
&info, &info,
center, Vec::new(),
start_radius, PrimitiveContainer::Brush(prim),
end_radius,
ratio_xy,
stops,
extend_mode,
gradient_index,
stretch_size,
); );
} }
@ -2208,72 +2107,6 @@ pub fn build_scene(config: &FrameBuilderConfig, request: SceneRequest) -> BuiltS
} }
} }
trait PrimitiveInfoTiler {
fn decompose(
&self,
tile_size: LayoutSize,
tile_spacing: LayoutSize,
max_prims: usize,
) -> Vec<LayoutPrimitiveInfo>;
}
impl PrimitiveInfoTiler for LayoutPrimitiveInfo {
fn decompose(
&self,
tile_size: LayoutSize,
tile_spacing: LayoutSize,
max_prims: usize,
) -> Vec<LayoutPrimitiveInfo> {
let mut prims = Vec::new();
let tile_repeat = tile_size + tile_spacing;
if tile_repeat.width <= 0.0 ||
tile_repeat.height <= 0.0 {
return prims;
}
if tile_repeat.width < self.rect.size.width ||
tile_repeat.height < self.rect.size.height {
let clip_rect = self.clip_rect
.intersection(&self.rect)
.unwrap_or_else(LayoutRect::zero);
let rect_p0 = self.rect.origin;
let rect_p1 = self.rect.bottom_right();
let mut y0 = rect_p0.y;
while y0 < rect_p1.y {
let mut x0 = rect_p0.x;
while x0 < rect_p1.x {
prims.push(LayoutPrimitiveInfo {
rect: LayoutRect::new(
LayoutPoint::new(x0, y0),
tile_size,
),
clip_rect,
is_backface_visible: self.is_backface_visible,
tag: self.tag,
});
// Mostly a safety against a crazy number of primitives
// being generated. If we exceed that amount, just bail
// out and only draw the maximum amount.
if prims.len() > max_prims {
warn!("too many prims found due to repeat/tile. dropping extra prims!");
return prims;
}
x0 += tile_repeat.width;
}
y0 += tile_repeat.height;
}
}
prims
}
}
/// Properties of a stacking context that are maintained /// Properties of a stacking context that are maintained
/// during creation of the scene. These structures are /// during creation of the scene. These structures are
/// not persisted after the initial scene build. /// not persisted after the initial scene build.

Просмотреть файл

@ -163,7 +163,7 @@ impl PicturePrimitive {
Some(PictureCompositeMode::Filter(ref mut filter)) => { Some(PictureCompositeMode::Filter(ref mut filter)) => {
match *filter { match *filter {
FilterOp::Opacity(ref binding, ref mut value) => { FilterOp::Opacity(ref binding, ref mut value) => {
*value = properties.resolve_float(binding, *value); *value = properties.resolve_float(binding);
} }
_ => {} _ => {}
} }

Просмотреть файл

@ -231,7 +231,7 @@ impl OpacityBinding {
let mut new_opacity = 1.0; let mut new_opacity = 1.0;
for binding in &self.bindings { for binding in &self.bindings {
let opacity = scene_properties.resolve_float(binding, 1.0); let opacity = scene_properties.resolve_float(binding);
new_opacity = new_opacity * opacity; new_opacity = new_opacity * opacity;
} }
@ -249,6 +249,11 @@ pub struct VisibleImageTile {
pub edge_flags: EdgeAaSegmentMask, pub edge_flags: EdgeAaSegmentMask,
} }
#[derive(Debug)]
pub struct VisibleGradientTile {
pub handle: GpuCacheHandle,
}
#[derive(Debug)] #[derive(Debug)]
pub enum BrushKind { pub enum BrushKind {
Solid { Solid {
@ -285,6 +290,8 @@ pub enum BrushKind {
end_radius: f32, end_radius: f32,
ratio_xy: f32, ratio_xy: f32,
stretch_size: LayoutSize, stretch_size: LayoutSize,
tile_spacing: LayoutSize,
visible_tiles: Vec<VisibleGradientTile>,
}, },
LinearGradient { LinearGradient {
gradient_index: CachedGradientIndex, gradient_index: CachedGradientIndex,
@ -295,6 +302,8 @@ pub enum BrushKind {
start_point: LayoutPoint, start_point: LayoutPoint,
end_point: LayoutPoint, end_point: LayoutPoint,
stretch_size: LayoutSize, stretch_size: LayoutSize,
tile_spacing: LayoutSize,
visible_tiles: Vec<VisibleGradientTile>,
}, },
Border { Border {
request: ImageRequest, request: ImageRequest,
@ -1423,7 +1432,7 @@ impl PrimitiveStore {
frame_context: &FrameBuildingContext, frame_context: &FrameBuildingContext,
frame_state: &mut FrameBuildingState, frame_state: &mut FrameBuildingState,
) { ) {
let mut is_tiled_image = false; let mut is_tiled = false;
let metadata = &mut self.cpu_metadata[prim_index.0]; let metadata = &mut self.cpu_metadata[prim_index.0];
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
{ {
@ -1467,7 +1476,7 @@ impl PrimitiveStore {
// Set if we need to request the source image from the cache this frame. // Set if we need to request the source image from the cache this frame.
if let Some(image_properties) = image_properties { if let Some(image_properties) = image_properties {
*current_epoch = image_properties.epoch; *current_epoch = image_properties.epoch;
is_tiled_image = image_properties.tiling.is_some(); is_tiled = image_properties.tiling.is_some();
// If the opacity changed, invalidate the GPU cache so that // If the opacity changed, invalidate the GPU cache so that
// the new color for this primitive gets uploaded. // the new color for this primitive gets uploaded.
@ -1481,7 +1490,7 @@ impl PrimitiveStore {
image_properties.descriptor.is_opaque && image_properties.descriptor.is_opaque &&
opacity_binding.current == 1.0; opacity_binding.current == 1.0;
if *tile_spacing != LayoutSize::zero() && !is_tiled_image { if *tile_spacing != LayoutSize::zero() && !is_tiled {
*source = ImageSource::Cache { *source = ImageSource::Cache {
// Size in device-pixels we need to allocate in render task cache. // Size in device-pixels we need to allocate in render task cache.
size: DeviceIntSize::new( size: DeviceIntSize::new(
@ -1496,7 +1505,7 @@ impl PrimitiveStore {
// we need to pre-render it to the render task cache. // we need to pre-render it to the render task cache.
if let Some(rect) = sub_rect { if let Some(rect) = sub_rect {
// We don't properly support this right now. // We don't properly support this right now.
debug_assert!(!is_tiled_image); debug_assert!(!is_tiled);
*source = ImageSource::Cache { *source = ImageSource::Cache {
// Size in device-pixels we need to allocate in render task cache. // Size in device-pixels we need to allocate in render task cache.
size: rect.size, size: rect.size,
@ -1698,29 +1707,107 @@ impl PrimitiveStore {
); );
} }
} }
BrushKind::RadialGradient { gradient_index, stops_range, .. } => { BrushKind::RadialGradient {
let stops_handle = &mut frame_state.cached_gradients[gradient_index.0].handle; gradient_index,
if let Some(mut request) = frame_state.gpu_cache.request(stops_handle) { stops_range,
let gradient_builder = GradientGpuBlockBuilder::new( center,
stops_range, start_radius,
pic_context.display_list, end_radius,
); ratio_xy,
gradient_builder.build( extend_mode,
false, stretch_size,
&mut request, tile_spacing,
ref mut visible_tiles,
..
} => {
build_gradient_stops_request(
gradient_index,
stops_range,
false,
frame_state,
pic_context,
);
if tile_spacing != LayoutSize::zero() {
is_tiled = true;
decompose_repeated_primitive(
visible_tiles,
metadata,
&stretch_size,
&tile_spacing,
prim_run_context,
frame_context,
frame_state,
&mut |rect, clip_rect, mut request| {
request.push(*rect);
request.push(*clip_rect);
request.push([
center.x,
center.y,
start_radius,
end_radius,
]);
request.push([
ratio_xy,
pack_as_float(extend_mode as u32),
stretch_size.width,
stretch_size.height,
]);
request.write_segment(*rect, [0.0; 4]);
},
); );
} }
} }
BrushKind::LinearGradient { gradient_index, stops_range, reverse_stops, .. } => { BrushKind::LinearGradient {
let stops_handle = &mut frame_state.cached_gradients[gradient_index.0].handle; gradient_index,
if let Some(mut request) = frame_state.gpu_cache.request(stops_handle) { stops_range,
let gradient_builder = GradientGpuBlockBuilder::new( reverse_stops,
stops_range, start_point,
pic_context.display_list, end_point,
); extend_mode,
gradient_builder.build( stretch_size,
reverse_stops, tile_spacing,
&mut request, ref mut visible_tiles,
..
} => {
build_gradient_stops_request(
gradient_index,
stops_range,
reverse_stops,
frame_state,
pic_context,
);
if tile_spacing != LayoutSize::zero() {
is_tiled = true;
decompose_repeated_primitive(
visible_tiles,
metadata,
&stretch_size,
&tile_spacing,
prim_run_context,
frame_context,
frame_state,
&mut |rect, clip_rect, mut request| {
request.push(*rect);
request.push(*clip_rect);
request.push([
start_point.x,
start_point.y,
end_point.x,
end_point.y,
]);
request.push([
pack_as_float(extend_mode as u32),
stretch_size.width,
stretch_size.height,
0.0,
]);
request.write_segment(*rect, [0.0; 4]);
}
); );
} }
} }
@ -1751,7 +1838,7 @@ impl PrimitiveStore {
} }
} }
if is_tiled_image { if is_tiled {
// we already requested each tile's gpu data. // we already requested each tile's gpu data.
return; return;
} }
@ -2480,6 +2567,80 @@ impl PrimitiveStore {
} }
} }
fn build_gradient_stops_request(
gradient_index: CachedGradientIndex,
stops_range: ItemRange<GradientStop>,
reverse_stops: bool,
frame_state: &mut FrameBuildingState,
pic_context: &PictureContext
) {
let stops_handle = &mut frame_state.cached_gradients[gradient_index.0].handle;
if let Some(mut request) = frame_state.gpu_cache.request(stops_handle) {
let gradient_builder = GradientGpuBlockBuilder::new(
stops_range,
pic_context.display_list,
);
gradient_builder.build(
reverse_stops,
&mut request,
);
}
}
fn decompose_repeated_primitive(
visible_tiles: &mut Vec<VisibleGradientTile>,
metadata: &mut PrimitiveMetadata,
stretch_size: &LayoutSize,
tile_spacing: &LayoutSize,
prim_run_context: &PrimitiveRunContext,
frame_context: &FrameBuildingContext,
frame_state: &mut FrameBuildingState,
callback: &mut FnMut(&LayoutRect, &LayoutRect, GpuDataRequest),
) {
visible_tiles.clear();
// Tighten the clip rect because decomposing the repeated image can
// produce primitives that are partially covering the original image
// rect and we want to clip these extra parts out.
let tight_clip_rect = metadata.local_clip_rect.intersection(&metadata.local_rect).unwrap();
let visible_rect = compute_conservative_visible_rect(
prim_run_context,
frame_context,
&tight_clip_rect
);
let stride = *stretch_size + *tile_spacing;
for_each_repetition(
&metadata.local_rect,
&visible_rect,
&stride,
&mut |origin, _| {
let mut handle = GpuCacheHandle::new();
if let Some(request) = frame_state.gpu_cache.request(&mut handle) {
let rect = LayoutRect {
origin: *origin,
size: *stretch_size,
};
callback(&rect, &tight_clip_rect, request);
}
visible_tiles.push(VisibleGradientTile { handle });
}
);
if visible_tiles.is_empty() {
// At this point if we don't have tiles to show it means we could probably
// have done a better a job at culling during an earlier stage.
// Clearing the screen rect has the effect of "culling out" the primitive
// from the point of view of the batch builder, and ensures we don't hit
// assertions later on because we didn't request any image.
metadata.screen_rect = None;
}
}
fn compute_conservative_visible_rect( fn compute_conservative_visible_rect(
prim_run_context: &PrimitiveRunContext, prim_run_context: &PrimitiveRunContext,
frame_context: &FrameBuildingContext, frame_context: &FrameBuildingContext,

Просмотреть файл

@ -54,15 +54,11 @@ impl SceneProperties {
) -> LayoutTransform { ) -> LayoutTransform {
match *property { match *property {
PropertyBinding::Value(value) => value, PropertyBinding::Value(value) => value,
PropertyBinding::Binding(ref key) => { PropertyBinding::Binding(ref key, v) => {
self.transform_properties self.transform_properties
.get(&key.id) .get(&key.id)
.cloned() .cloned()
.unwrap_or_else(|| { .unwrap_or(v)
warn!("Property binding has an invalid value.");
debug!("key={:?}", key);
LayoutTransform::identity()
})
} }
} }
} }
@ -70,20 +66,15 @@ impl SceneProperties {
/// Get the current value for a float property. /// Get the current value for a float property.
pub fn resolve_float( pub fn resolve_float(
&self, &self,
property: &PropertyBinding<f32>, property: &PropertyBinding<f32>
default_value: f32
) -> f32 { ) -> f32 {
match *property { match *property {
PropertyBinding::Value(value) => value, PropertyBinding::Value(value) => value,
PropertyBinding::Binding(ref key) => { PropertyBinding::Binding(ref key, v) => {
self.float_properties self.float_properties
.get(&key.id) .get(&key.id)
.cloned() .cloned()
.unwrap_or_else(|| { .unwrap_or(v)
warn!("Property binding has an invalid value.");
debug!("key={:?}", key);
default_value
})
} }
} }
} }

Просмотреть файл

@ -1078,10 +1078,13 @@ impl<T> PropertyBindingKey<T> {
/// A binding property can either be a specific value /// A binding property can either be a specific value
/// (the normal, non-animated case) or point to a binding location /// (the normal, non-animated case) or point to a binding location
/// to fetch the current value from. /// to fetch the current value from.
/// Note that Binding has also a non-animated value, the value is
/// used for the case where the animation is still in-delay phase
/// (i.e. the animation doesn't produce any animation values).
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum PropertyBinding<T> { pub enum PropertyBinding<T> {
Value(T), Value(T),
Binding(PropertyBindingKey<T>), Binding(PropertyBindingKey<T>, T),
} }
impl<T> From<T> for PropertyBinding<T> { impl<T> From<T> for PropertyBinding<T> {
@ -1090,12 +1093,6 @@ impl<T> From<T> for PropertyBinding<T> {
} }
} }
impl<T> From<PropertyBindingKey<T>> for PropertyBinding<T> {
fn from(key: PropertyBindingKey<T>) -> PropertyBinding<T> {
PropertyBinding::Binding(key)
}
}
/// The current value of an animated property. This is /// The current value of an animated property. This is
/// supplied by the calling code. /// supplied by the calling code.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, Serialize)]

Просмотреть файл

@ -1 +1 @@
4811a6e7c06f9dd1b4056e5f5e66983842983ba0 9d20df4e76e3b19c569fd89965f70a2c278ff0c8

Просмотреть файл

@ -1637,8 +1637,8 @@ pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
if let Some(anim) = anim { if let Some(anim) = anim {
debug_assert!(anim.id > 0); debug_assert!(anim.id > 0);
match anim.effect_type { match anim.effect_type {
WrAnimationType::Opacity => filters.push(FilterOp::Opacity(PropertyBinding::Binding(PropertyBindingKey::new(anim.id)), 1.0)), WrAnimationType::Opacity => filters.push(FilterOp::Opacity(PropertyBinding::Binding(PropertyBindingKey::new(anim.id), 1.0), 1.0)),
WrAnimationType::Transform => transform_binding = Some(PropertyBinding::Binding(PropertyBindingKey::new(anim.id))), WrAnimationType::Transform => transform_binding = Some(PropertyBinding::Binding(PropertyBindingKey::new(anim.id), LayoutTransform::identity())),
} }
} }

Просмотреть файл

@ -25,6 +25,12 @@ fn deserialize_blob(blob: &[u8]) -> Result<ColorU, ()> {
}; };
} }
// perform floor((x * a) / 255. + 0.5) see "Three wrongs make a right" for deriviation
fn premul(x: u8, a: u8) -> u8 {
let t = (x as u32) * (a as u32) + 128;
((t + (t >> 8)) >> 8) as u8
}
// This is the function that applies the deserialized drawing commands and generates // This is the function that applies the deserialized drawing commands and generates
// actual image data. // actual image data.
fn render_blob( fn render_blob(
@ -73,10 +79,11 @@ fn render_blob(
match descriptor.format { match descriptor.format {
ImageFormat::BGRA8 => { ImageFormat::BGRA8 => {
texels[((y * descriptor.width + x) * 4 + 0) as usize] = color.b * checker + tc; let a = color.a * checker + tc;
texels[((y * descriptor.width + x) * 4 + 1) as usize] = color.g * checker + tc; texels[((y * descriptor.width + x) * 4 + 0) as usize] = premul(color.b * checker + tc, a);
texels[((y * descriptor.width + x) * 4 + 2) as usize] = color.r * checker + tc; texels[((y * descriptor.width + x) * 4 + 1) as usize] = premul(color.g * checker + tc, a);
texels[((y * descriptor.width + x) * 4 + 3) as usize] = color.a * checker + tc; texels[((y * descriptor.width + x) * 4 + 2) as usize] = premul(color.r * checker + tc, a);
texels[((y * descriptor.width + x) * 4 + 3) as usize] = a;
} }
ImageFormat::R8 => { ImageFormat::R8 => {
texels[(y * descriptor.width + x) as usize] = color.a * checker + tc; texels[(y * descriptor.width + x) as usize] = color.a * checker + tc;

Просмотреть файл

@ -45,27 +45,21 @@ impl SceneProperties {
match property { match property {
PropertyBinding::Value(matrix) => matrix, PropertyBinding::Value(matrix) => matrix,
PropertyBinding::Binding(ref key) => self.transform_properties PropertyBinding::Binding(ref key, v) => self.transform_properties
.get(&key.id) .get(&key.id)
.cloned() .cloned()
.unwrap_or_else(|| { .unwrap_or(v),
println!("Property binding {:?} has an invalid value.", key);
LayoutTransform::identity()
}),
} }
} }
/// Get the current value for a float property. /// Get the current value for a float property.
pub fn resolve_float(&self, property: &PropertyBinding<f32>, default_value: f32) -> f32 { pub fn resolve_float(&self, property: &PropertyBinding<f32>) -> f32 {
match *property { match *property {
PropertyBinding::Value(value) => value, PropertyBinding::Value(value) => value,
PropertyBinding::Binding(ref key) => self.float_properties PropertyBinding::Binding(ref key, v) => self.float_properties
.get(&key.id) .get(&key.id)
.cloned() .cloned()
.unwrap_or_else(|| { .unwrap_or(v),
println!("Property binding {:?} has an invalid value.", key);
default_value
}),
} }
} }
} }

Просмотреть файл

@ -223,7 +223,7 @@ fn write_stacking_context(
FilterOp::Invert(x) => { filters.push(Yaml::String(format!("invert({})", x))) } FilterOp::Invert(x) => { filters.push(Yaml::String(format!("invert({})", x))) }
FilterOp::Opacity(x, _) => { FilterOp::Opacity(x, _) => {
filters.push(Yaml::String(format!("opacity({})", filters.push(Yaml::String(format!("opacity({})",
properties.resolve_float(&x, 1.0)))) properties.resolve_float(&x))))
} }
FilterOp::Saturate(x) => { filters.push(Yaml::String(format!("saturate({})", x))) } FilterOp::Saturate(x) => { filters.push(Yaml::String(format!("saturate({})", x))) }
FilterOp::Sepia(x) => { filters.push(Yaml::String(format!("sepia({})", x))) } FilterOp::Sepia(x) => { filters.push(Yaml::String(format!("sepia({})", x))) }

Просмотреть файл

@ -17,11 +17,12 @@ XPCOMUtils.defineLazyGetter(this, "WindowEventDispatcher",
/** /**
* ModuleManager creates and manages GeckoView modules. Each GeckoView module * ModuleManager creates and manages GeckoView modules. Each GeckoView module
* normally consists of a JSM file with an optional frame script file. The JSM * normally consists of a JSM module file with an optional content module file.
* file contains a class that extends GeckoViewModule. A module usually pairs * The module file contains a class that extends GeckoViewModule, and the
* with a particular GeckoSessionHandler or delegate on the Java side, and * content module file contains a class that extends GeckoViewContentModule. A
* automatically receives module lifetime events such as initialization, change * module usually pairs with a particular GeckoSessionHandler or delegate on the
* in enabled state, and change in settings. * Java side, and automatically receives module lifetime events such as
* initialization, change in enabled state, and change in settings.
*/ */
var ModuleManager = { var ModuleManager = {
get _initData() { get _initData() {
@ -48,11 +49,20 @@ var ModuleManager = {
} }
})()); })());
window.document.documentElement.appendChild(aBrowser);
WindowEventDispatcher.registerListener(this, [ WindowEventDispatcher.registerListener(this, [
"GeckoView:UpdateModuleState", "GeckoView:UpdateModuleState",
"GeckoView:UpdateInitData", "GeckoView:UpdateInitData",
"GeckoView:UpdateSettings", "GeckoView:UpdateSettings",
]); ]);
this.messageManager.addMessageListener("GeckoView:ContentModuleLoaded",
this);
this.forEach(module => {
module.onInit();
});
}, },
get window() { get window() {
@ -84,7 +94,7 @@ var ModuleManager = {
this._frozenSettings = Object.freeze(Object.assign({}, this._settings)); this._frozenSettings = Object.freeze(Object.assign({}, this._settings));
this.forEach(module => { this.forEach(module => {
if (module.enabled) { if (module.enabled && module.impl) {
module.impl.onSettingsUpdate(); module.impl.onSettingsUpdate();
} }
}); });
@ -94,6 +104,7 @@ var ModuleManager = {
}, },
onEvent(aEvent, aData, aCallback) { onEvent(aEvent, aData, aCallback) {
debug `onEvent ${aEvent} ${aData}`;
switch (aEvent) { switch (aEvent) {
case "GeckoView:UpdateModuleState": { case "GeckoView:UpdateModuleState": {
const module = this._modules.get(aData.module); const module = this._modules.get(aData.module);
@ -124,6 +135,19 @@ var ModuleManager = {
} }
} }
}, },
receiveMessage(aMsg) {
debug `receiveMessage ${aMsg.name} ${aMsg.data}`;
switch (aMsg.name) {
case "GeckoView:ContentModuleLoaded": {
const module = this._modules.get(aMsg.data.module);
if (module) {
module.onContentModuleLoaded();
}
break;
}
}
},
}; };
/** /**
@ -133,26 +157,76 @@ var ModuleManager = {
* object that extends GeckoViewModule. * object that extends GeckoViewModule.
*/ */
class ModuleInfo { class ModuleInfo {
constructor({enabled, manager, name, resource}) { /**
* Create a ModuleInfo instance. See _loadPhase for phase object description.
*
* @param manager the ModuleManager instance.
* @param name Name of the module.
* @param enabled Enabled state of the module at startup.
* @param onInit Phase object for the init phase, when the window is created.
* @param onEnable Phase object for the enable phase, when the module is first
* enabled by setting a delegate in Java.
*/
constructor({manager, name, enabled, onInit, onEnable}) {
this._manager = manager; this._manager = manager;
this._name = name; this._name = name;
const scope = {}; this._impl = null;
const global = ChromeUtils.import(resource, scope); this._contentModuleLoaded = false;
const tag = name.replace("GeckoView", "GeckoView.");
GeckoViewUtils.initLogging(tag, global);
this._impl = new scope[name](this);
this._enabled = false; this._enabled = false;
// Only enable once we performed initialization. // Only enable once we performed initialization.
this._enabledOnInit = enabled; this._enabledOnInit = enabled;
// For init, load resource _before_ initializing browser to support the
// onInitBrowser() override. However, load content module after initializing
// browser, because we don't have a message manager before then.
this._loadPhase({
resource: onInit && onInit.resource,
});
this._onInitPhase = {
frameScript: onInit && onInit.frameScript,
};
this._onEnablePhase = onEnable;
} }
onInit() { onInit() {
this._impl.onInit(); if (this._impl) {
this._impl.onInit();
}
this._loadPhase(this._onInitPhase);
this._onInitPhase = null;
this.enabled = this._enabledOnInit; this.enabled = this._enabledOnInit;
} }
/**
* Load resources according to a phase object that contains possible keys,
*
* "resource": specify the JSM resource to load for this module.
* "frameScript": specify a content JS frame script to load for this module.
*/
_loadPhase(aPhase) {
if (!aPhase) {
return;
}
if (aPhase.resource && !this._impl) {
const scope = {};
const global = ChromeUtils.import(aPhase.resource, scope);
const tag = this._name.replace("GeckoView", "GeckoView.");
GeckoViewUtils.initLogging(tag, global);
this._impl = new scope[this._name](this);
}
if (aPhase.frameScript && !this._contentModuleLoaded) {
if (this._impl) {
this._impl.onLoadContentModule();
}
this._manager.messageManager.loadFrameScript(aPhase.frameScript, true);
this._contentModuleLoaded = true;
}
}
get manager() { get manager() {
return this._manager; return this._manager;
} }
@ -174,21 +248,37 @@ class ModuleInfo {
return; return;
} }
if (!aEnabled) { if (!aEnabled && this._impl) {
this._impl.onDisable(); this._impl.onDisable();
} }
this._enabled = aEnabled; this._enabled = aEnabled;
if (aEnabled) { if (aEnabled) {
this._impl.onEnable(); this._loadPhase(this._onEnablePhase);
this._impl.onSettingsUpdate(); this._onEnablePhase = null;
if (this._impl) {
this._impl.onEnable();
this._impl.onSettingsUpdate();
}
} }
this._updateContentModuleState(/* includeSettings */ aEnabled);
}
onContentModuleLoaded() {
this._updateContentModuleState(/* includeSettings */ true);
if (this._impl) {
this._impl.onContentModuleLoaded();
}
}
_updateContentModuleState(aIncludeSettings) {
this._manager.messageManager.sendAsyncMessage("GeckoView:UpdateModuleState", { this._manager.messageManager.sendAsyncMessage("GeckoView:UpdateModuleState", {
module: this._name, module: this._name,
enabled: aEnabled, enabled: this.enabled,
settings: aEnabled ? this._manager.settings : null, settings: aIncludeSettings ? this._manager.settings : null,
}); });
} }
} }
@ -207,39 +297,56 @@ function startup() {
const browser = createBrowser(); const browser = createBrowser();
ModuleManager.init(browser, [{ ModuleManager.init(browser, [{
name: "GeckoViewAccessibility", name: "GeckoViewAccessibility",
resource: "resource://gre/modules/GeckoViewAccessibility.jsm", onInit: {
resource: "resource://gre/modules/GeckoViewAccessibility.jsm",
},
}, { }, {
name: "GeckoViewContent", name: "GeckoViewContent",
resource: "resource://gre/modules/GeckoViewContent.jsm", onInit: {
resource: "resource://gre/modules/GeckoViewContent.jsm",
frameScript: "chrome://geckoview/content/GeckoViewContent.js",
},
}, { }, {
name: "GeckoViewNavigation", name: "GeckoViewNavigation",
resource: "resource://gre/modules/GeckoViewNavigation.jsm", onInit: {
resource: "resource://gre/modules/GeckoViewNavigation.jsm",
},
onEnable: {
frameScript: "chrome://geckoview/content/GeckoViewNavigationContent.js",
},
}, { }, {
name: "GeckoViewProgress", name: "GeckoViewProgress",
resource: "resource://gre/modules/GeckoViewProgress.jsm", onEnable: {
resource: "resource://gre/modules/GeckoViewProgress.jsm",
},
}, { }, {
name: "GeckoViewScroll", name: "GeckoViewScroll",
resource: "resource://gre/modules/GeckoViewScroll.jsm", onEnable: {
frameScript: "chrome://geckoview/content/GeckoViewScrollContent.js",
},
}, { }, {
name: "GeckoViewSelectionAction", name: "GeckoViewSelectionAction",
resource: "resource://gre/modules/GeckoViewSelectionAction.jsm", onEnable: {
frameScript: "chrome://geckoview/content/GeckoViewSelectionActionContent.js",
},
}, { }, {
name: "GeckoViewSettings", name: "GeckoViewSettings",
resource: "resource://gre/modules/GeckoViewSettings.jsm", onInit: {
resource: "resource://gre/modules/GeckoViewSettings.jsm",
frameScript: "chrome://geckoview/content/GeckoViewContentSettings.js",
},
}, { }, {
name: "GeckoViewTab", name: "GeckoViewTab",
resource: "resource://gre/modules/GeckoViewTab.jsm", onInit: {
resource: "resource://gre/modules/GeckoViewTab.jsm",
},
}, { }, {
name: "GeckoViewTrackingProtection", name: "GeckoViewTrackingProtection",
resource: "resource://gre/modules/GeckoViewTrackingProtection.jsm", onEnable: {
resource: "resource://gre/modules/GeckoViewTrackingProtection.jsm",
},
}]); }]);
window.document.documentElement.appendChild(browser);
ModuleManager.forEach(module => {
module.onInit();
});
// Move focus to the content window at the end of startup, // Move focus to the content window at the end of startup,
// so things like text selection can work properly. // so things like text selection can work properly.
browser.focus(); browser.focus();

Просмотреть файл

@ -2,7 +2,6 @@
# Global options # Global options
ac_add_options --enable-debug ac_add_options --enable-debug
ac_add_options --enable-marionette
# Android # Android
ac_add_options --with-android-min-sdk=21 ac_add_options --with-android-min-sdk=21

Просмотреть файл

@ -2,7 +2,6 @@
# Global options # Global options
ac_add_options --enable-debug ac_add_options --enable-debug
ac_add_options --enable-marionette
# Android # Android
# Warning: Before increasing the with-android-min-sdk value, please note several places in and out # Warning: Before increasing the with-android-min-sdk value, please note several places in and out

Просмотреть файл

@ -7,7 +7,6 @@ NO_NDK=1
# Global options # Global options
ac_add_options --enable-debug ac_add_options --enable-debug
ac_add_options --enable-marionette
. "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/nightly" . "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/nightly"

Просмотреть файл

@ -32,6 +32,14 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --with-google-api-keyfile=/builds/gapi.data ac_add_options --with-google-api-keyfile=/builds/gapi.data
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-fennec-geoloc-api.key ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-fennec-geoloc-api.key
# Marionette is disabled on Android by default. This condition enables it only on some
# Fennec builds. It remains disabled on "nightly-try", "nightly", release", "beta", etc.
if [ -z "$MOZ_UPDATE_CHANNEL" ] || [ "$MOZ_UPDATE_CHANNEL" = "default" ] \
|| [ "$MOZ_UPDATE_CHANNEL" = "try" ];
then
ac_add_options --enable-marionette
fi
# MOZ_INSTALL_TRACKING does not guarantee MOZ_UPDATE_CHANNEL will be set so we # MOZ_INSTALL_TRACKING does not guarantee MOZ_UPDATE_CHANNEL will be set so we
# provide a default state. Currently, the default state provides a default # provide a default state. Currently, the default state provides a default
# keyfile because an assertion will be thrown if MOZ_INSTALL_TRACKING is # keyfile because an assertion will be thrown if MOZ_INSTALL_TRACKING is

Просмотреть файл

@ -20,8 +20,6 @@ class GeckoViewContent extends GeckoViewModule {
]); ]);
this.messageManager.addMessageListener("GeckoView:SaveStateFinish", this); this.messageManager.addMessageListener("GeckoView:SaveStateFinish", this);
this.registerContent("chrome://geckoview/content/GeckoViewContent.js");
} }
onEnable() { onEnable() {

Просмотреть файл

@ -84,8 +84,9 @@ class GeckoViewContentModule {
this.onInit(); this.onInit();
this.messageManager.sendAsyncMessage( this.messageManager.sendAsyncMessage("GeckoView:ContentModuleLoaded", {
"GeckoView:ContentRegistered", { module: this.moduleName }); module: this.moduleName,
});
} }
// Override to initialize module. // Override to initialize module.

Просмотреть файл

@ -64,27 +64,17 @@ class GeckoViewModule {
// Override to disable module after clearing the Java delegate. // Override to disable module after clearing the Java delegate.
onDisable() {} onDisable() {}
registerContent(aUri) { // Override to perform actions when content module has started loading;
if (this._isContentLoaded) { // by default, pause events so events that depend on content modules can work.
return; onLoadContentModule() {
}
this._isContentLoaded = true;
this._eventProxy.enableQueuing(true); this._eventProxy.enableQueuing(true);
}
let self = this; // Override to perform actions when content module has finished loading;
this.messageManager.addMessageListener("GeckoView:ContentRegistered", // by default, un-pause events and flush queued events.
function listener(aMsg) { onContentModuleLoaded() {
if (aMsg.data.module !== self.name) { this._eventProxy.enableQueuing(false);
return; this._eventProxy.dispatchQueuedEvents();
}
self.messageManager.removeMessageListener("GeckoView:ContentRegistered",
listener);
self.messageManager.sendAsyncMessage("GeckoView:UpdateSettings",
self.settings);
self._eventProxy.enableQueuing(false);
self._eventProxy.dispatchQueuedEvents();
});
this.messageManager.loadFrameScript(aUri, true);
} }
registerListener(aEventList) { registerListener(aEventList) {

Просмотреть файл

@ -250,9 +250,6 @@ class GeckoViewNavigation extends GeckoViewModule {
onEnable() { onEnable() {
debug `onEnable`; debug `onEnable`;
this.registerContent(
"chrome://geckoview/content/GeckoViewNavigationContent.js");
let flags = Ci.nsIWebProgress.NOTIFY_LOCATION; let flags = Ci.nsIWebProgress.NOTIFY_LOCATION;
this.progressFilter = this.progressFilter =
Cc["@mozilla.org/appshell/component/browser-status-filter;1"] Cc["@mozilla.org/appshell/component/browser-status-filter;1"]

Просмотреть файл

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewScroll"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
class GeckoViewScroll extends GeckoViewModule {
onEnable() {
debug `onEnable`;
this.registerContent("chrome://geckoview/content/GeckoViewScrollContent.js");
}
}

Просмотреть файл

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewSelectionAction"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
// Handles inter-op between accessible carets and GeckoSession.
class GeckoViewSelectionAction extends GeckoViewModule {
onEnable() {
debug `onEnable`;
this.registerContent("chrome://geckoview/content/GeckoViewSelectionActionContent.js");
}
}

Просмотреть файл

@ -42,9 +42,6 @@ class GeckoViewSettings extends GeckoViewModule {
onInit() { onInit() {
this._useTrackingProtection = false; this._useTrackingProtection = false;
this._useDesktopMode = false; this._useDesktopMode = false;
this.registerContent(
"chrome://geckoview/content/GeckoViewContentSettings.js");
} }
onSettingsUpdate() { onSettingsUpdate() {

Просмотреть файл

@ -13,8 +13,6 @@ EXTRA_JS_MODULES += [
'GeckoViewNavigation.jsm', 'GeckoViewNavigation.jsm',
'GeckoViewProgress.jsm', 'GeckoViewProgress.jsm',
'GeckoViewRemoteDebugger.jsm', 'GeckoViewRemoteDebugger.jsm',
'GeckoViewScroll.jsm',
'GeckoViewSelectionAction.jsm',
'GeckoViewSettings.jsm', 'GeckoViewSettings.jsm',
'GeckoViewTab.jsm', 'GeckoViewTab.jsm',
'GeckoViewTrackingProtection.jsm', 'GeckoViewTrackingProtection.jsm',

Просмотреть файл

@ -190,22 +190,21 @@ nsHostRecord::nsHostRecord(const nsHostKey& key)
, addr(nullptr) , addr(nullptr)
, negative(false) , negative(false)
, mResolving(0) , mResolving(0)
, mNative(false)
, mTRRSuccess(0) , mTRRSuccess(0)
, mNativeSuccess(0)
, mNative(false)
, mTRRUsed(false) , mTRRUsed(false)
, mNativeUsed(false) , mNativeUsed(false)
, mNativeSuccess(false)
, mFirstTRR(nullptr)
, onQueue(false) , onQueue(false)
, usingAnyThread(false) , usingAnyThread(false)
, mDoomed(false) , mDoomed(false)
, mDidCallbacks(false) , mDidCallbacks(false)
, mGetTtl(false) , mGetTtl(false)
, mResolveAgain(false)
, mTrrAUsed(INIT) , mTrrAUsed(INIT)
, mTrrAAAAUsed(INIT) , mTrrAAAAUsed(INIT)
, mTrrLock("nsHostRecord.mTrrLock") , mTrrLock("nsHostRecord.mTrrLock")
, mBlacklistedCount(0) , mBlacklistedCount(0)
, mResolveAgain(false)
{ {
} }

Просмотреть файл

@ -176,21 +176,26 @@ private:
explicit nsHostRecord(const nsHostKey& key); explicit nsHostRecord(const nsHostKey& key);
mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks; mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks;
int mResolving; // counter of outstanding resolving calls
bool mNative; // true if this record is being resolved "natively",
// which means that it is either on the pending queue
// or owned by one of the worker threads. */
int mTRRSuccess; // number of successful TRR responses
bool mTRRUsed; // TRR was used on this record
bool mNativeUsed;
int mNativeSuccess; // number of native lookup responses
nsAutoPtr<mozilla::net::AddrInfo> mFirstTRR; // partial TRR storage nsAutoPtr<mozilla::net::AddrInfo> mFirstTRR; // partial TRR storage
bool onQueue; // true if pending and on the queue (not yet given to getaddrinfo())
bool usingAnyThread; // true if off queue and contributing to mActiveAnyThreadCount uint16_t mResolving; // counter of outstanding resolving calls
bool mDoomed; // explicitly expired uint8_t mTRRSuccess; // number of successful TRR responses
bool mDidCallbacks; uint8_t mNativeSuccess; // number of native lookup responses
bool mGetTtl;
uint16_t mNative : 1; // true if this record is being resolved "natively",
// which means that it is either on the pending queue
// or owned by one of the worker threads. */
uint16_t mTRRUsed : 1; // TRR was used on this record
uint16_t mNativeUsed : 1;
uint16_t onQueue : 1; // true if pending and on the queue (not yet given to getaddrinfo())
uint16_t usingAnyThread : 1; // true if off queue and contributing to mActiveAnyThreadCount
uint16_t mDoomed : 1; // explicitly expired
uint16_t mDidCallbacks : 1;
uint16_t mGetTtl : 1;
// when the results from this resolve is returned, it is not to be
// trusted, but instead a new resolve must be made!
uint16_t mResolveAgain : 1;
enum { enum {
INIT, STARTED, OK, FAILED INIT, STARTED, OK, FAILED
@ -204,10 +209,6 @@ private:
// lifetime. // lifetime.
uint32_t mBlacklistedCount; uint32_t mBlacklistedCount;
// when the results from this resolve is returned, it is not to be
// trusted, but instead a new resolve must be made!
bool mResolveAgain;
// a list of addresses associated with this record that have been reported // a list of addresses associated with this record that have been reported
// as unusable. the list is kept as a set of strings to make it independent // as unusable. the list is kept as a set of strings to make it independent
// of gencnt. // of gencnt.

Просмотреть файл

@ -268,7 +268,6 @@ android-4.3-arm7-api-16/debug:
build-platform: android-api-16/debug build-platform: android-api-16/debug
test-sets: test-sets:
- android-common-tests - android-common-tests
- android-debug-tests
- android-gradle-tests - android-gradle-tests
android-4.3-arm7-api-16/opt: android-4.3-arm7-api-16/opt:

Просмотреть файл

@ -327,6 +327,7 @@ android-common-tests:
- geckoview-junit - geckoview-junit
# - jittest # not ready yet: bug 1098508 # - jittest # not ready yet: bug 1098508
- jsreftest - jsreftest
- marionette
- mochitest - mochitest
- mochitest-chrome - mochitest-chrome
- mochitest-clipboard - mochitest-clipboard
@ -337,10 +338,6 @@ android-common-tests:
- test-verify - test-verify
- xpcshell - xpcshell
android-debug-tests:
# Marionette only available on Fennec debug builds as a security precaution
- marionette
android-opt-tests: android-opt-tests:
# Robocop tests often fail on Debug builds # Robocop tests often fail on Debug builds
- robocop - robocop

Просмотреть файл

@ -12,6 +12,10 @@ transforms:
kind-dependencies: kind-dependencies:
- build - build
not-for-build-platforms:
# Address Sanitizer builds don't have symbols to upload.
- linux64-asan-reporter-nightly/opt
job-template: job-template:
description: Upload Symbols description: Upload Symbols
worker-type: aws-provisioner-v1/gecko-{level}-b-linux worker-type: aws-provisioner-v1/gecko-{level}-b-linux

Просмотреть файл

@ -1 +0,0 @@
target/

Просмотреть файл

@ -1342,7 +1342,12 @@ impl MarionetteConnection {
let poll_interval = time::Duration::from_millis(100); let poll_interval = time::Duration::from_millis(100);
let now = time::Instant::now(); let now = time::Instant::now();
debug!("Waiting {}s to connect to browser", timeout.as_secs()); debug!(
"Waiting {}s to connect to browser on {}:{}",
timeout.as_secs(),
DEFAULT_HOST,
self.port
);
loop { loop {
// immediately abort connection attempts if process disappears // immediately abort connection attempts if process disappears
if let &mut Some(ref mut runner) = browser { if let &mut Some(ref mut runner) = browser {

Просмотреть файл

@ -96,8 +96,8 @@ class GeckoInstance(object):
"javascript.options.showInConsole": True, "javascript.options.showInConsole": True,
# Enable Marionette component # Enable Marionette component
# (deprecated and can be removed when Firefox 60 ships)
"marionette.enabled": True, "marionette.enabled": True,
# (deprecated and can be removed when Firefox 60 ships)
"marionette.defaultPrefs.enabled": True, "marionette.defaultPrefs.enabled": True,
# Disable recommended automation prefs in CI # Disable recommended automation prefs in CI

2
testing/mozbase/rust/mozversion/.gitignore поставляемый
Просмотреть файл

@ -1,2 +0,0 @@
target
Cargo.lock

Просмотреть файл

@ -22,6 +22,8 @@ config = {
"hostutils_manifest_path": "testing/config/tooltool-manifests/linux64/hostutils.manifest", "hostutils_manifest_path": "testing/config/tooltool-manifests/linux64/hostutils.manifest",
"avds_dir": "/builds/worker/workspace/build/.android", "avds_dir": "/builds/worker/workspace/build/.android",
"minidump_stackwalk_path": "/usr/local/bin/linux64-minidump_stackwalk", "minidump_stackwalk_path": "/usr/local/bin/linux64-minidump_stackwalk",
"marionette_address": "localhost:2828",
"marionette_test_manifest": "unit-tests.ini",
"suite_definitions": { "suite_definitions": {
"mochitest": { "mochitest": {

Просмотреть файл

@ -6,8 +6,6 @@
config = { config = {
"deprecated_sdk_path": True, "deprecated_sdk_path": True,
"robocop_package_name": "org.mozilla.roboexample.test", "robocop_package_name": "org.mozilla.roboexample.test",
"marionette_address": "localhost:2828",
"marionette_test_manifest": "unit-tests.ini",
"tooltool_manifest_path": "testing/config/tooltool-manifests/androidarm_4_3/releng.manifest", "tooltool_manifest_path": "testing/config/tooltool-manifests/androidarm_4_3/releng.manifest",
"emulator_manifest": """ "emulator_manifest": """
[ [