Merge branch 'master' of github.com:highfidelity/hifi into dk/machineFingerprintToDS

This commit is contained in:
David Kelly 2016-12-16 12:17:54 -08:00
commit 126ae52cb4
162 changed files with 3540 additions and 1071 deletions

View file

@ -12,7 +12,6 @@
#include <assert.h>
#include <QProcess>
#include <QSettings>
#include <QSharedMemory>
#include <QThread>
#include <QTimer>
@ -38,6 +37,7 @@
#include "AssignmentClient.h"
#include "AssignmentClientLogging.h"
#include "avatars/ScriptableAvatar.h"
#include <Trace.h>
const QString ASSIGNMENT_CLIENT_TARGET_NAME = "assignment-client";
const long long ASSIGNMENT_REQUEST_INTERVAL_MSECS = 1 * 1000;
@ -49,8 +49,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
{
LogUtils::init();
QSettings::setDefaultFormat(QSettings::IniFormat);
DependencyManager::set<tracing::Tracer>();
DependencyManager::set<AccountManager>();
auto scriptableAvatar = DependencyManager::set<ScriptableAvatar>();

View file

@ -12,7 +12,6 @@
#include <QCommandLineParser>
#include <QThread>
#include <BuildInfo.h>
#include <LogHandler.h>
#include <SharedUtil.h>
#include <HifiConfigVariantMap.h>
@ -40,11 +39,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
ShutdownEventListener::getInstance();
# endif
setOrganizationName(BuildInfo::MODIFIED_ORGANIZATION);
setOrganizationDomain("highfidelity.io");
setApplicationName("assignment-client");
setApplicationVersion(BuildInfo::VERSION);
// parse command-line
QCommandLineParser parser;
parser.setApplicationDescription("High Fidelity Assignment Client");

View file

@ -13,10 +13,16 @@
#include <SharedUtil.h>
#include "AssignmentClientApp.h"
#include <BuildInfo.h>
int main(int argc, char* argv[]) {
disableQtBearerPoll(); // Fixes wifi ping spikes
QCoreApplication::setApplicationName(BuildInfo::ASSIGNMENT_CLIENT_NAME);
QCoreApplication::setOrganizationName(BuildInfo::MODIFIED_ORGANIZATION);
QCoreApplication::setOrganizationDomain(BuildInfo::ORGANIZATION_DOMAIN);
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
qInstallMessageHandler(LogHandler::verboseMessageHandler);
qInfo() << "Starting.";

View file

@ -1,6 +1,6 @@
//
// BuildInfo.h.in
// cmake/macros
// cmake/templates
//
// Created by Stephen Birarda on 1/14/16.
// Copyright 2015 High Fidelity, Inc.
@ -11,10 +11,19 @@
#define USE_STABLE_GLOBAL_SERVICES @USE_STABLE_GLOBAL_SERVICES@
#include <QString>
namespace BuildInfo {
// WARNING: This file has been auto-generated.
// Check cmake/templates/BuildInfo.h.in if you want to modify it.
const QString INTERFACE_NAME = "Interface";
const QString ASSIGNMENT_CLIENT_NAME = "assignment-client";
const QString DOMAIN_SERVER_NAME = "domain-server";
const QString AC_CLIENT_SERVER_NAME = "ac-client";
const QString MODIFIED_ORGANIZATION = "@BUILD_ORGANIZATION@";
const QString ORGANIZATION_DOMAIN = "highfidelity.io";
const QString VERSION = "@BUILD_VERSION@";
const QString BUILD_BRANCH = "@BUILD_BRANCH@";
const QString BUILD_GLOBAL_SERVICES = "@BUILD_GLOBAL_SERVICES@";
}

View file

@ -43,6 +43,7 @@
#include "DomainServerNodeData.h"
#include "NodeConnectionData.h"
#include <Trace.h>
int const DomainServer::EXIT_CODE_REBOOT = 234923;
@ -73,17 +74,12 @@ DomainServer::DomainServer(int argc, char* argv[]) :
{
parseCommandLine();
DependencyManager::set<tracing::Tracer>();
LogUtils::init();
Setting::init();
setOrganizationName(BuildInfo::MODIFIED_ORGANIZATION);
setOrganizationDomain("highfidelity.io");
setApplicationName("domain-server");
setApplicationVersion(BuildInfo::VERSION);
QSettings::setDefaultFormat(QSettings::IniFormat);
qDebug() << "Setting up domain-server";
qDebug() << "[VERSION] Build sequence:" << qPrintable(applicationVersion());
qDebug() << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION;
qDebug() << "[VERSION] VERSION:" << BuildInfo::VERSION;

View file

@ -9,6 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "DomainServerSettingsManager.h"
#include <algorithm>
#include <QtCore/QCoreApplication>
@ -16,23 +18,21 @@
#include <QtCore/QFile>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonObject>
#include <QtCore/QSettings>
#include <QtCore/QStandardPaths>
#include <QtCore/QUrl>
#include <QtCore/QUrlQuery>
#include <AccountManager.h>
#include <QTimeZone>
#include <AccountManager.h>
#include <Assignment.h>
#include <HifiConfigVariantMap.h>
#include <HTTPConnection.h>
#include <NLPacketList.h>
#include <NumericalConstants.h>
#include <SettingHandle.h>
#include "DomainServerNodeData.h"
#include "DomainServerSettingsManager.h"
const QString SETTINGS_DESCRIPTION_RELATIVE_PATH = "/resources/describe-settings.json";
const QString DESCRIPTION_SETTINGS_KEY = "settings";
@ -43,6 +43,8 @@ const QString DESCRIPTION_COLUMNS_KEY = "columns";
const QString SETTINGS_VIEWPOINT_KEY = "viewpoint";
static Setting::Handle<double> JSON_SETTING_VERSION("json-settings/version", 0.0);
DomainServerSettingsManager::DomainServerSettingsManager() :
_descriptionArray(),
_configMap()
@ -103,9 +105,7 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
// What settings version were we before and what are we using now?
// Do we need to do any re-mapping?
QSettings appSettings;
const QString JSON_SETTINGS_VERSION_KEY = "json-settings/version";
double oldVersion = appSettings.value(JSON_SETTINGS_VERSION_KEY, 0.0).toDouble();
double oldVersion = JSON_SETTING_VERSION.get();
if (oldVersion != _descriptionVersion) {
const QString ALLOWED_USERS_SETTINGS_KEYPATH = "security.allowed_users";
@ -301,7 +301,7 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
unpackPermissions();
// write the current description version to our settings
appSettings.setValue(JSON_SETTINGS_VERSION_KEY, _descriptionVersion);
JSON_SETTING_VERSION.set(_descriptionVersion);
}
QVariantMap& DomainServerSettingsManager::getDescriptorsMap() {

View file

@ -14,6 +14,7 @@
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtNetwork/QNetworkReply>
#include <HifiConfigVariantMap.h>
#include <HTTPManager.h>
@ -21,6 +22,8 @@
#include <ReceivedMessage.h>
#include "NodePermissions.h"
#include <Node.h>
const QString SETTINGS_PATHS_KEY = "paths";
const QString SETTINGS_PATH = "/settings";

View file

@ -17,12 +17,18 @@
#include <LogHandler.h>
#include <SharedUtil.h>
#include <BuildInfo.h>
#include "DomainServer.h"
int main(int argc, char* argv[]) {
disableQtBearerPoll(); // Fixes wifi ping spikes
QCoreApplication::setApplicationName(BuildInfo::DOMAIN_SERVER_NAME);
QCoreApplication::setOrganizationName(BuildInfo::MODIFIED_ORGANIZATION);
QCoreApplication::setOrganizationDomain(BuildInfo::ORGANIZATION_DOMAIN);
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
#ifndef WIN32
setvbuf(stdout, NULL, _IOLBF, 0);
#endif

View file

@ -166,6 +166,7 @@ if (WIN32)
add_dependency_external_projects(OpenVR)
add_dependency_external_projects(neuron)
add_dependency_external_projects(wasapi)
add_dependency_external_projects(steamworks)
endif()
# disable /OPT:REF and /OPT:ICF for the Debug builds
@ -175,10 +176,6 @@ if (WIN32)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG "/OPT:NOREF /OPT:NOICF")
endif()
if (NOT ANDROID)
set(NON_ANDROID_LIBRARIES steamworks-wrapper)
endif ()
# link required hifi libraries
link_hifi_libraries(
shared octree gpu gl gpu-gl procedural model render

View file

@ -1,4 +0,0 @@
[INFO]
name=Interface
organizationName=High Fidelity
organizationDomain=highfidelity.io

View file

@ -0,0 +1,36 @@
//
// NameCard.qml
// qml/hifi
//
// Created by Howard Stearns on 12/9/2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import Hifi 1.0
import QtQuick 2.5
import "../styles-uit"
Column {
property string displayName: "";
property string userName: "";
property int displayTextHeight: 18;
property int usernameTextHeight: 12;
RalewaySemiBold {
text: parent.displayName;
size: parent.displayTextHeight;
elide: Text.ElideRight;
width: parent.width;
}
RalewayLight {
visible: parent.displayName;
text: parent.userName;
size: parent.usernameTextHeight;
elide: Text.ElideRight;
width: parent.width;
}
}

View file

@ -0,0 +1,207 @@
//
// Pal.qml
// qml/hifi
//
// People Action List
//
// Created by Howard Stearns on 12/12/2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* TODO:
prototype:
- only show kick/mute when canKick
- margins everywhere
- column head centering
- column head font
- proper button .svg on toolbar
mvp:
- Show all participants, including ignored, and populate initial ignore/mute status.
- If name is elided, hover should scroll name left so the full name can be read.
*/
import QtQuick 2.5
import QtQuick.Controls 1.4
Rectangle {
id: pal;
property int keepFromHorizontalScroll: 1;
width: parent.width - keepFromHorizontalScroll;
height: parent.height;
property int nameWidth: width/2;
property int actionWidth: nameWidth / (table.columnCount - 1);
property int rowHeight: 50;
property var userData: [];
property var myData: ({displayName: "", userName: ""}); // valid dummy until set
property bool iAmAdmin: false;
function findSessionIndex(sessionId, optionalData) { // no findIndex in .qml
var i, data = optionalData || userData, length = data.length;
for (var i = 0; i < length; i++) {
if (data[i].sessionId === sessionId) {
return i;
}
}
return -1;
}
function fromScript(message) {
switch (message.method) {
case 'users':
var data = message.params;
var myIndex = findSessionIndex('', data);
iAmAdmin = Users.canKick;
myData = data[myIndex];
data.splice(myIndex, 1);
userData = data;
sortModel();
break;
case 'select':
var sessionId = message.params[0];
var selected = message.params[1];
var userIndex = findSessionIndex(sessionId);
if (selected) {
table.selection.clear(); // for now, no multi-select
table.selection.select(userIndex);
} else {
table.selection.deselect(userIndex);
}
break;
default:
console.log('Unrecognized message:', JSON.stringify(message));
}
}
ListModel {
id: userModel
}
function sortModel() {
var sortProperty = table.getColumn(table.sortIndicatorColumn).role;
var before = (table.sortIndicatorOrder === Qt.AscendingOrder) ? -1 : 1;
var after = -1 * before;
userData.sort(function (a, b) {
var aValue = a[sortProperty].toString().toLowerCase(), bValue = b[sortProperty].toString().toLowerCase();
switch (true) {
case (aValue < bValue): return before;
case (aValue > bValue): return after;
default: return 0;
}
});
table.selection.clear();
userModel.clear();
var userIndex = 0;
userData.forEach(function (datum) {
function init(property) {
if (datum[property] === undefined) {
datum[property] = false;
}
}
['ignore', 'spacer', 'mute', 'kick'].forEach(init);
datum.userIndex = userIndex++;
userModel.append(datum);
});
}
signal sendToScript(var message);
function noticeSelection() {
var userIds = [];
table.selection.forEach(function (userIndex) {
userIds.push(userData[userIndex].sessionId);
});
pal.sendToScript({method: 'selected', params: userIds});
}
Connections {
target: table.selection
onSelectionChanged: pal.noticeSelection()
}
Column {
NameCard {
id: myCard;
width: nameWidth;
displayName: myData.displayName;
userName: myData.userName;
}
TableView {
id: table;
TableViewColumn {
role: "displayName";
title: "Name";
width: nameWidth
}
TableViewColumn {
role: "ignore";
title: "Ignore"
width: actionWidth
}
TableViewColumn {
title: "";
width: actionWidth
}
TableViewColumn {
visible: iAmAdmin;
role: "mute";
title: "Mute";
width: actionWidth
}
TableViewColumn {
visible: iAmAdmin;
role: "kick";
title: "Ban"
width: actionWidth
}
model: userModel;
rowDelegate: Rectangle { // The only way I know to specify a row height.
height: rowHeight;
// The rest of this is cargo-culted to restore the default styling
SystemPalette {
id: myPalette;
colorGroup: SystemPalette.Active
}
color: {
var baseColor = styleData.alternate?myPalette.alternateBase:myPalette.base
return styleData.selected?myPalette.highlight:baseColor
}
}
itemDelegate: Item {
id: itemCell;
property bool isCheckBox: typeof(styleData.value) === 'boolean';
NameCard {
id: nameCard;
visible: !isCheckBox;
width: nameWidth;
displayName: styleData.value;
userName: model.userName;
}
Rectangle {
radius: itemCell.height / 4;
visible: isCheckBox;
color: styleData.value ? "green" : "red";
anchors.fill: parent;
MouseArea {
anchors.fill: parent;
acceptedButtons: Qt.LeftButton;
hoverEnabled: true;
onClicked: {
var newValue = !model[styleData.role];
var datum = userData[model.userIndex];
datum[styleData.role] = model[styleData.role] = newValue;
Users[styleData.role](model.sessionId);
// Just for now, while we cannot undo things:
userData.splice(model.userIndex, 1);
sortModel();
}
}
}
}
height: pal.height - myCard.height;
width: pal.width;
sortIndicatorVisible: true;
onSortIndicatorColumnChanged: sortModel();
onSortIndicatorOrderChanged: sortModel();
}
}
}

View file

@ -46,6 +46,8 @@
#include <gl/QOpenGLContextWrapper.h>
#include <shared/GlobalAppProperties.h>
#include <StatTracker.h>
#include <Trace.h>
#include <ResourceScriptingInterface.h>
#include <AccountManager.h>
#include <AddressManager.h>
@ -90,20 +92,21 @@
#include <PerfStat.h>
#include <PhysicsEngine.h>
#include <PhysicsHelpers.h>
#include <plugins/CodecPlugin.h>
#include <plugins/PluginManager.h>
#include <plugins/PluginUtils.h>
#include <plugins/CodecPlugin.h>
#include <plugins/SteamClientPlugin.h>
#include <RecordingScriptingInterface.h>
#include <RenderableWebEntityItem.h>
#include <RenderShadowTask.h>
#include <RenderDeferredTask.h>
#include <RenderForwardTask.h>
#include <ResourceCache.h>
#include <SandboxUtils.h>
#include <SceneScriptingInterface.h>
#include <ScriptEngines.h>
#include <ScriptCache.h>
#include <SoundCache.h>
#include <steamworks-wrapper/SteamClient.h>
#include <Tooltip.h>
#include <udt/PacketHeaders.h>
#include <UserActivityLogger.h>
@ -416,10 +419,13 @@ bool setupEssentials(int& argc, char** argv) {
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
// Set build version
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
Setting::init();
Setting::preInit();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->init();
}
DependencyManager::set<tracing::Tracer>();
#if defined(Q_OS_WIN)
// Select appropriate audio DLL
@ -441,10 +447,9 @@ bool setupEssentials(int& argc, char** argv) {
DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>();
Setting::init();
// Set dependencies
DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp));
DependencyManager::set<StatTracker>();
DependencyManager::set<ScriptEngines>();
DependencyManager::set<Preferences>();
DependencyManager::set<recording::Deck>();
@ -551,11 +556,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
_lastFaceTrackerUpdate(0)
{
setProperty(hifi::properties::STEAM, SteamClient::isRunning());
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
{
const QString TEST_SCRIPT = "--testScript";
const QString TRACE_FILE = "--traceFile";
const QStringList args = arguments();
for (int i = 0; i < args.size() - 1; ++i) {
if (args.at(i) == TEST_SCRIPT) {
@ -563,6 +570,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
if (QFileInfo(testScriptPath).exists()) {
setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
}
} else if (args.at(i) == TRACE_FILE) {
QString traceFilePath = args.at(i + 1);
setProperty(hifi::properties::TRACING, traceFilePath);
DependencyManager::get<tracing::Tracer>()->startTracing();
}
}
}
@ -606,7 +617,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_deadlockWatchdogThread = new DeadlockWatchdogThread();
_deadlockWatchdogThread->start();
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << SteamClient::getSteamVRBuildID();
if (steamClient) {
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
}
qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion());
qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION;
qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION;
@ -1569,6 +1582,13 @@ void Application::cleanupBeforeQuit() {
QString webengineRemoteDebugging = QProcessEnvironment::systemEnvironment().value("QTWEBENGINE_REMOTE_DEBUGGING", "false");
qCDebug(interfaceapp) << "QTWEBENGINE_REMOTE_DEBUGGING =" << webengineRemoteDebugging;
if (tracing::enabled()) {
auto tracer = DependencyManager::get<tracing::Tracer>();
tracer->stopTracing();
auto outputFile = property(hifi::properties::TRACING).toString();
tracer->serialize(outputFile);
}
// Stop third party processes so that they're not left running in the event of a subsequent shutdown crash.
#ifdef HAVE_DDE
DependencyManager::get<DdeFaceTracker>()->setEnabled(false);
@ -1695,6 +1715,10 @@ Application::~Application() {
Leapmotion::destroy();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->shutdown();
}
#if 0
ConnexionClient::getInstance().destroy();
#endif
@ -1739,10 +1763,14 @@ void Application::initializeGL() {
// Set up the render engine
render::CullFunctor cullFunctor = LODManager::shouldRender;
_renderEngine->addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", cullFunctor);
static const QString RENDER_FORWARD = "RENDER_FORWARD";
if (QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD)) {
_renderEngine->addJob<RenderForwardTask>("RenderForwardTask", cullFunctor);
} else {
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", cullFunctor);
}
_renderEngine->load();
_renderEngine->registerScene(_main3DScene);
// TODO: Load a cached config file
// The UI can't be created until the primary OpenGL
// context is created, because it needs to share
@ -1838,6 +1866,7 @@ void Application::initializeUi() {
rootContext->setContextProperty("Assets", new AssetMappingsScriptingInterface());
rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
rootContext->setContextProperty("Camera", &_myCamera);
@ -1874,8 +1903,10 @@ void Application::initializeUi() {
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine));
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
}
_glWidget->installEventFilter(offscreenUi.data());
offscreenUi->setMouseTranslator([=](const QPointF& pt) {
@ -1914,6 +1945,16 @@ void Application::initializeUi() {
}
void Application::paintGL() {
PROFILE_COUNTER(interfaceapp, "fps", { { "fps", _frameCounter.rate() } });
PROFILE_COUNTER(interfaceapp, "downloads", {
{ "current", ResourceCache::getLoadingRequests().length() },
{ "pending", ResourceCache::getPendingRequestCount() }
});
PROFILE_COUNTER(interfaceapp, "processing", {
{ "current", DependencyManager::get<StatTracker>()->getStat("Processing") },
{ "pending", DependencyManager::get<StatTracker>()->getStat("PendingProcessing") }
});
// Some plugins process message events, allowing paintGL to be called reentrantly.
if (_inPaint || _aboutToQuit) {
return;
@ -1925,7 +1966,7 @@ void Application::paintGL() {
_frameCount++;
auto lastPaintBegin = usecTimestampNow();
PROFILE_RANGE_EX(__FUNCTION__, 0xff0000ff, (uint64_t)_frameCount);
PROFILE_RANGE_EX(interfaceapp, __FUNCTION__, 0xff0000ff, (uint64_t)_frameCount);
PerformanceTimer perfTimer("paintGL");
if (nullptr == _displayPlugin) {
@ -2102,7 +2143,7 @@ void Application::paintGL() {
auto finalFramebuffer = framebufferCache->getFramebuffer();
{
PROFILE_RANGE(__FUNCTION__ "/mainRender");
PROFILE_RANGE(interfaceapp, "/mainRender");
PerformanceTimer perfTimer("mainRender");
renderArgs._boomOffset = boomOffset;
// Viewport is assigned to the size of the framebuffer
@ -2157,7 +2198,7 @@ void Application::paintGL() {
frame->overlay = _applicationOverlay.getOverlayTexture();
// deliver final scene rendering commands to the display plugin
{
PROFILE_RANGE(__FUNCTION__ "/pluginOutput");
PROFILE_RANGE(interfaceapp, "/pluginOutput");
PerformanceTimer perfTimer("pluginOutput");
_frameCounter.increment();
displayPlugin->submitFrame(frame);
@ -2245,7 +2286,7 @@ void Application::resizeEvent(QResizeEvent* event) {
}
void Application::resizeGL() {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
if (nullptr == _displayPlugin) {
return;
}
@ -2300,7 +2341,6 @@ bool Application::importSVOFromURL(const QString& urlString) {
}
bool Application::event(QEvent* event) {
if (!Menu::getInstance()) {
return false;
}
@ -2891,7 +2931,7 @@ void Application::maybeToggleMenuVisible(QMouseEvent* event) const {
}
void Application::mouseMoveEvent(QMouseEvent* event) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
if (_aboutToQuit) {
return;
@ -3199,9 +3239,11 @@ void Application::idle(float nsecsElapsed) {
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
}
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
SteamClient::runCallbacks();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->runCallbacks();
}
float secondsSinceLastUpdate = nsecsElapsed / NSECS_PER_MSEC / MSECS_PER_SECOND;
@ -3533,12 +3575,16 @@ void Application::init() {
_timerStart.start();
_lastTimeUpdated.start();
// when +connect_lobby in command line, join steam lobby
const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
if (lobbyIndex != -1) {
QString lobbyId = arguments().value(lobbyIndex + 1);
SteamClient::joinLobby(lobbyId);
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
// when +connect_lobby in command line, join steam lobby
const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
if (lobbyIndex != -1) {
QString lobbyId = arguments().value(lobbyIndex + 1);
steamClient->joinLobby(lobbyId);
}
}
@ -3910,9 +3956,11 @@ void Application::updateDialogs(float deltaTime) const {
}
}
static bool domainLoadingInProgress = false;
void Application::update(float deltaTime) {
PROFILE_RANGE_EX(__FUNCTION__, 0xffff0000, (uint64_t)_frameCount + 1);
PROFILE_RANGE_EX(interfaceapp, __FUNCTION__, 0xffff0000, (uint64_t)_frameCount + 1);
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::update()");
@ -3920,6 +3968,11 @@ void Application::update(float deltaTime) {
updateLOD();
if (!_physicsEnabled) {
if (!domainLoadingInProgress) {
PROFILE_ASYNC_BEGIN(interfaceapp, "Scene Loading", "");
domainLoadingInProgress = true;
}
// we haven't yet enabled physics. we wait until we think we have all the collision information
// for nearby entities before starting bullet up.
quint64 now = usecTimestampNow();
@ -3949,6 +4002,9 @@ void Application::update(float deltaTime) {
}
}
}
} else if (domainLoadingInProgress) {
domainLoadingInProgress = false;
PROFILE_ASYNC_END(interfaceapp, "Scene Loading", "");
}
{
@ -4042,12 +4098,12 @@ void Application::update(float deltaTime) {
QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
if (_physicsEnabled) {
PROFILE_RANGE_EX("Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PerformanceTimer perfTimer("physics");
{
PROFILE_RANGE_EX("UpdateStats", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "UpdateStats", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
PerformanceTimer perfTimer("updateStates)");
static VectorOfMotionStates motionStates;
@ -4081,14 +4137,14 @@ void Application::update(float deltaTime) {
});
}
{
PROFILE_RANGE_EX("StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "StepSimulation", 0xffff8000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PerformanceTimer perfTimer("stepSimulation");
getEntities()->getTree()->withWriteLock([&] {
_physicsEngine->stepSimulation();
});
}
{
PROFILE_RANGE_EX("HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "HarvestChanges", 0xffffff00, (uint64_t)getActiveDisplayPlugin()->presentCount());
PerformanceTimer perfTimer("harvestChanges");
if (_physicsEngine->hasOutgoingChanges()) {
getEntities()->getTree()->withWriteLock([&] {
@ -4130,20 +4186,20 @@ void Application::update(float deltaTime) {
_avatarSimCounter.increment();
{
PROFILE_RANGE_EX("OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "OtherAvatars", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
avatarManager->updateOtherAvatars(deltaTime);
}
qApp->updateMyAvatarLookAtPosition();
{
PROFILE_RANGE_EX("MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "MyAvatar", 0xffff00ff, (uint64_t)getActiveDisplayPlugin()->presentCount());
avatarManager->updateMyAvatar(deltaTime);
}
}
{
PROFILE_RANGE_EX("Overlays", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "Overlays", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PerformanceTimer perfTimer("overlays");
_overlays.update(deltaTime);
}
@ -4163,7 +4219,7 @@ void Application::update(float deltaTime) {
// Update my voxel servers with my current voxel query...
{
PROFILE_RANGE_EX("QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
PROFILE_RANGE_EX(interfaceapp, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
QMutexLocker viewLocker(&_viewMutex);
PerformanceTimer perfTimer("queryOctree");
quint64 sinceLastQuery = now - _lastQueriedTime;
@ -4203,7 +4259,7 @@ void Application::update(float deltaTime) {
avatarManager->postUpdate(deltaTime);
{
PROFILE_RANGE_EX("PreRenderLambdas", 0xffff0000, (uint64_t)0);
PROFILE_RANGE_EX(interfaceapp, "PreRenderLambdas", 0xffff0000, (uint64_t)0);
std::unique_lock<std::mutex> guard(_postUpdateLambdasLock);
for (auto& iter : _postUpdateLambdas) {
@ -4481,7 +4537,7 @@ QRect Application::getDesirableApplicationGeometry() const {
//
void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {
PerformanceTimer perfTimer("loadViewFrustum");
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
// We will use these below, from either the camera or head vectors calculated above
viewFrustum.setProjection(camera.getProjection());
@ -4657,7 +4713,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
myAvatar->preDisplaySide(renderArgs);
activeRenderingThread = QThread::currentThread();
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
PerformanceTimer perfTimer("display");
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()");
@ -5193,8 +5249,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine));
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine, steamClient.get()));
}
auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>();
scriptEngine->registerGlobalObject("Controller", scriptingInterface.data());
UserInputMapper::registerControllerTypes(scriptEngine);

View file

@ -18,19 +18,18 @@
#include <QLabel>
#include <PathUtils.h>
#include <QRadioButton>
#include <QSettings>
#include <QStandardPaths>
#include <QVBoxLayout>
#include <QtCore/QUrl>
#include "Application.h"
#include "Menu.h"
#include <SettingHandle.h>
#include <RunningMarker.h>
bool CrashHandler::checkForResetSettings(bool suppressPrompt) {
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings settings;
Settings settings;
settings.beginGroup("Developer");
QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions);
QVariant askToResetSettingsOption = settings.value(MenuOption::AskToResetSettings);
@ -110,8 +109,7 @@ void CrashHandler::handleCrash(CrashHandler::Action action) {
return;
}
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings settings;
Settings settings;
const QString ADDRESS_MANAGER_GROUP = "AddressManager";
const QString ADDRESS_KEY = "address";
const QString AVATAR_GROUP = "Avatar";

View file

@ -15,7 +15,8 @@
#include <AddressManager.h>
#include <DomainHandler.h>
#include <NodeList.h>
#include <steamworks-wrapper/SteamClient.h>
#include <plugins/PluginManager.h>
#include <plugins/SteamClientPlugin.h>
#include <UserActivityLogger.h>
#include <UUID.h>
@ -111,7 +112,9 @@ void DiscoverabilityManager::updateLocation() {
}
// Update Steam
SteamClient::updateLocation(domainHandler.getHostname(), addressManager->currentFacingShareableAddress());
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->updateLocation(domainHandler.getHostname(), addressManager->currentFacingShareableAddress());
}
}
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {

View file

@ -14,7 +14,6 @@
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <QSettings>
#include <gpu/Batch.h>

View file

@ -57,7 +57,6 @@
using namespace std;
const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f);
const float DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES = 30.0f;
const float MAX_WALKING_SPEED = 2.6f; // human walking speed

View file

@ -15,14 +15,13 @@
#include <QDir>
#include <QLocalSocket>
#include <QLocalServer>
#include <QSettings>
#include <QSharedMemory>
#include <QTranslator>
#include <BuildInfo.h>
#include <gl/OpenGLVersionChecker.h>
#include <SharedUtil.h>
#include <steamworks-wrapper/SteamClient.h>
#include "AddressManager.h"
#include "Application.h"
@ -32,7 +31,6 @@
#include <QtCore/QProcess>
#ifdef HAS_BUGSPLAT
#include <BuildInfo.h>
#include <BugSplat.h>
#include <CrashReporter.h>
#endif
@ -51,7 +49,13 @@ int main(int argc, const char* argv[]) {
#endif
disableQtBearerPoll(); // Fixes wifi ping spikes
// Set application infos
QCoreApplication::setApplicationName(BuildInfo::INTERFACE_NAME);
QCoreApplication::setOrganizationName(BuildInfo::MODIFIED_ORGANIZATION);
QCoreApplication::setOrganizationDomain(BuildInfo::ORGANIZATION_DOMAIN);
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
QString applicationName = "High Fidelity Interface - " + qgetenv("USERNAME");
bool instanceMightBeRunning = true;
@ -129,8 +133,10 @@ int main(int argc, const char* argv[]) {
}
QCommandLineParser parser;
QCommandLineOption checkMinSpecOption("checkMinSpec", "Check if machine meets minimum specifications");
QCommandLineOption runServerOption("runServer", "Whether to run the server");
QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
parser.addOption(checkMinSpecOption);
parser.addOption(runServerOption);
parser.addOption(serverContentPathOption);
parser.parse(arguments);
@ -157,11 +163,9 @@ int main(int argc, const char* argv[]) {
// or in the main window ctor, before GL startup.
Application::initPlugins(arguments);
SteamClient::init();
#ifdef Q_OS_WIN
// If we're running in steam mode, we need to do an explicit check to ensure we're up to the required min spec
if (SteamClient::isRunning()) {
if (parser.isSet(checkMinSpecOption)) {
QString appPath;
{
char filename[MAX_PATH];
@ -183,7 +187,6 @@ int main(int argc, const char* argv[]) {
int exitCode;
{
QSettings::setDefaultFormat(QSettings::IniFormat);
Application app(argc, const_cast<char**>(argv), startupTime, runServer, serverContentPathOptionValue);
// If we failed the OpenGLVersion check, log it.
@ -245,8 +248,6 @@ int main(int argc, const char* argv[]) {
Application::shutdownPlugins();
SteamClient::shutdown();
qCDebug(interfaceapp, "Normal exit.");
#if !defined(DEBUG) && !defined(Q_OS_LINUX)
// HACK: exit immediately (don't handle shutdown callbacks) for Release build

View file

@ -10,6 +10,10 @@
#include "TestScriptingInterface.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QLoggingCategory>
#include <DependencyManager.h>
#include <Trace.h>
TestScriptingInterface* TestScriptingInterface::getInstance() {
static TestScriptingInterface sharedInstance;
@ -28,3 +32,27 @@ void TestScriptingInterface::waitForDownloadIdle() {
void TestScriptingInterface::waitIdle() {
}
bool TestScriptingInterface::startTracing(QString logrules) {
if (!logrules.isEmpty()) {
QLoggingCategory::setFilterRules(logrules);
}
if (!DependencyManager::isSet<tracing::Tracer>()) {
return false;
}
DependencyManager::get<tracing::Tracer>()->startTracing();
return true;
}
bool TestScriptingInterface::stopTracing(QString filename) {
if (!DependencyManager::isSet<tracing::Tracer>()) {
return false;
}
auto tracer = DependencyManager::get<tracing::Tracer>();
tracer->stopTracing();
tracer->serialize(filename);
return true;
}

View file

@ -38,6 +38,17 @@ public slots:
*/
void waitIdle();
/**jsdoc
* Start recording Chrome compatible tracing events
* logRules can be used to specify a set of logging category rules to limit what gets captured
*/
bool startTracing(QString logrules = "");
/**jsdoc
* Stop recording Chrome compatible tracing events and serialize recorded events to a file
* Using a filename with a .gz extension will automatically compress the output file
*/
bool stopTracing(QString filename);
};
#endif // hifi_TestScriptingInterface_h

View file

@ -29,6 +29,7 @@
#include "ui/Stats.h"
#include "ui/AvatarInputs.h"
#include "OffscreenUi.h"
#include "InterfaceLogging.h"
#include <QQmlContext>
const vec4 CONNECTION_STATUS_BORDER_COLOR{ 1.0f, 0.0f, 0.0f, 0.8f };
@ -56,7 +57,7 @@ ApplicationOverlay::~ApplicationOverlay() {
// Renders the overlays either to a texture or to the screen
void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
buildFramebufferObject();
@ -95,7 +96,7 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) {
}
void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
if (!_uiTexture) {
_uiTexture = gpu::TexturePointer(gpu::Texture::createExternal2D(OffscreenQmlSurface::getDiscardLambda()));
@ -123,7 +124,7 @@ void ApplicationOverlay::renderQmlUi(RenderArgs* renderArgs) {
}
void ApplicationOverlay::renderAudioScope(RenderArgs* renderArgs) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
gpu::Batch& batch = *renderArgs->_batch;
auto geometryCache = DependencyManager::get<GeometryCache>();
@ -142,7 +143,7 @@ void ApplicationOverlay::renderAudioScope(RenderArgs* renderArgs) {
}
void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
gpu::Batch& batch = *renderArgs->_batch;
auto geometryCache = DependencyManager::get<GeometryCache>();
@ -261,7 +262,7 @@ static const auto DEFAULT_SAMPLER = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LI
static const auto DEPTH_FORMAT = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH);
void ApplicationOverlay::buildFramebufferObject() {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
auto uiSize = qApp->getUiSize();
if (!_overlayFramebuffer || uiSize != _overlayFramebuffer->getSize()) {
@ -287,4 +288,4 @@ gpu::TexturePointer ApplicationOverlay::getOverlayTexture() {
return gpu::TexturePointer();
}
return _overlayFramebuffer->getRenderBuffer(0);
}
}

View file

@ -17,7 +17,8 @@
#include <QtNetwork/QNetworkReply>
#include <NetworkingConstants.h>
#include <steamworks-wrapper/SteamClient.h>
#include <plugins/PluginManager.h>
#include <plugins/SteamClientPlugin.h>
#include "AccountManager.h"
#include "DependencyManager.h"
@ -56,7 +57,8 @@ void LoginDialog::toggleAction() {
}
bool LoginDialog::isSteamRunning() const {
return SteamClient::isRunning();
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
return steamClient && steamClient->isRunning();
}
void LoginDialog::login(const QString& username, const QString& password) const {
@ -66,69 +68,75 @@ void LoginDialog::login(const QString& username, const QString& password) const
void LoginDialog::loginThroughSteam() {
qDebug() << "Attempting to login through Steam";
SteamClient::requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
DependencyManager::get<AccountManager>()->requestAccessTokenWithSteam(ticket);
});
DependencyManager::get<AccountManager>()->requestAccessTokenWithSteam(ticket);
});
}
}
void LoginDialog::linkSteam() {
qDebug() << "Attempting to link Steam account";
SteamClient::requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "linkCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "linkFailed";
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "linkCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "linkFailed";
const QString LINK_STEAM_PATH = "api/v1/user/steam/link";
const QString LINK_STEAM_PATH = "api/v1/user/steam/link";
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(LINK_STEAM_PATH, AccountManagerAuth::Required,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(LINK_STEAM_PATH, AccountManagerAuth::Required,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
}
}
void LoginDialog::createAccountFromStream(QString username) {
qDebug() << "Attempting to create account from Steam info";
SteamClient::requestTicket([this, username](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this, username](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "createCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "createFailed";
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "createCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "createFailed";
const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create";
const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create";
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
if (!username.isEmpty()) {
payload.insert("username", QJsonValue::fromVariant(QVariant(username)));
}
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
if (!username.isEmpty()) {
payload.insert("username", QJsonValue::fromVariant(QVariant(username)));
}
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(CREATE_ACCOUNT_FROM_STEAM_PATH, AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(CREATE_ACCOUNT_FROM_STEAM_PATH, AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
}
}

View file

@ -292,23 +292,24 @@ void setupPreferences() {
{
static const QString RENDER("Graphics");
auto renderConfig = qApp->getRenderEngine()->getConfiguration();
if (renderConfig) {
auto ambientOcclusionConfig = renderConfig->getConfig<AmbientOcclusionEffect>();
if (ambientOcclusionConfig) {
auto getter = [ambientOcclusionConfig]()->QString { return ambientOcclusionConfig->getPreset(); };
auto setter = [ambientOcclusionConfig](QString preset) { ambientOcclusionConfig->setPreset(preset); };
auto preference = new ComboBoxPreference(RENDER, "Ambient occlusion", getter, setter);
preference->setItems(ambientOcclusionConfig->getPresetList());
preferences->addPreference(preference);
}
auto ambientOcclusionConfig = renderConfig->getConfig<AmbientOcclusionEffect>();
{
auto getter = [ambientOcclusionConfig]()->QString { return ambientOcclusionConfig->getPreset(); };
auto setter = [ambientOcclusionConfig](QString preset) { ambientOcclusionConfig->setPreset(preset); };
auto preference = new ComboBoxPreference(RENDER, "Ambient occlusion", getter, setter);
preference->setItems(ambientOcclusionConfig->getPresetList());
preferences->addPreference(preference);
}
auto shadowConfig = renderConfig->getConfig<RenderShadowTask>();
{
auto getter = [shadowConfig]()->QString { return shadowConfig->getPreset(); };
auto setter = [shadowConfig](QString preset) { shadowConfig->setPreset(preset); };
auto preference = new ComboBoxPreference(RENDER, "Shadows", getter, setter);
preference->setItems(shadowConfig->getPresetList());
preferences->addPreference(preference);
auto shadowConfig = renderConfig->getConfig<RenderShadowTask>();
if (shadowConfig) {
auto getter = [shadowConfig]()->QString { return shadowConfig->getPreset(); };
auto setter = [shadowConfig](QString preset) { shadowConfig->setPreset(preset); };
auto preference = new ComboBoxPreference(RENDER, "Shadows", getter, setter);
preference->setItems(shadowConfig->getPresetList());
preferences->addPreference(preference);
}
}
}
{

View file

@ -55,10 +55,6 @@ void SnapshotAnimated::saveSnapshotAnimated(QString pathStill, float aspectRatio
// Start the snapshotAnimatedTimer QTimer - argument for this is in milliseconds
SnapshotAnimated::snapshotAnimatedTimerRunning = true;
SnapshotAnimated::snapshotAnimatedTimer->start(SNAPSNOT_ANIMATED_FRAME_DELAY_MSEC);
// If we're already in the middle of capturing an animated snapshot...
} else {
// Just tell the dependency manager that the capture of the still snapshot has taken place.
emit dm->snapshotTaken(pathStill, "", false);
}
}
@ -88,9 +84,6 @@ void SnapshotAnimated::captureFrames() {
// If that was the last frame...
if ((SnapshotAnimated::snapshotAnimatedTimestamp - SnapshotAnimated::snapshotAnimatedFirstFrameTimestamp) >= (SnapshotAnimated::snapshotAnimatedDuration.get() * MSECS_PER_SECOND)) {
SnapshotAnimated::snapshotAnimatedTimerRunning = false;
// Reset the current frame timestamp
SnapshotAnimated::snapshotAnimatedTimestamp = 0;
SnapshotAnimated::snapshotAnimatedFirstFrameTimestamp = 0;
// Notify the user that we're processing the snapshot
emit SnapshotAnimated::snapshotAnimatedDM->processingGif();
@ -136,7 +129,10 @@ void SnapshotAnimated::processFrames() {
SnapshotAnimated::snapshotAnimatedFrameVector.squeeze();
SnapshotAnimated::snapshotAnimatedFrameDelayVector.clear();
SnapshotAnimated::snapshotAnimatedFrameDelayVector.squeeze();
// Reset the current frame timestamp
SnapshotAnimated::snapshotAnimatedTimestamp = 0;
SnapshotAnimated::snapshotAnimatedFirstFrameTimestamp = 0;
// Let the dependency manager know that the snapshots have been taken.
// Let the window scripting interface know that the snapshots have been taken.
emit SnapshotAnimated::snapshotAnimatedDM->snapshotTaken(SnapshotAnimated::snapshotStillPath, SnapshotAnimated::snapshotAnimatedPath, false);
}

View file

@ -19,6 +19,7 @@
#include <RegisteredMetaTypes.h>
#include "Application.h"
#include "InterfaceLogging.h"
#include "Image3DOverlay.h"
#include "Circle3DOverlay.h"
#include "Cube3DOverlay.h"
@ -101,7 +102,7 @@ void Overlays::cleanupOverlaysToDelete() {
}
void Overlays::renderHUD(RenderArgs* renderArgs) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(interfaceapp, __FUNCTION__);
QReadLocker lock(&_lock);
gpu::Batch& batch = *renderArgs->_batch;

View file

@ -394,7 +394,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
loadPoses(underPoses);
} else {
PROFILE_RANGE_EX("ik/relax", 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, "ik/relax", 0xffff00ff, 0);
// relax toward underPoses
// HACK: this relaxation needs to be constant per-frame rather than per-realtime
@ -433,7 +433,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
// build a list of targets from _targetVarVec
std::vector<IKTarget> targets;
{
PROFILE_RANGE_EX("ik/computeTargets", 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, "ik/computeTargets", 0xffff00ff, 0);
computeTargets(animVars, targets, underPoses);
}
@ -450,7 +450,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
} else {
{
PROFILE_RANGE_EX("ik/shiftHips", 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, "ik/shiftHips", 0xffff00ff, 0);
// shift hips according to the _hipsOffset from the previous frame
float offsetLength = glm::length(_hipsOffset);
@ -476,12 +476,12 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
}
{
PROFILE_RANGE_EX("ik/ccd", 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, "ik/ccd", 0xffff00ff, 0);
solveWithCyclicCoordinateDescent(targets);
}
{
PROFILE_RANGE_EX("ik/measureHipsOffset", 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, "ik/measureHipsOffset", 0xffff00ff, 0);
// measure new _hipsOffset for next frame
// by looking for discrepancies between where a targeted endEffector is

View file

@ -14,6 +14,9 @@
#include "AnimationCache.h"
#include "AnimationLogging.h"
#include <Trace.h>
#include <StatTracker.h>
#include <Profile.h>
int animationPointerMetaTypeId = qRegisterMetaType<AnimationPointer>();
@ -45,9 +48,14 @@ Animation::Animation(const QUrl& url) : Resource(url) {}
AnimationReader::AnimationReader(const QUrl& url, const QByteArray& data) :
_url(url),
_data(data) {
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
}
void AnimationReader::run() {
DependencyManager::get<StatTracker>()->decrementStat("PendingProcessing");
CounterStat counter("Processing");
PROFILE_RANGE_EX(animation, __FUNCTION__, 0xFF00FF00, 0, { { "url", _url.toString() } });
auto originalPriority = QThread::currentThread()->priority();
if (originalPriority == QThread::InheritPriority) {
originalPriority = QThread::NormalPriority;

View file

@ -65,6 +65,8 @@ public:
explicit Animation(const QUrl& url);
QString getType() const override { return "Animation"; }
const FBXGeometry& getGeometry() const { return *_geometry; }
virtual bool isLoaded() const override;

View file

@ -882,7 +882,7 @@ void Rig::updateAnimationStateHandlers() { // called on avatar update thread (wh
void Rig::updateAnimations(float deltaTime, glm::mat4 rootTransform) {
PROFILE_RANGE_EX(__FUNCTION__, 0xffff00ff, 0);
PROFILE_RANGE_EX(animation, __FUNCTION__, 0xffff00ff, 0);
setModelOffset(rootTransform);
@ -973,10 +973,6 @@ void Rig::updateFromEyeParameters(const EyeParameters& params) {
params.worldHeadOrientation, params.eyeLookAt, params.eyeSaccade);
}
static const glm::vec3 X_AXIS(1.0f, 0.0f, 0.0f);
static const glm::vec3 Y_AXIS(0.0f, 1.0f, 0.0f);
static const glm::vec3 Z_AXIS(0.0f, 0.0f, 1.0f);
void Rig::computeHeadNeckAnimVars(const AnimPose& hmdPose, glm::vec3& headPositionOut, glm::quat& headOrientationOut,
glm::vec3& neckPositionOut, glm::quat& neckOrientationOut) const {

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@
#include <stdint.h>
static const int SRC_MAX_CHANNELS = 2;
static const int SRC_MAX_CHANNELS = 4;
// polyphase filter
static const int SRC_PHASEBITS = 8;
@ -48,8 +48,6 @@ public:
int getMinInput(int outputFrames);
int getMaxInput(int outputFrames);
int getExactInput(int outputFrames);
private:
float* _polyphaseFilter;
int* _stepTable;
@ -77,12 +75,18 @@ private:
int multirateFilter1(const float* input0, float* output0, int inputFrames);
int multirateFilter2(const float* input0, const float* input1, float* output0, float* output1, int inputFrames);
int multirateFilter4(const float* input0, const float* input1, const float* input2, const float* input3,
float* output0, float* output1, float* output2, float* output3, int inputFrames);
int multirateFilter1_SSE(const float* input0, float* output0, int inputFrames);
int multirateFilter2_SSE(const float* input0, const float* input1, float* output0, float* output1, int inputFrames);
int multirateFilter1_ref(const float* input0, float* output0, int inputFrames);
int multirateFilter2_ref(const float* input0, const float* input1, float* output0, float* output1, int inputFrames);
int multirateFilter4_ref(const float* input0, const float* input1, const float* input2, const float* input3,
float* output0, float* output1, float* output2, float* output3, int inputFrames);
int multirateFilter1_AVX2(const float* input0, float* output0, int inputFrames);
int multirateFilter2_AVX2(const float* input0, const float* input1, float* output0, float* output1, int inputFrames);
int multirateFilter4_AVX2(const float* input0, const float* input1, const float* input2, const float* input3,
float* output0, float* output1, float* output2, float* output3, int inputFrames);
void convertInput(const int16_t* input, float** outputs, int numFrames);
void convertOutput(float** inputs, int16_t* output, int numFrames);

View file

@ -97,54 +97,9 @@ void Sound::downSample(const QByteArray& rawAudioByteArray, int sampleRate) {
// no resampling needed
_byteArray = rawAudioByteArray;
} else if (_isAmbisonic) {
// FIXME: add a proper Ambisonic resampler!
int numChannels = 4;
AudioSRC resampler[4] { {sampleRate, AudioConstants::SAMPLE_RATE, 1},
{sampleRate, AudioConstants::SAMPLE_RATE, 1},
{sampleRate, AudioConstants::SAMPLE_RATE, 1},
{sampleRate, AudioConstants::SAMPLE_RATE, 1} };
// resize to max possible output
int numSourceFrames = rawAudioByteArray.size() / (numChannels * sizeof(AudioConstants::AudioSample));
int maxDestinationFrames = resampler[0].getMaxOutput(numSourceFrames);
int maxDestinationBytes = maxDestinationFrames * numChannels * sizeof(AudioConstants::AudioSample);
_byteArray.resize(maxDestinationBytes);
int numDestinationFrames = 0;
// iterate over channels
int16_t* srcBuffer = new int16_t[numSourceFrames];
int16_t* dstBuffer = new int16_t[maxDestinationFrames];
for (int ch = 0; ch < 4; ch++) {
int16_t* src = (int16_t*)rawAudioByteArray.data();
int16_t* dst = (int16_t*)_byteArray.data();
// deinterleave samples
for (int i = 0; i < numSourceFrames; i++) {
srcBuffer[i] = src[4*i + ch];
}
// resample one channel
numDestinationFrames = resampler[ch].render(srcBuffer, dstBuffer, numSourceFrames);
// reinterleave samples
for (int i = 0; i < numDestinationFrames; i++) {
dst[4*i + ch] = dstBuffer[i];
}
}
delete[] srcBuffer;
delete[] dstBuffer;
// truncate to actual output
int numDestinationBytes = numDestinationFrames * numChannels * sizeof(AudioConstants::AudioSample);
_byteArray.resize(numDestinationBytes);
} else {
int numChannels = _isStereo ? 2 : 1;
int numChannels = _isAmbisonic ? AudioConstants::AMBISONIC : (_isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
AudioSRC resampler(sampleRate, AudioConstants::SAMPLE_RATE, numChannels);
// resize to max possible output

View file

@ -198,4 +198,109 @@ int AudioSRC::multirateFilter2_AVX2(const float* input0, const float* input1, fl
return outputFrames;
}
int AudioSRC::multirateFilter4_AVX2(const float* input0, const float* input1, const float* input2, const float* input3,
float* output0, float* output1, float* output2, float* output3, int inputFrames) {
int outputFrames = 0;
assert(_numTaps % 8 == 0); // SIMD8
if (_step == 0) { // rational
int32_t i = HI32(_offset);
while (i < inputFrames) {
const float* c0 = &_polyphaseFilter[_numTaps * _phase];
__m256 acc0 = _mm256_setzero_ps();
__m256 acc1 = _mm256_setzero_ps();
__m256 acc2 = _mm256_setzero_ps();
__m256 acc3 = _mm256_setzero_ps();
for (int j = 0; j < _numTaps; j += 8) {
//float coef = c0[j];
__m256 coef0 = _mm256_loadu_ps(&c0[j]);
//acc += input[i + j] * coef;
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j]), coef0, acc0);
acc1 = _mm256_fmadd_ps(_mm256_loadu_ps(&input1[i + j]), coef0, acc1);
acc2 = _mm256_fmadd_ps(_mm256_loadu_ps(&input2[i + j]), coef0, acc2);
acc3 = _mm256_fmadd_ps(_mm256_loadu_ps(&input3[i + j]), coef0, acc3);
}
// horizontal sum
acc0 = _mm256_hadd_ps(acc0, acc1);
acc2 = _mm256_hadd_ps(acc2, acc3);
acc0 = _mm256_hadd_ps(acc0, acc2);
__m128 t0 = _mm_add_ps(_mm256_castps256_ps128(acc0), _mm256_extractf128_ps(acc0, 1));
_mm_store_ss(&output0[outputFrames], t0);
_mm_store_ss(&output1[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,1)));
_mm_store_ss(&output2[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,2)));
_mm_store_ss(&output3[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,3)));
outputFrames += 1;
i += _stepTable[_phase];
if (++_phase == _upFactor) {
_phase = 0;
}
}
_offset = (int64_t)(i - inputFrames) << 32;
} else { // irrational
while (HI32(_offset) < inputFrames) {
int32_t i = HI32(_offset);
uint32_t f = LO32(_offset);
uint32_t phase = f >> SRC_FRACBITS;
float ftmp = (f & SRC_FRACMASK) * QFRAC_TO_FLOAT;
const float* c0 = &_polyphaseFilter[_numTaps * (phase + 0)];
const float* c1 = &_polyphaseFilter[_numTaps * (phase + 1)];
__m256 acc0 = _mm256_setzero_ps();
__m256 acc1 = _mm256_setzero_ps();
__m256 acc2 = _mm256_setzero_ps();
__m256 acc3 = _mm256_setzero_ps();
__m256 frac = _mm256_broadcast_ss(&ftmp);
for (int j = 0; j < _numTaps; j += 8) {
//float coef = c0[j] + frac * (c1[j] - c0[j]);
__m256 coef0 = _mm256_loadu_ps(&c0[j]);
__m256 coef1 = _mm256_loadu_ps(&c1[j]);
coef1 = _mm256_sub_ps(coef1, coef0);
coef0 = _mm256_fmadd_ps(coef1, frac, coef0);
//acc += input[i + j] * coef;
acc0 = _mm256_fmadd_ps(_mm256_loadu_ps(&input0[i + j]), coef0, acc0);
acc1 = _mm256_fmadd_ps(_mm256_loadu_ps(&input1[i + j]), coef0, acc1);
acc2 = _mm256_fmadd_ps(_mm256_loadu_ps(&input2[i + j]), coef0, acc2);
acc3 = _mm256_fmadd_ps(_mm256_loadu_ps(&input3[i + j]), coef0, acc3);
}
// horizontal sum
acc0 = _mm256_hadd_ps(acc0, acc1);
acc2 = _mm256_hadd_ps(acc2, acc3);
acc0 = _mm256_hadd_ps(acc0, acc2);
__m128 t0 = _mm_add_ps(_mm256_castps256_ps128(acc0), _mm256_extractf128_ps(acc0, 1));
_mm_store_ss(&output0[outputFrames], t0);
_mm_store_ss(&output1[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,1)));
_mm_store_ss(&output2[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,2)));
_mm_store_ss(&output3[outputFrames], _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(0,0,0,3)));
outputFrames += 1;
_offset += _step;
}
_offset -= (int64_t)inputFrames << 32;
}
_mm256_zeroupper();
return outputFrames;
}
#endif

View file

@ -12,8 +12,6 @@
#ifndef hifi_AutoUpdater_h
#define hifi_AutoUpdater_h
#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QMap>

View file

@ -16,7 +16,6 @@
#include <QtOpenGL/QGLWidget>
#include <QtGui/QImage>
#if defined(Q_OS_MAC)
#include <OpenGL/CGLCurrent.h>
#endif
@ -44,6 +43,7 @@
#include <CursorManager.h>
#include "CompositorHelper.h"
#include "Logging.h"
const char* SRGB_TO_LINEAR_FRAG = R"SCRIBE(
@ -129,7 +129,7 @@ public:
_context->makeCurrent();
while (!_shutdown) {
if (_pendingMainThreadOperation) {
PROFILE_RANGE("MainThreadOp")
PROFILE_RANGE(displayPlugins, "MainThreadOp")
{
Lock lock(_mutex);
_context->doneCurrent();
@ -203,7 +203,7 @@ public:
// Execute the frame and present it to the display device.
_context->makeCurrent();
{
PROFILE_RANGE("PluginPresent")
PROFILE_RANGE(displayPlugins, "PluginPresent")
currentPlugin->present();
CHECK_GL_ERROR();
}
@ -560,22 +560,22 @@ void OpenGLDisplayPlugin::compositeLayers() {
updateCompositeFramebuffer();
{
PROFILE_RANGE_EX("compositeScene", 0xff0077ff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "compositeScene", 0xff0077ff, (uint64_t)presentCount())
compositeScene();
}
{
PROFILE_RANGE_EX("compositeOverlay", 0xff0077ff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "compositeOverlay", 0xff0077ff, (uint64_t)presentCount())
compositeOverlay();
}
auto compositorHelper = DependencyManager::get<CompositorHelper>();
if (compositorHelper->getReticleVisible()) {
PROFILE_RANGE_EX("compositePointer", 0xff0077ff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "compositePointer", 0xff0077ff, (uint64_t)presentCount())
compositePointer();
}
{
PROFILE_RANGE_EX("compositeExtra", 0xff0077ff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "compositeExtra", 0xff0077ff, (uint64_t)presentCount())
compositeExtra();
}
}
@ -595,12 +595,12 @@ void OpenGLDisplayPlugin::internalPresent() {
}
void OpenGLDisplayPlugin::present() {
PROFILE_RANGE_EX(__FUNCTION__, 0xffffff00, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, __FUNCTION__, 0xffffff00, (uint64_t)presentCount())
updateFrameData();
incrementPresentCount();
{
PROFILE_RANGE_EX("recycle", 0xff00ff00, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "recycle", 0xff00ff00, (uint64_t)presentCount())
_gpuContext->recycle();
}
@ -614,19 +614,19 @@ void OpenGLDisplayPlugin::present() {
_lastFrame = _currentFrame.get();
});
// Execute the frame rendering commands
PROFILE_RANGE_EX("execute", 0xff00ff00, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "execute", 0xff00ff00, (uint64_t)presentCount())
_gpuContext->executeFrame(_currentFrame);
}
// Write all layers to a local framebuffer
{
PROFILE_RANGE_EX("composite", 0xff00ffff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "composite", 0xff00ffff, (uint64_t)presentCount())
compositeLayers();
}
// Take the composite framebuffer and send it to the output device
{
PROFILE_RANGE_EX("internalPresent", 0xff00ffff, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, "internalPresent", 0xff00ffff, (uint64_t)presentCount())
internalPresent();
}

View file

@ -206,7 +206,7 @@ float HmdDisplayPlugin::getLeftCenterPixel() const {
}
void HmdDisplayPlugin::internalPresent() {
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
PROFILE_RANGE_EX(displayPlugins, __FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
// Composite together the scene, overlay and mouse cursor
hmdPresent();

View file

@ -211,7 +211,7 @@ namespace render {
template <> void payloadRender(const RenderableModelEntityItemMeta::Pointer& payload, RenderArgs* args) {
if (args) {
if (payload && payload->entity) {
PROFILE_RANGE("MetaModelRender");
PROFILE_RANGE(renderlogging, "MetaModelRender");
payload->entity->render(args);
}
}

View file

@ -321,7 +321,7 @@ FBXNode parseTextFBXNode(Tokenizer& tokenizer) {
}
FBXNode FBXReader::parseFBX(QIODevice* device) {
PROFILE_RANGE_EX(__FUNCTION__, 0xff0000ff, device);
PROFILE_RANGE_EX(modelformat, __FUNCTION__, 0xff0000ff, device);
// verify the prolog
const QByteArray BINARY_PROLOG = "Kaydara FBX Binary ";
if (device->peek(BINARY_PROLOG.size()) != BINARY_PROLOG) {

View file

@ -420,7 +420,7 @@ done:
FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping, const QUrl& url) {
PROFILE_RANGE_EX(__FUNCTION__, 0xffff0000, nullptr);
PROFILE_RANGE_EX(modelformat, __FUNCTION__, 0xffff0000, nullptr);
QBuffer buffer { &model };
buffer.open(QIODevice::ReadOnly);

View file

@ -11,4 +11,4 @@
#include "GLLogging.h"
Q_LOGGING_CATEGORY(glLogging, "hifi.glLogging")
Q_LOGGING_CATEGORY(glLogging, "hifi.gl")

View file

@ -284,7 +284,7 @@ void OffscreenQmlSurface::render() {
GLuint texture = offscreenTextures.getNextTexture(_size);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo);
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
PROFILE_RANGE("qml_render->rendercontrol")
PROFILE_RANGE(glLogging, "qml_render->rendercontrol")
_renderControl->render();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, texture);
@ -622,7 +622,7 @@ void OffscreenQmlSurface::updateQuick() {
}
if (_render) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(glLogging, __FUNCTION__);
render();
_render = false;
}

View file

@ -30,6 +30,7 @@
#include "GLTexture.h"
#include "GLShader.h"
using namespace gpu;
using namespace gpu::gl;
@ -199,7 +200,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
_inRenderTransferPass = true;
{ // Sync all the buffers
PROFILE_RANGE("syncGPUBuffer");
PROFILE_RANGE(gpugllogging, "syncGPUBuffer");
for (auto& cached : batch._buffers._items) {
if (cached._data) {
@ -209,7 +210,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
}
{ // Sync all the buffers
PROFILE_RANGE("syncCPUTransform");
PROFILE_RANGE(gpugllogging, "syncCPUTransform");
_transform._cameras.clear();
_transform._cameraOffsets.clear();
@ -241,7 +242,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
}
{ // Sync the transform buffers
PROFILE_RANGE("syncGPUTransform");
PROFILE_RANGE(gpugllogging, "syncGPUTransform");
transferTransformState(batch);
}
@ -303,7 +304,7 @@ void GLBackend::render(const Batch& batch) {
}
{
PROFILE_RANGE("Transfer");
PROFILE_RANGE(gpugllogging, "Transfer");
renderPassTransfer(batch);
}
@ -313,7 +314,7 @@ void GLBackend::render(const Batch& batch) {
}
#endif
{
PROFILE_RANGE(_stereo._enable ? "Render Stereo" : "Render");
PROFILE_RANGE(gpugllogging, _stereo._enable ? "Render Stereo" : "Render");
renderPassDraw(batch);
}
#ifdef GPU_STEREO_DRAWCALL_INSTANCED

View file

@ -10,6 +10,7 @@
//
#include "GLBackend.h"
#include "GLQuery.h"
#include "GLShared.h"
using namespace gpu;
using namespace gpu::gl;
@ -27,7 +28,7 @@ void GLBackend::do_beginQuery(const Batch& batch, size_t paramOffset) {
auto query = batch._queries.get(batch._params[paramOffset]._uint);
GLQuery* glquery = syncGPUObject(*query);
if (glquery) {
PROFILE_RANGE_BEGIN(glquery->_profileRangeId, query->getName().c_str(), 0xFFFF7F00);
PROFILE_RANGE_BEGIN(gpugllogging, glquery->_profileRangeId, query->getName().c_str(), 0xFFFF7F00);
++_queryStage._rangeQueryDepth;
glGetInteger64v(GL_TIMESTAMP, (GLint64*)&glquery->_batchElapsedTime);
@ -61,7 +62,7 @@ void GLBackend::do_endQuery(const Batch& batch, size_t paramOffset) {
glGetInteger64v(GL_TIMESTAMP, &now);
glquery->_batchElapsedTime = now - glquery->_batchElapsedTime;
PROFILE_RANGE_END(glquery->_profileRangeId);
PROFILE_RANGE_END(gpugllogging, glquery->_profileRangeId);
(void)CHECK_GL_ERROR();
}

View file

@ -12,7 +12,6 @@
#include <unordered_set>
#include <unordered_map>
#include <QtCore/QThread>
#include "../gl/GLTexelFormat.h"
@ -123,7 +122,7 @@ void GL41Texture::transferMip(uint16_t mipLevel, uint8_t face) const {
}
void GL41Texture::startTransfer() {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(gpugllogging, __FUNCTION__);
Parent::startTransfer();
glBindTexture(_target, _id);

View file

@ -17,6 +17,7 @@
#include <QtCore/QDebug>
#include <QtCore/QThread>
#include <Trace.h>
#include <NumericalConstants.h>
@ -757,6 +758,9 @@ bool sphericalHarmonicsFromTexture(const gpu::Texture& cubeTexture, std::vector<
if(width != cubeTexture.getHeight()) {
return false;
}
PROFILE_RANGE(gpulogging, "sphericalHarmonicsFromTexture");
const uint sqOrder = order*order;
// allocate memory for calculations
@ -788,6 +792,7 @@ bool sphericalHarmonicsFromTexture(const gpu::Texture& cubeTexture, std::vector<
// for each face of cube texture
for(int face=0; face < gpu::Texture::NUM_CUBE_FACES; face++) {
PROFILE_RANGE(gpulogging, "ProcessFace");
auto numComponents = cubeTexture.accessStoredMipFace(0,face)->getFormat().getScalarCount();
auto data = cubeTexture.accessStoredMipFace(0,face)->readData();
@ -995,4 +1000,4 @@ Texture::ExternalUpdates Texture::getUpdates() const {
_externalUpdates.swap(result);
}
return result;
}
}

View file

@ -21,6 +21,8 @@
#include <QThreadPool>
#include "ModelNetworkingLogging.h"
#include <Trace.h>
#include <StatTracker.h>
class GeometryReader;
@ -39,6 +41,8 @@ class GeometryMappingResource : public GeometryResource {
public:
GeometryMappingResource(const QUrl& url) : GeometryResource(url) {};
QString getType() const override { return "GeometryMapping"; }
virtual void downloadFinished(const QByteArray& data) override;
private slots:
@ -50,6 +54,9 @@ private:
};
void GeometryMappingResource::downloadFinished(const QByteArray& data) {
PROFILE_ASYNC_BEGIN(modelnetworking, "GeometryMappingResource::downloadFinished", _url.toString(),
{ { "url", _url.toString() } });
auto mapping = FSTReader::readMapping(data);
QString filename = mapping.value("filename").toString();
@ -113,6 +120,7 @@ void GeometryMappingResource::onGeometryMappingLoaded(bool success) {
disconnect(_connection); // FIXME Should not have to do this
}
PROFILE_ASYNC_END(modelnetworking, "GeometryMappingResource::downloadFinished", _url.toString());
finishedLoading(success);
}
@ -120,8 +128,10 @@ class GeometryReader : public QRunnable {
public:
GeometryReader(QWeakPointer<Resource>& resource, const QUrl& url, const QVariantHash& mapping,
const QByteArray& data) :
_resource(resource), _url(url), _mapping(mapping), _data(data) {}
virtual ~GeometryReader() = default;
_resource(resource), _url(url), _mapping(mapping), _data(data) {
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
}
virtual void run() override;
@ -133,6 +143,9 @@ private:
};
void GeometryReader::run() {
DependencyManager::get<StatTracker>()->decrementStat("PendingProcessing");
CounterStat counter("Processing");
PROFILE_RANGE_EX(modelnetworking, "GeometryReader::run", 0xFF00FF00, 0, { { "url", _url.toString() } });
auto originalPriority = QThread::currentThread()->priority();
if (originalPriority == QThread::InheritPriority) {
originalPriority = QThread::NormalPriority;
@ -197,6 +210,8 @@ public:
GeometryDefinitionResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl) :
GeometryResource(url, resolveTextureBaseUrl(url, textureBaseUrl)), _mapping(mapping) {}
QString getType() const override { return "GeometryDefinition"; }
virtual void downloadFinished(const QByteArray& data) override;
protected:

View file

@ -14,6 +14,9 @@
class NetworkShader : public Resource {
public:
NetworkShader(const QUrl& url);
QString getType() const override { return "NetworkShader"; }
virtual void downloadFinished(const QByteArray& data) override;
QString _source;

View file

@ -33,6 +33,8 @@
#include <PathUtils.h>
#include "ModelNetworkingLogging.h"
#include <Trace.h>
#include <StatTracker.h>
TextureCache::TextureCache() {
setUnusedResourceCacheSize(0);
@ -331,6 +333,7 @@ ImageReader::ImageReader(const QWeakPointer<Resource>& resource, const QByteArra
outFile.close();
}
#endif
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
}
void ImageReader::listSupportedImageFormats() {
@ -342,7 +345,11 @@ void ImageReader::listSupportedImageFormats() {
}
void ImageReader::run() {
PROFILE_RANGE_EX(__FUNCTION__, 0xffff0000, nullptr);
DependencyManager::get<StatTracker>()->decrementStat("PendingProcessing");
CounterStat counter("Processing");
PROFILE_RANGE_EX(modelnetworking, __FUNCTION__, 0xffff0000, 0, { { "url", _url.toString() } });
auto originalPriority = QThread::currentThread()->priority();
if (originalPriority == QThread::InheritPriority) {
originalPriority = QThread::NormalPriority;
@ -356,7 +363,6 @@ void ImageReader::run() {
qCWarning(modelnetworking) << "Abandoning load of" << _url << "; could not get strong ref";
return;
}
listSupportedImageFormats();
// Help the QImage loader by extracting the image file format from the url filename ext.
@ -378,7 +384,6 @@ void ImageReader::run() {
}
return;
}
gpu::TexturePointer texture = nullptr;
{
// Double-check the resource still exists between long operations.
@ -390,7 +395,7 @@ void ImageReader::run() {
auto url = _url.toString().toStdString();
PROFILE_RANGE_EX(__FUNCTION__"::textureLoader", 0xffffff00, nullptr);
PROFILE_RANGE_EX(modelnetworking, __FUNCTION__, 0xffffff00, 0);
texture.reset(resource.dynamicCast<NetworkTexture>()->getTextureLoader()(image, url));
}

View file

@ -63,10 +63,13 @@ public:
NetworkTexture(const QUrl& url, Type type, const QByteArray& content);
NetworkTexture(const QUrl& url, const TextureLoaderFunc& textureLoader, const QByteArray& content);
QString getType() const override { return "NetworkTexture"; }
int getOriginalWidth() const { return _originalWidth; }
int getOriginalHeight() const { return _originalHeight; }
int getWidth() const { return _width; }
int getHeight() const { return _height; }
Type getTextureType() const { return _type; }
TextureLoaderFunc getTextureLoader() const;

View file

@ -14,6 +14,8 @@
#include <QPainter>
#include <QDebug>
#include <Profile.h>
#include "ModelLogging.h"
using namespace model;
@ -744,6 +746,8 @@ const CubeLayout CubeLayout::CUBEMAP_LAYOUTS[] = {
const int CubeLayout::NUM_CUBEMAP_LAYOUTS = sizeof(CubeLayout::CUBEMAP_LAYOUTS) / sizeof(CubeLayout);
gpu::Texture* TextureUsage::processCubeTextureColorFromImage(const QImage& srcImage, const std::string& srcImageName, bool isLinear, bool doCompress, bool generateMips, bool generateIrradiance) {
PROFILE_RANGE(modelLog, "processCubeTextureColorFromImage");
gpu::Texture* theTexture = nullptr;
if ((srcImage.width() > 0) && (srcImage.height() > 0)) {
QImage image = processSourceImage(srcImage, true);
@ -801,11 +805,13 @@ gpu::Texture* TextureUsage::processCubeTextureColorFromImage(const QImage& srcIm
}
if (generateMips) {
PROFILE_RANGE(modelLog, "generateMips");
theTexture->autoGenerateMips(-1);
}
// Generate irradiance while we are at it
if (generateIrradiance) {
PROFILE_RANGE(modelLog, "generateIrradiance");
theTexture->generateIrradiance();
}
}

View file

@ -105,7 +105,7 @@ QUrl AddressManager::currentFacingShareableAddress() const {
void AddressManager::loadSettings(const QString& lookupString) {
if (lookupString.isEmpty()) {
handleUrl(currentAddressHandle.get().toString(), LookupTrigger::StartupFromSettings);
handleUrl(currentAddressHandle.get(), LookupTrigger::StartupFromSettings);
} else {
handleUrl(lookupString, LookupTrigger::StartupFromSettings);
}

View file

@ -604,7 +604,7 @@ bool AssetClient::cancelGetAssetRequest(MessageID id) {
for (auto& kv : _pendingRequests) {
auto& messageCallbackMap = kv.second;
auto requestIt = messageCallbackMap.find(id);
if (requestIt != kv.second.end()) {
if (requestIt != messageCallbackMap.end()) {
auto& message = requestIt->second.message;
if (message) {

View file

@ -19,8 +19,12 @@
#include "NetworkLogging.h"
#include "NodeList.h"
#include "ResourceCache.h"
#include <Trace.h>
static int requestID = 0;
AssetRequest::AssetRequest(const QString& hash) :
_requestID(++requestID),
_hash(hash)
{
}

View file

@ -56,6 +56,7 @@ signals:
void progress(qint64 totalReceived, qint64 total);
private:
int _requestID;
State _state = NotStarted;
Error _error = NoError;
AssetInfo _info;

View file

@ -17,6 +17,8 @@
#include "AssetUtils.h"
#include "MappingRequest.h"
#include "NetworkLogging.h"
#include <Trace.h>
#include <Profile.h>
static const int DOWNLOAD_PROGRESS_LOG_INTERVAL_SECONDS = 5;
@ -27,12 +29,14 @@ AssetResourceRequest::AssetResourceRequest(const QUrl& url) :
}
AssetResourceRequest::~AssetResourceRequest() {
if (_assetMappingRequest) {
_assetMappingRequest->deleteLater();
}
if (_assetRequest) {
_assetRequest->deleteLater();
if (_assetRequest || _assetMappingRequest) {
if (_assetMappingRequest) {
_assetMappingRequest->deleteLater();
}
if (_assetRequest) {
_assetRequest->deleteLater();
}
}
}
@ -108,7 +112,6 @@ void AssetResourceRequest::requestMappingForPath(const AssetPath& path) {
}
void AssetResourceRequest::requestHash(const AssetHash& hash) {
// Make request to atp
auto assetClient = DependencyManager::get<AssetClient>();
_assetRequest = assetClient->createRequest(hash);
@ -118,7 +121,7 @@ void AssetResourceRequest::requestHash(const AssetHash& hash) {
Q_ASSERT(_state == InProgress);
Q_ASSERT(req == _assetRequest);
Q_ASSERT(req->getState() == AssetRequest::Finished);
switch (req->getError()) {
case AssetRequest::Error::NoError:
_data = req->getData();

View file

@ -19,6 +19,7 @@
#include <BuildInfo.h>
#include "Assignment.h"
#include <QtCore/QStandardPaths>
#include <QtCore/QDir>
Assignment::Type Assignment::typeForNodeType(NodeType_t nodeType) {
switch (nodeType) {
@ -51,7 +52,7 @@ Assignment::Assignment() :
}
Assignment::Assignment(Assignment::Command command, Assignment::Type type, const QString& pool, Assignment::Location location) :
Assignment::Assignment(Assignment::Command command, Assignment::Type type, const QString& pool, Assignment::Location location, QString dataDirectory) :
_uuid(),
_command(command),
_type(type),
@ -60,7 +61,8 @@ Assignment::Assignment(Assignment::Command command, Assignment::Type type, const
_payload(),
_isStatic(false),
_walletUUID(),
_nodeVersion()
_nodeVersion(),
_dataDirectory(dataDirectory)
{
if (_command == Assignment::CreateCommand) {
// this is a newly created assignment, generate a random UUID

View file

@ -55,7 +55,8 @@ public:
Assignment(Assignment::Command command,
Assignment::Type type,
const QString& pool = emptyPool,
Assignment::Location location = Assignment::LocalLocation);
Assignment::Location location = Assignment::LocalLocation,
QString dataDirectory = QString());
Assignment(const Assignment& otherAssignment);
Assignment& operator=(const Assignment &rhsAssignment);
@ -103,6 +104,7 @@ protected:
bool _isStatic; /// defines if this assignment needs to be re-queued in the domain-server if it stops being fulfilled
QUuid _walletUUID; /// the UUID for the wallet that should be paid for this assignment
QString _nodeVersion;
QString _dataDirectory;
};
uint qHash(const Assignment::Type& key, uint seed);

View file

@ -109,6 +109,10 @@ void HifiSockAddr::handleLookupResult(const QHostInfo& hostInfo) {
}
}
QString HifiSockAddr::toString() const {
return _address.toString() + ":" + QString::number(_port);
}
QDebug operator<<(QDebug debug, const HifiSockAddr& sockAddr) {
debug.nospace() << sockAddr._address.toString().toLocal8Bit().constData() << ":" << sockAddr._port;
return debug.space();

View file

@ -53,6 +53,8 @@ public:
static int packSockAddr(unsigned char* packetData, const HifiSockAddr& packSockAddr);
static int unpackSockAddr(const unsigned char* packetData, HifiSockAddr& unpackDestSockAddr);
QString toString() const;
friend QDebug operator<<(QDebug debug, const HifiSockAddr& sockAddr);
friend QDataStream& operator<<(QDataStream& dataStream, const HifiSockAddr& sockAddr);
friend QDataStream& operator>>(QDataStream& dataStream, HifiSockAddr& sockAddr);

View file

@ -37,6 +37,7 @@
#include "HifiSockAddr.h"
#include "NetworkLogging.h"
#include "udt/Packet.h"
#include <Trace.h>
static Setting::Handle<quint16> LIMITED_NODELIST_LOCAL_PORT("LimitedNodeList.LocalPort", 0);
@ -1116,7 +1117,6 @@ void LimitedNodeList::flagTimeForConnectionStep(ConnectionStep connectionStep) {
}
void LimitedNodeList::flagTimeForConnectionStep(ConnectionStep connectionStep, quint64 timestamp) {
if (connectionStep == ConnectionStep::LookupAddress) {
QWriteLocker writeLock(&_connectionTimeLock);

View file

@ -103,8 +103,7 @@ public:
ReceiveFirstAudioPacket
};
Q_ENUMS(ConnectionStep);
Q_ENUM(ConnectionStep);
const QUuid& getSessionUUID() const { return _sessionUUID; }
void setSessionUUID(const QUuid& sessionUUID);

View file

@ -12,5 +12,6 @@
#include "NetworkLogging.h"
Q_LOGGING_CATEGORY(networking, "hifi.networking")
Q_LOGGING_CATEGORY(resourceLog, "hifi.networking.resource")
Q_LOGGING_CATEGORY(asset_client, "hifi.networking.asset_client")
Q_LOGGING_CATEGORY(messages_client, "hifi.networking.messages_client")

View file

@ -14,6 +14,7 @@
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(resourceLog)
Q_DECLARE_LOGGING_CATEGORY(networking)
Q_DECLARE_LOGGING_CATEGORY(asset_client)
Q_DECLARE_LOGGING_CATEGORY(messages_client)

View file

@ -20,6 +20,8 @@
#include "BandwidthRecorder.h"
#include "NetworkLogging.h"
#include <Trace.h>
#include "NodeType.h"
NetworkPeer::NetworkPeer(QObject* parent) :
@ -156,6 +158,7 @@ void NetworkPeer::activateMatchingOrNewSymmetricSocket(const HifiSockAddr& match
}
void NetworkPeer::softReset() {
qDebug() << "Soft reset ";
// a soft reset should clear the sockets and reset the number of connection attempts
_localSocket.clear();
_publicSocket.clear();

View file

@ -32,6 +32,7 @@
#include "NetworkLogging.h"
#include "udt/PacketHeaders.h"
#include "SharedUtil.h"
#include <Trace.h>
const int KEEPALIVE_PING_INTERVAL_MS = 1000;

View file

@ -23,6 +23,8 @@
#include "NodeList.h"
#include "ResourceCache.h"
#include <Trace.h>
#include <Profile.h>
#define clamp(x, min, max) (((x) < (min)) ? (min) :\
(((x) > (max)) ? (max) :\
@ -495,11 +497,12 @@ const int DEFAULT_REQUEST_LIMIT = 10;
int ResourceCache::_requestLimit = DEFAULT_REQUEST_LIMIT;
int ResourceCache::_requestsActive = 0;
static int requestID = 0;
Resource::Resource(const QUrl& url) :
_url(url),
_activeUrl(url),
_request(nullptr) {
_requestID(++requestID) {
init();
}
@ -647,20 +650,24 @@ void Resource::reinsert() {
void Resource::makeRequest() {
if (_request) {
PROFILE_ASYNC_END(resourceLog, "Resource:" + getType(), QString::number(_requestID));
_request->disconnect();
_request->deleteLater();
}
PROFILE_ASYNC_BEGIN(resourceLog, "Resource:" + getType(), QString::number(_requestID), { { "url", _url.toString() }, { "activeURL", _activeUrl.toString() } });
_request = ResourceManager::createResourceRequest(this, _activeUrl);
if (!_request) {
qCDebug(networking).noquote() << "Failed to get request for" << _url.toDisplayString();
ResourceCache::requestCompleted(_self);
finishedLoading(false);
PROFILE_ASYNC_END(resourceLog, "Resource:" + getType(), QString::number(_requestID));
return;
}
qCDebug(networking).noquote() << "Starting request for:" << _url.toDisplayString();
qCDebug(resourceLog).noquote() << "Starting request for:" << _url.toDisplayString();
emit loading();
connect(_request, &ResourceRequest::progress, this, &Resource::onProgress);
@ -681,6 +688,11 @@ void Resource::handleDownloadProgress(uint64_t bytesReceived, uint64_t bytesTota
void Resource::handleReplyFinished() {
Q_ASSERT_X(_request, "Resource::handleReplyFinished", "Request should not be null while in handleReplyFinished");
PROFILE_ASYNC_END(resourceLog, "Resource:" + getType(), QString::number(_requestID), {
{ "from_cache", _request->loadedFromCache() },
{ "size_mb", _bytesTotal / 1000000.0 }
});
setSize(_bytesTotal);
if (!_request || _request != sender()) {

View file

@ -342,6 +342,8 @@ public:
Resource(const QUrl& url);
~Resource();
virtual QString getType() const { return "Resource"; }
/// Returns the key last used to identify this resource in the unused map.
int getLRUKey() const { return _lruKey; }
@ -461,6 +463,7 @@ private:
bool isInScript() const { return _isInScript; }
void setInScript(bool isInScript) { _isInScript = isInScript; }
int _requestID;
ResourceRequest* _request{ nullptr };
int _lruKey{ 0 };
QTimer* _replyTimer{ nullptr };

View file

@ -23,6 +23,7 @@
#include "Packet.h"
#include "PacketList.h"
#include "Socket.h"
#include <Trace.h>
using namespace udt;
using namespace std::chrono;

View file

@ -58,7 +58,7 @@ public:
using ControlPacketPointer = std::unique_ptr<ControlPacket>;
Connection(Socket* parentSocket, HifiSockAddr destination, std::unique_ptr<CongestionControl> congestionControl);
~Connection();
virtual ~Connection();
void sendReliablePacket(std::unique_ptr<Packet> packet);
void sendReliablePacketList(std::unique_ptr<PacketList> packet);

View file

@ -30,6 +30,8 @@
#include "PacketList.h"
#include "../UserActivityLogger.h"
#include "Socket.h"
#include <Trace.h>
#include <Profile.h>
using namespace udt;
using namespace std::chrono;
@ -84,6 +86,7 @@ SendQueue::SendQueue(Socket* socket, HifiSockAddr dest) :
_socket(socket),
_destination(dest)
{
PROFILE_ASYNC_BEGIN(networking, "SendQueue", _destination.toString());
// setup psuedo-random number generation for all instances of SendQueue
static std::random_device rd;
@ -102,6 +105,10 @@ SendQueue::SendQueue(Socket* socket, HifiSockAddr dest) :
_lastReceiverResponse = QDateTime::currentMSecsSinceEpoch();
}
SendQueue::~SendQueue() {
PROFILE_ASYNC_END(networking, "SendQueue", _destination.toString());
}
void SendQueue::queuePacket(std::unique_ptr<Packet> packet) {
_packets.queuePacket(std::move(packet));
@ -220,6 +227,7 @@ void SendQueue::sendHandshake() {
if (!_hasReceivedHandshakeACK) {
// we haven't received a handshake ACK from the client, send another now
auto handshakePacket = ControlPacket::create(ControlPacket::Handshake, sizeof(SequenceNumber));
PROFILE_ASYNC_BEGIN(networking, "SendQueue:Handshake", _destination.toString());
handshakePacket->writePrimitive(_initialSequenceNumber);
_socket->writeBasePacket(*handshakePacket, _destination);
@ -236,6 +244,7 @@ void SendQueue::handshakeACK(SequenceNumber initialSequenceNumber) {
std::lock_guard<std::mutex> locker { _handshakeMutex };
_hasReceivedHandshakeACK = true;
}
PROFILE_ASYNC_END(networking, "SendQueue:Handshake", _destination.toString());
// Notify on the handshake ACK condition
_handshakeACKCondition.notify_one();

View file

@ -51,6 +51,8 @@ public:
};
static std::unique_ptr<SendQueue> create(Socket* socket, HifiSockAddr destination);
virtual ~SendQueue();
void queuePacket(std::unique_ptr<Packet> packet);
void queuePacketList(std::unique_ptr<PacketList> packetList);

View file

@ -26,6 +26,7 @@
#include "../NLPacket.h"
#include "../NLPacketList.h"
#include "PacketList.h"
#include <Trace.h>
using namespace udt;

View file

@ -16,6 +16,8 @@
#include <QtCore/QDebug>
#include <Profile.h>
#include <LogHandler.h>
#include <NodeList.h>
#include <PerfStat.h>
@ -28,6 +30,7 @@
#include "OctreeLogging.h"
#include "OctreeUtils.h"
#include "SharedUtil.h"
#include <Trace.h>
AtomicUIntStat OctreeElement::_octreeMemoryUsage { 0 };
AtomicUIntStat OctreeElement::_octcodeMemoryUsage { 0 };
@ -389,6 +392,7 @@ OctreeElementPointer OctreeElement::addChildAtIndex(int childIndex) {
_isDirty = true;
markWithChangedTime();
PROFILE_INSTANT(octree, "EntityAdd", "g");
}
return childAt;
}

View file

@ -19,6 +19,7 @@ enum class PluginType {
class DisplayPlugin;
class InputPlugin;
class CodecPlugin;
class SteamClientPlugin;
class Plugin;
class PluginContainer;
class PluginManager;
@ -29,4 +30,4 @@ using InputPluginPointer = std::shared_ptr<InputPlugin>;
using InputPluginList = std::vector<InputPluginPointer>;
using CodecPluginPointer = std::shared_ptr<CodecPlugin>;
using CodecPluginList = std::vector<CodecPluginPointer>;
using SteamClientPluginPointer = std::shared_ptr<SteamClientPlugin>;

View file

@ -147,6 +147,22 @@ const CodecPluginList& PluginManager::getCodecPlugins() {
return codecPlugins;
}
const SteamClientPluginPointer PluginManager::getSteamClientPlugin() {
static SteamClientPluginPointer steamClientPlugin;
static std::once_flag once;
std::call_once(once, [&] {
// Now grab the dynamic plugins
for (auto loader : getLoadedPlugins()) {
SteamClientProvider* steamClientProvider = qobject_cast<SteamClientProvider*>(loader->instance());
if (steamClientProvider) {
steamClientPlugin = steamClientProvider->getSteamClientPlugin();
break;
}
}
});
return steamClientPlugin;
}
#ifndef Q_OS_ANDROID
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class

View file

@ -19,6 +19,7 @@ public:
const DisplayPluginList& getDisplayPlugins();
const InputPluginList& getInputPlugins();
const CodecPluginList& getCodecPlugins();
const SteamClientPluginPointer getSteamClientPlugin();
DisplayPluginList getPreferredDisplayPlugins();
void setPreferredDisplayPlugins(const QStringList& displays);

View file

@ -45,3 +45,11 @@ public:
#define CodecProvider_iid "com.highfidelity.plugins.codec"
Q_DECLARE_INTERFACE(CodecProvider, CodecProvider_iid)
class SteamClientProvider {
public:
virtual ~SteamClientProvider() {}
virtual SteamClientPluginPointer getSteamClientPlugin() = 0;
};
#define SteamClientProvider_iid "com.highfidelity.plugins.steamclient"
Q_DECLARE_INTERFACE(SteamClientProvider, SteamClientProvider_iid)

View file

@ -0,0 +1,59 @@
//
// SteamClientPlugin.h
// libraries/plugins/src/plugins
//
// Created by Clement Brisset on 12/14/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_SteamClientPlugin_h
#define hifi_SteamClientPlugin_h
#include <functional>
#include <QtCore/QObject>
#include <QtCore/QByteArray>
using Ticket = QByteArray;
using TicketRequestCallback = std::function<void(Ticket)>;
class SteamClientPlugin {
public:
virtual ~SteamClientPlugin() {};
virtual bool init() = 0;
virtual void shutdown() = 0;
virtual bool isRunning() = 0;
virtual void runCallbacks() = 0;
virtual void requestTicket(TicketRequestCallback callback) = 0;
virtual void updateLocation(QString status, QUrl locationUrl) = 0;
virtual void openInviteOverlay() = 0;
virtual void joinLobby(QString lobbyId) = 0;
virtual int getSteamVRBuildID() = 0;
};
class SteamScriptingInterface : public QObject {
Q_OBJECT
Q_PROPERTY(bool isRunning READ isRunning)
public:
SteamScriptingInterface(QObject* parent, SteamClientPlugin* plugin) : QObject(parent) {}
public slots:
bool isRunning() const { return _plugin->isRunning(); }
void openInviteOverlay() const { _plugin->openInviteOverlay(); }
private:
SteamClientPlugin* _plugin;
};
#endif /* hifi_SteamClientPlugin_h */

0
libraries/render-utils/src/DeferredBuffer.slh Executable file → Normal file
View file

0
libraries/render-utils/src/DeferredBufferWrite.slh Executable file → Normal file
View file

0
libraries/render-utils/src/DeferredGlobalLight.slh Executable file → Normal file
View file

0
libraries/render-utils/src/DeferredLighting.slh Executable file → Normal file
View file

View file

@ -793,7 +793,7 @@ void RenderDeferred::configure(const Config& config) {
}
void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) {
PROFILE_RANGE("DeferredLighting");
PROFILE_RANGE(renderlogging, "DeferredLighting");
auto deferredTransform = inputs.get0();
auto deferredFramebuffer = inputs.get1();

View file

@ -58,7 +58,6 @@ float frustumGrid_eyeToVolumeDepth(float eposZ, float rangeNear, float rangeFar)
return (-eposZ - rangeNear) / (rangeFar - rangeNear);
}
vec3 frustumGrid_eyeToVolume(vec3 epos, mat4 projection, float rangeNear, float rangeFar) {
vec4 clipPos = vec4(epos.x * projection[0][0] + epos.z * projection[2][0],
epos.y * projection[1][1] + epos.z * projection[2][1],
@ -126,15 +125,11 @@ int frustumGrid_eyeDepthToClusterLayer(float eyeZ) {
}
ivec3 frustumGrid_eyeToClusterPos(vec3 eyePos) {
if ((eyePos.z > -frustumGrid.frustumNear) || (eyePos.z < -frustumGrid.frustumFar)) {
return ivec3(-2);
}
if (eyePos.z > -frustumGrid.rangeNear) {
return ivec3(0,0,-1);
}
vec3 volumePos = frustumGrid_eyeToVolume(eyePos, frustumGrid.eyeToGridProj, frustumGrid.rangeNear, frustumGrid.rangeFar);
// make sure the frontEyePos is always in the front to eval the grid pos correctly
vec3 frontEyePos = eyePos;
frontEyePos.z = (eyePos.z > 0.0f ? -eyePos.z : eyePos.z);
vec3 volumePos = frustumGrid_eyeToVolume(frontEyePos, frustumGrid.eyeToGridProj, frustumGrid.rangeNear, frustumGrid.rangeFar);
vec3 gridPos = frustumGrid_volumeToGrid(volumePos, frustumGrid.dims);
@ -143,10 +138,20 @@ ivec3 frustumGrid_eyeToClusterPos(vec3 eyePos) {
gridPos.z = frustumGrid.dims.z;
}
ivec3 igridPos = ivec3(floor(gridPos));
return ivec3(floor(gridPos));
if ((eyePos.z > -frustumGrid.frustumNear) || (eyePos.z < -frustumGrid.frustumFar)) {
return ivec3(igridPos.x, igridPos.y, - 2);
}
if (eyePos.z > -frustumGrid.rangeNear) {
return ivec3(igridPos.x, igridPos.y, -1);
}
return igridPos;
}
int frustumGrid_eyeToClusterDirH(vec3 eyeDir) {
if (eyeDir.z >= 0.0f) {
return (eyeDir.x > 0 ? frustumGrid.dims.x : -1);

View file

@ -279,6 +279,7 @@ uint32_t scanLightVolumeSphere(FrustumGrid& grid, const FrustumGrid::Planes plan
// FInd the light origin cluster
auto centerCluster = grid.frustumGrid_eyeToClusterPos(glm::vec3(eyePosRadius));
int center_z = centerCluster.z;
int center_y = centerCluster.y;

View file

@ -27,6 +27,7 @@
#include "Model.h"
#include "RenderUtilsLogging.h"
#include <Trace.h>
using namespace std;
@ -280,7 +281,7 @@ void Model::reset() {
}
bool Model::updateGeometry() {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(renderutils, __FUNCTION__);
bool needFullUpdate = false;
if (!isLoaded()) {
@ -474,7 +475,7 @@ bool Model::convexHullContains(glm::vec3 point) {
// entity-scripts to call. I think it would be best to do the picking once-per-frame (in cpu, or gpu if possible)
// and then the calls use the most recent such result.
void Model::recalculateMeshBoxes(bool pickAgainstTriangles) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(renderutils, __FUNCTION__);
bool calculatedMeshTrianglesNeeded = pickAgainstTriangles && !_calculatedMeshTrianglesValid;
if (!_calculatedMeshBoxesValid || calculatedMeshTrianglesNeeded || (!_calculatedMeshPartBoxesValid && pickAgainstTriangles) ) {
@ -967,7 +968,7 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe
}
void Blender::run() {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE_EX(renderutils, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
QVector<glm::vec3> vertices, normals;
if (_model) {
int offset = 0;
@ -1088,7 +1089,7 @@ void Model::snapToRegistrationPoint() {
}
void Model::simulate(float deltaTime, bool fullUpdate) {
PROFILE_RANGE(__FUNCTION__);
PROFILE_RANGE(renderutils, __FUNCTION__);
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint);

0
libraries/render-utils/src/RenderDeferredTask.cpp Executable file → Normal file
View file

0
libraries/render-utils/src/RenderDeferredTask.h Executable file → Normal file
View file

View file

@ -0,0 +1,163 @@
//
// RenderForwardTask.cpp
// render-utils/src/
//
// Created by Zach Pomerantz on 12/13/2016.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "RenderForwardTask.h"
#include "RenderDeferredTask.h"
#include <PerfStat.h>
#include <PathUtils.h>
#include <RenderArgs.h>
#include <ViewFrustum.h>
#include <gpu/Context.h>
#include <render/CullTask.h>
#include <render/SortTask.h>
#include <render/DrawTask.h>
#include <render/DrawStatus.h>
#include <render/DrawSceneOctree.h>
#include <render/BlurTask.h>
#include "LightingModel.h"
#include "DebugDeferredBuffer.h"
#include "DeferredFramebuffer.h"
#include "DeferredLightingEffect.h"
#include "SurfaceGeometryPass.h"
#include "FramebufferCache.h"
#include "HitEffect.h"
#include "TextureCache.h"
#include "AmbientOcclusionEffect.h"
#include "AntialiasingEffect.h"
#include "ToneMappingEffect.h"
#include "SubsurfaceScattering.h"
#include <gpu/StandardShaderLib.h>
#include "drawOpaqueStencil_frag.h"
using namespace render;
extern void initOverlay3DPipelines(render::ShapePlumber& plumber);
extern void initDeferredPipelines(render::ShapePlumber& plumber);
RenderForwardTask::RenderForwardTask(CullFunctor cullFunctor) {
// Prepare the ShapePipelines
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
initDeferredPipelines(*shapePlumber);
// CPU jobs:
// Fetch and cull the items from the scene
const auto spatialSelection = addJob<FetchSpatialTree>("FetchSceneSelection");
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
auto spatialFilter = ItemFilter::Builder::visibleWorldItems().withoutLayered();
const auto culledSpatialSelection = addJob<CullSpatialSelection>("CullSceneSelection", spatialSelection, cullFunctor, RenderDetails::ITEM, spatialFilter);
// Overlays are not culled
const auto nonspatialSelection = addJob<FetchNonspatialItems>("FetchOverlaySelection");
// Multi filter visible items into different buckets
const int NUM_FILTERS = 3;
const int OPAQUE_SHAPE_BUCKET = 0;
const int TRANSPARENT_SHAPE_BUCKET = 1;
const int LIGHT_BUCKET = 2;
const int BACKGROUND_BUCKET = 2;
MultiFilterItem<NUM_FILTERS>::ItemFilterArray spatialFilters = { {
ItemFilter::Builder::opaqueShape(),
ItemFilter::Builder::transparentShape(),
ItemFilter::Builder::light()
} };
MultiFilterItem<NUM_FILTERS>::ItemFilterArray nonspatialFilters = { {
ItemFilter::Builder::opaqueShape(),
ItemFilter::Builder::transparentShape(),
ItemFilter::Builder::background()
} };
const auto filteredSpatialBuckets = addJob<MultiFilterItem<NUM_FILTERS>>("FilterSceneSelection", culledSpatialSelection, spatialFilters).get<MultiFilterItem<NUM_FILTERS>::ItemBoundsArray>();
const auto filteredNonspatialBuckets = addJob<MultiFilterItem<NUM_FILTERS>>("FilterOverlaySelection", nonspatialSelection, nonspatialFilters).get<MultiFilterItem<NUM_FILTERS>::ItemBoundsArray>();
// Extract / Sort opaques / Transparents / Lights / Overlays
const auto opaques = addJob<DepthSortItems>("DepthSortOpaque", filteredSpatialBuckets[OPAQUE_SHAPE_BUCKET]);
const auto transparents = addJob<DepthSortItems>("DepthSortTransparent", filteredSpatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
const auto lights = filteredSpatialBuckets[LIGHT_BUCKET];
const auto overlayOpaques = addJob<DepthSortItems>("DepthSortOverlayOpaque", filteredNonspatialBuckets[OPAQUE_SHAPE_BUCKET]);
const auto overlayTransparents = addJob<DepthSortItems>("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET];
const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer");
// Blit!
addJob<Blit>("Blit", framebuffer);
}
void RenderForwardTask::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
// sanity checks
assert(sceneContext);
if (!sceneContext->_scene) {
return;
}
// Is it possible that we render without a viewFrustum ?
if (!(renderContext->args && renderContext->args->hasViewFrustum())) {
return;
}
auto config = std::static_pointer_cast<Config>(renderContext->jobConfig);
for (auto job : _jobs) {
job.run(sceneContext, renderContext);
}
}
void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, gpu::FramebufferPointer& framebuffer) {
auto framebufferCache = DependencyManager::get<FramebufferCache>();
auto framebufferSize = framebufferCache->getFrameBufferSize();
glm::uvec2 frameSize(framebufferSize.width(), framebufferSize.height());
// Resizing framebuffers instead of re-building them seems to cause issues with threaded rendering
if (_framebuffer && _framebuffer->getSize() != frameSize) {
_framebuffer.reset();
}
if (!_framebuffer) {
_framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("forward"));
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
auto colorTexture = gpu::TexturePointer(gpu::Texture::create2D(colorFormat, frameSize.x, frameSize.y, defaultSampler));
_framebuffer->setRenderBuffer(0, colorTexture);
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
auto depthTexture = gpu::TexturePointer(gpu::Texture::create2D(depthFormat, frameSize.x, frameSize.y, defaultSampler));
_framebuffer->setDepthStencilBuffer(depthTexture, depthFormat);
}
auto args = renderContext->args;
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);
batch.setFramebuffer(_framebuffer);
batch.clearFramebuffer(
gpu::Framebuffer::BUFFER_COLOR0 |
gpu::Framebuffer::BUFFER_COLOR1 |
gpu::Framebuffer::BUFFER_COLOR2 |
gpu::Framebuffer::BUFFER_COLOR3 |
gpu::Framebuffer::BUFFER_DEPTH |
gpu::Framebuffer::BUFFER_STENCIL,
vec4(vec3(0), 0), 1.0, 0.0, true);
});
framebuffer = _framebuffer;
}

View file

@ -0,0 +1,42 @@
//
// RenderForwardTask.h
// render-utils/src/
//
// Created by Zach Pomerantz on 12/13/2016.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_RenderForwardTask_h
#define hifi_RenderForwardTask_h
#include <gpu/Pipeline.h>
#include <render/CullTask.h>
#include "LightingModel.h"
using RenderForwardTaskConfig = render::GPUTaskConfig;
class RenderForwardTask : public render::Task {
public:
using Config = RenderForwardTaskConfig;
RenderForwardTask(render::CullFunctor cullFunctor);
void configure(const Config& config) {}
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
using JobModel = Model<RenderForwardTask, Config>;
};
class PrepareFramebuffer {
public:
using JobModel = render::Job::ModelO<PrepareFramebuffer, gpu::FramebufferPointer>;
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::FramebufferPointer& framebuffer);
private:
gpu::FramebufferPointer _framebuffer;
};
#endif // hifi_RenderForwardTask_h

0
libraries/render-utils/src/Shadow.slh Executable file → Normal file
View file

0
libraries/render-utils/src/deferred_light_spot.slv Executable file → Normal file
View file

View file

View file

0
libraries/render-utils/src/model.slf Executable file → Normal file
View file

0
libraries/render-utils/src/model.slv Executable file → Normal file
View file

0
libraries/render-utils/src/model_lightmap.slf Executable file → Normal file
View file

0
libraries/render-utils/src/model_lightmap.slv Executable file → Normal file
View file

View file

View file

Some files were not shown because too many files have changed in this diff Show more