From ba4aec2aff76fb21d1fae4048c2424a0595127e2 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 28 Nov 2018 01:01:18 -0800 Subject: [PATCH] Fixing the issues with thte debug renderdeferredTask and investigating the avatars perf --- .../render-utils/src/RenderDeferredTask.cpp | 4 +- libraries/task/src/task/Varying.h | 3 +- .../developer/utilities/workload/avatars.js | 129 ++++++++++++++++++ .../developer/utilities/workload/avatars.qml | 78 +++++++++++ 4 files changed, 211 insertions(+), 3 deletions(-) create mode 100644 scripts/developer/utilities/workload/avatars.js create mode 100644 scripts/developer/utilities/workload/avatars.qml diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 731ab38467..01df28d1dd 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -294,8 +294,8 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("ToneMapping", toneMappingInputs); { // Debug the bounds of the rendered items, still look at the zbuffer - const auto debugInputs = RenderDeferredTaskDebug::Input(items, inputs[1], zones, selectedItems, currentStageFrames, prepareDeferredOutputs, deferredFrameTransform, jitter).asVarying(); - task.addJob("DebugRenderDeferredTask", input); + const auto debugInputs = RenderDeferredTaskDebug::Input(fetchedItems, inputs[1], zones, selectedItems, currentStageFrames, prepareDeferredOutputs, deferredFrameTransform, jitter).asVarying(); + task.addJob("DebugRenderDeferredTask", debugInputs); /*task.addJob("DrawMetaBounds", metas); task.addJob("DrawOpaqueBounds", opaques); task.addJob("DrawTransparentBounds", transparents); diff --git a/libraries/task/src/task/Varying.h b/libraries/task/src/task/Varying.h index f7dbdfba29..2da0111bc2 100644 --- a/libraries/task/src/task/Varying.h +++ b/libraries/task/src/task/Varying.h @@ -12,6 +12,7 @@ #ifndef hifi_task_Varying_h #define hifi_task_Varying_h +#include #include #include @@ -23,7 +24,7 @@ public: Varying() {} Varying(const Varying& var) : _concept(var._concept) {} Varying& operator=(const Varying& var) { - _concept = var._concept; + _concept = var._concept; return (*this); } template Varying(const T& data) : _concept(std::make_shared>(data)) {} diff --git a/scripts/developer/utilities/workload/avatars.js b/scripts/developer/utilities/workload/avatars.js new file mode 100644 index 0000000000..3080ef09db --- /dev/null +++ b/scripts/developer/utilities/workload/avatars.js @@ -0,0 +1,129 @@ +"use strict"; + +// +// Avatars.js +// tablet-engine app +// +// Copyright 2018 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 +// + +(function() { + var TABLET_BUTTON_NAME = "Avatars"; + var QMLAPP_URL = Script.resolvePath("./avatars.qml"); + var ICON_URL = Script.resolvePath("../../../system/assets/images/lod-i.svg"); + var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/lod-a.svg"); + + var onTablet = false; // set this to true to use the tablet, false use a floating window + + var onAppScreen = false; + + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + var button = tablet.addButton({ + text: TABLET_BUTTON_NAME, + icon: ICON_URL, + activeIcon: ACTIVE_ICON_URL + }); + + var hasEventBridge = false; + + var onScreen = false; + var window; + + function onClicked() { + if (onTablet) { + if (onAppScreen) { + tablet.gotoHomeScreen(); + } else { + tablet.loadQMLSource(QMLAPP_URL); + } + } else { + if (onScreen) { + killWindow() + } else { + createWindow() + } + } + } + + function createWindow() { + var qml = Script.resolvePath(QMLAPP_URL); + window = Desktop.createWindow(Script.resolvePath(QMLAPP_URL), { + title: TABLET_BUTTON_NAME, + flags: Desktop.ALWAYS_ON_TOP, + presentationMode: Desktop.PresentationMode.NATIVE, + size: {x: 400, y: 600} + }); + window.closed.connect(killWindow); + window.fromQml.connect(fromQml); + onScreen = true + button.editProperties({isActive: true}); + } + + function killWindow() { + if (window !== undefined) { + window.closed.disconnect(killWindow); + window.fromQml.disconnect(fromQml); + window.close() + window = undefined + } + onScreen = false + button.editProperties({isActive: false}) + } + + function wireEventBridge(on) { + if (!tablet) { + print("Warning in wireEventBridge(): 'tablet' undefined!"); + return; + } + if (on) { + if (!hasEventBridge) { + tablet.fromQml.connect(fromQml); + hasEventBridge = true; + } + } else { + if (hasEventBridge) { + tablet.fromQml.disconnect(fromQml); + hasEventBridge = false; + } + } + } + + function onScreenChanged(type, url) { + if (onTablet) { + onAppScreen = (url === QMLAPP_URL); + + button.editProperties({isActive: onAppScreen}); + wireEventBridge(onAppScreen); + } + } + + button.clicked.connect(onClicked); + tablet.screenChanged.connect(onScreenChanged); + + Script.scriptEnding.connect(function () { + killWindow() + if (onAppScreen) { + tablet.gotoHomeScreen(); + } + button.clicked.disconnect(onClicked); + tablet.screenChanged.disconnect(onScreenChanged); + tablet.removeButton(button); + }); + + function fromQml(message) { + } + + function sendToQml(message) { + if (onTablet) { + tablet.sendToQml(message); + } else { + if (window) { + window.sendToQml(message); + } + } + } + +}()); diff --git a/scripts/developer/utilities/workload/avatars.qml b/scripts/developer/utilities/workload/avatars.qml new file mode 100644 index 0000000000..5951e72c31 --- /dev/null +++ b/scripts/developer/utilities/workload/avatars.qml @@ -0,0 +1,78 @@ +// +// avatars.qml +// scripts/developer/utilities/workload +// +// Created by Sam Gateau on 2018.11.28 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + +import "../lib/plotperf" +import "../render/configSlider" + +Item { + id: root + anchors.fill:parent + + Component.onCompleted: { + } + + Component.onDestruction: { + } + + Column { + id: topHeader + spacing: 8 + anchors.right: parent.right + anchors.left: parent.left + } + + Column { + id: stats + spacing: 4 + anchors.right: parent.right + anchors.left: parent.left + anchors.top: topHeader.bottom + anchors.bottom: parent.bottom + + function evalEvenHeight() { + // Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ? + var numPlots = (children.length + - 2) + return (height - topLine.height - bottomLine.height - spacing * (numPlots - 1)) / (numPlots) + } + + Separator { + id: topLine + } + + PlotPerf { + title: "Avatars" + height: parent.evalEvenHeight() + object: Stats + valueScale: 1 + valueUnit: "num" + plots: [ + { + prop: "updatedAvatarCount", + label: "updatedAvatarCount", + color: "#FFFF00" + }, + { + prop: "notUpdatedAvatarCount", + label: "notUpdatedAvatarCount", + color: "#00FF00" + } + ] + } + Separator { + id: bottomLine + } + } +}