Merge branch 'master' of https://github.com/highfidelity/hifi into verbose-logging-2

This commit is contained in:
howard-stearns 2019-06-10 19:42:07 -07:00
commit d7f6685022
26 changed files with 210 additions and 60 deletions

View file

@ -1463,7 +1463,7 @@
"data": {
"alpha": 0.0,
"desiredSpeed": 1.4,
"characteristicSpeeds": [0.5, 1.8, 2.3, 3.2, 4.5],
"characteristicSpeeds": [0.5, 1.8, 2.3, 3.0, 5.0],
"alphaVar": "moveForwardAlpha",
"desiredSpeedVar": "moveForwardSpeed"
},
@ -1509,8 +1509,8 @@
"type": "clip",
"data": {
"url": "qrc:///avatar/animations/jog_fwd.fbx",
"startFrame": 0.0,
"endFrame": 25.0,
"startFrame": 1.0,
"endFrame": 22.0,
"timeScale": 1.0,
"loopFlag": true
},
@ -1522,7 +1522,7 @@
"data": {
"url": "qrc:///avatar/animations/run_fwd.fbx",
"startFrame": 1.0,
"endFrame": 22.0,
"endFrame": 23.0,
"timeScale": 1.0,
"loopFlag": true
},
@ -2099,4 +2099,4 @@
}
]
}
}
}

View file

@ -269,6 +269,9 @@ Item {
StatText {
text: "GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
}
StatText {
text: "LOD Target: " + root.lodTargetFramerate + " Hz Angle: " + root.lodAngle + " deg"
}
StatText {
text: "Drawcalls: " + root.drawcalls
}

View file

@ -259,6 +259,35 @@ Item {
visible: root.expanded;
text: "Entity Servers In: " + root.entityPacketsInKbps + " kbps";
}
StatText {
visible: !root.expanded
text: "Octree Elements Server: " + root.serverElements +
" Local: " + root.localElements;
}
StatText {
visible: root.expanded
text: "Octree Sending Mode: " + root.sendingMode;
}
StatText {
visible: root.expanded
text: "Octree Packets to Process: " + root.packetStats;
}
StatText {
visible: root.expanded
text: "Octree Elements - ";
}
StatText {
visible: root.expanded
text: "\tServer: " + root.serverElements +
" Internal: " + root.serverInternal +
" Leaves: " + root.serverLeaves;
}
StatText {
visible: root.expanded
text: "\tLocal: " + root.localElements +
" Internal: " + root.localInternal +
" Leaves: " + root.localLeaves;
}
StatText {
visible: root.expanded;
text: "Downloads: " + root.downloads + "/" + root.downloadLimit +
@ -316,6 +345,9 @@ Item {
StatText {
text: "GPU frame size: " + root.gpuFrameSize.x + " x " + root.gpuFrameSize.y
}
StatText {
text: "LOD Target: " + root.lodTargetFramerate + " Hz Angle: " + root.lodAngle + " deg"
}
StatText {
text: "Drawcalls: " + root.drawcalls
}
@ -401,35 +433,6 @@ Item {
text: " out of view: " + root.shadowOutOfView +
" too small: " + root.shadowTooSmall;
}
StatText {
visible: !root.expanded
text: "Octree Elements Server: " + root.serverElements +
" Local: " + root.localElements;
}
StatText {
visible: root.expanded
text: "Octree Sending Mode: " + root.sendingMode;
}
StatText {
visible: root.expanded
text: "Octree Packets to Process: " + root.packetStats;
}
StatText {
visible: root.expanded
text: "Octree Elements - ";
}
StatText {
visible: root.expanded
text: "\tServer: " + root.serverElements +
" Internal: " + root.serverInternal +
" Leaves: " + root.serverLeaves;
}
StatText {
visible: root.expanded
text: "\tLocal: " + root.localElements +
" Internal: " + root.localInternal +
" Leaves: " + root.localLeaves;
}
StatText {
visible: root.expanded
text: "LOD: " + root.lodStatus;

View file

@ -351,7 +351,18 @@ float LODManager::getHMDLODTargetFPS() const {
}
float LODManager::getLODTargetFPS() const {
auto refreshRateFPS = qApp->getRefreshRateManager().getActiveRefreshRate();
// Use the current refresh rate as the recommended rate target used to cap the LOD manager control value.
// When focused, Use the Focus Inactive as the targget LOD to void abrupt changes from the lod controller.
auto& refreshRateManager = qApp->getRefreshRateManager();
auto refreshRateRegime = refreshRateManager.getRefreshRateRegime();
auto refreshRateProfile = refreshRateManager.getRefreshRateProfile();
auto refreshRateUXMode = refreshRateManager.getUXMode();
auto refreshRateFPS = refreshRateManager.getActiveRefreshRate();
if (refreshRateRegime == RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE) {
refreshRateFPS = refreshRateManager.queryRefreshRateTarget(refreshRateProfile, RefreshRateManager::RefreshRateRegime::FOCUS_INACTIVE, refreshRateUXMode);
}
auto lodTargetFPS = getDesktopLODTargetFPS();
if (qApp->isHMDMode()) {
lodTargetFPS = getHMDLODTargetFPS();

View file

@ -13,6 +13,7 @@
#include <platform/Profiler.h>
#include "scripting/RenderScriptingInterface.h"
#include "LODManager.h"
PerformanceManager::PerformanceManager()
{
@ -68,11 +69,14 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME);
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
break;
case PerformancePreset::MID:
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
break;
case PerformancePreset::LOW:
@ -80,6 +84,8 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO);
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.75f);
break;
case PerformancePreset::UNKNOWN:
default:

View file

@ -107,9 +107,7 @@ RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile
RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME;
if (getUXMode() != RefreshRateManager::UXMode::VR) {
profile =(RefreshRateManager::RefreshRateProfile) _refreshRateProfileSettingLock.resultWithReadLock<int>([&] {
return _refreshRateProfileSetting.get();
});
return _refreshRateProfile;
}
return profile;
@ -138,15 +136,17 @@ void RefreshRateManager::setUXMode(RefreshRateManager::UXMode uxMode) {
}
}
int RefreshRateManager::queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const {
int targetRefreshRate = VR_TARGET_RATE;
if (uxMode == RefreshRateManager::UXMode::DESKTOP) {
targetRefreshRate = REFRESH_RATE_PROFILES[profile][regime];
}
return targetRefreshRate;
}
void RefreshRateManager::updateRefreshRateController() const {
if (_refreshRateOperator) {
int targetRefreshRate;
if (_uxMode == RefreshRateManager::UXMode::DESKTOP) {
targetRefreshRate = REFRESH_RATE_PROFILES[_refreshRateProfile][_refreshRateRegime];
} else {
targetRefreshRate = VR_TARGET_RATE;
}
int targetRefreshRate = queryRefreshRateTarget(_refreshRateProfile, _refreshRateRegime, _uxMode);
_refreshRateOperator(targetRefreshRate);
_activeRefreshRate = targetRefreshRate;
}

View file

@ -65,6 +65,9 @@ public:
int getActiveRefreshRate() const { return _activeRefreshRate; }
void updateRefreshRateController() const;
// query the refresh rate target at the specified combination
int queryRefreshRateTarget(RefreshRateProfile profile, RefreshRateRegime regime, UXMode uxMode) const;
void resetInactiveTimer();
void toggleInactive();

View file

@ -2488,12 +2488,12 @@ QVariantList MyAvatar::getAvatarEntitiesVariant() {
QVariantMap avatarEntityData;
avatarEntityData["id"] = entityID;
EntityItemProperties entityProperties = entity->getProperties(desiredProperties);
QScriptValue scriptProperties;
{
std::lock_guard<std::mutex> guard(_scriptEngineLock);
QScriptValue scriptProperties;
scriptProperties = EntityItemPropertiesToScriptValue(_scriptEngine, entityProperties);
avatarEntityData["properties"] = scriptProperties.toVariant();
}
avatarEntityData["properties"] = scriptProperties.toVariant();
avatarEntitiesData.append(QVariant(avatarEntityData));
}
}

View file

@ -132,6 +132,10 @@ static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SI
bool GraphicsEngine::shouldPaint() const {
auto displayPlugin = qApp->getActiveDisplayPlugin();
if (!displayPlugin) {
// We're shutting down
return false;
}
#ifdef DEBUG_PAINT_DELAY
static uint64_t paintDelaySamples{ 0 };
@ -175,6 +179,10 @@ void GraphicsEngine::render_performFrame() {
{
PROFILE_RANGE(render, "/getActiveDisplayPlugin");
displayPlugin = qApp->getActiveDisplayPlugin();
if (!displayPlugin) {
// We're shutting down
return;
}
}
{

View file

@ -416,6 +416,8 @@ void Stats::updateStats(bool force) {
gpuContext->getFrameStats(gpuFrameStats);
STAT_UPDATE(drawcalls, gpuFrameStats._DSNumDrawcalls);
STAT_UPDATE(lodTargetFramerate, DependencyManager::get<LODManager>()->getLODTargetFPS());
STAT_UPDATE(lodAngle, DependencyManager::get<LODManager>()->getLODAngleDeg());
// Incoming packets

View file

@ -109,6 +109,8 @@ private: \
* @property {number} shadowRendered - <em>Read-only.</em>
* @property {string} sendingMode - <em>Read-only.</em>
* @property {string} packetStats - <em>Read-only.</em>
* @property {number} lodAngle - <em>Read-only.</em>
* @property {number} lodTargetFramerate - <em>Read-only.</em>
* @property {string} lodStatus - <em>Read-only.</em>
* @property {string} timingStats - <em>Read-only.</em>
* @property {string} gameUpdateStats - <em>Read-only.</em>
@ -272,6 +274,8 @@ class Stats : public QQuickItem {
STATS_PROPERTY(int, shadowRendered, 0)
STATS_PROPERTY(QString, sendingMode, QString())
STATS_PROPERTY(QString, packetStats, QString())
STATS_PROPERTY(int, lodAngle, 0)
STATS_PROPERTY(int, lodTargetFramerate, 0)
STATS_PROPERTY(QString, lodStatus, QString())
STATS_PROPERTY(QString, timingStats, QString())
STATS_PROPERTY(QString, gameUpdateStats, QString())
@ -858,6 +862,20 @@ signals:
*/
void packetStatsChanged();
/**jsdoc
* Triggered when the value of the <code>lodAngle</code> property changes.
* @function Stats.lodAngleChanged
* @returns {Signal}
*/
void lodAngleChanged();
/**jsdoc
* Triggered when the value of the <code>lodTargetFramerate</code> property changes.
* @function Stats.lodTargetFramerateChanged
* @returns {Signal}
*/
void lodTargetFramerateChanged();
/**jsdoc
* Triggered when the value of the <code>lodStatus</code> property changes.
* @function Stats.lodStatusChanged

View file

@ -66,6 +66,10 @@ endfunction()
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${src_files})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${APP_NAME})
set_from_env(LAUNCHER_HMAC_SECRET LAUNCHER_HMAC_SECRET "")
if (LAUNCHER_HMAC_SECRET STREQUAL "")
message(FATAL_ERROR "LAUNCHER_HMAC_SECRET is not set")
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_HMAC_SECRET="${LAUNCHER_HMAC_SECRET}")
file(GLOB NIB_FILES "nib/*.xib")

View file

@ -50,6 +50,11 @@ function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE)
endfunction()
set_from_env(LAUNCHER_HMAC_SECRET LAUNCHER_HMAC_SECRET "")
if (LAUNCHER_HMAC_SECRET STREQUAL "")
message(FATAL_ERROR "LAUNCHER_HMAC_SECRET is not set")
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE LAUNCHER_HMAC_SECRET="${LAUNCHER_HMAC_SECRET}")

View file

@ -55,7 +55,7 @@ protected:
bool _faceCamera { false };
bool _glow { false };
size_t _numVertices;
size_t _numVertices { 0 };
gpu::BufferPointer _polylineDataBuffer;
gpu::BufferPointer _polylineGeometryBuffer;
static std::map<std::pair<render::Args::RenderMethod, bool>, gpu::PipelinePointer> _pipelines;

View file

@ -346,7 +346,7 @@ void ResourceCache::setRequestLimit(uint32_t limit) {
QSharedPointer<Resource> ResourceCache::getResource(const QUrl& url, const QUrl& fallback, void* extra, size_t extraHash) {
QSharedPointer<Resource> resource;
{
QReadLocker locker(&_resourcesLock);
QWriteLocker locker(&_resourcesLock);
auto& resourcesWithExtraHash = _resources[url];
auto resourcesWithExtraHashIter = resourcesWithExtraHash.find(extraHash);
if (resourcesWithExtraHashIter != resourcesWithExtraHash.end()) {

View file

@ -18,6 +18,9 @@
#include <unistd.h>
#include <cpuid.h>
#include <sys/sysctl.h>
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
#endif
using namespace platform;
@ -33,18 +36,75 @@ void MACOSInstance::enumerateCpu() {
}
void MACOSInstance::enumerateGpu() {
#ifdef Q_OS_MAC
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
#endif
}
void MACOSInstance::enumerateDisplays() {
#ifdef Q_OS_MAC
auto displayID = CGMainDisplayID();
auto displaySize = CGDisplayScreenSize(displayID);
const auto MM_TO_IN = 0.0393701;
auto displaySizeWidthInches = displaySize.width * MM_TO_IN;
auto displaySizeHeightInches = displaySize.height * MM_TO_IN;
auto displaySizeDiagonalInches = sqrt(displaySizeWidthInches * displaySizeWidthInches + displaySizeHeightInches * displaySizeHeightInches);
auto displayBounds = CGDisplayBounds(displayID);
auto displayMaster =CGDisplayIsMain(displayID);
auto displayUnit =CGDisplayUnitNumber(displayID);
auto displayModel =CGDisplayModelNumber(displayID);
auto displayVendor = CGDisplayVendorNumber(displayID);
auto displaySerial = CGDisplaySerialNumber(displayID);
auto displayMode = CGDisplayCopyDisplayMode(displayID);
auto displayModeWidth = CGDisplayModeGetPixelWidth(displayMode);
auto displayModeHeight = CGDisplayModeGetPixelHeight(displayMode);
auto displayRefreshrate = CGDisplayModeGetRefreshRate(displayMode);
CGDisplayModeRelease(displayMode);
json display = {};
display["physicalWidth"] = displaySizeWidthInches;
display["physicalHeight"] = displaySizeHeightInches;
display["physicalDiagonal"] = displaySizeDiagonalInches;
display["ppi"] = sqrt(displayModeHeight * displayModeHeight + displayModeWidth * displayModeWidth) / displaySizeDiagonalInches;
display["coordLeft"] = displayBounds.origin.x;
display["coordRight"] = displayBounds.origin.x + displayBounds.size.width;
display["coordTop"] = displayBounds.origin.y;
display["coordBottom"] = displayBounds.origin.y + displayBounds.size.height;
display["isMaster"] = displayMaster;
display["unit"] = displayUnit;
display["vendor"] = displayVendor;
display["model"] = displayModel;
display["serial"] = displaySerial;
display["refreshrate"] =displayRefreshrate;
display["modeWidth"] = displayModeWidth;
display["modeHeight"] = displayModeHeight;
_display.push_back(display);
#endif
}
void MACOSInstance::enumerateMemory() {
json ram = {};

View file

@ -18,6 +18,7 @@ namespace platform {
void enumerateCpu() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateDisplays() override;
void enumerateComputer () override;
};

View file

@ -18,6 +18,7 @@ bool Instance::enumeratePlatform() {
enumerateComputer();
enumerateCpu();
enumerateGpu();
enumerateDisplays();
enumerateMemory();
// And profile the platform and put the tier in "computer"

View file

@ -37,6 +37,7 @@ public:
void virtual enumerateCpu()=0;
void virtual enumerateMemory()=0;
void virtual enumerateGpu()=0;
void virtual enumerateDisplays() {}
void virtual enumerateComputer()=0;
virtual ~Instance();

View file

@ -939,6 +939,11 @@ void GeometryCache::renderWireSphere(gpu::Batch& batch, const glm::vec4& color)
void GeometryCache::renderGrid(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,
int majorRows, int majorCols, float majorEdge, int minorRows, int minorCols, float minorEdge,
const glm::vec4& color, bool forward, int id) {
if (majorRows == 0 || majorCols == 0) {
return;
}
Vec2FloatPair majorKey(glm::vec2(majorRows, majorCols), majorEdge);
Vec2FloatPair minorKey(glm::vec2(minorRows, minorCols), minorEdge);
Vec2FloatPairPair key(majorKey, minorKey);
@ -962,8 +967,8 @@ void GeometryCache::renderGrid(gpu::Batch& batch, const glm::vec2& minCorner, co
gridBuffer.edit<GridSchema>().period = glm::vec4(majorRows, majorCols, minorRows, minorCols);
gridBuffer.edit<GridSchema>().offset.x = -(majorEdge / majorRows) / 2;
gridBuffer.edit<GridSchema>().offset.y = -(majorEdge / majorCols) / 2;
gridBuffer.edit<GridSchema>().offset.z = -(minorEdge / minorRows) / 2;
gridBuffer.edit<GridSchema>().offset.w = -(minorEdge / minorCols) / 2;
gridBuffer.edit<GridSchema>().offset.z = minorRows == 0 ? 0 : -(minorEdge / minorRows) / 2;
gridBuffer.edit<GridSchema>().offset.w = minorCols == 0 ? 0 : -(minorEdge / minorCols) / 2;
gridBuffer.edit<GridSchema>().edge = glm::vec4(glm::vec2(majorEdge),
// If rows or columns are not set, do not draw minor gridlines
glm::vec2((minorRows != 0 && minorCols != 0) ? minorEdge : 0.0f));

View file

@ -0,0 +1,5 @@
var window = Desktop.createWindow(Script.resolvePath('./lod.qml'), {
title: "LOD Setup",
presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: 350, y: 500}
});

View file

@ -535,7 +535,9 @@ function shutdown() {
if (!HMD.active) {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
toolbar.writeProperty("visible", true);
if (toolbar) {
toolbar.writeProperty("visible", true);
}
}
}

View file

@ -10,7 +10,7 @@
/* global EntityListTool, Tablet, selectionManager, Entities, Camera, MyAvatar, Vec3, Menu, Messages,
cameraManager, MENU_EASE_ON_FOCUS, deleteSelectedEntities, toggleSelectedEntitiesLocked, toggleSelectedEntitiesVisible,
keyUpEventFromUIWindow */
keyUpEventFromUIWindow, Script, SelectionDisplay, SelectionManager, Clipboard */
var PROFILING_ENABLED = false;
var profileIndent = '';
@ -148,6 +148,20 @@ EntityListTool = function(shouldUseEditTabletApp) {
return value !== undefined ? value : "";
}
function entityIsBaked(properties) {
if (properties.type === "Model") {
var lowerModelURL = properties.modelURL.toLowerCase();
return lowerModelURL.endsWith(".baked.fbx") || lowerModelURL.endsWith(".baked.fst");
} else if (properties.type === "Zone") {
var lowerSkyboxURL = properties.skybox ? properties.skybox.url.toLowerCase() : "";
var lowerAmbientURL = properties.ambientLight ? properties.ambientLight.ambientURL.toLowerCase() : "";
return (lowerSkyboxURL === "" || lowerSkyboxURL.endsWith(".texmeta.json")) &&
(lowerAmbientURL === "" || lowerAmbientURL.endsWith(".texmeta.json"));
} else {
return false;
}
}
that.sendUpdate = function() {
PROFILE('Script-sendUpdate', function() {
var entities = [];
@ -164,7 +178,8 @@ EntityListTool = function(shouldUseEditTabletApp) {
var cameraPosition = Camera.position;
PROFILE("getMultipleProperties", function () {
var multipleProperties = Entities.getMultipleEntityProperties(ids, ['name', 'type', 'locked',
'visible', 'renderInfo', 'modelURL', 'materialURL', 'imageURL', 'script', 'certificateID']);
'visible', 'renderInfo', 'modelURL', 'materialURL', 'imageURL', 'script', 'certificateID',
'skybox.url', 'ambientLight.url']);
for (var i = 0; i < multipleProperties.length; i++) {
var properties = multipleProperties[i];
@ -193,7 +208,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
valueIfDefined(properties.renderInfo.texturesSize) : ""),
hasTransparent: (properties.renderInfo !== undefined ?
valueIfDefined(properties.renderInfo.hasTransparent) : ""),
isBaked: properties.type === "Model" ? url.toLowerCase().endsWith(".baked.fbx") : false,
isBaked: entityIsBaked(properties),
drawCalls: (properties.renderInfo !== undefined ?
valueIfDefined(properties.renderInfo.drawCalls) : ""),
hasScript: properties.script !== ""

View file

@ -112,9 +112,6 @@ def fixupWinZip(filename):
shutil.move(outFullPath, fullPath)
def buildLightLauncher():
# FIXME remove once MFC is enabled on the windows build hosts
if sys.platform == 'win32':
return
launcherSourcePath = os.path.join(SOURCE_PATH, 'launchers', sys.platform)
launcherBuildPath = os.path.join(BUILD_PATH, 'launcher')
if not os.path.exists(launcherBuildPath):
@ -146,7 +143,7 @@ def buildLightLauncher():
elif sys.platform == 'win32':
# FIXME
launcherDestFile = os.path.join(BUILD_PATH, "{}.exe".format(computeArchiveName('Launcher')))
launcherSourceFile = os.path.join(launcherBuildPath, "Launcher.exe")
launcherSourceFile = os.path.join(launcherBuildPath, "Release", "HQLauncher.exe")
print("Moving {} to {}".format(launcherSourceFile, launcherDestFile))
shutil.move(launcherSourceFile, launcherDestFile)